Commit 8359d9a6 by 罗志长

Merge branch 'dev'

parents e841eac1 96edab64
......@@ -1326,9 +1326,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (!isSuccess) {
return;
}
RedisUtil.set(key, faultState);
this.update(new UpdateWrapper<PlatDevice>().lambda()
.set(PlatDevice::getStatus, "abnormal").eq(PlatDevice::getOriDeviceId, deviceId));
RedisUtil.set(key, faultState);
log.info("设备:{} 故障处理, 设置故障", deviceId);
}
} else {
......@@ -1337,9 +1337,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (!isSuccess) {
return;
}
RedisUtil.delete(key);
this.update(new UpdateWrapper<PlatDevice>().lambda()
.set(PlatDevice::getStatus, "online").eq(PlatDevice::getOriDeviceId, deviceId));
RedisUtil.delete(key);
log.info("设备:{} 故障处理, 恢复正常", deviceId);
}
}
......
......@@ -277,12 +277,11 @@ public class PushCallback implements MqttCallbackExtended {
* 处理设备状态
*/
public void handleStatus(DeviceInfo device) {
if (!REPORT_PROPERTY.equals(device.getMessageType())) {
return;
}
CompletableFuture.runAsync(() -> {
if (REPORT_PROPERTY.equals(device.getMessageType())) {
// 处理设备故障
platDeviceService.handleFault(device);
}
// 更新设备状态
platDeviceService.updateDeviceStatus(device.getMessageType(), device.getDeviceId(), "");
}, taskExecutor);
......
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