2026-06-24 f4bd1f3c89d906131495a0aca5aaf82966378510
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package cn.iocoder.yudao.module.iot.core.topic.event;
 
import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum;
import lombok.Data;
 
/**
 * IoT 设备事件上报 Request DTO
 * <p>
 * 用于 {@link IotDeviceMessageMethodEnum#EVENT_POST} 消息的 params 参数
 *
 * @author 芋道源码
 * @see <a href="http://help.aliyun.com/zh/marketplace/device-reporting-events">阿里云 - 设备上报事件</a>
 */
@Data
public class IotDeviceEventPostReqDTO {
 
    /**
     * 事件标识符
     */
    private String identifier;
 
    /**
     * 事件输出参数
     */
    private Object value;
 
    /**
     * 上报时间(毫秒时间戳,可选)
     */
    private Long time;
 
    /**
     * 创建事件上报 DTO
     *
     * @param identifier 事件标识符
     * @param value   事件值
     * @return DTO 对象
     */
    public static IotDeviceEventPostReqDTO of(String identifier, Object value) {
        return of(identifier, value, null);
    }
 
    /**
     * 创建事件上报 DTO(带时间)
     *
     * @param identifier 事件标识符
     * @param value   事件值
     * @param time    上报时间
     * @return DTO 对象
     */
    public static IotDeviceEventPostReqDTO of(String identifier, Object value, Long time) {
        return new IotDeviceEventPostReqDTO().setIdentifier(identifier).setValue(value).setTime(time);
    }
 
}