deason 1 月之前
父节点
当前提交
23a4212da7
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

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

@@ -140,6 +140,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
             throw new StatusException(Constants.SYSTEM_BUSY);
             throw new StatusException(Constants.SYSTEM_BUSY);
         }
         }
 
 
+        String capacityLockKey = String.format(CacheConstants.LOCK_EXAM_SITE_CAPACITY, examSiteId);
+        if (concurrentService.isLocked(capacityLockKey)) {
+            log.warn("考点剩余可约数量更新中,不允许考生操作预约!lockKey:{}", capacityLockKey);
+            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);
@@ -276,6 +282,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
             throw new StatusException(Constants.SYSTEM_BUSY);
             throw new StatusException(Constants.SYSTEM_BUSY);
         }
         }
 
 
+        String capacityLockKey = String.format(CacheConstants.LOCK_EXAM_SITE_CAPACITY, examSiteId);
+        if (concurrentService.isLocked(capacityLockKey)) {
+            log.warn("考点剩余可约数量更新中,不允许考生操作预约!lockKey:{}", capacityLockKey);
+            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);