From 39d1799b045720515c02cbf0a8cec808705c07d2 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 7 Aug 2024 11:04:56 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java | 10 +++------- .../main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java | 9 ++------- .../java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java | 11 +++-------- .../main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java | 9 +++------ .../java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java | 9 +++------ 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java index 87acece..e52a759 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java @@ -29,16 +29,12 @@ public class DroolsMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("DroolsMqttConsumer监听到消息"+data.toString()); + log.error("DroolsMqttConsumer监听到消息"+data.toString()); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = droolsAlarmService.receiveMessage(s); + log.error("监听规则引擎有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("规则引擎告警数据处理报错(DroolsAlarm):"+e); - System.out.println("规则引擎告警数据处理报错(DroolsAlarm):"+e); - } + alarmSaveService.save(alarmEntities); } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java index 827825c..aa5f4ca 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java @@ -29,18 +29,13 @@ public class FdpMqttConsumer implements SubscribeCallBack { @Override public void onMessage(Map data) { String s = JSONObject.toJSONString(data); - log.info("监听Fdp消息 : {}" ,s); + log.error("FdpMqttConsumer监听到消息 : {}" ,s); //消费代码 List alarmEntities = fdpAlarmService.receiveMessage(s); if(CollectionUtil.isEmpty(alarmEntities)){ return; } log.error("监听Fdp有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); - //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - throw new ServiceException("集中监控告警数据处理报错(FdpAlarm):"+e); - } + alarmSaveService.save(alarmEntities); } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java index 82880ad..c891b9f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java @@ -29,18 +29,13 @@ public class HZ300MqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.error("HZ3000队列监听到消息 : {}",data); + log.error("HZ3000MqttConsumer监听到消息 : {}",data); //消费代码 List alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data)); if(CollectionUtil.isEmpty(alarmEntities)){ - log.error("HZ3000消息转换数据异常"); return; } - //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("HZ3000告警数据处理报错(HZ300Alarm):{}" , e.getMessage()); - } + log.error("监听HZ3000有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); + alarmSaveService.save(alarmEntities); } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java index 13fae87..2ecbe66 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java @@ -27,15 +27,12 @@ public class SoeMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("SoeMqttConsumer监听到消息"+data.toString()); + log.error("SoeMqttConsumer监听到消息"+data.toString()); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = soeAlarmService.receiveMessage(s); + log.error("监听设备实例有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("条件告警数据处理报错(SoeAlarm):"+e); - } + alarmSaveService.save(alarmEntities); } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java index 447db7b..eaa9ef6 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java @@ -26,15 +26,12 @@ public class VideoMqttConsumer implements SubscribeCallBack { private AlarmSaveService alarmSaveService; @Override public void onMessage(Map data) { - log.info("VideoMqttConsumer队列监听到消息 : {}",data); + log.error("VideoMqttConsumer监听到消息 : {}",data); String s = JSONObject.toJSONString(data); //消费代码 List alarmEntities = videoAlarmService.receiveMessage(s); + log.error("监听视频告警有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); //统一数据处理 - try { - alarmSaveService.save(alarmEntities); - }catch (Exception e){ - log.error("HZ3000告警数据处理报错(HZ300Alarm):"+e); - } + alarmSaveService.save(alarmEntities); } }