deason il y a 7 mois
Parent
commit
ffbfcbc99c

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

@@ -296,8 +296,7 @@ public class ApplyTaskCacheService implements CacheConstants {
 
             try {
                 if (!lock.tryLock()) {
-                    log.warn("获取锁失败,不允许同时操作!{}", lockKey);
-                    return;
+                    throw new RuntimeException("获取锁失败,不允许同时操作!" + lockKey);
                 }
 
                 for (Long timePeriodId : timePeriodIds) {

+ 2 - 0
src/main/java/com/qmth/exam/reserve/service/impl/TimePeriodServiceImpl.java

@@ -15,6 +15,7 @@ import com.qmth.exam.reserve.service.TimePeriodService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -30,6 +31,7 @@ public class TimePeriodServiceImpl extends ServiceImpl<TimePeriodDao, TimePeriod
     @Autowired
     private ApplyTaskCacheService cacheService;
 
+    @Transactional
     @Override
     public void saveTimePeriod(Long userId, Long id, List<TimePeriodReq> timeList) {
         ApplyTaskEntity task = taskService.getById(id);