|
@@ -2147,10 +2147,19 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<LocalDateBigDecimalMapDto> teacherIncomeStat(Integer teacherId, Integer year, Integer month) {
|
|
|
|
|
|
+ public Map<String, Object> teacherIncomeStat(Integer teacherId, Integer year, Integer month) {
|
|
|
|
+ if(Objects.isNull(year)){
|
|
|
|
+ year = LocalDate.now().get(ChronoField.YEAR);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
+ result.put("total", BigDecimal.ZERO);
|
|
|
|
+ result.put("salary", BigDecimal.ZERO);
|
|
|
|
+
|
|
List<LocalDateBigDecimalMapDto> monthIncomeMapList = courseScheduleTeacherSalaryDao.teacherIncomeStat(teacherId, year, month);
|
|
List<LocalDateBigDecimalMapDto> monthIncomeMapList = courseScheduleTeacherSalaryDao.teacherIncomeStat(teacherId, year, month);
|
|
if(CollectionUtils.isEmpty(monthIncomeMapList)){
|
|
if(CollectionUtils.isEmpty(monthIncomeMapList)){
|
|
- return monthIncomeMapList;
|
|
|
|
|
|
+ result.put("data", monthIncomeMapList);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
if(Objects.isNull(month)){
|
|
if(Objects.isNull(month)){
|
|
@@ -2184,7 +2193,13 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
|
|
|
monthIncomeMapList.sort(Comparator.comparing(LocalDateBigDecimalMapDto::getDate));
|
|
monthIncomeMapList.sort(Comparator.comparing(LocalDateBigDecimalMapDto::getDate));
|
|
|
|
|
|
- return monthIncomeMapList;
|
|
|
|
|
|
+ BigDecimal reduce = monthIncomeMapList.stream().map(LocalDateBigDecimalMapDto::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+
|
|
|
|
+ result.put("total", reduce);
|
|
|
|
+ result.put("salary", reduce);
|
|
|
|
+ result.put("data", monthIncomeMapList);
|
|
|
|
+
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|