|
@@ -5178,6 +5178,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
courseRepeatCheckInfos.sort(Comparator.comparing(CourseRepeatCheckDto::getStartClassTime));
|
|
|
Map<Date, List<CourseRepeatCheckDto>> dayCourseMap = courseRepeatCheckInfos.stream().collect(Collectors.groupingBy(CourseRepeatCheckDto::getClassDate));
|
|
|
Map<Long, List<Long>> courseRepeatIdMap = new HashMap<>();
|
|
|
+ int needAdjustCourseNum = 0;
|
|
|
for (CourseRepeatCheckDto cs1 : courseRepeatCheckInfos) {
|
|
|
if(!courseRepeatIdMap.containsKey(cs1.getCourseId())){
|
|
|
courseRepeatIdMap.put(cs1.getCourseId(), new ArrayList<>());
|
|
@@ -5209,21 +5210,24 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if(repeatTeacherNums>0){
|
|
|
System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
|
|
|
courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
|
|
|
+ needAdjustCourseNum++;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
-// long repeatStudentNums = cs1.getStudentIds().stream().filter(studentId -> cs2.getStudentIds().contains(studentId)).count();
|
|
|
-// if(repeatStudentNums>0){
|
|
|
-// System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
|
|
|
-// courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
|
|
|
-// continue;
|
|
|
-// }
|
|
|
+ long repeatStudentNums = cs1.getStudentIds().stream().filter(studentId -> cs2.getStudentIds().contains(studentId)).count();
|
|
|
+ if(repeatStudentNums>0){
|
|
|
+ System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
|
|
|
+ courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
|
|
|
+ needAdjustCourseNum++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
if(CollectionUtils.isEmpty(courseRepeatIdMap.get(cs1.getCourseId()))||courseRepeatIdMap.get(cs1.getCourseId()).size()==1){
|
|
|
courseRepeatIdMap.remove(cs1.getCourseId());
|
|
|
}
|
|
|
}
|
|
|
System.out.println("重复课程:" + JSON.toJSONString(courseRepeatIdMap));
|
|
|
+ System.out.println("需调整课程数量:" + needAdjustCourseNum);
|
|
|
System.out.println("重复课程数量:" + courseRepeatIdMap.size());
|
|
|
}
|
|
|
}
|