Browse Source

增加告警数据过滤

zhongwei
ty 10 months ago
parent
commit
6ccdade06b
  1. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java

@ -63,7 +63,7 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
//根据最近5分钟的数据,做去重
for (String key : keys) {
String value = stringRedisTemplate.opsForValue().get(key);
if (value.equals(alarm.getAlarmContext())){
if (value.equals(stations.get(0).getName()+alarm.getAlarmContext())){
return;
}
}
@ -94,7 +94,7 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
return;
}
String key="hzims:queue:filter:alarm"+alarm.getAlarmId();
stringRedisTemplate.opsForValue().set(key,alarm.getAlarmContext());
stringRedisTemplate.opsForValue().set(key,stations.get(0).getName()+alarm.getAlarmContext());
stringRedisTemplate.expire(key,5, TimeUnit.MINUTES);
// 步骤7.发生数据至redis告警队列
stringRedisTemplate.opsForList().rightPush("hzims:queue:alarm", JSON.toJSONString(alarm));

Loading…
Cancel
Save