|
@@ -17,10 +17,7 @@ import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
|
|
|
import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
|
|
|
import com.qmth.exam.reserve.cache.impl.ExamSiteCacheService;
|
|
|
import com.qmth.exam.reserve.dao.StudentApplyDao;
|
|
|
-import com.qmth.exam.reserve.entity.ApplyTaskEntity;
|
|
|
-import com.qmth.exam.reserve.entity.ExamSiteEntity;
|
|
|
-import com.qmth.exam.reserve.entity.StudentApplyEntity;
|
|
|
-import com.qmth.exam.reserve.entity.TimePeriodEntity;
|
|
|
+import com.qmth.exam.reserve.entity.*;
|
|
|
import com.qmth.exam.reserve.enums.ApplyStatus;
|
|
|
import com.qmth.exam.reserve.service.*;
|
|
|
import com.qmth.exam.reserve.util.DateUtil;
|
|
@@ -73,6 +70,9 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
@Autowired
|
|
|
private ConcurrentService concurrentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SystemPropertyService systemPropertyService;
|
|
|
+
|
|
|
@Override
|
|
|
public void saveStudentApply(LoginUser student, Long examSiteId, Long timePeriodId) {
|
|
|
if (examSiteId == null) {
|
|
@@ -233,6 +233,13 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
log.warn("取消预约失败,尚未开启预约任务!stuApplyTaskId:{}", student.getApplyTaskId());
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ //预约总开关
|
|
|
+ SystemPropertyEntity systemProperty = systemPropertyService.findByPropKey(curApplyTask.getOrgId(), Constants.APPLY_SWITCH);
|
|
|
+ if (systemProperty != null && systemProperty.getPropValue() != null && systemProperty.getPropValue().equals(Constants.APPLY_SWITCH_CLOSE)) {
|
|
|
+ throw new StatusException("当前无法自主取消,请联系教学点老师进行操作");
|
|
|
+ }
|
|
|
+
|
|
|
if (!curApplyTask.getTaskId().equals(student.getApplyTaskId())) {
|
|
|
log.warn("取消预约失败,当前预约任务与学生的不匹配!curApplyTaskId:{} stuApplyTaskId:{}", curApplyTask.getTaskId(), student.getApplyTaskId());
|
|
|
return;
|
|
@@ -420,6 +427,9 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
vo.setAllowCancel(false);
|
|
|
vo.setCancel(bean.getCancel());
|
|
|
|
|
|
+ //预约总开关
|
|
|
+ SystemPropertyEntity systemProperty = systemPropertyService.findByPropKey(curApplyTask.getOrgId(), Constants.APPLY_SWITCH);
|
|
|
+
|
|
|
TimePeriodEntity timePeriod = timePeriods.get(bean.getTimePeriodId());
|
|
|
vo.setTimePeriodId(bean.getTimePeriodId());
|
|
|
if (timePeriod != null) {
|
|
@@ -427,7 +437,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
vo.setTimePeriodEnd(timePeriod.getEndTime());
|
|
|
|
|
|
Date curDate = new Date(vo.getTimePeriodStart());
|
|
|
- if (curDate.after(allowDate)) {
|
|
|
+ if (curDate.after(allowDate) && systemProperty != null && systemProperty.getPropValue().equals(Constants.APPLY_SWITCH_OPEN)) {
|
|
|
// “当前时段开始时间”在“允许取消时间”之后,可以取消预约
|
|
|
vo.setAllowCancel(true);
|
|
|
}
|