feat:【IoT 物联网】优化固件相关请求和响应对象,添加文件 URL 格式校验,更新固件 ID 类型为 Long

This commit is contained in:
YunaiV
2025-06-30 19:08:29 +08:00
parent 3ca4cf265a
commit f9d782c701
12 changed files with 131 additions and 225 deletions

View File

@@ -70,7 +70,6 @@ public class IotEmqxDownstreamHandler {
private String buildTopicByMethod(IotDeviceMessage message, String productKey, String deviceName) {
// 1. 判断是否为回复消息
boolean isReply = IotDeviceMessageUtils.isReplyMessage(message);
// 2. 根据消息方法类型构建对应的主题
return IotMqttTopicUtils.buildTopicByMethod(message.getMethod(), productKey, deviceName, isReply);
}

View File

@@ -18,6 +18,11 @@ public final class IotMqttTopicUtils {
*/
private static final String SYS_TOPIC_PREFIX = "/sys/";
/**
* 回复主题后缀
*/
private static final String REPLY_TOPIC_SUFFIX = "_reply";
// ========== MQTT HTTP 接口路径常量 ==========
/**
@@ -48,15 +53,12 @@ public final class IotMqttTopicUtils {
if (StrUtil.isBlank(method)) {
return null;
}
// 1. 将点分隔符转换为斜杠
String topicSuffix = method.replace('.', '/');
// 2. 对于回复消息,添加 _reply 后缀
if (isReply) {
topicSuffix += "_reply";
topicSuffix += REPLY_TOPIC_SUFFIX;
}
// 3. 构建完整主题
return SYS_TOPIC_PREFIX + productKey + "/" + deviceName + "/" + topicSuffix;
}