Browse Source

#告警处理过滤重复告警增加站点限制

zhongwei
yang_shj 6 months ago
parent
commit
ba58ef17a7
  1. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmAssociationController.java
  2. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java
  3. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java
  4. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java
  5. 12
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml
  6. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java
  7. 8
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmAssociationController.java

@ -76,6 +76,4 @@ public class EmAssociationController extends BladeController {
return R.status(emAssociationService.deleteLogic(Func.toLongList(ids)));
}
}

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

@ -61,9 +61,9 @@ public class AlarmSaveServiceImpl implements AlarmSaveService {
return false;
}
// 步骤2.查询当天处理的告警
List<String> handlers = handleService.sameDayContent();
List<String> handlers = handleService.sameDayContent(stations.getData().stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 步骤3.查询延后未完成的告警
List<String> delays = handleService.incompleteContent();
List<String> delays = handleService.incompleteContent(stations.getData().stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 步骤4.近5分钟内告警
Set<String> keys = stringRedisTemplate.keys("hzims:queue:filter:alarm" + "*");
// 步骤5.遍历保存告警数据

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java

@ -29,7 +29,7 @@ public class HZ300MqttConsumer implements SubscribeCallBack {
private AlarmSaveService alarmSaveService;
@Override
public void onMessage(Map<String, Object> data) {
log.info("HZ3000队列监听到消息 : {}",data);
log.error("HZ3000队列监听到消息 : {}",data);
//消费代码
List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data));
if(CollectionUtil.isEmpty(alarmEntities)){

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.java

@ -22,7 +22,7 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper<AlarmHandleEn
List<String> handles(@Param("start") String start,@Param("end") String end);
List<String> sameDayContent(@Param("start") String start,@Param("end") String end);
List<String> sameDayContent(@Param("start") String start,@Param("end") String end,@Param("stations") List<String> stations);
List<String> incompleteContent(@Param("end") String end);
List<String> incompleteContent(@Param("end") String end,@Param("stations") List<String> stations);
}

12
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml

@ -50,6 +50,12 @@
<if test="start != null and end != null">
AND HANDLER.CREATE_TIME BETWEEN #{start} AND #{end}
</if>
<if test="stations != null">
and HANDLER.STATION_CODE in
<foreach collection="stations" item="station" index="index" open="(" close=")" separator=",">
#{station}
</foreach>
</if>
</where>
</select>
<select id="incompleteContent" resultType="java.lang.String">
@ -59,6 +65,12 @@
HANDLER.IS_DELETED = 0
AND HANDLER.HANDLE_WAY = 1
AND (HANDLER.DELAY_TIME &gt; #{end})
<if test="stations != null">
and HANDLER.STATION_CODE in
<foreach collection="stations" item="station" index="index" open="(" close=")" separator=",">
#{station}
</foreach>
</if>
</where>
</select>
</mapper>

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java

@ -26,7 +26,7 @@ public interface AlarmHandleService extends BaseService<AlarmHandleEntity> {
List<String> handles();
List<String> sameDayContent();
List<String> sameDayContent(List<String> stations);
List<String> incompleteContent();
List<String> incompleteContent(List<String> stations);
}

8
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java

@ -173,12 +173,12 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
* @return
*/
@Override
public List<String> sameDayContent() {
public List<String> sameDayContent(List<String> stations) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR_OF_DAY,-1);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
return this.baseMapper.sameDayContent(start,end);
return this.baseMapper.sameDayContent(start,end,stations);
}
/**
@ -186,8 +186,8 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
* @return
*/
@Override
public List<String> incompleteContent() {
public List<String> incompleteContent(List<String> stations) {
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
return this.baseMapper.incompleteContent(end);
return this.baseMapper.incompleteContent(end,stations);
}
}

Loading…
Cancel
Save