Browse Source

修改mq发送报警消息

xujiaheng 3 years ago
parent
commit
6088e4733f
1 changed files with 4 additions and 11 deletions
  1. 4 11
      src/main/java/com/persagy/service/impl/AlarmHandleServiceImpl.java

+ 4 - 11
src/main/java/com/persagy/service/impl/AlarmHandleServiceImpl.java

@@ -16,6 +16,9 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.stream.Collectors;
 
+import com.persagy.entity.*;
+import com.persagy.enumeration.YesNoEnum;
+import com.persagy.repository.AlarmLastTimeRepository;
 import org.apache.commons.lang3.StringUtils;
 import org.quartz.JobDataMap;
 import org.springframework.amqp.core.Message;
@@ -39,12 +42,6 @@ import com.persagy.cache.AlarmLastTimeCache;
 import com.persagy.cache.AlarmRedisCache;
 import com.persagy.cache.CreatedAlarmIdsCache;
 import com.persagy.client.GroupNettyClient;
-import com.persagy.entity.AlarmConditionState;
-import com.persagy.entity.AlarmDefine;
-import com.persagy.entity.AlarmRecord;
-import com.persagy.entity.Condition;
-import com.persagy.entity.ExpireAlarmMessage;
-import com.persagy.entity.ZktAlarmRecordDO;
 import com.persagy.entity.v2.AlarmCondition;
 import com.persagy.entity.v2.DmpMessage;
 import com.persagy.entity.v2.ItemCodeCondition;
@@ -511,8 +508,7 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
 					objectNode.set("iotData", objectMapper.readTree(objectMapper.writeValueAsString(paramMap)));
 					objectNode.put("groupCode", groupCode);
 					// 推送报警持续消息到MQ
-					this.sendToMQ(JSONObject.parseObject(JSONObject.toJSONString(objectNode)), alarmId,
-							alarmDefine.getProjectId());
+					this.sendToMQ(JSONObject.parseObject(JSONObject.toJSONString(objectNode)), alarmId, alarmDefine.getProjectId());
 				}
 			}
 			// 之前是是正常状态
@@ -533,9 +529,6 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
 				if (alarmLastTime >= condition.getTriggerUphold()) {
 					String alarmId = StringUtil.getUUID();
 					log.debug("报警持续时间大于设定的持续时间,产生一条报警: [{}]", alarmId);
-					// 有新的报警产生,alarmLastTimeMap中报警标记为可删除
-					alarmLastTimeCache.setDeleteAvailable(defineId);
-					alarmLastTimeCache.updateAlarmId(defineId, alarmId);
 					// 边缘端保存报警信息
 					saveZktAlarmRecordWhenAlarmStart(alarmId, alarmDefine, dataTime);
 					// 报警定义状态更新为未处理