فهرست منبع

fix selfApplyEnable

deason 1 ماه پیش
والد
کامیت
d7f83a7838
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

+ 14 - 0
src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

@@ -260,6 +260,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
             throw new StatusException("当前无法自主取消,请联系教学点老师进行操作");
         }
 
+        CategoryCacheBean category = categoryCacheService.getCategoryById(student.getCategoryId());
+        if (category == null || !category.getSelfApplyEnable()) {
+            log.warn("取消预约失败,当前教学点尚未开启考生自主预约!categoryId:{}", student.getCategoryId());
+            throw new StatusException("当前教学点尚未开启考生自主预约");
+        }
+
         TimePeriodEntity timePeriod = timePeriodService.getById(timePeriodId);
         if (timePeriod == null) {
             log.warn("取消预约失败,预约时段不存在!examSiteId:{} timePeriodId:{}", examSiteId, timePeriodId);
@@ -395,6 +401,10 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
         // 自主预约全局开关
         boolean globalOpen = systemPropertyService.existPropValue(curApplyTask.getOrgId(), Constants.APPLY_SWITCH, Constants.APPLY_SWITCH_OPEN);
+        if (globalOpen) {
+            CategoryCacheBean category = categoryCacheService.getCategoryById(student.getCategoryId());
+            globalOpen = category != null && category.getSelfApplyEnable();
+        }
 
         // 考前N天,禁止考生自主取消预约
         Date allowDate = DateUtil.changeDateAndTimeEnd(new Date(), curApplyTask.getAllowApplyCancelDays());
@@ -435,6 +445,10 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
         // 自主预约全局开关
         boolean globalOpen = systemPropertyService.existPropValue(curApplyTask.getOrgId(), Constants.APPLY_SWITCH, Constants.APPLY_SWITCH_OPEN);
+        if (globalOpen) {
+            CategoryCacheBean category = categoryCacheService.getCategoryById(student.getCategoryId());
+            globalOpen = category != null && category.getSelfApplyEnable();
+        }
 
         Set<Long> timePeriodIds = maps.values().stream().map(ApplyRecordCacheBean::getTimePeriodId).collect(Collectors.toSet());
         Map<Long, TimePeriodEntity> timePeriods = this.getTimePeriods(timePeriodIds);