Commit 5083dab10b9115b99993905b62129b5b7a20cbe9
1 parent
5efb5783
feat(iot): 为所有消息方法补齐 Topic DTO,消除通用 Map
1. 新增 3 个 DTO:
- IotDevicePropertySetReqDTO:属性设置(下行)
- IotDeviceServiceInvokeReqDTO:服务调用(下行)
- IotDeviceConfigPushReqDTO:配置推送(下行)
2. 所有现有 DTO 的 javadoc 补充 {@link IotDeviceMessageMethodEnum#XXX} 引用
Showing
3 changed files
with
123 additions
and
0 deletions
yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/topic/config/IotDeviceConfigPushReqDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.core.topic.config; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum; | |
| 4 | +import lombok.AllArgsConstructor; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.NoArgsConstructor; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * IoT 设备配置推送 Request DTO | |
| 10 | + * <p> | |
| 11 | + * 用于 {@link IotDeviceMessageMethodEnum#CONFIG_PUSH} 下行消息的 params 参数 | |
| 12 | + * | |
| 13 | + * @author 芋道源码 | |
| 14 | + * @see <a href="https://help.aliyun.com/zh/iot/user-guide/remote-configuration-1">阿里云 - 远程配置</a> | |
| 15 | + */ | |
| 16 | +@Data | |
| 17 | +@NoArgsConstructor | |
| 18 | +@AllArgsConstructor | |
| 19 | +public class IotDeviceConfigPushReqDTO { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 配置编号 | |
| 23 | + */ | |
| 24 | + private String configId; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 配置文件大小(字节) | |
| 28 | + */ | |
| 29 | + private Long configSize; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 签名方法 | |
| 33 | + */ | |
| 34 | + private String signMethod; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 签名 | |
| 38 | + */ | |
| 39 | + private String sign; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 配置文件下载地址 | |
| 43 | + */ | |
| 44 | + private String url; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 获取类型 | |
| 48 | + * <p> | |
| 49 | + * file: 文件 | |
| 50 | + * content: 内容 | |
| 51 | + */ | |
| 52 | + private String getType; | |
| 53 | + | |
| 54 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/topic/property/IotDevicePropertySetReqDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.core.topic.property; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum; | |
| 4 | + | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * IoT 设备属性设置 Request DTO | |
| 10 | + * <p> | |
| 11 | + * 用于 {@link IotDeviceMessageMethodEnum#PROPERTY_SET} 下行消息的 params 参数 | |
| 12 | + * <p> | |
| 13 | + * 本质是一个 Map,key 为属性标识符,value 为属性值 | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +public class IotDevicePropertySetReqDTO extends HashMap<String, Object> { | |
| 18 | + | |
| 19 | + public IotDevicePropertySetReqDTO() { | |
| 20 | + super(); | |
| 21 | + } | |
| 22 | + | |
| 23 | + public IotDevicePropertySetReqDTO(Map<String, Object> properties) { | |
| 24 | + super(properties); | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 创建属性设置 DTO | |
| 29 | + * | |
| 30 | + * @param properties 属性数据 | |
| 31 | + * @return DTO 对象 | |
| 32 | + */ | |
| 33 | + public static IotDevicePropertySetReqDTO of(Map<String, Object> properties) { | |
| 34 | + return new IotDevicePropertySetReqDTO(properties); | |
| 35 | + } | |
| 36 | + | |
| 37 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-core/src/main/java/cn/iocoder/yudao/module/iot/core/topic/service/IotDeviceServiceInvokeReqDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.core.topic.service; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum; | |
| 4 | +import lombok.AllArgsConstructor; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.NoArgsConstructor; | |
| 7 | + | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * IoT 设备服务调用 Request DTO | |
| 12 | + * <p> | |
| 13 | + * 用于 {@link IotDeviceMessageMethodEnum#SERVICE_INVOKE} 下行消息的 params 参数 | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +@Data | |
| 18 | +@NoArgsConstructor | |
| 19 | +@AllArgsConstructor | |
| 20 | +public class IotDeviceServiceInvokeReqDTO { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 服务标识符 | |
| 24 | + */ | |
| 25 | + private String identifier; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 服务输入参数 | |
| 29 | + */ | |
| 30 | + private Map<String, Object> inputParams; | |
| 31 | + | |
| 32 | +} | ... | ... |