yonge 3 年之前
父节点
当前提交
eac28d3485
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. 14 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

+ 14 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -3482,16 +3482,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(Objects.isNull(vipGroup)){
 			throw new BizException("未找到指定的vip课程");
 		}
-		
-		VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
-		
-		if(vipGroupCategory == null){
-			throw new BizException("请修改VIP课课程形式");
-		}
-		
-		if(vipGroupCategory.getStudentNum() < studentCoursePriceMap.size()){
-			throw new BizException("学生人数超过{}人,请调整", vipGroupCategory.getStudentNum());
-		}
 
 		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
 
@@ -3513,14 +3503,24 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("当前课程组已经停止,无法进行添加学员操作。");
 		}
 
+        Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
+		if(exitStudentNum>0){
+			throw new BizException("选择的学生中存在此课程中已存在的学生");
+		}
+
         Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
         if(studentNum.compareTo(classGroup.getExpectStudentNum())>=0){
             throw new BizException("该班级人数已达上限");
         }
-
-        Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
-		if(exitStudentNum>0){
-			throw new BizException("选择的学生中存在此课程中已存在的学生");
+		
+		VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
+		
+		if(vipGroupCategory == null){
+			throw new BizException("请修改VIP课课程形式");
+		}
+		
+		if(vipGroupCategory.getStudentNum() < (studentCoursePriceMap.size() + studentNum)){
+			throw new BizException("学生人数超过{}人,请调整", vipGroupCategory.getStudentNum());
 		}
 
 		VipGroupActivity vipGroupActivity = null;