去掉定时任务后删除最后一条设备状态的逻辑,因为有设置过期
parent
d8aaa53ac2
commit
3e4ee7b4b2
|
|
@ -348,7 +348,7 @@ public class MqttMessageHandler implements SmartLifecycle {
|
||||||
}
|
}
|
||||||
if (!isValidStatus) {
|
if (!isValidStatus) {
|
||||||
log.debug("【设备状态包】结构不合法(非8个功能码),跳过Redis写入,deviceId={};payload={}", deviceId, payload);
|
log.debug("【设备状态包】结构不合法(非8个功能码),跳过Redis写入,deviceId={};payload={}", deviceId, payload);
|
||||||
} else {
|
} else if(hasAutoOffTask(deviceId)){
|
||||||
// ✅ 8个功能码状态包:无条件写device:latest:{deviceId},避免自动关读不到最新状态
|
// ✅ 8个功能码状态包:无条件写device:latest:{deviceId},避免自动关读不到最新状态
|
||||||
stringRedisTemplate.opsForValue().set(
|
stringRedisTemplate.opsForValue().set(
|
||||||
"device:latest:" + deviceId,
|
"device:latest:" + deviceId,
|
||||||
|
|
@ -472,7 +472,6 @@ public class MqttMessageHandler implements SmartLifecycle {
|
||||||
//todo
|
//todo
|
||||||
mqttMessageSender.publish(deviceTopic, down.toJSONString());
|
mqttMessageSender.publish(deviceTopic, down.toJSONString());
|
||||||
log.info("【自动关任务】检测仍在运行,已下发关闭:deviceId={}, funcType={}, payload={}", deviceId, funcType, down.toJSONString());
|
log.info("【自动关任务】检测仍在运行,已下发关闭:deviceId={}, funcType={}, payload={}", deviceId, funcType, down.toJSONString());
|
||||||
Boolean deleteSuccess = stringRedisTemplate.delete("device:latest:" + deviceId);
|
|
||||||
} else {
|
} else {
|
||||||
log.info("【自动关任务】检测未运行或状态未知,跳过关闭:deviceId={}, funcType={}, current={}", deviceId, funcType, current);
|
log.info("【自动关任务】检测未运行或状态未知,跳过关闭:deviceId={}, funcType={}, current={}", deviceId, funcType, current);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue