MqttDto.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. package com.xy.dto;
  2. import cn.hutool.json.JSONObject;
  3. import com.fasterxml.jackson.annotation.JsonFormat;
  4. import com.xy.utils.PageBean;
  5. import io.swagger.annotations.ApiModelProperty;
  6. import lombok.Data;
  7. import lombok.experimental.Accessors;
  8. import javax.validation.constraints.NotBlank;
  9. import javax.validation.constraints.NotNull;
  10. import java.time.LocalDate;
  11. import java.time.LocalDateTime;
  12. @Data
  13. @Accessors(chain = true)
  14. public class MqttDto {
  15. @ApiModelProperty(value = "设备id")
  16. private Long deviceId;
  17. @ApiModelProperty("是否调试模式")
  18. private Boolean debug;
  19. @ApiModelProperty("消息级别qs")
  20. private Integer level;
  21. @ApiModelProperty("消息消费时间(延迟消费) yyyy-MM-dd HH:mm:ss")
  22. private String delayTime;
  23. @ApiModelProperty("指令有效期,单位:s")
  24. private Integer timeout;
  25. @ApiModelProperty(value = "指令对象")
  26. private PaterDto pater;
  27. @Data
  28. @Accessors(chain = true)
  29. public static class ResultBack {
  30. @NotBlank(message = "cmdType不能为空")
  31. @ApiModelProperty(value = "业务类型", required = true)
  32. private String cmdType;
  33. @ApiModelProperty(value = "质检通知对象")
  34. private DeviceQualityDto.QualityResultBack qualityResultBack;
  35. @ApiModelProperty(value = "温度设置通知对象")
  36. private DeviceTempSetDto.DeviceTempResultBack deviceTempResultBack;
  37. @ApiModelProperty(value = "设备版本升级通知对象")
  38. private DeviceVersionUpDto.DeviceVersionUpResultBack deviceVersionUpResultBack;
  39. }
  40. @Data
  41. @Accessors(chain = true)
  42. public static class SnByCmdAndResult {
  43. @NotNull(message = "sn不能为空")
  44. @ApiModelProperty("sn")
  45. private Long sn;
  46. }
  47. @Data
  48. @Accessors(chain = true)
  49. public static class Page extends Vo2 {
  50. @ApiModelProperty("分页对象")
  51. private PageBean page;
  52. @JsonFormat(pattern = "yyyy-MM-dd")
  53. @ApiModelProperty(value = "发送时间-起")
  54. private LocalDate beginSendTime;
  55. @JsonFormat(pattern = "yyyy-MM-dd")
  56. @ApiModelProperty(value = "发送时间-始")
  57. private LocalDate endSendTime;
  58. @JsonFormat(pattern = "yyyy-MM-dd")
  59. @ApiModelProperty(value = "过期时间-起")
  60. private LocalDate beginTimeout;
  61. @JsonFormat(pattern = "yyyy-MM-dd")
  62. @ApiModelProperty(value = "过期时间-始")
  63. private LocalDate endTimeout;
  64. @JsonFormat(pattern = "yyyy-MM-dd")
  65. @ApiModelProperty(value = "延迟消费时间-起")
  66. private LocalDate beginDelayTime;
  67. @JsonFormat(pattern = "yyyy-MM-dd")
  68. @ApiModelProperty(value = "延迟消费时间-始")
  69. private LocalDate endDelayTime;
  70. public LocalDateTime getBeginSendTime() {
  71. return beginSendTime == null ? null : beginSendTime.atTime(0, 0, 0);
  72. }
  73. public LocalDateTime getEndSendTime() {
  74. return endSendTime == null ? null : endSendTime.atTime(23, 59, 59);
  75. }
  76. public LocalDateTime getBeginTimeout() {
  77. return beginTimeout == null ? null : beginTimeout.atTime(0, 0, 0);
  78. }
  79. public LocalDateTime getEndTimeout() {
  80. return endTimeout == null ? null : endTimeout.atTime(23, 59, 59);
  81. }
  82. public LocalDateTime getBeginDelayTime() {
  83. return beginDelayTime == null ? null : beginDelayTime.atTime(0, 0, 0);
  84. }
  85. public LocalDateTime getEndDelayTime() {
  86. return endDelayTime == null ? null : endDelayTime.atTime(23, 59, 59);
  87. }
  88. }
  89. @Data
  90. @Accessors(chain = true)
  91. public static class Vo2 {
  92. @ApiModelProperty("id")
  93. private Long sn;
  94. @ApiModelProperty("业务sn")
  95. private Long wkSn;
  96. @ApiModelProperty("是否调试")
  97. private Boolean debug;
  98. @ApiModelProperty("业务类型")
  99. private String cmdType;
  100. @ApiModelProperty("行为类型")
  101. private String actionType;
  102. @ApiModelProperty("指令状态 1=已发送 2=发送失败 3=已执行 4=执行失败,5=执行超时 6=已完成 7=已拒绝")
  103. private Integer status;
  104. @ApiModelProperty("指令完整值")
  105. private String value;
  106. @ApiModelProperty("指令发送时间")
  107. private String sendTime;
  108. @ApiModelProperty("客户端指令上报时间")
  109. private String backClientTime;
  110. @ApiModelProperty("服务端指令上报时间")
  111. private String backServerTime;
  112. @ApiModelProperty("指令有效期")
  113. private Integer timeout;
  114. @ApiModelProperty("接收指令的topic")
  115. private String topic;
  116. @ApiModelProperty("是否应答")
  117. private Boolean ack;
  118. @ApiModelProperty("消息级别")
  119. private Integer level;
  120. @ApiModelProperty("已发送次数")
  121. private Integer num;
  122. @ApiModelProperty("消息消费时间(延迟消费)")
  123. private String delayTime;
  124. @ApiModelProperty("错误日志")
  125. private String error;
  126. }
  127. @Data
  128. @Accessors(chain = true)
  129. public static class Vo3 extends Vo2 {
  130. @ApiModelProperty("执行结果")
  131. private JSONObject result;
  132. }
  133. }