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

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

@@ -286,17 +286,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         //获取最后一节课
         CourseSchedule latestCourseSchedule = vipGroup.getCourseSchedules().stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
 
-        if (firstCourseSchedule.getStartClassTime().before(new Date())) {
-            throw new BizException("开课时间不能小于当前时间");
-        }
+        if (!vipGroup1.getStatus().equals(VipGroupStatusEnum.PROGRESS)) {
+            if (firstCourseSchedule.getStartClassTime().before(new Date())) {
+                throw new BizException("开课时间不能小于当前时间");
+            }
 
-        if (vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())) {
-            throw new BizException("报名开始时间必须在报名截至时间之前");
-        }
+            if (vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())) {
+                throw new BizException("报名开始时间必须在报名截至时间之前");
+            }
+
+            if (vipGroupApplyBaseInfoDto.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
+                    || DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(), firstCourseSchedule.getEndClassTime())) {
+                throw new BizException("创建失败,报名截止时间必须在开课时间前一天");
+            }
 
-        if (vipGroupApplyBaseInfoDto.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
-                || DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(), firstCourseSchedule.getEndClassTime())) {
-            throw new BizException("创建失败,报名截止时间必须在开课时间前一天");
         }
 
         VipGroupCategory vipGroupCategory = vipGroupCategoryService.get(vipGroupApplyBaseInfoDto.getVipGroupCategoryId());
@@ -361,7 +364,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         } else {
             classGroup.setExpectStudentNum(vipGroupCategory.getStudentNum());
         }
-        classGroup.setStudentNum(0);
         classGroup.setName(vipGroupApplyBaseInfoDto.getName());
         classGroup.setTotalClassTimes(totalClassTimes);
         classGroup.setType(ClassGroupTypeEnum.valueOf(groupType));
@@ -461,7 +463,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }
         }
 
-        courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
+        if (!vipGroup1.getStatus().equals(VipGroupStatusEnum.PROGRESS)) {
+            courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
+        }
         vipGroupApplyBaseInfoDto.setCourseSchedulesJson(JSON.toJSONString(courseSchedules));
         vipGroupDao.update(vipGroupApplyBaseInfoDto);
         return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());