|
@@ -564,12 +564,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if(existCourseSchedules ==null || existCourseSchedules.size()==0){
|
|
|
return null;
|
|
|
}
|
|
|
- //新课程对应的班级编号列表
|
|
|
- List<Integer> newCourseScheduleClassGroupIds = courseSchedules
|
|
|
- .stream()
|
|
|
- .map(CourseSchedule::getClassGroupId)
|
|
|
- .distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
+
|
|
|
|
|
|
List<Long> existCourseScheduleIds = existCourseSchedules.stream()
|
|
|
.map(CourseSchedule::getId)
|
|
@@ -582,6 +577,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}else{
|
|
|
allCourseSchedules = courseSchedules;
|
|
|
}
|
|
|
+
|
|
|
+ //新课程对应的班级编号列表
|
|
|
+ List<Integer> newCourseScheduleClassGroupIds = allCourseSchedules
|
|
|
+ .stream()
|
|
|
+ .map(CourseSchedule::getClassGroupId)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
//所有课程的班级编号
|
|
|
List<Integer> classGroupIds = allCourseSchedules
|
|
|
.stream()
|
|
@@ -624,7 +627,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
boolean isTeacherRepeat = false;
|
|
|
boolean isStudentRepeat = false;
|
|
|
//检测老师冲突
|
|
|
- existCourseSchedule.setTeachingTeacherIdList(courseScheduleTeacherMap.get(existCourseSchedule.getId().intValue()).getIds());
|
|
|
+ if(courseScheduleTeacherMap.containsKey(existCourseSchedule.getId().intValue())){
|
|
|
+ existCourseSchedule.setTeachingTeacherIdList(courseScheduleTeacherMap.get(existCourseSchedule.getId().intValue()).getIds());
|
|
|
+ }else {
|
|
|
+ existCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(existCourseSchedule.getClassGroupId()).getIds());
|
|
|
+ }
|
|
|
newCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(newCourseSchedule.getClassGroupId()).getIds());
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(newCourseSchedule.getTeachingTeacherIdList())
|
|
@@ -645,19 +652,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
//如果班级不同,则需要检测两个班级是否存在重复的学生
|
|
|
List<ClassGroupStudentMapper> preClassGroupStudents=classGroupStudentsMap.get(newCourseSchedule.getClassGroupId());
|
|
|
List<ClassGroupStudentMapper> backClassGroupStudents=classGroupStudentsMap.get(existCourseSchedule.getClassGroupId());
|
|
|
- //当前课程所在班级的学生编号列表
|
|
|
- List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
|
|
|
- .map(ClassGroupStudentMapper::getUserId)
|
|
|
- .collect(Collectors.toList());
|
|
|
- //后面一节课程所在班级的学生编号列表
|
|
|
- List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
|
|
|
- .map(ClassGroupStudentMapper::getUserId)
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<Integer> repeatStudentIds = preClassGroupStudentIds.stream()
|
|
|
- .filter(backClassGroupStudentIds::contains)
|
|
|
- .collect(Collectors.toList());
|
|
|
- if(!CollectionUtils.isEmpty(repeatStudentIds)){
|
|
|
- isStudentRepeat = true;
|
|
|
+
|
|
|
+ List<Integer> repeatStudentIds = new ArrayList<>();
|
|
|
+ if(classGroupStudentsMap.containsKey(newCourseSchedule.getClassGroupId()) && classGroupStudentsMap.containsKey(existCourseSchedule.getClassGroupId())) {
|
|
|
+ //当前课程所在班级的学生编号列表
|
|
|
+ List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
|
|
|
+ .map(ClassGroupStudentMapper::getUserId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ //后面一节课程所在班级的学生编号列表
|
|
|
+ List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
|
|
|
+ .map(ClassGroupStudentMapper::getUserId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ repeatStudentIds = preClassGroupStudentIds.stream()
|
|
|
+ .filter(backClassGroupStudentIds::contains)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(repeatStudentIds)) {
|
|
|
+ isStudentRepeat = true;
|
|
|
+ }
|
|
|
}
|
|
|
if(!isTeacherRepeat && !isStudentRepeat){
|
|
|
continue;
|