package com.xy.dto; import cn.hutool.json.JSONObject; import com.fasterxml.jackson.annotation.JsonFormat; import com.xy.utils.PageBean; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.time.LocalDate; import java.time.LocalDateTime; @Data @Accessors(chain = true) public class MqttDto { @ApiModelProperty(value = "设备id") private Long deviceId; @ApiModelProperty("是否调试模式") private Boolean debug; @ApiModelProperty("消息级别qs") private Integer level; @ApiModelProperty("消息消费时间(延迟消费) yyyy-MM-dd HH:mm:ss") private String delayTime; @ApiModelProperty("指令有效期,单位:s") private Integer timeout; @ApiModelProperty(value = "指令对象") private PaterDto pater; @Data @Accessors(chain = true) public static class ResultBack { @NotBlank(message = "cmdType不能为空") @ApiModelProperty(value = "业务类型", required = true) private String cmdType; @ApiModelProperty(value = "质检通知对象") private DeviceQualityDto.QualityResultBack qualityResultBack; @ApiModelProperty(value = "温度设置通知对象") private DeviceTempSetDto.DeviceTempResultBack deviceTempResultBack; @ApiModelProperty(value = "设备版本升级通知对象") private DeviceVersionUpDto.DeviceVersionUpResultBack deviceVersionUpResultBack; } @Data @Accessors(chain = true) public static class SnByCmdAndResult { @NotNull(message = "sn不能为空") @ApiModelProperty("sn") private Long sn; } @Data @Accessors(chain = true) public static class Page extends Vo2 { @ApiModelProperty("分页对象") private PageBean page; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "发送时间-起") private LocalDate beginSendTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "发送时间-始") private LocalDate endSendTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "过期时间-起") private LocalDate beginTimeout; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "过期时间-始") private LocalDate endTimeout; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "延迟消费时间-起") private LocalDate beginDelayTime; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "延迟消费时间-始") private LocalDate endDelayTime; public LocalDateTime getBeginSendTime() { return beginSendTime == null ? null : beginSendTime.atTime(0, 0, 0); } public LocalDateTime getEndSendTime() { return endSendTime == null ? null : endSendTime.atTime(23, 59, 59); } public LocalDateTime getBeginTimeout() { return beginTimeout == null ? null : beginTimeout.atTime(0, 0, 0); } public LocalDateTime getEndTimeout() { return endTimeout == null ? null : endTimeout.atTime(23, 59, 59); } public LocalDateTime getBeginDelayTime() { return beginDelayTime == null ? null : beginDelayTime.atTime(0, 0, 0); } public LocalDateTime getEndDelayTime() { return endDelayTime == null ? null : endDelayTime.atTime(23, 59, 59); } } @Data @Accessors(chain = true) public static class Vo2 { @ApiModelProperty("id") private Long sn; @ApiModelProperty("业务sn") private Long wkSn; @ApiModelProperty("是否调试") private Boolean debug; @ApiModelProperty("业务类型") private String cmdType; @ApiModelProperty("行为类型") private String actionType; @ApiModelProperty("指令状态 1=已发送 2=发送失败 3=已执行 4=执行失败,5=执行超时 6=已完成 7=已拒绝") private Integer status; @ApiModelProperty("指令完整值") private String value; @ApiModelProperty("指令发送时间") private String sendTime; @ApiModelProperty("客户端指令上报时间") private String backClientTime; @ApiModelProperty("服务端指令上报时间") private String backServerTime; @ApiModelProperty("指令有效期") private Integer timeout; @ApiModelProperty("接收指令的topic") private String topic; @ApiModelProperty("是否应答") private Boolean ack; @ApiModelProperty("消息级别") private Integer level; @ApiModelProperty("已发送次数") private Integer num; @ApiModelProperty("消息消费时间(延迟消费)") private String delayTime; @ApiModelProperty("错误日志") private String error; } @Data @Accessors(chain = true) public static class Vo3 extends Vo2 { @ApiModelProperty("执行结果") private JSONObject result; } }