haogh 3 долоо хоног өмнө
parent
commit
6de4ef7a6e

+ 15 - 20
src/main/java/com/qmth/exam/reserve/service/impl/TimePeriodExamRoomServiceImpl.java

@@ -254,7 +254,7 @@ public class TimePeriodExamRoomServiceImpl extends ServiceImpl<TimePeriodExamRoo
                 throw new StatusException("其他老师正在修改该考点的容量,请稍后重试!");
             } else {
 
-                log.warn("[考场排班设置] 获取锁成功,同一个教学点正在修改该考点的容量,请稍后重试!lockKey:{}", examSiteLockKey);
+                log.warn("[考场排班设置] 获取锁成功,lockKey:{}", examSiteLockKey);
 
                 // 获取已有时段数据
                 List<TimePeriodExamSiteBean> existingTimePeriods = timePeriodService.listTimePeriodByExamRoomId(curApplyTask.getTaskId(), examRoomId);
@@ -377,25 +377,20 @@ public class TimePeriodExamRoomServiceImpl extends ServiceImpl<TimePeriodExamRoo
                     log.warn("[考场排班设置] 更新条数:{}", toBeUpdated.size());
                 }
 
-                // 提交事务后刷新缓存
-                TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
-                    @Override
-                    public void afterCommit() {
-                        for (Long timePeriodId : updatedTimePeriodIds) {
-                            int oldCapacity = oldCapacityMap.getOrDefault(timePeriodId, 0);;
-                            int newCapacity = examSiteService.getExamSiteTimePeriodCapacity(examSiteCacheBean.getExamSiteId(), timePeriodId);
-
-                            log.warn("[考场排班设置] 刷新缓存,timePeriodId:{},oldCapacity:{},newCapacity:{}", timePeriodId, oldCapacity, newCapacity);
-
-                            applyTaskCacheService.refreshApplyAvailableCountCache(
-                                    examRoom.getExamSiteId(),
-                                    timePeriodId,
-                                    oldCapacity,
-                                    newCapacity
-                            );
-                        }
-                    }
-                });
+                // 刷新缓存
+                for (Long timePeriodId : updatedTimePeriodIds) {
+                    int oldCapacity = oldCapacityMap.getOrDefault(timePeriodId, 0);
+                    int newCapacity = examSiteService.getExamSiteTimePeriodCapacity(examSiteCacheBean.getExamSiteId(), timePeriodId);
+
+                    log.warn("[考场排班设置] 刷新缓存,timePeriodId:{},oldCapacity:{},newCapacity:{}", timePeriodId, oldCapacity, newCapacity);
+
+                    applyTaskCacheService.refreshApplyAvailableCountCache(
+                            examRoom.getExamSiteId(),
+                            timePeriodId,
+                            oldCapacity,
+                            newCapacity
+                    );
+                }
             }
         } catch (Exception e) {
             log.error("[考场排班设置]保存失败,原因:{}", e.getMessage(), e);