注释没用逻辑

feasure
xce 2026-01-16 21:36:36 +08:00
parent dee84cfe54
commit bc21635090
1 changed files with 11 additions and 10 deletions

View File

@ -177,6 +177,7 @@ public class MqttMessageHandler implements SmartLifecycle {
/**
* \
*
* @param topic
* @param payload JSON
*/
@ -307,16 +308,16 @@ public class MqttMessageHandler implements SmartLifecycle {
log.info("【订阅管理】前端{}订阅设备{}成功", clientId, deviceId);
// 推送设备最新状态(可选)
String latestStatus = stringRedisTemplate.opsForValue().get("device:latest:" + deviceId);
if (latestStatus != null) {
String frontendTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/up";
try {
mqttMessageSender.publish(frontendTopic, latestStatus);
} catch (MqttException e) {
// 优化替换System.err为log.error
log.error("【订阅推送】设备{}状态推送失败", deviceId, e);
}
}
// String latestStatus = stringRedisTemplate.opsForValue().get("device:latest:" + deviceId);
// if (latestStatus != null) {
// String frontendTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/up";
// try {
// mqttMessageSender.publish(frontendTopic, latestStatus);
// } catch (MqttException e) {
// // 优化替换System.err为log.error
// log.error("【订阅推送】设备{}状态推送失败", deviceId, e);
// }
// }
}
/**