deason před 1 rokem
rodič
revize
f354e63ed0

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

@@ -57,11 +57,11 @@ public class StudentApplyRecordJob {
             int queueSize = queue.size();
             log.info("[JOB] queue size:{}", queueSize);
 
-            for (int i = 0; i < queueSize; i++) {
+            for (int i = 1; i <= queueSize; i++) {
                 ApplyRecordCacheBean value = queue.poll();
 
                 try {
-                    this.saveOrUpdate(value);
+                    this.saveOrUpdate(value, i);
                 } catch (Exception e) {
                     // 保存至数据库失败,放回队列重试执行
                     boolean success = queue.offer(value);
@@ -86,7 +86,7 @@ public class StudentApplyRecordJob {
     }
 
     // @Transactional
-    public void saveOrUpdate(ApplyRecordCacheBean bean) {
+    public void saveOrUpdate(ApplyRecordCacheBean bean, int index) {
         if (bean == null) {
             return;
         }
@@ -111,7 +111,7 @@ public class StudentApplyRecordJob {
             updateWrapper.set(StudentApplyEntity::getUpdateTime, bean.getOperateTime());
             updateWrapper.eq(StudentApplyEntity::getId, data.getId());
             studentApplyService.update(updateWrapper);
-            log.info("{} 预约修改!", msg);
+            log.info("{} 预约修改!{}", msg, index);
         } else {
             // 不存在预约记录,则新增
             data = new StudentApplyEntity();
@@ -123,7 +123,7 @@ public class StudentApplyRecordJob {
             data.setCreateTime(bean.getOperateTime());
             data.setUpdateTime(bean.getOperateTime());
             studentApplyService.save(data);
-            log.info("{} 预约新增!", msg);
+            log.info("{} 预约新增!{}", msg, index);
         }
 
         if (data.getCancel()) {