Browse Source

解决过期任务无法正常处理的bug

lixing 3 years ago
parent
commit
355ab13bfe
1 changed files with 25 additions and 34 deletions
  1. 25 34
      src/main/java/com/persagy/job/AlarmExpireJob.java

+ 25 - 34
src/main/java/com/persagy/job/AlarmExpireJob.java

@@ -17,6 +17,8 @@ import com.persagy.repository.AlarmRecordRepository;
 import com.persagy.service.impl.AlarmHandleServiceImpl;
 import com.persagy.utils.DateUtils;
 import com.persagy.utils.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.quartz.*;
@@ -48,56 +50,45 @@ public class AlarmExpireJob extends QuartzJobBean {
     /**
      * 报警记录信息详情
      */
+    @Setter
+    @Getter
     private String alarmRecord;
     /**
      * 重试次数
      */
+    @Setter
+    @Getter
     private String refire;
     /**
      * 过期时间
      */
+    @Setter
+    @Getter
     private String expireTime;
     /**
      * 报警定义标识(itemcode+objId)
      */
+    @Setter
+    @Getter
     private String defineId;
 
-    public String getState() {
-        return state;
-    }
-
-    public void setState(String state) {
-        this.state = state;
-    }
-
     /**
      * 报警状态(2-恢复 3-过期)
      */
+    @Setter
+    @Getter
     private String state;
-
-    public String getEndTime() {
-        return endTime;
-    }
-
-    public void setEndTime(String endTime) {
-        this.endTime = endTime;
-    }
-
-    public String getEndInfo() {
-        return endInfo;
-    }
-
-    public void setEndInfo(String endInfo) {
-        this.endInfo = endInfo;
-    }
-
     /**
      * 恢复时间
      */
+    @Setter
+    @Getter
     private String endTime;
     /**
      * 恢复时刻信息
      */
+    @Setter
+    @Getter
     private String endInfo;
     /**
      * 集团编码
@@ -133,15 +124,15 @@ public class AlarmExpireJob extends QuartzJobBean {
                 ZktAlarmRecordDO zktAlarmRecordDO = StringUtil.tranferItemToDTO(alarmRecord, ZktAlarmRecordDO.class);
                 String alarmId = zktAlarmRecordDO.getAlarmId();
 
-                // 立即过期的场景,过期的时候可能还没有报警记录ID,需要延迟重新执行
-                if (!createdAlarmIdsCache.contains(alarmId)) {
-                    log.info("已创建的报警id中不包含[{}], 定时任务将在5分钟后重新执行", alarmId);
-                    log.info("refire:[{}]", refire);
-                    mergedJobDataMap.put("refire", String.valueOf(StringUtil.getInt(refire) + 1));
-                    reFireJob(context, mergedJobDataMap);
-                    log.info("----------------结束---------------------");
-                    return;
-                }
+//                // 立即过期的场景,过期的时候可能还没有报警记录ID,需要延迟重新执行
+//                if (!createdAlarmIdsCache.contains(alarmId)) {
+//                    log.info("已创建的报警id中不包含[{}], 定时任务将在5分钟后重新执行", alarmId);
+//                    log.info("refire:[{}]", refire);
+//                    mergedJobDataMap.put("refire", String.valueOf(StringUtil.getInt(refire) + 1));
+//                    reFireJob(context, mergedJobDataMap);
+//                    log.info("----------------结束---------------------");
+//                    return;
+//                }
 
                 log.info("报警参数为:[{}]", zktAlarmRecordDO);