|
|
@@ -7,11 +7,11 @@ import lombok.NoArgsConstructor;
|
|
|
import lombok.Setter;
|
|
|
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.hswebframework.web.validator.CreateGroup;
|
|
|
-import org.jetlinks.community.device.enums.DeviceProductState;
|
|
|
import org.jetlinks.community.device.enums.DirectiveState;
|
|
|
import org.jetlinks.core.message.DeviceMessage;
|
|
|
-import org.jetlinks.core.message.MessageType;
|
|
|
import javax.persistence.Column;
|
|
|
import javax.persistence.Index;
|
|
|
import javax.persistence.Table;
|
|
|
@@ -57,7 +57,7 @@ public class DeviceDirectivesEntity extends GenericEntity<String> {
|
|
|
@Comment("消息类型")
|
|
|
@Column(name = "message_type",nullable = false)
|
|
|
@NotBlank(message = "消息类型不能为空", groups = CreateGroup.class)
|
|
|
- private String messageType;
|
|
|
+ private MessageType messageType;
|
|
|
|
|
|
@Comment("错误原因")
|
|
|
@Column(name = "last_error")
|
|
|
@@ -68,14 +68,12 @@ public class DeviceDirectivesEntity extends GenericEntity<String> {
|
|
|
@Column(name = "reply_message")
|
|
|
@ColumnType(jdbcType = JDBCType.CLOB)
|
|
|
@Schema(description = "回复内容")
|
|
|
- @JsonCodec
|
|
|
private DeviceMessage replyMessage;
|
|
|
|
|
|
@Comment("下发指令")
|
|
|
@Column(name = "send_message")
|
|
|
@ColumnType(jdbcType = JDBCType.CLOB)
|
|
|
@Schema(description = "下发指令")
|
|
|
- @JsonCodec
|
|
|
private DeviceMessage sendMessage;
|
|
|
|
|
|
@Column(name = "state",length = 16)
|
|
|
@@ -93,8 +91,22 @@ public class DeviceDirectivesEntity extends GenericEntity<String> {
|
|
|
String deviceId,
|
|
|
String messageId,
|
|
|
long sendTimestamp,
|
|
|
- String messageType, DeviceMessage sendMessage) {
|
|
|
+ MessageType messageType, DeviceMessage sendMessage) {
|
|
|
return new DeviceDirectivesEntity(productId,deviceId,messageId,sendTimestamp,messageType,null,null,sendMessage,null);
|
|
|
}
|
|
|
|
|
|
+ @AllArgsConstructor
|
|
|
+ @Getter
|
|
|
+ @Dict("directive-msg-state")
|
|
|
+ public static enum MessageType implements EnumDict<String> {
|
|
|
+ READ_PROPERTY("读取属性"),
|
|
|
+ WRITE_PROPERTY("设置属性"),
|
|
|
+ INVOKE_FUNCTION("调用功能");
|
|
|
+
|
|
|
+ private String text;
|
|
|
+ @Override
|
|
|
+ public String getValue() {
|
|
|
+ return this.name();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|