|
@@ -288,6 +288,142 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void exercisesSituationStatistics2(String monday) {
|
|
|
+ LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
|
|
|
+ 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());
|
|
|
+
|
|
|
+ List<StudentServeCourseDto> studentFutureCourseInfo = studentDao.getStudentFutureCourseInfo(monDayDate.toString());
|
|
|
+ Map<Integer, List<StudentServeCourseDto>> studentCourseMap = studentFutureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
|
|
|
+
|
|
|
+ List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
|
|
|
+
|
|
|
+ for (Map.Entry<Integer, List<StudentServeCourseDto>> studentCourseMapEntry : studentCourseMap.entrySet()) {
|
|
|
+ Map<CourseSchedule.CourseScheduleType, List<StudentServeCourseDto>> typeCourseMap = studentCourseMapEntry.getValue().stream().collect(Collectors.groupingBy(StudentServeCourseDto::getType));
|
|
|
+
|
|
|
+ if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.SINGLE)){
|
|
|
+ List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
|
|
|
+ List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE).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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.VIP)){
|
|
|
+ List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.VIP).stream().filter(c -> TeachModeEnum.ONLINE.equals(c.getTeachMode()) && 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<>());
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }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());
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIdsStr) {
|
|
|
Map<String, Object> result=new HashMap<>();
|
|
|
if(Objects.isNull(courseScheduleId)&&Objects.isNull(studentIdsStr)){
|