Bladeren bron

Merge remote-tracking branch 'origin/master'

zouxuan 4 jaren geleden
bovenliggende
commit
b0fbb40325

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

@@ -393,16 +393,6 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findAllByClassGroup(classGroupId);
 
-        //线上基础技能班,原始分班人数不能小于3人大于6人
-//        if (classGroupStudents.size() <= 0 && classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
-//            if (studentIds.size() < 3) {
-//                throw new BizException("线上基础技能班人数不能小于3人");
-//            }
-//            if (studentIds.size() > 6) {
-//                throw new BizException("线上基础技能班人数不能大于6人");
-//            }
-//        }
-
         Set<Integer> allStudentIds = new HashSet<>();
         Set<Integer> oldStudentIds = new HashSet<>();
         Set<Integer> oldNormalStudentIds = new HashSet<>();
@@ -418,6 +408,16 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             oldNormalStudentIds = classGroupStudents.stream().filter(s -> ClassGroupStudentStatusEnum.NORMAL.equals(s.getStatus())).map(ClassGroupStudentMapper::getUserId).collect(Collectors.toSet());
         }
 
+        //线上基础技能班,原始分班人数不能小于3人大于6人
+        if (classGroupStudents.size() <= 0 && classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
+            if (studentIds.size() < 3 && oldNormalStudentIds.size() > 0) {
+                throw new BizException("线上基础技能班人数不能小于3人");
+            }
+            if (studentIds.size() > 6) {
+                throw new BizException("线上基础技能班人数不能大于6人");
+            }
+        }
+
         Set<Integer> repeatStudentIds = allStudentIds.stream().filter(oldNormalStudentIds::contains).collect(Collectors.toSet());
         addStudentIds = allStudentIds.stream().filter(id -> !repeatStudentIds.contains(id)).collect(Collectors.toSet());
         removeStudentIds = oldNormalStudentIds.stream().filter(id -> !repeatStudentIds.contains(id)).collect(Collectors.toSet());