Browse Source

#日志打印修改

zhongwei
yang_shj 4 months ago
parent
commit
39d1799b04
  1. 8
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/DroolsMqttConsumer.java
  2. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java
  3. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/HZ300MqttConsumer.java
  4. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/SoeMqttConsumer.java
  5. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/VideoMqttConsumer.java

8
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; private AlarmSaveService alarmSaveService;
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
log.info("DroolsMqttConsumer监听到消息"+data.toString()); log.error("DroolsMqttConsumer监听到消息"+data.toString());
String s = JSONObject.toJSONString(data); String s = JSONObject.toJSONString(data);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = droolsAlarmService.receiveMessage(s); List<AlarmEntity> alarmEntities = droolsAlarmService.receiveMessage(s);
log.error("监听规则引擎有效消息 : {}" ,alarmEntities.get(0).getAlarmId());
//统一数据处理 //统一数据处理
try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
}catch (Exception e){
log.error("规则引擎告警数据处理报错(DroolsAlarm):"+e);
System.out.println("规则引擎告警数据处理报错(DroolsAlarm):"+e);
}
} }
} }

7
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/FdpMqttConsumer.java

@ -29,18 +29,13 @@ public class FdpMqttConsumer implements SubscribeCallBack {
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
String s = JSONObject.toJSONString(data); String s = JSONObject.toJSONString(data);
log.info("监听Fdp消息 : {}" ,s); log.error("FdpMqttConsumer监听到消息 : {}" ,s);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = fdpAlarmService.receiveMessage(s); List<AlarmEntity> alarmEntities = fdpAlarmService.receiveMessage(s);
if(CollectionUtil.isEmpty(alarmEntities)){ if(CollectionUtil.isEmpty(alarmEntities)){
return; return;
} }
log.error("监听Fdp有效消息 : {}" ,alarmEntities.get(0).getAlarmId()); log.error("监听Fdp有效消息 : {}" ,alarmEntities.get(0).getAlarmId());
//统一数据处理
try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
}catch (Exception e){
throw new ServiceException("集中监控告警数据处理报错(FdpAlarm):"+e);
}
} }
} }

9
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; private AlarmSaveService alarmSaveService;
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
log.error("HZ3000队列监听到消息 : {}",data); log.error("HZ3000MqttConsumer监听到消息 : {}",data);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data)); List<AlarmEntity> alarmEntities = systemAlarmService.receiveMessage(JSONObject.toJSONString(data));
if(CollectionUtil.isEmpty(alarmEntities)){ if(CollectionUtil.isEmpty(alarmEntities)){
log.error("HZ3000消息转换数据异常");
return; return;
} }
//统一数据处理 log.error("监听HZ3000有效消息 : {}" ,alarmEntities.get(0).getAlarmId());
try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
}catch (Exception e){
log.error("HZ3000告警数据处理报错(HZ300Alarm):{}" , e.getMessage());
}
} }
} }

7
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; private AlarmSaveService alarmSaveService;
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
log.info("SoeMqttConsumer监听到消息"+data.toString()); log.error("SoeMqttConsumer监听到消息"+data.toString());
String s = JSONObject.toJSONString(data); String s = JSONObject.toJSONString(data);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = soeAlarmService.receiveMessage(s); List<AlarmEntity> alarmEntities = soeAlarmService.receiveMessage(s);
log.error("监听设备实例有效消息 : {}" ,alarmEntities.get(0).getAlarmId());
//统一数据处理 //统一数据处理
try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
}catch (Exception e){
log.error("条件告警数据处理报错(SoeAlarm):"+e);
}
} }
} }

7
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; private AlarmSaveService alarmSaveService;
@Override @Override
public void onMessage(Map<String, Object> data) { public void onMessage(Map<String, Object> data) {
log.info("VideoMqttConsumer队列监听到消息 : {}",data); log.error("VideoMqttConsumer监听到消息 : {}",data);
String s = JSONObject.toJSONString(data); String s = JSONObject.toJSONString(data);
//消费代码 //消费代码
List<AlarmEntity> alarmEntities = videoAlarmService.receiveMessage(s); List<AlarmEntity> alarmEntities = videoAlarmService.receiveMessage(s);
log.error("监听视频告警有效消息 : {}" ,alarmEntities.get(0).getAlarmId());
//统一数据处理 //统一数据处理
try {
alarmSaveService.save(alarmEntities); alarmSaveService.save(alarmEntities);
}catch (Exception e){
log.error("HZ3000告警数据处理报错(HZ300Alarm):"+e);
}
} }
} }

Loading…
Cancel
Save