注释没用逻辑
parent
dee84cfe54
commit
bc21635090
|
|
@ -177,6 +177,7 @@ public class MqttMessageHandler implements SmartLifecycle {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息分发处理:根据主题类型路由到不同处理方法\仅处理设备状态、前端控制指令
|
* 消息分发处理:根据主题类型路由到不同处理方法\仅处理设备状态、前端控制指令
|
||||||
|
* 可以监听到设备传过来的业务数据 以及前端传过来的控制设备指令
|
||||||
* @param topic 消息主题
|
* @param topic 消息主题
|
||||||
* @param payload 消息内容(JSON字符串)
|
* @param payload 消息内容(JSON字符串)
|
||||||
*/
|
*/
|
||||||
|
|
@ -307,16 +308,16 @@ public class MqttMessageHandler implements SmartLifecycle {
|
||||||
log.info("【订阅管理】前端{}订阅设备{}成功", clientId, deviceId);
|
log.info("【订阅管理】前端{}订阅设备{}成功", clientId, deviceId);
|
||||||
|
|
||||||
// 推送设备最新状态(可选)
|
// 推送设备最新状态(可选)
|
||||||
String latestStatus = stringRedisTemplate.opsForValue().get("device:latest:" + deviceId);
|
// String latestStatus = stringRedisTemplate.opsForValue().get("device:latest:" + deviceId);
|
||||||
if (latestStatus != null) {
|
// if (latestStatus != null) {
|
||||||
String frontendTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/up";
|
// String frontendTopic = "frontend/" + clientId + "/dtu/" + deviceId + "/up";
|
||||||
try {
|
// try {
|
||||||
mqttMessageSender.publish(frontendTopic, latestStatus);
|
// mqttMessageSender.publish(frontendTopic, latestStatus);
|
||||||
} catch (MqttException e) {
|
// } catch (MqttException e) {
|
||||||
// 优化:替换System.err为log.error
|
// // 优化:替换System.err为log.error
|
||||||
log.error("【订阅推送】设备{}状态推送失败", deviceId, e);
|
// log.error("【订阅推送】设备{}状态推送失败", deviceId, e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue