|
@@ -55,7 +55,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int createCourseScheduleTeacherVipSalary(VipGroup vipGroup,
|
|
|
+ public void createCourseScheduleTeacherVipSalary(VipGroup vipGroup,
|
|
|
List<CourseSchedule> vipCourseSchedules,
|
|
|
BigDecimal onlineTeacherSalary,
|
|
|
BigDecimal offlineTeacherSalary) {
|
|
@@ -77,7 +77,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
.sorted(Comparator.comparing(CourseSchedule::getStartClassTime)).collect(Collectors.toList());
|
|
|
for (int i = 0; i < courseSchedules.size(); i++) {
|
|
|
//创建教师课程薪水记录
|
|
|
- CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
+ CourseScheduleTeacherSalary courseScheduleTeacherSalary = courseScheduleTeacherSalaryDao.queryByCourseScheduleIdAndUserId(courseSchedules.get(i).getId(),courseSchedules.get(i).getActualTeacherId());
|
|
|
+ if(Objects.isNull(courseScheduleTeacherSalary)){
|
|
|
+ courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
+ }
|
|
|
courseScheduleTeacherSalary.setCourseScheduleId(courseSchedules.get(i).getId());
|
|
|
courseScheduleTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
courseScheduleTeacherSalary.setUserId(courseSchedules.get(i).getActualTeacherId().intValue());
|
|
@@ -103,10 +106,16 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
courseScheduleTeacherSalary.setExpectSalary(feeInfo.get("offlineTeacherSalary"));
|
|
|
}
|
|
|
}
|
|
|
- courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
|
|
|
+ if(Objects.isNull(courseScheduleTeacherSalary.getId())){
|
|
|
+ courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
|
|
|
+ }else{
|
|
|
+ courseScheduleTeacherSalaryDao.update(courseScheduleTeacherSalary);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
+ if(courseScheduleTeacherSalaries.size()>0){
|
|
|
+ courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -350,12 +359,26 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
//如果结算方式是教师默认课酬
|
|
|
if (settlementType.equals(SalarySettlementTypeEnum.TEACHER_DEFAULT)) {
|
|
|
//课程时长与结算单位时长占比
|
|
|
- BigDecimal classTimeDuty = new BigDecimal(duration).divide(new BigDecimal(30));
|
|
|
+ BigDecimal classTimeDuty = new BigDecimal(duration);
|
|
|
+ if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.HIGH)) {
|
|
|
+ classTimeDuty=classTimeDuty.divide(new BigDecimal(45));
|
|
|
+ }else if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.CLASSROOM)) {
|
|
|
+ classTimeDuty=classTimeDuty.divide(new BigDecimal(40));
|
|
|
+ }else{
|
|
|
+ classTimeDuty=classTimeDuty.divide(new BigDecimal(30));
|
|
|
+ }
|
|
|
BigDecimal teacherDefaultSalary = courseScheduleTeacherSalary.getTeacherRole().equals(TeachTypeEnum.BISHOP) ? teacherDefaultMusicGroupSalaryWithTeacherId.getMainTeacher30MinSalary() : teacherDefaultMusicGroupSalaryWithTeacherId.getAssistantTeacher30MinSalary();
|
|
|
teacherSalary = teacherDefaultSalary.multiply(classTimeDuty).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
} else if (settlementType.equals(SalarySettlementTypeEnum.GRADIENT_SALARY)) {
|
|
|
//课程时长与结算单位时长占比
|
|
|
- BigDecimal classTimeDuty = new BigDecimal(duration).divide(new BigDecimal(90));
|
|
|
+ BigDecimal classTimeDuty = new BigDecimal(duration);
|
|
|
+ if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.HIGH)) {
|
|
|
+ classTimeDuty=classTimeDuty.divide(new BigDecimal(45));
|
|
|
+ }else if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.CLASSROOM)) {
|
|
|
+ classTimeDuty=classTimeDuty.divide(new BigDecimal(40));
|
|
|
+ }else{
|
|
|
+ classTimeDuty=classTimeDuty.divide(new BigDecimal(90));
|
|
|
+ }
|
|
|
BigDecimal teacherDefaultSalary = courseScheduleTeacherSalary.getTeacherRole().equals(TeachTypeEnum.BISHOP) ? teacherDefaultMusicGroupSalaryWithTeacherId.getMainTeacher90MinSalary() : teacherDefaultMusicGroupSalaryWithTeacherId.getAssistantTeacher90MinSalary();
|
|
|
teacherSalary = teacherDefaultSalary.multiply(classTimeDuty).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|