|
@@ -71,6 +71,12 @@ public class DeviceStatusEventHandler implements AwoaraEventHandler<DeviceStatus
|
|
|
private void handleOffline(WashDevice device, String deviceName, String offlineKey) {
|
|
private void handleOffline(WashDevice device, String deviceName, String offlineKey) {
|
|
|
log.info("设备离线: deviceId={}, deviceName={}", device.getId(), deviceName);
|
|
log.info("设备离线: deviceId={}, deviceName={}", device.getId(), deviceName);
|
|
|
|
|
|
|
|
|
|
+ // 更新设备状态为故障
|
|
|
|
|
+ washDeviceService.lambdaUpdate()
|
|
|
|
|
+ .set(WashDevice::getState, WashDevice.STATE_故障)
|
|
|
|
|
+ .eq(WashDevice::getId, device.getId())
|
|
|
|
|
+ .update();
|
|
|
|
|
+
|
|
|
stringRedisTemplate.opsForValue().set(offlineKey,
|
|
stringRedisTemplate.opsForValue().set(offlineKey,
|
|
|
String.valueOf(System.currentTimeMillis()),
|
|
String.valueOf(System.currentTimeMillis()),
|
|
|
Duration.ofHours(24));
|
|
Duration.ofHours(24));
|
|
@@ -91,6 +97,12 @@ public class DeviceStatusEventHandler implements AwoaraEventHandler<DeviceStatus
|
|
|
private void handleOnline(WashDevice device, String deviceName, String offlineKey) {
|
|
private void handleOnline(WashDevice device, String deviceName, String offlineKey) {
|
|
|
log.info("设备上线: deviceId={}, deviceName={}", device.getId(), deviceName);
|
|
log.info("设备上线: deviceId={}, deviceName={}", device.getId(), deviceName);
|
|
|
|
|
|
|
|
|
|
+ // 更新设备状态为空闲
|
|
|
|
|
+ washDeviceService.lambdaUpdate()
|
|
|
|
|
+ .set(WashDevice::getState, WashDevice.STATE_空闲)
|
|
|
|
|
+ .eq(WashDevice::getId, device.getId())
|
|
|
|
|
+ .update();
|
|
|
|
|
+
|
|
|
stringRedisTemplate.delete(offlineKey);
|
|
stringRedisTemplate.delete(offlineKey);
|
|
|
|
|
|
|
|
var unrecoveredLog = monitorLogService.lambdaQuery()
|
|
var unrecoveredLog = monitorLogService.lambdaQuery()
|