|
@@ -238,24 +238,35 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ BigDecimal zero = new BigDecimal("0");
|
|
|
+
|
|
|
//获取课程对应教学点补贴
|
|
|
- List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(new ArrayList<>(courseScheduleIds));
|
|
|
- Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
|
|
|
+// List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(new ArrayList<>(courseScheduleIds));
|
|
|
+// Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
|
|
|
|
|
|
someDayAgoTeacherCourseSalaryNoSettlement.forEach(courseScheduleTeacherSalary -> {
|
|
|
List<String> deductReasons = new ArrayList<>();
|
|
|
|
|
|
BigDecimal expectSalary = courseScheduleTeacherSalary.getExpectSalary();
|
|
|
|
|
|
- BigDecimal subsidy = courseSubsidyMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
|
|
|
- if (Objects.isNull(subsidy)) {
|
|
|
- subsidy = new BigDecimal(0);
|
|
|
+// BigDecimal subsidy = courseSubsidyMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
|
|
|
+// if (Objects.isNull(subsidy)) {
|
|
|
+// subsidy = new BigDecimal(0);
|
|
|
+// }
|
|
|
+// courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
+// expectSalary = expectSalary.add(subsidy);
|
|
|
+//
|
|
|
+// if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
+// deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+// }
|
|
|
+
|
|
|
+ if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
|
|
|
+ courseScheduleTeacherSalary.setSubsidy(zero);
|
|
|
}
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
- expectSalary = expectSalary.add(subsidy);
|
|
|
|
|
|
- if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
- deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+ if(BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getSubsidy())!=0){
|
|
|
+ expectSalary = expectSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
+ deductReasons.add("课程补贴:" + courseScheduleTeacherSalary.getSubsidy());
|
|
|
}
|
|
|
|
|
|
Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
|
|
@@ -380,9 +391,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
List<TeacherAttendance> allTeacherAttendances = teacherAttendanceDao.findByCourseSchedules(courseScheduleIds);
|
|
|
Map<String, List<TeacherAttendance>> teacherCourseAttendanceMap = allTeacherAttendances.stream().collect(Collectors.groupingBy(ta -> org.apache.commons.lang3.StringUtils.joinWith(":", ta.getCourseScheduleId(), ta.getTeacherId())));
|
|
|
|
|
|
+ BigDecimal zero = new BigDecimal(0);
|
|
|
+
|
|
|
//获取课程对应教学点补贴
|
|
|
- List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(courseScheduleIds);
|
|
|
- Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
|
|
|
+// List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(courseScheduleIds);
|
|
|
+// Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
|
|
|
|
|
|
//处理课酬信息
|
|
|
someDayAgoTeacherCourseSalaryNoSettlement.forEach(courseScheduleTeacherSalary -> {
|
|
@@ -390,14 +403,23 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
|
|
|
BigDecimal expectSalary = courseScheduleTeacherSalary.getExpectSalary();
|
|
|
|
|
|
- BigDecimal subsidy = courseSubsidyMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
|
|
|
- if (Objects.isNull(subsidy)) {
|
|
|
- subsidy = new BigDecimal(0);
|
|
|
+// BigDecimal subsidy = courseSubsidyMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
|
|
|
+// if (Objects.isNull(subsidy)) {
|
|
|
+// subsidy = new BigDecimal(0);
|
|
|
+// }
|
|
|
+// courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
+// expectSalary = expectSalary.add(subsidy);
|
|
|
+// if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
+// deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+// }
|
|
|
+
|
|
|
+ if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
|
|
|
+ courseScheduleTeacherSalary.setSubsidy(zero);
|
|
|
}
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
- expectSalary = expectSalary.add(subsidy);
|
|
|
- if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
- deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+
|
|
|
+ if(BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getSubsidy())!=0){
|
|
|
+ expectSalary = expectSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
+ deductReasons.add("课程补贴:" + courseScheduleTeacherSalary.getSubsidy());
|
|
|
}
|
|
|
|
|
|
Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
|
|
@@ -513,9 +535,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ BigDecimal zero = new BigDecimal(0);
|
|
|
+
|
|
|
//获取课程对应教学点补贴
|
|
|
- List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(courseScheduleIds);
|
|
|
- Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
|
|
|
+// List<Map<Long, BigDecimal>> courseSubsidyByCourses = courseScheduleTeacherSalaryDao.findCourseSubsidyByCourses(courseScheduleIds);
|
|
|
+// Map<Integer, BigDecimal> courseSubsidyMap = MapUtil.convertIntegerMap(courseSubsidyByCourses);
|
|
|
|
|
|
Set<Integer> schoolIds = yesterdayCourseSchedules.stream().map(CourseSchedule::getSchoolId).collect(Collectors.toSet());
|
|
|
List<School> schools = schoolDao.getSchools(new ArrayList<>(schoolIds));
|
|
@@ -616,13 +640,22 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
|
|
|
List<String> deductReasons = new ArrayList<>();
|
|
|
|
|
|
- BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getId());
|
|
|
- if (Objects.isNull(subsidy)) {
|
|
|
- subsidy = new BigDecimal(0);
|
|
|
+// BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getId());
|
|
|
+// if (Objects.isNull(subsidy)) {
|
|
|
+// subsidy = new BigDecimal(0);
|
|
|
+// }
|
|
|
+// teacherSalary = teacherSalary.add(subsidy);
|
|
|
+// if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
+// deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+// }
|
|
|
+
|
|
|
+ if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
|
|
|
+ courseScheduleTeacherSalary.setSubsidy(zero);
|
|
|
}
|
|
|
- teacherSalary = teacherSalary.add(subsidy);
|
|
|
- if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
- deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+
|
|
|
+ if(BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getSubsidy())!=0){
|
|
|
+ teacherSalary = teacherSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
+ deductReasons.add("课程补贴:" + courseScheduleTeacherSalary.getSubsidy());
|
|
|
}
|
|
|
|
|
|
//未转正
|
|
@@ -700,7 +733,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
courseScheduleTeacherSalary.setDeductionReason(org.apache.commons.lang3.StringUtils.join(deductReasons, ";"));
|
|
|
|
|
|
//更新教师结算信息
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
courseScheduleTeacherSalary.setActualSalary(finalSalary.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:finalSalary);
|
|
|
courseScheduleTeacherSalary.setBelongToDaya(false);
|
|
|
courseScheduleTeacherSalary.setSettlementTime(now);
|
|
@@ -713,13 +745,22 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
|
|
|
List<String> deductReasons = new ArrayList<>();
|
|
|
|
|
|
- BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getId());
|
|
|
- if (Objects.isNull(subsidy)) {
|
|
|
- subsidy = new BigDecimal(0);
|
|
|
+// BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getId());
|
|
|
+// if (Objects.isNull(subsidy)) {
|
|
|
+// subsidy = new BigDecimal(0);
|
|
|
+// }
|
|
|
+// teacherSalary = teacherSalary.add(subsidy);
|
|
|
+// if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
+// deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+// }
|
|
|
+
|
|
|
+ if(Objects.isNull(courseScheduleTeacherSalary.getSubsidy())){
|
|
|
+ courseScheduleTeacherSalary.setSubsidy(zero);
|
|
|
}
|
|
|
- teacherSalary = teacherSalary.add(subsidy);
|
|
|
- if(BigDecimal.ZERO.compareTo(subsidy)!=0){
|
|
|
- deductReasons.add("教学点补贴:" + subsidy);
|
|
|
+
|
|
|
+ if(BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getSubsidy())!=0){
|
|
|
+ teacherSalary = teacherSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
+ deductReasons.add("课程补贴:" + courseScheduleTeacherSalary.getSubsidy());
|
|
|
}
|
|
|
|
|
|
// boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
|
|
@@ -847,7 +888,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
}
|
|
|
|
|
|
//更新教师结算信息
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
courseScheduleTeacherSalary.setActualSalary(finalSalary.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:finalSalary);
|
|
|
courseScheduleTeacherSalary.setBelongToDaya(false);
|
|
|
courseScheduleTeacherSalary.setSettlementTime(now);
|
|
@@ -1613,13 +1653,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
if(CourseSchedule.CourseScheduleType.MUSIC_NETWORK.equals(courseSchedule.getType())||CourseSchedule.CourseScheduleType.HIGH_ONLINE.equals(courseSchedule.getType())){
|
|
|
List<TeacherSalaryDeductReasonDto> deductReasons = new ArrayList<>();
|
|
|
|
|
|
- BigDecimal subsidy = new BigDecimal(0);
|
|
|
- if (Objects.nonNull(school)&&Objects.nonNull(school.getSubsidy())) {
|
|
|
- subsidy = school.getSubsidy();
|
|
|
- }
|
|
|
-
|
|
|
- teacherSalary = teacherSalary.add(subsidy);
|
|
|
- teacherSalary = teacherSalary.add(subsidy);
|
|
|
+ teacherSalary = teacherSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
if(BigDecimal.ZERO.compareTo(teacherSalary)>0){
|
|
|
teacherSalary = new BigDecimal(0);
|
|
|
}
|
|
@@ -1690,17 +1724,12 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
BigDecimal finalSalary = teacherSalary.subtract(deductCost).setScale(BigDecimal.ZERO.intValue(), BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
//更新教师结算信息
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
courseScheduleTeacherSalary.setActualSalary(finalSalary.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:finalSalary);
|
|
|
courseScheduleTeacherSalary.setDeductReasons(deductReasons);
|
|
|
}else{
|
|
|
List<TeacherSalaryDeductReasonDto> deductReasons = new ArrayList<>();
|
|
|
|
|
|
- BigDecimal subsidy = new BigDecimal(0);
|
|
|
- if (Objects.nonNull(school)&&Objects.nonNull(school.getSubsidy())) {
|
|
|
- subsidy = school.getSubsidy();
|
|
|
- }
|
|
|
- teacherSalary = teacherSalary.add(subsidy);
|
|
|
+ teacherSalary = teacherSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
if(BigDecimal.ZERO.compareTo(teacherSalary)>0){
|
|
|
teacherSalary = new BigDecimal(0);
|
|
|
}
|
|
@@ -1828,7 +1857,6 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
BigDecimal finalSalary = teacherSalary.subtract(deductCost).setScale(BigDecimal.ZERO.intValue(), BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
//更新教师结算信息
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
courseScheduleTeacherSalary.setActualSalary(finalSalary.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:finalSalary);
|
|
|
courseScheduleTeacherSalary.setDeductReasons(deductReasons);
|
|
|
}
|
|
@@ -1846,12 +1874,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
|
|
|
BigDecimal expectSalary = courseScheduleTeacherSalary.getExpectSalary();
|
|
|
|
|
|
- BigDecimal subsidy = new BigDecimal(0);
|
|
|
- if (Objects.nonNull(school)&&Objects.nonNull(school.getSubsidy())) {
|
|
|
- subsidy = school.getSubsidy();
|
|
|
- }
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
- expectSalary = expectSalary.add(subsidy);
|
|
|
+ expectSalary = expectSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
if(BigDecimal.ZERO.compareTo(expectSalary)>0){
|
|
|
expectSalary = new BigDecimal(0);
|
|
|
}
|
|
@@ -1953,12 +1976,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
|
|
|
BigDecimal expectSalary = courseScheduleTeacherSalary.getExpectSalary();
|
|
|
|
|
|
- BigDecimal subsidy = new BigDecimal(0);
|
|
|
- if (Objects.nonNull(school)&&Objects.nonNull(school.getSubsidy())) {
|
|
|
- subsidy = school.getSubsidy();
|
|
|
- }
|
|
|
- courseScheduleTeacherSalary.setSubsidy(subsidy);
|
|
|
- expectSalary = expectSalary.add(subsidy);
|
|
|
+ expectSalary = expectSalary.add(courseScheduleTeacherSalary.getSubsidy());
|
|
|
if(BigDecimal.ZERO.compareTo(expectSalary)>0){
|
|
|
expectSalary = new BigDecimal(0);
|
|
|
}
|
|
@@ -2101,6 +2119,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
|
|
|
Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
+ BigDecimal zero = new BigDecimal(0);
|
|
|
+
|
|
|
for (CourseScheduleTeacherSalary teacherSalary : teacherSalaries) {
|
|
|
//课程
|
|
|
CourseSchedule courseSchedule = idCourseMap.get(teacherSalary.getCourseScheduleId());
|
|
@@ -2111,6 +2131,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
//教师
|
|
|
Teacher teacher = idTeacherMap.get(teacherSalary.getUserId());
|
|
|
|
|
|
+ if(Objects.isNull(teacherSalary.getSubsidy())){
|
|
|
+ teacherSalary.setSubsidy(zero);
|
|
|
+ }
|
|
|
+
|
|
|
switch (courseSchedule.getGroupType()){
|
|
|
case MUSIC:
|
|
|
calMusicCourseTeacherActualSalary(courseSchedule, teacherSalary, teacherAttendances, school, teacher, attendanceRange);
|
|
@@ -2198,6 +2222,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
|
|
|
Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
+ BigDecimal zero = new BigDecimal(0);
|
|
|
+
|
|
|
for (CourseScheduleTeacherSalary teacherSalary : teacherSalaries) {
|
|
|
//课程
|
|
|
CourseSchedule courseSchedule = idCourseMap.get(teacherSalary.getCourseScheduleId());
|
|
@@ -2208,6 +2234,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
//教师
|
|
|
Teacher teacher = idTeacherMap.get(teacherSalary.getUserId());
|
|
|
|
|
|
+ if(Objects.isNull(teacherSalary.getSubsidy())){
|
|
|
+ teacherSalary.setSubsidy(zero);
|
|
|
+ }
|
|
|
+
|
|
|
BigDecimal oldSalary = null;
|
|
|
BigDecimal oldSubsidy = null;
|
|
|
if(Objects.nonNull(teacherSalary.getSettlementTime())){
|