|
@@ -120,6 +120,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
throw new StatusException("当前预约时段已禁止预约");
|
|
throw new StatusException("当前预约时段已禁止预约");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (concurrentService.isLocked(CacheConstants.LOCK_AUTO_APPLY)) {
|
|
|
|
+ // 系统自动预约“任务执行期间”不允许预约
|
|
|
|
+ log.warn("系统自动预约中,不允许考生操作预约!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
|
+ throw new StatusException(Constants.SYSTEM_BUSY);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 考生预约操作锁
|
|
// 考生预约操作锁
|
|
String studentApplyLockKey = String.format(CacheConstants.LOCK_STUDENT_APPLY, student.getId());
|
|
String studentApplyLockKey = String.format(CacheConstants.LOCK_STUDENT_APPLY, student.getId());
|
|
RLock studentApplyLock = (RLock) concurrentService.getLock(studentApplyLockKey);
|
|
RLock studentApplyLock = (RLock) concurrentService.getLock(studentApplyLockKey);
|
|
@@ -128,13 +134,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
log.warn("获取锁失败,同一个考生不允许同时操作预约!lockKey:{}", studentApplyLockKey);
|
|
log.warn("获取锁失败,同一个考生不允许同时操作预约!lockKey:{}", studentApplyLockKey);
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
}
|
|
}
|
|
-
|
|
|
|
log.info("获取锁成功!lockKey:{}", studentApplyLockKey);
|
|
log.info("获取锁成功!lockKey:{}", studentApplyLockKey);
|
|
- if (concurrentService.isLocked(CacheConstants.LOCK_AUTO_APPLY)) {
|
|
|
|
- // 系统自动预约“任务执行期间”不允许预约
|
|
|
|
- log.warn("系统自动预约中,不允许考生操作预约!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
|
- throw new StatusException(Constants.SYSTEM_BUSY);
|
|
|
|
- }
|
|
|
|
|
|
|
|
// 考生剩余预约次数 = 允许预约次数 - 已完成预约次数
|
|
// 考生剩余预约次数 = 允许预约次数 - 已完成预约次数
|
|
int studentApplyNumber = applyTaskCacheService.getStudentApplyNumber(student.getId());
|
|
int studentApplyNumber = applyTaskCacheService.getStudentApplyNumber(student.getId());
|
|
@@ -251,6 +251,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
throw new StatusException("当前预约记录已禁止取消预约");
|
|
throw new StatusException("当前预约记录已禁止取消预约");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (concurrentService.isLocked(CacheConstants.LOCK_AUTO_APPLY)) {
|
|
|
|
+ // 系统自动预约“任务执行期间”不允许取消预约
|
|
|
|
+ log.warn("系统自动预约中,不允许考生操作预约!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
|
+ throw new StatusException(Constants.SYSTEM_BUSY);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 考生预约操作锁
|
|
// 考生预约操作锁
|
|
String studentApplyLockKey = String.format(CacheConstants.LOCK_STUDENT_APPLY, student.getId());
|
|
String studentApplyLockKey = String.format(CacheConstants.LOCK_STUDENT_APPLY, student.getId());
|
|
RLock studentApplyLock = (RLock) concurrentService.getLock(studentApplyLockKey);
|
|
RLock studentApplyLock = (RLock) concurrentService.getLock(studentApplyLockKey);
|
|
@@ -259,13 +265,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
log.warn("获取锁失败,同一个考生不允许同时操作预约!lockKey:{}", studentApplyLockKey);
|
|
log.warn("获取锁失败,同一个考生不允许同时操作预约!lockKey:{}", studentApplyLockKey);
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
}
|
|
}
|
|
-
|
|
|
|
log.info("获取锁成功!lockKey:{}", studentApplyLockKey);
|
|
log.info("获取锁成功!lockKey:{}", studentApplyLockKey);
|
|
- if (concurrentService.isLocked(CacheConstants.LOCK_AUTO_APPLY)) {
|
|
|
|
- // 系统自动预约“任务执行期间”不允许取消预约
|
|
|
|
- log.warn("系统自动预约中,不允许考生操作预约!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
|
- throw new StatusException(Constants.SYSTEM_BUSY);
|
|
|
|
- }
|
|
|
|
|
|
|
|
// StudentApplyEntity existApply = applyTaskCacheService.getStudentApplyRecordFormDB(student.getId(), examSiteId, timePeriodId);
|
|
// StudentApplyEntity existApply = applyTaskCacheService.getStudentApplyRecordFormDB(student.getId(), examSiteId, timePeriodId);
|
|
ApplyRecordCacheBean existApply = applyTaskCacheService.getStudentApplyRecord(student.getId(), examSiteId, timePeriodId);
|
|
ApplyRecordCacheBean existApply = applyTaskCacheService.getStudentApplyRecord(student.getId(), examSiteId, timePeriodId);
|