周箭河 пре 5 година
родитељ
комит
5f91ba03d3

+ 17 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -652,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((preClassGroupStudents==null || preClassGroupStudents.size()==0) || (backClassGroupStudents==null || backClassGroupStudents.size()==0)) {
+					//当前课程所在班级的学生编号列表
+					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;