|
|
@ -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()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |