Commit 79cf29e2 authored by 赵啸非's avatar 赵啸非

添加告警统计信息

parent fa751a60
...@@ -54,7 +54,14 @@ public class DownMsgTask implements Runnable { ...@@ -54,7 +54,14 @@ public class DownMsgTask implements Runnable {
for (List<DeviceMsgReq> deviceMsgReqs : partition) { for (List<DeviceMsgReq> deviceMsgReqs : partition) {
for (DeviceMsgReq item : deviceMsgReqs) { for (DeviceMsgReq item : deviceMsgReqs) {
//根据设备编码查询设备 //根据设备编码查询设备
DeviceEntity deviceEntity = deviceService.getExtCache(item.getDeviceCode()); DeviceEntity deviceEntity = null;
try {
deviceEntity = deviceService.getExtCache(item.getDeviceCode());
} catch (Exception e) {
log.info("deviceCode:{}", item.getDeviceCode());
log.error("redis 获取设备异常!", e);
continue;
}
if (!ObjectUtils.isEmpty(deviceEntity)) { if (!ObjectUtils.isEmpty(deviceEntity)) {
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders(); TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, item.getMessageType()); header.put(MessageHeader.MESSAGETYPE, item.getMessageType());
...@@ -62,7 +69,7 @@ public class DownMsgTask implements Runnable { ...@@ -62,7 +69,7 @@ public class DownMsgTask implements Runnable {
header.put(MessageHeader.TIMESTAMP, item.getTimestamp().toString()); header.put(MessageHeader.TIMESTAMP, item.getTimestamp().toString());
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), item.getData(), header); TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), item.getData(), header);
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE,Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(),JSON.toJSONString(queueMsg)); messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg));
DeviceLogEntity deviceLogEntity = new DeviceLogEntity(); DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue(); deviceLogEntity.initAttrValue();
...@@ -76,7 +83,7 @@ public class DownMsgTask implements Runnable { ...@@ -76,7 +83,7 @@ public class DownMsgTask implements Runnable {
deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue()); deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue());
deviceLogEntity.setCreateUserId(1L); deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date()); deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity,null); deviceLogService.save(deviceLogEntity, null);
} else { } else {
log.info("未找到设备,deviceCode:{}", item.getDeviceCode()); log.info("未找到设备,deviceCode:{}", item.getDeviceCode());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment