deason 1 年之前
父節點
當前提交
f354e63ed0
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/main/java/com/qmth/exam/reserve/job/StudentApplyRecordJob.java

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

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