|  | @@ -61,165 +61,184 @@ public class StudentServeServiceImpl implements StudentServeService {
 | 
	
		
			
				|  |  |          LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
 | 
	
		
			
				|  |  |          Date nextMonday = Date.from(sunDayDate.plusDays(1).atStartOfDay(DateUtil.zoneId).toInstant());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        List<StudentServeDto> serviceStudents = studentDao.getBeServiceStudents(monDayDate.toString());
 | 
	
		
			
				|  |  | -        if(CollectionUtils.isEmpty(serviceStudents)){
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        List<Integer> beServeStudentIds=studentDao.getServeStudentIds();
 | 
	
		
			
				|  |  | +        BigDecimal currentPage=BigDecimal.ONE,
 | 
	
		
			
				|  |  | +                pageSize=new BigDecimal(1000),
 | 
	
		
			
				|  |  | +                total=new BigDecimal(beServeStudentIds.size()),
 | 
	
		
			
				|  |  | +                totalPage=total.divide(pageSize, BigDecimal.ROUND_UP);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Map<Integer, List<StudentServeDto>> studentCoursesMap = serviceStudents.stream().collect(Collectors.groupingBy(StudentServeDto::getUserId));
 | 
	
		
			
				|  |  | +        List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //本周不服务学员列表
 | 
	
		
			
				|  |  | -        Set<Integer> dontServeInCurrentWeekStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | -        //本周有课学员编号集合
 | 
	
		
			
				|  |  | -        Set<Integer> haveClassStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | -        //本周无课学员编号集合
 | 
	
		
			
				|  |  | -        Set<Integer> noClassStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | -        for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
 | 
	
		
			
				|  |  | +        while (currentPage.compareTo(totalPage)<=0){
 | 
	
		
			
				|  |  | +            List<Integer> studentIds=beServeStudentIds.stream().skip(pageSize.multiply(currentPage.subtract(BigDecimal.ONE)).longValue()).limit(pageSize.longValue()).collect(Collectors.toList());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            List<StudentServeDto> haveCourseStudents = studentCoursesEntry.getValue().stream().filter(e -> Objects.nonNull(e.getCourseStartTime())).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -            if(CollectionUtils.isEmpty(haveCourseStudents)){
 | 
	
		
			
				|  |  | -                noClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | -                continue;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            StudentServeDto studentServeDto = haveCourseStudents.stream().min(Comparator.comparing(StudentServeDto::getCourseStartTime)).get();
 | 
	
		
			
				|  |  | -            if(Objects.isNull(studentServeDto.getCourseStartTime())){
 | 
	
		
			
				|  |  | -                noClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | -                continue;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if(!studentServeDto.getCourseStartTime().before(nextMonday)){
 | 
	
		
			
				|  |  | -                dontServeInCurrentWeekStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | -                continue;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            long count = haveCourseStudents.stream().filter(e -> (GroupType.PRACTICE.equals(e.getGroupType()) ||
 | 
	
		
			
				|  |  | -                    (GroupType.MUSIC.equals(e.getGroupType()) && TeachModeEnum.OFFLINE.equals(e.getTeachMode())))
 | 
	
		
			
				|  |  | -                    &&nextMonday.after(e.getCourseStartTime())).count();
 | 
	
		
			
				|  |  | -            if(count>0){
 | 
	
		
			
				|  |  | -                haveClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +            List<StudentServeDto> serviceStudents;
 | 
	
		
			
				|  |  | +            if(sunDayDate.isBefore(LocalDate.now())){
 | 
	
		
			
				|  |  | +                serviceStudents = studentDao.getBeServiceStudentsInfoWithStudentsForHistory(monDayDate.toString(), nextMonday,studentIds);
 | 
	
		
			
				|  |  |              }else{
 | 
	
		
			
				|  |  | -                noClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                serviceStudents = studentDao.getBeServiceStudentsInfoWithStudents(monDayDate.toString(), new Date(),studentIds);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(CollectionUtils.isEmpty(serviceStudents)){
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Set<Integer> allServeStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | -        allServeStudentIds.addAll(haveClassStudentIds);
 | 
	
		
			
				|  |  | -        allServeStudentIds.addAll(noClassStudentIds);
 | 
	
		
			
				|  |  | +            Map<Integer, List<StudentServeDto>> studentCoursesMap = serviceStudents.stream().collect(Collectors.groupingBy(StudentServeDto::getUserId));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Map<Integer, List<StudentServeCourseHomeworkDto>> studentHomeworkMap=new HashMap<>();
 | 
	
		
			
				|  |  | -        Map<Integer, List<ExtracurricularExercisesReply>> studentExercisesMap=new HashMap<>();
 | 
	
		
			
				|  |  | +            //本周不服务学员列表
 | 
	
		
			
				|  |  | +            Set<Integer> dontServeInCurrentWeekStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | +            //本周有课学员编号集合
 | 
	
		
			
				|  |  | +            Set<Integer> haveClassStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | +            //本周无课学员编号集合
 | 
	
		
			
				|  |  | +            Set<Integer> noClassStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | +            for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if (!CollectionUtils.isEmpty(allServeStudentIds)){
 | 
	
		
			
				|  |  | -            List<StudentServeCourseHomeworkDto> studentHomeworks = studentCourseHomeworkDao.findStudentHomeworkWithCourseDateRange(monDayDate.toString(), sunDayDate.toString(), new ArrayList<>(allServeStudentIds));
 | 
	
		
			
				|  |  | -            studentHomeworkMap = studentHomeworks.stream().filter(h -> DateUtil.daysBetween(h.getCourseStartTime(), h.getHomeworkCreateTime())<3).collect(Collectors.groupingBy(StudentServeCourseHomeworkDto::getUserId));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +                List<StudentServeDto> haveCourseStudents = studentCoursesEntry.getValue().stream().filter(e -> Objects.nonNull(e.getCourseStartTime())).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                if(CollectionUtils.isEmpty(haveCourseStudents)){
 | 
	
		
			
				|  |  | +                    noClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                StudentServeDto studentServeDto = haveCourseStudents.stream().min(Comparator.comparing(StudentServeDto::getCourseStartTime)).get();
 | 
	
		
			
				|  |  | +                if(Objects.isNull(studentServeDto.getCourseStartTime())){
 | 
	
		
			
				|  |  | +                    noClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if(!studentServeDto.getCourseStartTime().before(nextMonday)){
 | 
	
		
			
				|  |  | +                    dontServeInCurrentWeekStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                long count = haveCourseStudents.stream().filter(e -> (GroupType.PRACTICE.equals(e.getGroupType()) ||
 | 
	
		
			
				|  |  | +                        (GroupType.MUSIC.equals(e.getGroupType()) && TeachModeEnum.OFFLINE.equals(e.getTeachMode())))
 | 
	
		
			
				|  |  | +                        &&nextMonday.after(e.getCourseStartTime())).count();
 | 
	
		
			
				|  |  | +                if(count>0){
 | 
	
		
			
				|  |  | +                    haveClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                }else{
 | 
	
		
			
				|  |  | +                    noClassStudentIds.add(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if(!CollectionUtils.isEmpty(allServeStudentIds)){
 | 
	
		
			
				|  |  | -            List<ExtracurricularExercisesReply> studentExercises = extracurricularExercisesReplyDao.getStudentExercisesWithTimeZone(monDayDate.toString(), sunDayDate.toString(), new ArrayList<>(allServeStudentIds));
 | 
	
		
			
				|  |  | -            studentExercisesMap = studentExercises.stream().collect(Collectors.groupingBy(ExtracurricularExercisesReply::getUserId));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +            Set<Integer> allServeStudentIds=new HashSet<>();
 | 
	
		
			
				|  |  | +            allServeStudentIds.addAll(haveClassStudentIds);
 | 
	
		
			
				|  |  | +            allServeStudentIds.addAll(noClassStudentIds);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
 | 
	
		
			
				|  |  | -        for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
 | 
	
		
			
				|  |  | +            Map<Integer, List<StudentServeCourseHomeworkDto>> studentHomeworkMap=new HashMap<>();
 | 
	
		
			
				|  |  | +            Map<Integer, List<ExtracurricularExercisesReply>> studentExercisesMap=new HashMap<>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(dontServeInCurrentWeekStudentIds.contains(studentCoursesEntry.getKey())){
 | 
	
		
			
				|  |  | -                continue;
 | 
	
		
			
				|  |  | +            if (!CollectionUtils.isEmpty(allServeStudentIds)){
 | 
	
		
			
				|  |  | +                List<StudentServeCourseHomeworkDto> studentHomeworks = studentCourseHomeworkDao.findStudentHomeworkWithCourseDateRange(monDayDate.toString(), sunDayDate.toString(), new ArrayList<>(allServeStudentIds));
 | 
	
		
			
				|  |  | +                studentHomeworkMap = studentHomeworks.stream().filter(h -> DateUtil.daysBetween(h.getCourseStartTime(), h.getHomeworkCreateTime())<3).collect(Collectors.groupingBy(StudentServeCourseHomeworkDto::getUserId));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation();
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setStudentId(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setTeacherId(studentCoursesEntry.getValue().get(0).getTeacherId());
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setActualExercisesNum(0);
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setExercisesReplyNum(0);
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setExercisesMessageNum(0);
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(0);
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setWeekOfYear(nowDate.get(DateUtil.weekFields.weekOfYear()));
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setMonday(DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | -            studentExtracurricularExercisesSituation.setSunday(DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            if(haveClassStudentIds.contains(studentCoursesEntry.getKey())){
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setServeType("HOMEWORK");
 | 
	
		
			
				|  |  | +            if(!CollectionUtils.isEmpty(allServeStudentIds)){
 | 
	
		
			
				|  |  | +                List<ExtracurricularExercisesReply> studentExercises = extracurricularExercisesReplyDao.getStudentExercisesWithTimeZone(monDayDate.toString(), sunDayDate.toString(), new ArrayList<>(allServeStudentIds));
 | 
	
		
			
				|  |  | +                studentExercisesMap = studentExercises.stream().collect(Collectors.groupingBy(ExtracurricularExercisesReply::getUserId));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(noClassStudentIds.contains(studentCoursesEntry.getKey())){
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setServeType("EXERCISE");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +            for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            List<StudentServeCourseHomeworkDto> studentHomeworks = studentHomeworkMap.get(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | -            if(!CollectionUtils.isEmpty(studentHomeworks)){
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setActualExercisesNum(1);
 | 
	
		
			
				|  |  | -                long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
 | 
	
		
			
				|  |  | -                long haveSubmitTimes = studentHomeworks.stream().filter(e -> Objects.nonNull(e.getSubmitTime())).count();
 | 
	
		
			
				|  |  | -                if(replyNum>0&&haveSubmitTimes>0){
 | 
	
		
			
				|  |  | -                    Date lastSubmitTime = studentHomeworks.stream().filter(e->Objects.nonNull(e.getSubmitTime())).max(Comparator.comparing(StudentServeCourseHomeworkDto::getSubmitTime)).get().getSubmitTime();
 | 
	
		
			
				|  |  | -                    studentExtracurricularExercisesSituation.setLastSubmitTime(lastSubmitTime);
 | 
	
		
			
				|  |  | +                if(dontServeInCurrentWeekStudentIds.contains(studentCoursesEntry.getKey())){
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                int exercisesMessageNum=0;
 | 
	
		
			
				|  |  | -                int exercisesMessageTimelyNum=0;
 | 
	
		
			
				|  |  | -                for (StudentServeCourseHomeworkDto studentHomework : studentHomeworks) {
 | 
	
		
			
				|  |  | -                    if(!YesOrNoEnum.YES.equals(studentHomework.getStatus())){
 | 
	
		
			
				|  |  | -                        continue;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    if(!YesOrNoEnum.YES.equals(studentHomework.getIsReplied())){
 | 
	
		
			
				|  |  | -                        continue;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    exercisesMessageNum+=1;
 | 
	
		
			
				|  |  | -                    if(new Integer(1).equals(studentHomework.getIsRepliedTimely())){
 | 
	
		
			
				|  |  | -                        exercisesMessageTimelyNum+=1;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation();
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setStudentId(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setTeacherId(studentCoursesEntry.getValue().get(0).getTeacherId());
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setActualExercisesNum(0);
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setExercisesReplyNum(0);
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setExercisesMessageNum(0);
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(0);
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setWeekOfYear(nowDate.get(DateUtil.weekFields.weekOfYear()));
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setMonday(DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | +                studentExtracurricularExercisesSituation.setSunday(DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if(haveClassStudentIds.contains(studentCoursesEntry.getKey())){
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setServeType("HOMEWORK");
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setExercisesMessageNum(exercisesMessageNum>0?1:0);
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>0?1:0);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | -            if(!CollectionUtils.isEmpty(studentExercises)){
 | 
	
		
			
				|  |  | -                studentExtracurricularExercisesSituation.setActualExercisesNum(1);
 | 
	
		
			
				|  |  | -                long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
 | 
	
		
			
				|  |  | -                if(studentExtracurricularExercisesSituation.getExercisesReplyNum()<=0){
 | 
	
		
			
				|  |  | -                    studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
 | 
	
		
			
				|  |  | +                if(noClassStudentIds.contains(studentCoursesEntry.getKey())){
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setServeType("EXERCISE");
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                long haveSubmitTimes = studentExercises.stream().filter(e->Objects.nonNull(e.getSubmitTime())).count();
 | 
	
		
			
				|  |  | -                if(replyNum>0&&haveSubmitTimes>0){
 | 
	
		
			
				|  |  | -                    Date lastSubmitTime = studentExercises.stream().filter(e->Objects.nonNull(e.getSubmitTime())).max(Comparator.comparing(ExtracurricularExercisesReply::getSubmitTime)).get().getSubmitTime();
 | 
	
		
			
				|  |  | -                    if(Objects.isNull(studentExtracurricularExercisesSituation.getLastSubmitTime())||lastSubmitTime.after(studentExtracurricularExercisesSituation.getLastSubmitTime())){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                List<StudentServeCourseHomeworkDto> studentHomeworks = studentHomeworkMap.get(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                if(!CollectionUtils.isEmpty(studentHomeworks)){
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setActualExercisesNum(1);
 | 
	
		
			
				|  |  | +                    long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
 | 
	
		
			
				|  |  | +                    long haveSubmitTimes = studentHomeworks.stream().filter(e -> Objects.nonNull(e.getSubmitTime())).count();
 | 
	
		
			
				|  |  | +                    if(replyNum>0&&haveSubmitTimes>0){
 | 
	
		
			
				|  |  | +                        Date lastSubmitTime = studentHomeworks.stream().filter(e->Objects.nonNull(e.getSubmitTime())).max(Comparator.comparing(StudentServeCourseHomeworkDto::getSubmitTime)).get().getSubmitTime();
 | 
	
		
			
				|  |  |                          studentExtracurricularExercisesSituation.setLastSubmitTime(lastSubmitTime);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                    int exercisesMessageNum=0;
 | 
	
		
			
				|  |  | +                    int exercisesMessageTimelyNum=0;
 | 
	
		
			
				|  |  | +                    for (StudentServeCourseHomeworkDto studentHomework : studentHomeworks) {
 | 
	
		
			
				|  |  | +                        if(!YesOrNoEnum.YES.equals(studentHomework.getStatus())){
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if(!YesOrNoEnum.YES.equals(studentHomework.getIsReplied())){
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        exercisesMessageNum+=1;
 | 
	
		
			
				|  |  | +                        if(new Integer(1).equals(studentHomework.getIsRepliedTimely())){
 | 
	
		
			
				|  |  | +                            exercisesMessageTimelyNum+=1;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setExercisesMessageNum(exercisesMessageNum>0?1:0);
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>0?1:0);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                int exercisesMessageNum=0;
 | 
	
		
			
				|  |  | -                int exercisesMessageTimelyNum=0;
 | 
	
		
			
				|  |  | -                for (ExtracurricularExercisesReply studentHomework : studentExercises) {
 | 
	
		
			
				|  |  | -                    if(!new Integer(1).equals(studentHomework.getStatus())){
 | 
	
		
			
				|  |  | -                        continue;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(studentCoursesEntry.getKey());
 | 
	
		
			
				|  |  | +                if(!CollectionUtils.isEmpty(studentExercises)){
 | 
	
		
			
				|  |  | +                    studentExtracurricularExercisesSituation.setActualExercisesNum(1);
 | 
	
		
			
				|  |  | +                    long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
 | 
	
		
			
				|  |  | +                    if(studentExtracurricularExercisesSituation.getExercisesReplyNum()<=0){
 | 
	
		
			
				|  |  | +                        studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    if(!new Integer(1).equals(studentHomework.getIsReplied())){
 | 
	
		
			
				|  |  | -                        continue;
 | 
	
		
			
				|  |  | +                    long haveSubmitTimes = studentExercises.stream().filter(e->Objects.nonNull(e.getSubmitTime())).count();
 | 
	
		
			
				|  |  | +                    if(replyNum>0&&haveSubmitTimes>0){
 | 
	
		
			
				|  |  | +                        Date lastSubmitTime = studentExercises.stream().filter(e->Objects.nonNull(e.getSubmitTime())).max(Comparator.comparing(ExtracurricularExercisesReply::getSubmitTime)).get().getSubmitTime();
 | 
	
		
			
				|  |  | +                        if(Objects.isNull(studentExtracurricularExercisesSituation.getLastSubmitTime())||lastSubmitTime.after(studentExtracurricularExercisesSituation.getLastSubmitTime())){
 | 
	
		
			
				|  |  | +                            studentExtracurricularExercisesSituation.setLastSubmitTime(lastSubmitTime);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    exercisesMessageNum+=1;
 | 
	
		
			
				|  |  | -                    if(new Integer(1).equals(studentHomework.getIsRepliedTimely())){
 | 
	
		
			
				|  |  | -                        exercisesMessageTimelyNum+=1;
 | 
	
		
			
				|  |  | +                    int exercisesMessageNum=0;
 | 
	
		
			
				|  |  | +                    int exercisesMessageTimelyNum=0;
 | 
	
		
			
				|  |  | +                    for (ExtracurricularExercisesReply studentHomework : studentExercises) {
 | 
	
		
			
				|  |  | +                        if(!new Integer(1).equals(studentHomework.getStatus())){
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        if(!new Integer(1).equals(studentHomework.getIsReplied())){
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        exercisesMessageNum+=1;
 | 
	
		
			
				|  |  | +                        if(new Integer(1).equals(studentHomework.getIsRepliedTimely())){
 | 
	
		
			
				|  |  | +                            exercisesMessageTimelyNum+=1;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if(studentExtracurricularExercisesSituation.getExercisesMessageNum()<=0){
 | 
	
		
			
				|  |  | +                        studentExtracurricularExercisesSituation.setExercisesMessageNum(exercisesMessageNum>0?1:0);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if(studentExtracurricularExercisesSituation.getExercisesMessageTimelyNum()<=0){
 | 
	
		
			
				|  |  | +                        studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>0?1:0);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if(studentExtracurricularExercisesSituation.getExercisesMessageNum()<=0){
 | 
	
		
			
				|  |  | -                    studentExtracurricularExercisesSituation.setExercisesMessageNum(exercisesMessageNum>0?1:0);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                if(studentExtracurricularExercisesSituation.getExercisesMessageTimelyNum()<=0){
 | 
	
		
			
				|  |  | -                    studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>0?1:0);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +                results.add(studentExtracurricularExercisesSituation);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            results.add(studentExtracurricularExercisesSituation);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            currentPage=currentPage.add(BigDecimal.ONE);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          studentExtracurricularExercisesSituationDao.deleteByMonday(monDayDate.toString());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        BigDecimal currentPage=BigDecimal.ONE,
 | 
	
		
			
				|  |  | -                pageSize=new BigDecimal(10000),
 | 
	
		
			
				|  |  | -                total=new BigDecimal(results.size()),
 | 
	
		
			
				|  |  | -                totalPage=total.divide(pageSize, BigDecimal.ROUND_UP);
 | 
	
		
			
				|  |  | -        while (currentPage.compareTo(totalPage)<=0){
 | 
	
		
			
				|  |  | -            List<StudentExtracurricularExercisesSituation> rows=results.stream().skip(pageSize.multiply(currentPage.subtract(BigDecimal.ONE)).longValue()).limit(pageSize.longValue()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        BigDecimal currentPage1=BigDecimal.ONE,
 | 
	
		
			
				|  |  | +                pageSize1=new BigDecimal(10000),
 | 
	
		
			
				|  |  | +                total1=new BigDecimal(results.size()),
 | 
	
		
			
				|  |  | +                totalPage1=total1.divide(pageSize1, BigDecimal.ROUND_UP);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        while (currentPage1.compareTo(totalPage1)<=0){
 | 
	
		
			
				|  |  | +            List<StudentExtracurricularExercisesSituation> rows=results.stream().skip(pageSize1.multiply(currentPage1.subtract(BigDecimal.ONE)).longValue()).limit(pageSize1.longValue()).collect(Collectors.toList());
 | 
	
		
			
				|  |  |              studentExtracurricularExercisesSituationDao.batchInsert(rows);
 | 
	
		
			
				|  |  | -            currentPage=currentPage.add(BigDecimal.ONE);
 | 
	
		
			
				|  |  | +            currentPage1=currentPage1.add(BigDecimal.ONE);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |