Commit 17a72034 authored by 赵啸非's avatar 赵啸非

添加告警统计信息

parent 0e8e229e
...@@ -60,14 +60,14 @@ public class DirectDynamicListener implements MessageListener { ...@@ -60,14 +60,14 @@ public class DirectDynamicListener implements MessageListener {
String queue = message.getMessageProperties().getConsumerQueue(); String queue = message.getMessageProperties().getConsumerQueue();
byte[] body = message.getBody(); byte[] body = message.getBody();
String data = new String(body); String data = new String(body);
// log.info("接收到:{} ,\n消息内容为:{}", queue, data); // log.info("接收到:{} ,\n消息内容为:{}", queue, data);
DefaultQueueMsg queueMsg = JSON.parseObject(data, DefaultQueueMsg.class); DefaultQueueMsg queueMsg = JSON.parseObject(data, DefaultQueueMsg.class);
//做相应业务,做日志操作 //做相应业务,做日志操作
String deviceCode = queueMsg.getHeaders().getData().get(DEVICECODE); String deviceCode = queueMsg.getHeaders().getData().get(DEVICECODE);
String messageType = queueMsg.getHeaders().getData().get(MESSAGETYPE); String messageType = queueMsg.getHeaders().getData().get(MESSAGETYPE);
try { try {
if(ObjectUtils.isEmpty(deviceCode)){ if (ObjectUtils.isEmpty(deviceCode)) {
log.info("onMessage deviceCode is null,receive data:{}",data); log.info("onMessage deviceCode is null,receive data:{}", data);
return; return;
} }
...@@ -77,7 +77,15 @@ public class DirectDynamicListener implements MessageListener { ...@@ -77,7 +77,15 @@ public class DirectDynamicListener implements MessageListener {
if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) { if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) {
deviceEntity.setOnlineTime(new Date()); deviceEntity.setOnlineTime(new Date());
deviceEntity.setDeviceStatus(DeviceStatusEnum.在线.getValue()); deviceEntity.setDeviceStatus(DeviceStatusEnum.在线.getValue());
// deviceService.update(deviceEntity); DeviceEntity entity = new DeviceEntity();
entity.setOnlineTime(new Date());
entity.setDeviceStatus(DeviceStatusEnum.在线.getValue());
DeviceEntity condition = new DeviceEntity();
condition.setId(deviceEntity.getId());
deviceService.getDeviceDao().update(entity, condition);
// deviceService.update(deviceEntity);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
...@@ -104,7 +112,7 @@ public class DirectDynamicListener implements MessageListener { ...@@ -104,7 +112,7 @@ public class DirectDynamicListener implements MessageListener {
//获取exchange, //获取exchange,
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
String phpInUrl=GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_IN_HTTP_URL, "http://172.15.28.116:8090"); String phpInUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_IN_HTTP_URL, "http://172.15.28.116:8090");
if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType) if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType)
&& !ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(platformEntity)
&& platformEntity.getSendSwitch() == YesNoEnum.YES.getValue()) { && platformEntity.getSendSwitch() == YesNoEnum.YES.getValue()) {
......
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