Quellcode durchsuchen

feat(iot): 为所有消息方法补齐 Topic DTO,消除通用 Map

1. 新增 3 个 DTO:
   - IotDevicePropertySetReqDTO:属性设置(下行)
   - IotDeviceServiceInvokeReqDTO:服务调用(下行)
   - IotDeviceConfigPushReqDTO:配置推送(下行)
2. 所有现有 DTO 的 javadoc 补充 {@link IotDeviceMessageMethodEnum#XXX} 引用
YunaiV vor 4 Monaten
Ursprung
Commit
5083dab10b

+ 54 - 0
yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/topic/config/IotDeviceConfigPushReqDTO.java

@@ -0,0 +1,54 @@
+package cn.iocoder.yudao.module.iot.core.topic.config;
+
+import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * IoT 设备配置推送 Request DTO
+ * <p>
+ * 用于 {@link IotDeviceMessageMethodEnum#CONFIG_PUSH} 下行消息的 params 参数
+ *
+ * @author 芋道源码
+ * @see <a href="https://help.aliyun.com/zh/iot/user-guide/remote-configuration-1">阿里云 - 远程配置</a>
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotDeviceConfigPushReqDTO {
+
+    /**
+     * 配置编号
+     */
+    private String configId;
+
+    /**
+     * 配置文件大小(字节)
+     */
+    private Long configSize;
+
+    /**
+     * 签名方法
+     */
+    private String signMethod;
+
+    /**
+     * 签名
+     */
+    private String sign;
+
+    /**
+     * 配置文件下载地址
+     */
+    private String url;
+
+    /**
+     * 获取类型
+     * <p>
+     * file: 文件
+     * content: 内容
+     */
+    private String getType;
+
+}

+ 37 - 0
yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/topic/property/IotDevicePropertySetReqDTO.java

@@ -0,0 +1,37 @@
+package cn.iocoder.yudao.module.iot.core.topic.property;
+
+import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * IoT 设备属性设置 Request DTO
+ * <p>
+ * 用于 {@link IotDeviceMessageMethodEnum#PROPERTY_SET} 下行消息的 params 参数
+ * <p>
+ * 本质是一个 Map,key 为属性标识符,value 为属性值
+ *
+ * @author 芋道源码
+ */
+public class IotDevicePropertySetReqDTO extends HashMap<String, Object> {
+
+    public IotDevicePropertySetReqDTO() {
+        super();
+    }
+
+    public IotDevicePropertySetReqDTO(Map<String, Object> properties) {
+        super(properties);
+    }
+
+    /**
+     * 创建属性设置 DTO
+     *
+     * @param properties 属性数据
+     * @return DTO 对象
+     */
+    public static IotDevicePropertySetReqDTO of(Map<String, Object> properties) {
+        return new IotDevicePropertySetReqDTO(properties);
+    }
+
+}

+ 32 - 0
yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/topic/service/IotDeviceServiceInvokeReqDTO.java

@@ -0,0 +1,32 @@
+package cn.iocoder.yudao.module.iot.core.topic.service;
+
+import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+/**
+ * IoT 设备服务调用 Request DTO
+ * <p>
+ * 用于 {@link IotDeviceMessageMethodEnum#SERVICE_INVOKE} 下行消息的 params 参数
+ *
+ * @author 芋道源码
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class IotDeviceServiceInvokeReqDTO {
+
+    /**
+     * 服务标识符
+     */
+    private String identifier;
+
+    /**
+     * 服务输入参数
+     */
+    private Map<String, Object> inputParams;
+
+}