【功能完善】IOT: ThingModel 服务和事件
This commit is contained in:
parent
ed901bc97f
commit
94cfc4a1b1
|
@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* IOT 访问方式枚举类
|
||||
* IOT 产品物模型属性读取类型枚举
|
||||
*
|
||||
* @author ahh
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package cn.iocoder.yudao.module.iot.enums.thingmodel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* IOT 产品物模型参数是输入参数还是输出参数枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotProductThingModelParamDirectionEnum {
|
||||
|
||||
INPUT("input"), // 输入参数
|
||||
OUTPUT("output"); // 输出参数
|
||||
|
||||
private final String direction;
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package cn.iocoder.yudao.module.iot.enums.thingmodel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* IOT 产品物模型服务调用方式枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotProductThingModelServiceCallTypeEnum {
|
||||
|
||||
ASYNC("async"), // 异步调用
|
||||
SYNC("sync"); // 同步调用
|
||||
|
||||
private final String type;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package cn.iocoder.yudao.module.iot.enums.thingmodel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* IOT 产品物模型事件类型枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotProductThingModelServiceEventTypeEnum {
|
||||
|
||||
INFO("info"), // 信息
|
||||
ALERT("alert"), // 告警
|
||||
ERROR("error"); // 故障
|
||||
|
||||
private final String type;
|
||||
|
||||
}
|
|
@ -1,9 +1,15 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelArgument;
|
||||
import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelServiceEventTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物模型中的事件
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class ThingModelEvent {
|
||||
|
||||
|
@ -19,14 +25,28 @@ public class ThingModelEvent {
|
|||
* 事件描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否是标准品类的必选事件。
|
||||
*
|
||||
* - true:是
|
||||
* - false:否
|
||||
*/
|
||||
private Boolean required;
|
||||
/**
|
||||
* 事件类型
|
||||
*
|
||||
* "info"、"alert"、"error"
|
||||
* 关联枚举 {@link IotProductThingModelServiceEventTypeEnum}
|
||||
*/
|
||||
private String eventType;
|
||||
/**
|
||||
* 事件的输出参数
|
||||
*
|
||||
* 输出参数定义事件调用后返回的结果或反馈信息,用于确认操作结果或提供额外的信息。
|
||||
*/
|
||||
private List<ThingModelInputOutputParam> outputParams;
|
||||
/**
|
||||
* 标识设备需要执行的具体操作
|
||||
*/
|
||||
private String type;
|
||||
private List<ThingModelArgument> outputData;
|
||||
private String method;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelDataSpecs;
|
||||
import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelParamDirectionEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* IOT 产品物模型中的服务、事件的输入输出参数
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class ThingModelInputOutputParam {
|
||||
|
||||
/**
|
||||
* 参数标识符
|
||||
*/
|
||||
private String identifier;
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 参数描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 用于区分输入或输出参数
|
||||
*
|
||||
* 关联枚举 {@link IotProductThingModelParamDirectionEnum}
|
||||
*/
|
||||
private String direction;
|
||||
/**
|
||||
* 参数的序号。从 0 开始排序,且不能重复。
|
||||
*/
|
||||
private Integer paraOrder;
|
||||
/**
|
||||
* 参数值的数据类型,与 dataSpecs 的 dataType 保持一致
|
||||
*/
|
||||
private String dataType;
|
||||
/**
|
||||
* 参数值的数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中
|
||||
*/
|
||||
private ThingModelDataSpecs dataSpecs;
|
||||
/**
|
||||
* 参数值的数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中
|
||||
*/
|
||||
private List<ThingModelDataSpecs> dataSpecsList;
|
||||
|
||||
}
|
|
@ -1,9 +1,15 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelArgument;
|
||||
import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelServiceCallTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物模型中的服务
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class ThingModelService {
|
||||
|
||||
|
@ -19,15 +25,34 @@ public class ThingModelService {
|
|||
* 服务描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否是标准品类的必选服务。
|
||||
*
|
||||
* - true:是
|
||||
* - false:否
|
||||
*/
|
||||
private Boolean required;
|
||||
/**
|
||||
* 调用类型
|
||||
*
|
||||
* "sync"、"async"
|
||||
* 关联枚举 {@link IotProductThingModelServiceCallTypeEnum}
|
||||
*/
|
||||
private String callType;
|
||||
private List<ThingModelArgument> inputData;
|
||||
private List<ThingModelArgument> outputData;
|
||||
/**
|
||||
* 服务的输入参数
|
||||
*
|
||||
* 输入参数定义服务调用时所需提供的信息,用于控制设备行为或执行特定任务
|
||||
*/
|
||||
private List<ThingModelInputOutputParam> inputParams;
|
||||
/**
|
||||
* 服务的输出参数
|
||||
*
|
||||
* 输出参数定义服务调用后返回的结果或反馈信息,用于确认操作结果或提供额外的信息。
|
||||
*/
|
||||
private List<ThingModelInputOutputParam> outputParams;
|
||||
/**
|
||||
* 标识设备需要执行的具体操作
|
||||
*/
|
||||
private String method;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ThingModelArgument {
|
||||
|
||||
public static final String DIRECTION_INPUT = "input";
|
||||
public static final String DIRECTION_OUTPUT = "output";
|
||||
|
||||
private String identifier;
|
||||
private String name;
|
||||
/**
|
||||
* 物模型中的属性
|
||||
*/
|
||||
private ThingModelProperty property;
|
||||
/**
|
||||
* 用于区分输入或输出参数,"input" 或 "output"
|
||||
*/
|
||||
private String direction;
|
||||
private String description;
|
||||
|
||||
}
|
Loading…
Reference in New Issue