|
|
@@ -1,8 +1,5 @@
|
|
|
package org.jetlinks.community.device.entity;
|
|
|
|
|
|
-import cn.hutool.json.JSONUtil;
|
|
|
-import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Getter;
|
|
|
@@ -12,8 +9,11 @@ import org.hswebframework.ezorm.rdb.mapping.annotation.*;
|
|
|
import org.hswebframework.web.api.crud.entity.GenericEntity;
|
|
|
import org.hswebframework.web.dict.Dict;
|
|
|
import org.hswebframework.web.dict.EnumDict;
|
|
|
+import org.jetlinks.community.annotation.MessageCodec;
|
|
|
import org.jetlinks.community.device.enums.DirectiveState;
|
|
|
import org.jetlinks.core.message.CommonDeviceMessage;
|
|
|
+import org.jetlinks.core.message.DeviceMessage;
|
|
|
+
|
|
|
import javax.persistence.Column;
|
|
|
import javax.persistence.Index;
|
|
|
import javax.persistence.Table;
|
|
|
@@ -70,18 +70,18 @@ public class DeviceDirectivesEntity extends GenericEntity<String> {
|
|
|
private String lastError;
|
|
|
|
|
|
@Comment("回复内容")
|
|
|
- @Column(name = "reply_message")
|
|
|
+ @Column(name = "upstream")
|
|
|
@ColumnType(jdbcType = JDBCType.CLOB)
|
|
|
@Schema(description = "回复内容")
|
|
|
- @JsonCodec
|
|
|
- private CommonDeviceMessage replyMessage;
|
|
|
+ @MessageCodec
|
|
|
+ private DeviceMessage upstream;
|
|
|
|
|
|
@Comment("下发指令")
|
|
|
- @Column(name = "send_message")
|
|
|
+ @Column(name = "downstream")
|
|
|
@ColumnType(jdbcType = JDBCType.CLOB)
|
|
|
@Schema(description = "下发指令")
|
|
|
- @JsonCodec
|
|
|
- private CommonDeviceMessage sendMessage;
|
|
|
+ @MessageCodec
|
|
|
+ private DeviceMessage downstream;
|
|
|
|
|
|
@Column(name = "state",length = 16)
|
|
|
@EnumCodec
|
|
|
@@ -94,16 +94,17 @@ public class DeviceDirectivesEntity extends GenericEntity<String> {
|
|
|
)
|
|
|
private DirectiveState state;
|
|
|
|
|
|
- public DeviceDirectivesEntity(String productId, String deviceId, String messageId, Long sendTimestamp, MessageType messageType, String lastError, CommonDeviceMessage replyMessage, CommonDeviceMessage sendMessage, DirectiveState state) {
|
|
|
+ public DeviceDirectivesEntity(String productId, String deviceId, String messageId, Long sendTimestamp, MessageType messageType, String lastError, DeviceMessage upstream, DeviceMessage downstream, DirectiveState state) {
|
|
|
this.productId = productId;
|
|
|
this.deviceId = deviceId;
|
|
|
this.messageId = messageId;
|
|
|
this.sendTimestamp = sendTimestamp;
|
|
|
this.messageType = messageType;
|
|
|
this.lastError = lastError;
|
|
|
- this.replyMessage = replyMessage;
|
|
|
- this.sendMessage = sendMessage;
|
|
|
+ this.upstream = upstream;
|
|
|
+ this.downstream = downstream;
|
|
|
this.state = state;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static DeviceDirectivesEntity of(String productId,
|