Commit bf80128e by huangjy

fix:离线不删除设备缓存,

parent 8d47ba0e
...@@ -921,12 +921,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -921,12 +921,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
List<PlatDevice> deviceList = list(deviceLambdaQueryWrapper); List<PlatDevice> deviceList = list(deviceLambdaQueryWrapper);
if (CollectionUtils.isNotEmpty(deviceList)) { if (CollectionUtils.isNotEmpty(deviceList)) {
for (PlatDevice platDevice : deviceList) { for (PlatDevice platDevice : deviceList) {
platDevice.setStatus(messageType.toLowerCase());
if (isOffLine) { if (isOffLine) {
RedisUtil.delete(RedisConst.ALARM_DEVICE_OFF_BED_ID + platDevice.getId()); RedisUtil.delete(RedisConst.ALARM_DEVICE_OFF_BED_ID + platDevice.getId());
} }
} }
deviceCacheUtil.putAll(deviceList);
} }
return true; return true;
} }
......
...@@ -114,12 +114,10 @@ public class PushCallback implements MqttCallback { ...@@ -114,12 +114,10 @@ public class PushCallback implements MqttCallback {
// 收到消息并设置返回字符串格式 // 收到消息并设置返回字符串格式
String payload = new String(message.getPayload(), "UTF-8"); String payload = new String(message.getPayload(), "UTF-8");
// logger.info("接收消息主题:{}, 接收消息QoS:{}", topic, message.getQos());
logger.info("接收消息内容:payload格式:{}", payload); logger.info("接收消息内容:payload格式:{}", payload);
// 解析数据 // 解析数据
DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class); DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class);
// todo
syncProperties(device); syncProperties(device);
...@@ -199,7 +197,7 @@ public class PushCallback implements MqttCallback { ...@@ -199,7 +197,7 @@ public class PushCallback implements MqttCallback {
String deviceId = device.getDeviceId(); String deviceId = device.getDeviceId();
String messageType = device.getMessageType(); String messageType = device.getMessageType();
//更新设备状态 //更新设备状态
boolean statusFlag = platDeviceService.updateDeviceStatus(messageType, deviceId, ""); platDeviceService.updateDeviceStatus(messageType, deviceId, "");
if (org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase(messageType, DeviceState.online.getValue())) { if (org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase(messageType, DeviceState.online.getValue())) {
return; return;
} }
...@@ -247,6 +245,7 @@ public class PushCallback implements MqttCallback { ...@@ -247,6 +245,7 @@ public class PushCallback implements MqttCallback {
} }
} }
} }
}catch (Exception e){ }catch (Exception e){
logger.error("告警异常pushCallback:",e); logger.error("告警异常pushCallback:",e);
} }
......
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 sign in to comment