소스 검색

Merge branch 'del_classGroup_student' into online1

周箭河 4 년 전
부모
커밋
2892a17f34
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

+ 8 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -477,6 +477,14 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         addStudentIds = allStudentIds.stream().filter(id -> !repeatStudentIds.contains(id)).collect(Collectors.toSet());
         removeStudentIds = oldNormalStudentIds.stream().filter(id -> !repeatStudentIds.contains(id)).collect(Collectors.toSet());
 
+        //未开始的课程
+        List<CourseSchedule> classGroupNotStartCourse = courseScheduleDao.findCoursesByClassGroupId(classGroupId.intValue(), CourseStatusEnum.NOT_START);
+
+        //有未开始的课程不能删除学生
+        if(!CollectionUtils.isEmpty(removeStudentIds) && !CollectionUtils.isEmpty(classGroupNotStartCourse)){
+            throw new BizException("班级有未上完的课程,不能删除学生");
+        }
+
         List<ClassGroupStudentMapper> needUpdateClassGroupStudents = new ArrayList<>();
 
         for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
@@ -516,7 +524,6 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         classGroupService.updateClassStudentNum(classGroupId.intValue(), allStudentIds.size());
 
-        List<CourseSchedule> classGroupNotStartCourse = courseScheduleDao.findCoursesByClassGroupId(classGroupId.intValue(), CourseStatusEnum.NOT_START);
         if (CollectionUtils.isEmpty(classGroupNotStartCourse)) {
             if (!CollectionUtils.isEmpty(addStudentIds)) {
                 if(musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS){