fix: bug修复。

This commit is contained in:
tianyongbao
2026-01-10 01:43:49 +08:00
parent 5bd63f83df
commit 2f740b74cd

View File

@@ -48,6 +48,13 @@ public class AmqpMessageHandlerImpl implements AmqpMessageHandler {
// 尝试从 topic 或 method 判断消息类型 // 尝试从 topic 或 method 判断消息类型
String topic = json.getStr("topic"); String topic = json.getStr("topic");
String method = json.getStr("method"); String method = json.getStr("method");
String status = json.getStr("status");
// 检查是否是设备上线/下线消息
if (status != null && ("online".equals(status) || "offline".equals(status))) {
handleLifeCycleMessage(json);
return;
}
if (topic != null) { if (topic != null) {
// 根据 topic 判断消息类型 // 根据 topic 判断消息类型
@@ -60,6 +67,10 @@ public class AmqpMessageHandlerImpl implements AmqpMessageHandler {
} }
return; return;
} }
// 如果都没有,记录警告并跳过
log.warn("无法识别的消息格式: {}", message);
return;
} }
switch (messageType) { switch (messageType) {