| 
					
				 | 
			
			
				@@ -2271,6 +2271,74 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> result = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.put("total", BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put("salary", BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate minDate = LocalDate.of(2021, 3, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate startDate = LocalDate.of(year, Objects.isNull(month)?1:month, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(year<=2021&&Objects.isNull(month)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            startDate = startDate.withMonth(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put("total", BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put("salary", BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put("data", Collections.emptyList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(startDate.compareTo(minDate)<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<LocalDateBigDecimalMapDto> monthIncomeMapList = courseScheduleTeacherSalaryDao.teacherIncomeStat(teacherId, year, month); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(CollectionUtils.isEmpty(monthIncomeMapList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(Objects.isNull(month)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Set<String> months = monthIncomeMapList.stream().map(e -> DateUtil.dateToString(e.getDate(), "yyyy-MM")).collect(Collectors.toSet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LocalDate now = LocalDate.now(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            now = now.plusMonths(-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while (startDate.compareTo(now)<=0&&year.equals(startDate.get(ChronoField.YEAR))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String dateStr = dateFormatter.format(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(!months.contains(dateStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    monthIncomeMapList.add(new LocalDateBigDecimalMapDto(Date.from(startDate.atStartOfDay(DateUtil.zoneId).toInstant()), dateStr, BigDecimal.ZERO)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                startDate = startDate.plusMonths(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Set<String> dates = monthIncomeMapList.stream().map(e -> DateUtil.dateToString(e.getDate(), "yyyy-MM-dd")).collect(Collectors.toSet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer oldMonth = Objects.isNull(month)?new Integer(1):month; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while (oldMonth.equals(startDate.get(ChronoField.MONTH_OF_YEAR))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String dateStr = DateUtil.dateFormatter.format(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(!dates.contains(dateStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    monthIncomeMapList.add(new LocalDateBigDecimalMapDto(Date.from(startDate.atStartOfDay(DateUtil.zoneId).toInstant()), dateStr, BigDecimal.ZERO)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                startDate = startDate.plusDays(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        monthIncomeMapList.sort(Comparator.comparing(LocalDateBigDecimalMapDto::getDate)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Map<String, Object> teacherIncomeStatNew(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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LocalDate minDate = LocalDate.of(2021, 3, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LocalDate startDate = LocalDate.of(year, Objects.isNull(month)?1:month, 1); 
			 |