deason hace 1 año
padre
commit
8622fcafd8

+ 3 - 1
src/main/java/com/qmth/exam/reserve/cache/impl/ApplyTaskCacheService.java

@@ -150,7 +150,9 @@ public class ApplyTaskCacheService implements CacheConstants {
     public void decreaseApplyFinishCount(Long examSiteId, Long timePeriodId) {
     public void decreaseApplyFinishCount(Long examSiteId, Long timePeriodId) {
         String cacheKey = String.format(CACHE_APPLY_FINISH, examSiteId, timePeriodId);
         String cacheKey = String.format(CACHE_APPLY_FINISH, examSiteId, timePeriodId);
         RAtomicLong atomic = redisClient.getRedissonClient().getAtomicLong(cacheKey);
         RAtomicLong atomic = redisClient.getRedissonClient().getAtomicLong(cacheKey);
-        atomic.decrementAndGet();
+        if (atomic.get() > 0) {
+            atomic.decrementAndGet();
+        }
     }
     }
 
 
     /**
     /**

+ 2 - 7
src/main/java/com/qmth/exam/reserve/job/StudentApplyRecordJob.java

@@ -83,12 +83,7 @@ public class StudentApplyRecordJob {
         String msg = String.format("%s_%s_%s_%s", bean.getStudentId(), bean.getExamSiteId(),
         String msg = String.format("%s_%s_%s_%s", bean.getStudentId(), bean.getExamSiteId(),
                 bean.getTimePeriodId(), bean.getCancel());
                 bean.getTimePeriodId(), bean.getCancel());
         if (existEntity != null) {
         if (existEntity != null) {
-            if (!existEntity.getCancel()) {
-                log.info("{} 预约已存在,跳过!", msg);
-                return;
-            }
-
-            // 存在“已取消”预约记录,则恢复预约
+            // 存在预约记录,则修改
             LambdaUpdateWrapper<StudentApplyEntity> updateWrapper = new LambdaUpdateWrapper<>();
             LambdaUpdateWrapper<StudentApplyEntity> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(StudentApplyEntity::getCancel, bean.getCancel());
             updateWrapper.set(StudentApplyEntity::getCancel, bean.getCancel());
             updateWrapper.set(StudentApplyEntity::getOperateId, bean.getOperateId());
             updateWrapper.set(StudentApplyEntity::getOperateId, bean.getOperateId());
@@ -97,7 +92,7 @@ public class StudentApplyRecordJob {
             studentApplyService.update(updateWrapper);
             studentApplyService.update(updateWrapper);
             log.info("{} 预约修改!", msg);
             log.info("{} 预约修改!", msg);
         } else {
         } else {
-            // 不存在则新增预约记录
+            // 不存在预约记录,则新增
             StudentApplyEntity entity = new StudentApplyEntity();
             StudentApplyEntity entity = new StudentApplyEntity();
             entity.setStudentId(bean.getStudentId());
             entity.setStudentId(bean.getStudentId());
             entity.setExamSiteId(bean.getExamSiteId());
             entity.setExamSiteId(bean.getExamSiteId());