|
@@ -290,6 +290,11 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
@Override
|
|
|
public void exercisesSituationStatistics2(String monday) {
|
|
|
LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(monday)){
|
|
|
+ nowDate=LocalDate.parse(monday, DateUtil.dateFormatter);
|
|
|
+ }
|
|
|
+
|
|
|
LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
|
|
|
LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
|
|
|
Date nextMonday = Date.from(sunDayDate.plusDays(1).atStartOfDay(DateUtil.zoneId).toInstant());
|
|
@@ -361,33 +366,13 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
}
|
|
|
}else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.MIX)){
|
|
|
- List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
|
|
|
- List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.MIX).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
|
- if(CollectionUtils.isEmpty(weekCourseInfo)){
|
|
|
- StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
- futureCourseInfo.get(0).getActualTeacherId(),nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
- DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
- "EXERCISE", null);
|
|
|
- results.add(studentExtracurricularExercisesSituation);
|
|
|
- }else{
|
|
|
- Map<String, List<StudentServeCourseDto>> groupCourseInfo = weekCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
|
|
|
- Map<Integer, Set<Long>> teacherServiceCourseIdMap = new HashMap<>();
|
|
|
- for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
|
|
|
- StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
|
|
|
- if(!teacherServiceCourseIdMap.containsKey(courseInfo.getActualTeacherId())){
|
|
|
- teacherServiceCourseIdMap.put(courseInfo.getActualTeacherId(), new HashSet<>());
|
|
|
- }
|
|
|
- teacherServiceCourseIdMap.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
|
|
|
- }
|
|
|
- for (Map.Entry<Integer, Set<Long>> teacherServiceCourseIdMapEntry : teacherServiceCourseIdMap.entrySet()) {
|
|
|
- StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
- teacherServiceCourseIdMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
- DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
- "EXERCISE", StringUtils.join(teacherServiceCourseIdMapEntry.getValue(), ","));
|
|
|
- studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherServiceCourseIdMapEntry.getValue().size());
|
|
|
- results.add(studentExtracurricularExercisesSituation);
|
|
|
- }
|
|
|
- }
|
|
|
+ CourseSchedule studentHistoryLastCourse = courseScheduleStudentPaymentDao.getStudentHistoryLastCourse(studentCourseMapEntry.getKey(), monday, CourseSchedule.CourseScheduleType.SINGLE);
|
|
|
+ StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
+ Objects.isNull(studentHistoryLastCourse)?studentCourseMapEntry.getValue().get(0).getLeadTeacherId():studentHistoryLastCourse.getActualTeacherId(),
|
|
|
+ nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
+ DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
+ "EXERCISE", null);
|
|
|
+ results.add(studentExtracurricularExercisesSituation);
|
|
|
}else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.PRACTICE)){
|
|
|
List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE);
|
|
|
List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
@@ -404,6 +389,8 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
|
|
|
if(!teacherServiceCourseIdMap.containsKey(courseInfo.getActualTeacherId())){
|
|
|
teacherServiceCourseIdMap.put(courseInfo.getActualTeacherId(), new HashSet<>());
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
}
|
|
|
teacherServiceCourseIdMap.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
|
|
|
}
|
|
@@ -420,7 +407,16 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
+ 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);
|
|
|
+ currentPage1=currentPage1.add(BigDecimal.ONE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|