diff --git a/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thingmodel/IotProductThingModelAccessModeEnum.java b/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thinkmodel/IotProductThinkModelAccessModeEnum.java similarity index 68% rename from yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thingmodel/IotProductThingModelAccessModeEnum.java rename to yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thinkmodel/IotProductThinkModelAccessModeEnum.java index a755018034..b7f6ca312d 100644 --- a/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thingmodel/IotProductThingModelAccessModeEnum.java +++ b/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thinkmodel/IotProductThinkModelAccessModeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.enums.thingmodel; +package cn.iocoder.yudao.module.iot.enums.thinkmodel; import lombok.AllArgsConstructor; import lombok.Getter; @@ -10,7 +10,7 @@ import lombok.Getter; */ @AllArgsConstructor @Getter -public enum IotProductThingModelAccessModeEnum { +public enum IotProductThinkModelAccessModeEnum { READ_ONLY("r"), READ_WRITE("rw"); diff --git a/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thingmodel/IotProductThingModelTypeEnum.java b/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thinkmodel/IotProductThinkModelTypeEnum.java similarity index 73% rename from yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thingmodel/IotProductThingModelTypeEnum.java rename to yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thinkmodel/IotProductThinkModelTypeEnum.java index a12299e993..7c7562e279 100644 --- a/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thingmodel/IotProductThingModelTypeEnum.java +++ b/yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/thinkmodel/IotProductThinkModelTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.enums.thingmodel; +package cn.iocoder.yudao.module.iot.enums.thinkmodel; import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; @@ -14,13 +14,13 @@ import java.util.Arrays; */ @AllArgsConstructor @Getter -public enum IotProductThingModelTypeEnum implements IntArrayValuable { +public enum IotProductThinkModelTypeEnum implements IntArrayValuable { PROPERTY(1, "属性"), SERVICE(2, "服务"), EVENT(3, "事件"); - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotProductThingModelTypeEnum::getType).toArray(); + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(IotProductThinkModelTypeEnum::getType).toArray(); /** * 类型 @@ -31,8 +31,8 @@ public enum IotProductThingModelTypeEnum implements IntArrayValuable { */ private final String description; - public static IotProductThingModelTypeEnum valueOfType(Integer type) { - for (IotProductThingModelTypeEnum value : values()) { + public static IotProductThinkModelTypeEnum valueOfType(Integer type) { + for (IotProductThinkModelTypeEnum value : values()) { if (value.getType().equals(type)) { return value; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.java deleted file mode 100644 index 11a2ffcc50..0000000000 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.java +++ /dev/null @@ -1,84 +0,0 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel; - -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelRespVO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; -import cn.iocoder.yudao.module.iot.convert.productthingmodel.IotProductThingModelConvert; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; -import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -@Tag(name = "管理后台 - IoT 产品物模型") -@RestController -@RequestMapping("/iot/product-thing-model") -@Validated -public class IotProductThingModelController { - - @Resource - private IotProductThingModelService thinkModelFunctionService; - - @PostMapping("/create") - @Operation(summary = "创建产品物模型") - @PreAuthorize("@ss.hasPermission('iot:product-thing-model:create')") - public CommonResult createProductThingModel(@Valid @RequestBody IotProductThingModelSaveReqVO createReqVO) { - return success(thinkModelFunctionService.createProductThingModel(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新产品物模型") - @PreAuthorize("@ss.hasPermission('iot:product-thing-model:update')") - public CommonResult updateProductThingModel(@Valid @RequestBody IotProductThingModelSaveReqVO updateReqVO) { - thinkModelFunctionService.updateProductThingModel(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除产品物模型") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('iot:product-thing-model:delete')") - public CommonResult deleteProductThingModel(@RequestParam("id") Long id) { - thinkModelFunctionService.deleteProductThingModel(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得产品物模型") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('iot:product-thing-model:query')") - public CommonResult getProductThingModel(@RequestParam("id") Long id) { - IotProductThingModelDO function = thinkModelFunctionService.getProductThingModel(id); - return success(IotProductThingModelConvert.INSTANCE.convert(function)); - } - - @GetMapping("/list-by-product-id") - @Operation(summary = "获得产品物模型") - @Parameter(name = "productId", description = "产品ID", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('iot:product-thing-model:query')") - public CommonResult> getProductThingModelListByProductId(@RequestParam("productId") Long productId) { - List list = thinkModelFunctionService.getProductThingModelListByProductId(productId); - return success(IotProductThingModelConvert.INSTANCE.convertList(list)); - } - - @GetMapping("/page") - @Operation(summary = "获得产品物模型分页") - @PreAuthorize("@ss.hasPermission('iot:product-thing-model:query')") - public CommonResult> getProductThingModelPage(@Valid IotProductThingModelPageReqVO pageReqVO) { - PageResult pageResult = thinkModelFunctionService.getProductThingModelPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, IotProductThingModelRespVO.class)); - } - -} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArgument.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArgument.java deleted file mode 100644 index 289bb60108..0000000000 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArgument.java +++ /dev/null @@ -1,18 +0,0 @@ -// TODO @puhui999:productthingmodel 是不是不要这层包了 -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; - -import lombok.Data; - -@Data -public class ThingModelArgument { - - private String identifier; - private String name; - private ThingModelDataSpecs dataType; - /** - * 用于区分输入或输出参数,"input" 或 "output" - */ - private String direction; - private String description; - -} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.http b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/IotProductThingModelController.http similarity index 82% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.http rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/IotProductThingModelController.http index 7742705ef1..2343eed38c 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.http +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/IotProductThingModelController.http @@ -1,5 +1,5 @@ -### 请求 /iot/product-thing-model/create 接口 => 成功 -POST {{baseUrl}}/iot/product-thing-model/create +### 请求 /iot/product-think-model/create 接口 => 成功 +POST {{baseUrl}}/iot/product-think-model/create Content-Type: application/json tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} @@ -30,8 +30,8 @@ Authorization: Bearer {{token}} } } -### 请求 /iot/product-thing-model/create 接口 => 成功 -POST {{baseUrl}}/iot/product-thing-model/create +### 请求 /iot/product-think-model/create 接口 => 成功 +POST {{baseUrl}}/iot/product-think-model/create Content-Type: application/json tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} @@ -65,8 +65,8 @@ Authorization: Bearer {{token}} } } -### 请求 /iot/product-thing-model/create 接口 => 成功 -POST {{baseUrl}}/iot/product-thing-model/create +### 请求 /iot/product-think-model/create 接口 => 成功 +POST {{baseUrl}}/iot/product-think-model/create Content-Type: application/json tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} @@ -134,8 +134,8 @@ Authorization: Bearer {{token}} } } -### 请求 /iot/product-thing-model/update 接口 => 成功 -PUT {{baseUrl}}/iot/product-thing-model/update +### 请求 /iot/product-think-model/update 接口 => 成功 +PUT {{baseUrl}}/iot/product-think-model/update Content-Type: application/json tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} @@ -170,18 +170,18 @@ Authorization: Bearer {{token}} } } -### 请求 /iot/product-thing-model/delete 接口 => 成功 -DELETE {{baseUrl}}/iot/product-thing-model/delete?id=36 +### 请求 /iot/product-think-model/delete 接口 => 成功 +DELETE {{baseUrl}}/iot/product-think-model/delete?id=36 tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} -### 请求 /iot/product-thing-model/get 接口 => 成功 -GET {{baseUrl}}/iot/product-thing-model/get?id=40 +### 请求 /iot/product-think-model/get 接口 => 成功 +GET {{baseUrl}}/iot/product-think-model/get?id=40 tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} -### 请求 /iot/product-thing-model/list-by-product-id 接口 => 成功 -GET {{baseUrl}}/iot/product-thing-model/list-by-product-id?productId=1001 +### 请求 /iot/product-think-model/list-by-product-id 接口 => 成功 +GET {{baseUrl}}/iot/product-think-model/list-by-product-id?productId=1001 tenant-id: {{adminTenentId}} Authorization: Bearer {{token}} \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/IotProductThinkModelController.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/IotProductThinkModelController.java new file mode 100644 index 0000000000..03408b59db --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/IotProductThinkModelController.java @@ -0,0 +1,84 @@ +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelPageReqVO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelRespVO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelSaveReqVO; +import cn.iocoder.yudao.module.iot.convert.thinkmodel.IotProductThinkModelConvert; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; +import cn.iocoder.yudao.module.iot.service.thinkmodel.IotProductThinkModelService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - IoT 产品物模型") +@RestController +@RequestMapping("/iot/product-think-model") +@Validated +public class IotProductThinkModelController { + + @Resource + private IotProductThinkModelService thinkModelFunctionService; + + @PostMapping("/create") + @Operation(summary = "创建产品物模型") + @PreAuthorize("@ss.hasPermission('iot:product-think-model:create')") + public CommonResult createProductThinkModel(@Valid @RequestBody IotProductThinkModelSaveReqVO createReqVO) { + return success(thinkModelFunctionService.createProductThinkModel(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新产品物模型") + @PreAuthorize("@ss.hasPermission('iot:product-think-model:update')") + public CommonResult updateProductThinkModel(@Valid @RequestBody IotProductThinkModelSaveReqVO updateReqVO) { + thinkModelFunctionService.updateProductThinkModel(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除产品物模型") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('iot:product-think-model:delete')") + public CommonResult deleteProductThinkModel(@RequestParam("id") Long id) { + thinkModelFunctionService.deleteProductThinkModel(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得产品物模型") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('iot:product-think-model:query')") + public CommonResult getProductThinkModel(@RequestParam("id") Long id) { + IotProductThinkModelDO function = thinkModelFunctionService.getProductThinkModel(id); + return success(IotProductThinkModelConvert.INSTANCE.convert(function)); + } + + @GetMapping("/list-by-product-id") + @Operation(summary = "获得产品物模型") + @Parameter(name = "productId", description = "产品ID", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('iot:product-think-model:query')") + public CommonResult> getProductThinkModelListByProductId(@RequestParam("productId") Long productId) { + List list = thinkModelFunctionService.getProductThinkModelListByProductId(productId); + return success(IotProductThinkModelConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得产品物模型分页") + @PreAuthorize("@ss.hasPermission('iot:product-think-model:query')") + public CommonResult> getProductThinkModelPage(@Valid IotProductThinkModelPageReqVO pageReqVO) { + PageResult pageResult = thinkModelFunctionService.getProductThinkModelPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, IotProductThinkModelRespVO.class)); + } + +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelEvent.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelEvent.java similarity index 58% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelEvent.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelEvent.java index 11563dfa86..7d16aa50ba 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelEvent.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelEvent.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelArgument; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType.ThinkModelArgument; import lombok.Data; import java.util.List; @Data -public class ThingModelEvent { +public class ThinkModelEvent { /** * 事件标识符 @@ -26,7 +26,7 @@ public class ThingModelEvent { * "info"、"alert"、"error" */ private String type; - private List outputData; + private List outputData; private String method; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelProperty.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelProperty.java similarity index 68% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelProperty.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelProperty.java index b07d00c946..a4d2e98921 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelProperty.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelProperty.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelDataSpecs; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelAccessModeEnum; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType.ThinkModelDataSpecs; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelAccessModeEnum; import lombok.Data; import java.util.List; @@ -14,7 +14,7 @@ import java.util.List; * @author HUIHUI */ @Data -public class ThingModelProperty { +public class ThinkModelProperty { /** * 属性标识符 @@ -30,7 +30,7 @@ public class ThingModelProperty { private String description; /** * 云端可以对该属性进行的操作类型 - * 关联枚举 {@link IotProductThingModelAccessModeEnum} + * 关联枚举 {@link IotProductThinkModelAccessModeEnum} */ private String accessMode; /** @@ -47,10 +47,10 @@ public class ThingModelProperty { /** * 数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中 */ - private ThingModelDataSpecs dataSpecs; + private ThinkModelDataSpecs dataSpecs; /** * 数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中 */ - private List dataSpecsList; + private List dataSpecsList; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelRespVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelRespVO.java similarity index 66% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelRespVO.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelRespVO.java index eeb0937bfb..7eb06ce394 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelRespVO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model; import lombok.*; @@ -9,7 +9,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @ToString -public class ThingModelRespVO { +public class ThinkModelRespVO { /** * 产品编号 @@ -35,16 +35,16 @@ public class ThingModelRespVO { /** * 属性列表 */ - private List properties; + private List properties; /** * 服务列表 */ - private List services; + private List services; /** * 事件列表 */ - private List events; + private List events; } } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelService.java similarity index 53% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelService.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelService.java index dfcc8a64b6..851df36564 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/ThingModelService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/ThinkModelService.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelArgument; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType.ThinkModelArgument; import lombok.Data; import java.util.List; @Data -public class ThingModelService { +public class ThinkModelService { /** * 服务标识符 @@ -26,8 +26,8 @@ public class ThingModelService { * "sync"、"async" */ private String callType; - private List inputData; - private List outputData; + private List inputData; + private List outputData; private String method; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelArgument.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelArgument.java new file mode 100644 index 0000000000..9192fc28d9 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelArgument.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; + +import lombok.Data; + +@Data +public class ThinkModelArgument { + + private String identifier; + private String name; + private ThinkModelDataSpecs dataType; + /** + * 用于区分输入或输出参数,"input" 或 "output" + */ + private String direction; + private String description; + +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArrayDataSpecs.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelArrayDataSpecs.java similarity index 79% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArrayDataSpecs.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelArrayDataSpecs.java index 3be26e296b..5f3e2e8b47 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArrayDataSpecs.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelArrayDataSpecs.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @@ -14,7 +14,7 @@ import java.util.List; @Data @EqualsAndHashCode(callSuper = true) @JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 -public class ThingModelArrayDataSpecs extends ThingModelDataSpecs { +public class ThinkModelArrayDataSpecs extends ThinkModelDataSpecs { /** * 数组中的元素个数。 @@ -28,7 +28,7 @@ public class ThingModelArrayDataSpecs extends ThingModelDataSpecs { * 数据类型(childDataType)为列表型 struct 的数据规范存储在 dataSpecsList 中。 * 此时 struct 取值范围为:int、float、double、text、date、enum、bool */ - private List dataSpecsList; + private List dataSpecsList; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelBoolOrEnumDataSpecs.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelBoolOrEnumDataSpecs.java similarity index 82% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelBoolOrEnumDataSpecs.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelBoolOrEnumDataSpecs.java index e2ab9bdbb7..8a44b584cd 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelBoolOrEnumDataSpecs.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelBoolOrEnumDataSpecs.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) @JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 -public class ThingModelBoolOrEnumDataSpecs extends ThingModelDataSpecs { +public class ThinkModelBoolOrEnumDataSpecs extends ThinkModelDataSpecs { /** * 枚举项的名称。 diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDataSpecs.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelDataSpecs.java similarity index 50% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDataSpecs.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelDataSpecs.java index 32090f64bf..2d01747651 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDataSpecs.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelDataSpecs.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import lombok.Data; /** - * 抽象类 ThingModelDataSpecs + * 抽象类 ThinkModelDataSpecs * * 用于表示物模型数据的通用类型,根据具体的 "dataType" 字段动态映射到对应的子类。 * 提供多态支持,适用于不同类型的数据结构序列化和反序列化场景。 @@ -15,17 +15,17 @@ import lombok.Data; @Data @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "dataType", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = ThingModelNumericDataSpec.class, name = "int"), - @JsonSubTypes.Type(value = ThingModelNumericDataSpec.class, name = "float"), - @JsonSubTypes.Type(value = ThingModelNumericDataSpec.class, name = "double"), - @JsonSubTypes.Type(value = ThingModelDateOrTextDataSpecs.class, name = "text"), - @JsonSubTypes.Type(value = ThingModelDateOrTextDataSpecs.class, name = "date"), - @JsonSubTypes.Type(value = ThingModelBoolOrEnumDataSpecs.class, name = "bool"), - @JsonSubTypes.Type(value = ThingModelBoolOrEnumDataSpecs.class, name = "enum"), - @JsonSubTypes.Type(value = ThingModelArrayDataSpecs.class, name = "array"), - @JsonSubTypes.Type(value = ThingModelStructDataSpecs.class, name = "struct") + @JsonSubTypes.Type(value = ThinkModelNumericDataSpec.class, name = "int"), + @JsonSubTypes.Type(value = ThinkModelNumericDataSpec.class, name = "float"), + @JsonSubTypes.Type(value = ThinkModelNumericDataSpec.class, name = "double"), + @JsonSubTypes.Type(value = ThinkModelDateOrTextDataSpecs.class, name = "text"), + @JsonSubTypes.Type(value = ThinkModelDateOrTextDataSpecs.class, name = "date"), + @JsonSubTypes.Type(value = ThinkModelBoolOrEnumDataSpecs.class, name = "bool"), + @JsonSubTypes.Type(value = ThinkModelBoolOrEnumDataSpecs.class, name = "enum"), + @JsonSubTypes.Type(value = ThinkModelArrayDataSpecs.class, name = "array"), + @JsonSubTypes.Type(value = ThinkModelStructDataSpecs.class, name = "struct") }) -public abstract class ThingModelDataSpecs { +public abstract class ThinkModelDataSpecs { /** * 数据类型 diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDateOrTextDataSpecs.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelDateOrTextDataSpecs.java similarity index 81% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDateOrTextDataSpecs.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelDateOrTextDataSpecs.java index 4ce7d2dee9..640316b47c 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDateOrTextDataSpecs.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelDateOrTextDataSpecs.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) @JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 -public class ThingModelDateOrTextDataSpecs extends ThingModelDataSpecs { +public class ThinkModelDateOrTextDataSpecs extends ThinkModelDataSpecs { /** * 数据长度,单位为字节。取值不能超过 2048。 diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelNumericDataSpec.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelNumericDataSpec.java similarity index 89% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelNumericDataSpec.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelNumericDataSpec.java index 391cbf90aa..714b57bd6a 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelNumericDataSpec.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelNumericDataSpec.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) @JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 -public class ThingModelNumericDataSpec extends ThingModelDataSpecs { +public class ThinkModelNumericDataSpec extends ThinkModelDataSpecs { /** * 最大值,需转为字符串类型。值必须与 dataType 类型一致。 diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelStructDataSpecs.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelStructDataSpecs.java similarity index 74% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelStructDataSpecs.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelStructDataSpecs.java index 04c38ed286..8cbb9afe5b 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelStructDataSpecs.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/model/dataType/ThinkModelStructDataSpecs.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelAccessModeEnum; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelAccessModeEnum; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; import lombok.EqualsAndHashCode; @@ -15,7 +15,7 @@ import java.util.List; @Data @EqualsAndHashCode(callSuper = true) @JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 -public class ThingModelStructDataSpecs extends ThingModelDataSpecs { +public class ThinkModelStructDataSpecs extends ThinkModelDataSpecs { /** * 属性标识符 @@ -31,7 +31,7 @@ public class ThingModelStructDataSpecs extends ThingModelDataSpecs { private String description; /** * 云端可以对该属性进行的操作类型 - * 关联枚举 {@link IotProductThingModelAccessModeEnum} + * 关联枚举 {@link IotProductThinkModelAccessModeEnum} */ private String accessMode; /** @@ -48,11 +48,11 @@ public class ThingModelStructDataSpecs extends ThingModelDataSpecs { /** * 数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中 */ - private ThingModelDataSpecs dataSpecs; + private ThinkModelDataSpecs dataSpecs; /** * 数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中 */ - private List dataSpecsList; + private List dataSpecsList; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelPageReqVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelPageReqVO.java similarity index 75% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelPageReqVO.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelPageReqVO.java index 31c5ba1d99..afb412228f 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelPageReqVO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelPageReqVO.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.Data; @@ -13,7 +13,7 @@ import lombok.ToString; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class IotProductThingModelPageReqVO extends PageParam { +public class IotProductThinkModelPageReqVO extends PageParam { @Schema(description = "功能标识") private String identifier; @@ -22,7 +22,7 @@ public class IotProductThingModelPageReqVO extends PageParam { private String name; @Schema(description = "功能类型", example = "1") - @InEnum(IotProductThingModelTypeEnum.class) + @InEnum(IotProductThinkModelTypeEnum.class) private Integer type; @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelRespVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelRespVO.java similarity index 75% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelRespVO.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelRespVO.java index 83c51fb592..a79cd26779 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelRespVO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelRespVO.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelEvent; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelService; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelEvent; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelService; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; @@ -13,7 +13,7 @@ import java.time.LocalDateTime; @Schema(description = "管理后台 - IoT 产品物模型 Response VO") @Data @ExcelIgnoreUnannotated -public class IotProductThingModelRespVO { +public class IotProductThinkModelRespVO { @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21816") @ExcelProperty("产品ID") @@ -39,13 +39,13 @@ public class IotProductThingModelRespVO { private Integer type; @Schema(description = "属性", requiredMode = Schema.RequiredMode.REQUIRED) - private ThingModelProperty property; + private ThinkModelProperty property; @Schema(description = "服务", requiredMode = Schema.RequiredMode.REQUIRED) - private ThingModelEvent event; + private ThinkModelEvent event; @Schema(description = "事件", requiredMode = Schema.RequiredMode.REQUIRED) - private ThingModelService service; + private ThinkModelService service; @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelSaveReqVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelSaveReqVO.java similarity index 70% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelSaveReqVO.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelSaveReqVO.java index e230c39186..3cce60427d 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelSaveReqVO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodel/vo/IotProductThinkModelSaveReqVO.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo; +package cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo; import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelEvent; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelService; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelEvent; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelService; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; @@ -12,7 +12,7 @@ import lombok.Data; @Schema(description = "管理后台 - IoT 产品物模型新增/修改 Request VO") @Data -public class IotProductThingModelSaveReqVO { +public class IotProductThinkModelSaveReqVO { @Schema(description = "编号", example = "1") private Long id; @@ -38,16 +38,16 @@ public class IotProductThingModelSaveReqVO { @Schema(description = "功能类型", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "功能类型不能为空") - @InEnum(IotProductThingModelTypeEnum.class) + @InEnum(IotProductThinkModelTypeEnum.class) private Integer type; @Schema(description = "属性", requiredMode = Schema.RequiredMode.REQUIRED) - private ThingModelProperty property; + private ThinkModelProperty property; @Schema(description = "服务", requiredMode = Schema.RequiredMode.REQUIRED) - private ThingModelService service; + private ThinkModelService service; @Schema(description = "事件", requiredMode = Schema.RequiredMode.REQUIRED) - private ThingModelEvent event; + private ThinkModelEvent event; } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/device/IotDeviceDataConvert.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/device/IotDeviceDataConvert.java index d8f6e47042..22d5dda6dc 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/device/IotDeviceDataConvert.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/device/IotDeviceDataConvert.java @@ -12,7 +12,7 @@ public interface IotDeviceDataConvert { // default List convert(Map deviceData, IotDeviceDO device){ // List list = new ArrayList<>(); // deviceData.forEach((identifier, value) -> { -//// ThingModelProperty property = ThingModelService.INSTANCE.getProperty(device.getProductId(), identifier); +//// ThinkModelProperty property = ThinkModelService.INSTANCE.getProperty(device.getProductId(), identifier); //// if (Objects.isNull(property)) { //// return; //// } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/productthingmodel/IotProductThingModelConvert.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/productthingmodel/IotProductThingModelConvert.java deleted file mode 100644 index 1d57982d56..0000000000 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/productthingmodel/IotProductThingModelConvert.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.iocoder.yudao.module.iot.convert.productthingmodel; - -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelEvent; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelService; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelRespVO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Named; -import org.mapstruct.factory.Mappers; - -import java.util.List; -import java.util.Objects; - -@Mapper -public interface IotProductThingModelConvert { - - IotProductThingModelConvert INSTANCE = Mappers.getMapper(IotProductThingModelConvert.class); - - // 将 SaveReqVO 转换为 DO - @Mapping(target = "property", expression = "java(convertToProperty(bean))") - @Mapping(target = "event", expression = "java(convertToEvent(bean))") - @Mapping(target = "service", expression = "java(convertToService(bean))") - IotProductThingModelDO convert(IotProductThingModelSaveReqVO bean); - - // 将 DO 转换为 RespVO - @Mapping(target = "property", source = "property") - @Mapping(target = "event", source = "event") - @Mapping(target = "service", source = "service") - IotProductThingModelRespVO convert(IotProductThingModelDO bean); - - // 批量转换 - List convertList(List list); - - @Named("convertToProperty") - default ThingModelProperty convertToProperty(IotProductThingModelSaveReqVO bean) { - if (Objects.equals(bean.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { - return bean.getProperty(); - } - return null; - } - - @Named("convertToEvent") - default ThingModelEvent convertToEvent(IotProductThingModelSaveReqVO bean) { - if (Objects.equals(bean.getType(), IotProductThingModelTypeEnum.EVENT.getType())) { - return bean.getEvent(); - } - return null; - } - - @Named("convertToService") - default ThingModelService convertToService(IotProductThingModelSaveReqVO bean) { - if (Objects.equals(bean.getType(), IotProductThingModelTypeEnum.SERVICE.getType())) { - return bean.getService(); - } - return null; - } - -} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/thinkmodel/IotProductThinkModelConvert.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/thinkmodel/IotProductThinkModelConvert.java new file mode 100644 index 0000000000..bb5c22b356 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/thinkmodel/IotProductThinkModelConvert.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.iot.convert.thinkmodel; + +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelEvent; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelService; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelRespVO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelSaveReqVO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Named; +import org.mapstruct.factory.Mappers; + +import java.util.List; +import java.util.Objects; + +@Mapper +public interface IotProductThinkModelConvert { + + IotProductThinkModelConvert INSTANCE = Mappers.getMapper(IotProductThinkModelConvert.class); + + // 将 SaveReqVO 转换为 DO + @Mapping(target = "property", expression = "java(convertToProperty(bean))") + @Mapping(target = "event", expression = "java(convertToEvent(bean))") + @Mapping(target = "service", expression = "java(convertToService(bean))") + IotProductThinkModelDO convert(IotProductThinkModelSaveReqVO bean); + + // 将 DO 转换为 RespVO + @Mapping(target = "property", source = "property") + @Mapping(target = "event", source = "event") + @Mapping(target = "service", source = "service") + IotProductThinkModelRespVO convert(IotProductThinkModelDO bean); + + // 批量转换 + List convertList(List list); + + @Named("convertToProperty") + default ThinkModelProperty convertToProperty(IotProductThinkModelSaveReqVO bean) { + if (Objects.equals(bean.getType(), IotProductThinkModelTypeEnum.PROPERTY.getType())) { + return bean.getProperty(); + } + return null; + } + + @Named("convertToEvent") + default ThinkModelEvent convertToEvent(IotProductThinkModelSaveReqVO bean) { + if (Objects.equals(bean.getType(), IotProductThinkModelTypeEnum.EVENT.getType())) { + return bean.getEvent(); + } + return null; + } + + @Named("convertToService") + default ThinkModelService convertToService(IotProductThinkModelSaveReqVO bean) { + if (Objects.equals(bean.getType(), IotProductThinkModelTypeEnum.SERVICE.getType())) { + return bean.getService(); + } + return null; + } + +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDataDO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDataDO.java index 73e7ee34d8..8ff9b13527 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDataDO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDataDO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.iot.dal.dataobject.device; import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -30,7 +30,7 @@ public class IotDeviceDataDO { /** * 物模型编号 *

- * 关联 {@link IotProductThingModelDO#getId()} + * 关联 {@link IotProductThinkModelDO#getId()} */ private Long thinkModelFunctionId; @@ -51,21 +51,21 @@ public class IotDeviceDataDO { /** * 属性标识符 *

- * 关联 {@link IotProductThingModelDO#getIdentifier()} + * 关联 {@link IotProductThinkModelDO#getIdentifier()} */ private String identifier; /** * 属性名称 *

- * 关联 {@link IotProductThingModelDO#getName()} + * 关联 {@link IotProductThinkModelDO#getName()} */ private String name; /** * 数据类型 *

- * 关联 {@link IotProductThingModelDO#getProperty()#getDataType()} + * 关联 {@link IotProductThinkModelDO#getProperty()#getDataType()} */ private String dataType; diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/FieldParser.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/FieldParser.java index 6dfe54c073..065d9bfedf 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/FieldParser.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/FieldParser.java @@ -1,8 +1,7 @@ package cn.iocoder.yudao.module.iot.dal.dataobject.tdengine; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelRespVO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelDataSpecs; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelRespVO; import java.util.HashMap; import java.util.List; @@ -34,10 +33,10 @@ public class FieldParser { * @param property 物模型属性 * @return TdField对象 */ - public static TdFieldDO parse(ThingModelProperty property) { + public static TdFieldDO parse(ThinkModelProperty property) { String fieldName = property.getIdentifier().toLowerCase(); //// TODO @puhui999: 需要重构 - //ThingModelDataSpecs type = property.getDataType(); + //ThinkModelDataSpecs type = property.getDataType(); // //// 将物模型字段类型映射为td字段类型 //String fType = TYPE_MAPPING.get(type.getDataType().toUpperCase()); @@ -57,7 +56,7 @@ public class FieldParser { * @param thingModel 物模型响应对象 * @return 字段列表 */ - public static List parse(ThingModelRespVO thingModel) { + public static List parse(ThinkModelRespVO thingModel) { return thingModel.getModel().getProperties().stream() .map(FieldParser::parse) .collect(Collectors.toList()); diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/ThingModelMessage.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/ThinkModelMessage.java similarity index 97% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/ThingModelMessage.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/ThinkModelMessage.java index d5009dc244..22cf9e2ef6 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/ThingModelMessage.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/tdengine/ThinkModelMessage.java @@ -15,7 +15,7 @@ import java.util.Map; @NoArgsConstructor @AllArgsConstructor @Builder -public class ThingModelMessage { +public class ThinkModelMessage { /** * 消息ID diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/productthingmodel/IotProductThingModelDO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thinkmodel/IotProductThinkModelDO.java similarity index 66% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/productthingmodel/IotProductThingModelDO.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thinkmodel/IotProductThinkModelDO.java index 1cececc0cc..76b2a63e73 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/productthingmodel/IotProductThingModelDO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thinkmodel/IotProductThinkModelDO.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel; +package cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelEvent; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelService; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelEvent; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelService; import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -19,17 +19,17 @@ import lombok.NoArgsConstructor; /** * IoT 产品物模型功能 DO *

- * 每个 {@link IotProductDO} 和 {@link IotProductThingModelDO} 是“一对多”的关系,它的每个属性、事件、服务都对应一条记录 + * 每个 {@link IotProductDO} 和 {@link IotProductThinkModelDO} 是“一对多”的关系,它的每个属性、事件、服务都对应一条记录 * * @author 芋道源码 */ -@TableName(value = "iot_product_thing_model", autoResultMap = true) -@KeySequence("iot_product_thing_model_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@TableName(value = "iot_product_think_model", autoResultMap = true) +@KeySequence("iot_product_think_model_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @Data @Builder @NoArgsConstructor @AllArgsConstructor -public class IotProductThingModelDO extends BaseDO { +public class IotProductThinkModelDO extends BaseDO { /** * 物模型功能编号 @@ -66,7 +66,7 @@ public class IotProductThingModelDO extends BaseDO { /** * 功能类型 *

- * 枚举 {@link IotProductThingModelTypeEnum} + * 枚举 {@link IotProductThinkModelTypeEnum} */ private Integer type; @@ -74,18 +74,18 @@ public class IotProductThingModelDO extends BaseDO { * 属性 */ @TableField(typeHandler = JacksonTypeHandler.class) - private ThingModelProperty property; + private ThinkModelProperty property; /** * 事件 */ @TableField(typeHandler = JacksonTypeHandler.class) - private ThingModelEvent event; + private ThinkModelEvent event; /** * 服务 */ @TableField(typeHandler = JacksonTypeHandler.class) - private ThingModelService service; + private ThinkModelService service; } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodel/IotProductThinkModelMapper.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodel/IotProductThinkModelMapper.java new file mode 100644 index 0000000000..de76aa6336 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodel/IotProductThinkModelMapper.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.iot.dal.mysql.thinkmodel; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelPageReqVO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * IoT 产品物模型 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface IotProductThinkModelMapper extends BaseMapperX { + + default PageResult selectPage(IotProductThinkModelPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(IotProductThinkModelDO::getIdentifier, reqVO.getIdentifier()) + .likeIfPresent(IotProductThinkModelDO::getName, reqVO.getName()) + .eqIfPresent(IotProductThinkModelDO::getType, reqVO.getType()) + .eqIfPresent(IotProductThinkModelDO::getProductId, reqVO.getProductId()) + .notIn(IotProductThinkModelDO::getIdentifier, "get", "set", "post") + .orderByDesc(IotProductThinkModelDO::getId)); + } + + default IotProductThinkModelDO selectByProductIdAndIdentifier(Long productId, String identifier) { + return selectOne(IotProductThinkModelDO::getProductId, productId, + IotProductThinkModelDO::getIdentifier, identifier); + } + + default List selectListByProductId(Long productId) { + return selectList(IotProductThinkModelDO::getProductId, productId); + } + + default List selectListByProductIdAndType(Long productId, Integer type) { + return selectList(IotProductThinkModelDO::getProductId, productId, + IotProductThinkModelDO::getType, type); + } + + default List selectListByProductIdAndIdentifiersAndTypes(Long productId, + List identifiers, + List types) { + return selectList(new LambdaQueryWrapperX() + .eq(IotProductThinkModelDO::getProductId, productId) + .in(IotProductThinkModelDO::getIdentifier, identifiers) + .in(IotProductThinkModelDO::getType, types)); + } + + default IotProductThinkModelDO selectByProductIdAndName(Long productId, String name) { + return selectOne(IotProductThinkModelDO::getProductId, productId, + IotProductThinkModelDO::getName, name); + } + + default List selectListByProductKey(String productKey) { + return selectList(IotProductThinkModelDO::getProductKey, productKey); + } + +} \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodelfunction/IotProductThingModelMapper.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodelfunction/IotProductThingModelMapper.java deleted file mode 100644 index 6ec0d48463..0000000000 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodelfunction/IotProductThingModelMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.iocoder.yudao.module.iot.dal.mysql.thinkmodelfunction; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * IoT 产品物模型 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface IotProductThingModelMapper extends BaseMapperX { - - default PageResult selectPage(IotProductThingModelPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(IotProductThingModelDO::getIdentifier, reqVO.getIdentifier()) - .likeIfPresent(IotProductThingModelDO::getName, reqVO.getName()) - .eqIfPresent(IotProductThingModelDO::getType, reqVO.getType()) - .eqIfPresent(IotProductThingModelDO::getProductId, reqVO.getProductId()) - .notIn(IotProductThingModelDO::getIdentifier, "get", "set", "post") - .orderByDesc(IotProductThingModelDO::getId)); - } - - default IotProductThingModelDO selectByProductIdAndIdentifier(Long productId, String identifier) { - return selectOne(IotProductThingModelDO::getProductId, productId, - IotProductThingModelDO::getIdentifier, identifier); - } - - default List selectListByProductId(Long productId) { - return selectList(IotProductThingModelDO::getProductId, productId); - } - - default List selectListByProductIdAndType(Long productId, Integer type) { - return selectList(IotProductThingModelDO::getProductId, productId, - IotProductThingModelDO::getType, type); - } - - default List selectListByProductIdAndIdentifiersAndTypes(Long productId, - List identifiers, - List types) { - return selectList(new LambdaQueryWrapperX() - .eq(IotProductThingModelDO::getProductId, productId) - .in(IotProductThingModelDO::getIdentifier, identifiers) - .in(IotProductThingModelDO::getType, types)); - } - - default IotProductThingModelDO selectByProductIdAndName(Long productId, String name) { - return selectOne(IotProductThingModelDO::getProductId, productId, - IotProductThingModelDO::getName, name); - } - - default List selectListByProductKey(String productKey) { - return selectList(IotProductThingModelDO::getProductKey, productKey); - } - -} \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceDataServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceDataServiceImpl.java index 6dbcf0ab7c..ed2e32f2d6 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceDataServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceDataServiceImpl.java @@ -7,15 +7,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataPageReqVO; import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDataDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.SelectVisualDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.ThingModelMessage; +import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.ThinkModelMessage; import cn.iocoder.yudao.module.iot.dal.redis.deviceData.DeviceDataRedisDAO; import cn.iocoder.yudao.module.iot.dal.tdengine.TdEngineDMLMapper; import cn.iocoder.yudao.module.iot.enums.IotConstants; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; -import cn.iocoder.yudao.module.iot.service.tdengine.IotThingModelMessageService; -import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; +import cn.iocoder.yudao.module.iot.service.tdengine.IotThinkModelMessageService; +import cn.iocoder.yudao.module.iot.service.thinkmodel.IotProductThinkModelService; import jakarta.annotation.Resource; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; @@ -38,9 +38,9 @@ public class IotDeviceDataServiceImpl implements IotDeviceDataService { @Resource private IotDeviceService deviceService; @Resource - private IotThingModelMessageService thingModelMessageService; + private IotThinkModelMessageService thingModelMessageService; @Resource - private IotProductThingModelService thinkModelFunctionService; + private IotProductThinkModelService thinkModelFunctionService; @Resource private TdEngineDMLMapper tdEngineDMLMapper; @@ -54,7 +54,7 @@ public class IotDeviceDataServiceImpl implements IotDeviceDataService { // 2. 解析消息,保存数据 JSONObject jsonObject = new JSONObject(message); log.info("[saveDeviceData][productKey({}) deviceName({}) data({})]", productKey, deviceName, jsonObject); - ThingModelMessage thingModelMessage = ThingModelMessage.builder() + ThinkModelMessage thingModelMessage = ThinkModelMessage.builder() .id(jsonObject.getStr("id")) .sys(jsonObject.get("sys")) .method(jsonObject.getStr("method")) @@ -64,7 +64,7 @@ public class IotDeviceDataServiceImpl implements IotDeviceDataService { .deviceName(deviceName) .deviceKey(device.getDeviceKey()) .build(); - thingModelMessageService.saveThingModelMessage(device, thingModelMessage); + thingModelMessageService.saveThinkModelMessage(device, thingModelMessage); } @Override @@ -73,9 +73,9 @@ public class IotDeviceDataServiceImpl implements IotDeviceDataService { // 1. 获取设备信息 IotDeviceDO device = deviceService.getDevice(deviceDataReqVO.getDeviceId()); // 2. 获取设备属性最新数据 - List thinkModelFunctionList = thinkModelFunctionService.getProductThingModelListByProductKey(device.getProductKey()); + List thinkModelFunctionList = thinkModelFunctionService.getProductThinkModelListByProductKey(device.getProductKey()); thinkModelFunctionList = thinkModelFunctionList.stream() - .filter(function -> IotProductThingModelTypeEnum.PROPERTY.getType() + .filter(function -> IotProductThinkModelTypeEnum.PROPERTY.getType() .equals(function.getType())).toList(); // 3. 过滤标识符和属性名称 diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java index dabc9ad4a0..b26c2c123b 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProduc import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; import cn.iocoder.yudao.module.iot.dal.mysql.product.IotProductMapper; import cn.iocoder.yudao.module.iot.enums.product.IotProductStatusEnum; -import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; +import cn.iocoder.yudao.module.iot.service.thinkmodel.IotProductThinkModelService; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import jakarta.annotation.Resource; import org.springframework.context.annotation.Lazy; @@ -34,7 +34,7 @@ public class IotProductServiceImpl implements IotProductService { @Resource @Lazy - private IotProductThingModelService thinkModelFunctionService; + private IotProductThinkModelService thinkModelFunctionService; @Override public Long createProduct(IotProductSaveReqVO createReqVO) { diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableService.java index e66278ccd3..bf76ae1c32 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableService.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.iot.service.tdengine; import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; import java.util.List; @@ -14,5 +14,5 @@ public interface IotSuperTableService { /** * 创建超级表数据模型 */ - void createSuperTableDataModel(IotProductDO product, List functionList); + void createSuperTableDataModel(IotProductDO product, List functionList); } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableServiceImpl.java index 84e98296ee..59fa9d0f30 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotSuperTableServiceImpl.java @@ -2,15 +2,15 @@ package cn.iocoder.yudao.module.iot.service.tdengine; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelRespVO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelRespVO; import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.FieldParser; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.TdFieldDO; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.TdTableDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; import cn.iocoder.yudao.module.iot.dal.tdengine.TdEngineDDLMapper; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -33,8 +33,8 @@ public class IotSuperTableServiceImpl implements IotSuperTableService { private String url; @Override - public void createSuperTableDataModel(IotProductDO product, List functionList) { - ThingModelRespVO thingModel = buildThingModel(product, functionList); + public void createSuperTableDataModel(IotProductDO product, List functionList) { + ThinkModelRespVO thingModel = buildThinkModel(product, functionList); if (thingModel.getModel() == null || CollUtil.isEmpty(thingModel.getModel().getProperties())) { log.warn("物模型属性列表为空,不创建超级表"); @@ -56,7 +56,7 @@ public class IotSuperTableServiceImpl implements IotSuperTableService { /** * 创建超级表 */ - private void createSuperTable(ThingModelRespVO thingModel, Integer deviceType) { + private void createSuperTable(ThinkModelRespVO thingModel, Integer deviceType) { // 解析物模型,获取字段列表 List schemaFields = new ArrayList<>(); schemaFields.add(TdFieldDO.builder() @@ -84,7 +84,7 @@ public class IotSuperTableServiceImpl implements IotSuperTableService { /** * 更新超级表 */ - private void updateSuperTable(ThingModelRespVO thingModel, Integer deviceType) { + private void updateSuperTable(ThinkModelRespVO thingModel, Integer deviceType) { String superTableName = getSuperTableName(deviceType, thingModel.getProductKey()); try { List oldFields = getTableFields(superTableName); @@ -210,18 +210,18 @@ public class IotSuperTableServiceImpl implements IotSuperTableService { /** * 构建物模型 */ - private ThingModelRespVO buildThingModel(IotProductDO product, List functionList) { - ThingModelRespVO thingModel = new ThingModelRespVO(); + private ThinkModelRespVO buildThinkModel(IotProductDO product, List functionList) { + ThinkModelRespVO thingModel = new ThinkModelRespVO(); thingModel.setId(product.getId()); thingModel.setProductKey(product.getProductKey()); - List properties = functionList.stream() - .filter(function -> IotProductThingModelTypeEnum.PROPERTY.equals( - IotProductThingModelTypeEnum.valueOfType(function.getType()))) - .map(this::buildThingModelProperty) + List properties = functionList.stream() + .filter(function -> IotProductThinkModelTypeEnum.PROPERTY.equals( + IotProductThinkModelTypeEnum.valueOfType(function.getType()))) + .map(this::buildThinkModelProperty) .collect(Collectors.toList()); - ThingModelRespVO.Model model = new ThingModelRespVO.Model(); + ThinkModelRespVO.Model model = new ThinkModelRespVO.Model(); model.setProperties(properties); thingModel.setModel(model); @@ -231,8 +231,8 @@ public class IotSuperTableServiceImpl implements IotSuperTableService { /** * 构建物模型属性 */ - private ThingModelProperty buildThingModelProperty(IotProductThingModelDO function) { - ThingModelProperty property = BeanUtil.copyProperties(function, ThingModelProperty.class); + private ThinkModelProperty buildThinkModelProperty(IotProductThinkModelDO function) { + ThinkModelProperty property = BeanUtil.copyProperties(function, ThinkModelProperty.class); property.setDataType(function.getProperty().getDataType()); return property; } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThinkModelMessageService.java similarity index 65% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageService.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThinkModelMessageService.java index ffcb3063c5..67ee2b99ae 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThinkModelMessageService.java @@ -1,12 +1,12 @@ package cn.iocoder.yudao.module.iot.service.tdengine; import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.ThingModelMessage; +import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.ThinkModelMessage; /** * 物模型消息 Service */ -public interface IotThingModelMessageService { +public interface IotThinkModelMessageService { /** * 保存物模型消息 @@ -14,5 +14,5 @@ public interface IotThingModelMessageService { * @param device 设备 * @param thingModelMessage 物模型消息 */ - void saveThingModelMessage(IotDeviceDO device, ThingModelMessage thingModelMessage); + void saveThinkModelMessage(IotDeviceDO device, ThinkModelMessage thingModelMessage); } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThinkModelMessageServiceImpl.java similarity index 86% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageServiceImpl.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThinkModelMessageServiceImpl.java index fdb0ca9e42..eaaa3efebd 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThinkModelMessageServiceImpl.java @@ -10,16 +10,16 @@ import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDataDO; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.FieldParser; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.TdFieldDO; import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.TdTableDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.ThingModelMessage; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; +import cn.iocoder.yudao.module.iot.dal.dataobject.tdengine.ThinkModelMessage; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; import cn.iocoder.yudao.module.iot.dal.redis.deviceData.DeviceDataRedisDAO; import cn.iocoder.yudao.module.iot.dal.tdengine.TdEngineDDLMapper; import cn.iocoder.yudao.module.iot.dal.tdengine.TdEngineDMLMapper; import cn.iocoder.yudao.module.iot.enums.IotConstants; import cn.iocoder.yudao.module.iot.enums.device.IotDeviceStatusEnum; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; import cn.iocoder.yudao.module.iot.service.device.IotDeviceService; -import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; +import cn.iocoder.yudao.module.iot.service.thinkmodel.IotProductThinkModelService; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -33,7 +33,7 @@ import java.util.stream.Collectors; */ @Slf4j @Service -public class IotThingModelMessageServiceImpl implements IotThingModelMessageService { +public class IotThinkModelMessageServiceImpl implements IotThinkModelMessageService { private static final String TAG_NOTE = "TAG"; private static final String NOTE = "note"; @@ -47,7 +47,7 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ private String url; @Resource - private IotProductThingModelService iotProductThingModelService; + private IotProductThinkModelService iotProductThinkModelService; @Resource private IotDeviceService iotDeviceService; @Resource @@ -61,7 +61,7 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ // TODO @haohao:这个方法,可以考虑加下 1. 2. 3. 更有层次感 @Override @TenantIgnore - public void saveThingModelMessage(IotDeviceDO device, ThingModelMessage thingModelMessage) { + public void saveThinkModelMessage(IotDeviceDO device, ThinkModelMessage thingModelMessage) { // 1. 判断设备状态,如果为未激活状态,创建数据表并更新设备状态 if (IotDeviceStatusEnum.INACTIVE.getStatus().equals(device.getStatus())) { createDeviceTable(device.getDeviceType(), device.getProductKey(), device.getDeviceName(), device.getDeviceKey()); @@ -71,7 +71,7 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ // 2. 获取设备属性并进行物模型校验,过滤非物模型属性 Map params = thingModelMessage.dataToMap(); - List functionList = getValidFunctionList(thingModelMessage.getProductKey()); + List functionList = getValidFunctionList(thingModelMessage.getProductKey()); if (functionList.isEmpty()) { return; } @@ -90,21 +90,21 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ .build()); } - private List getValidFunctionList(String productKey) { - return iotProductThingModelService - .getProductThingModelListByProductKey(productKey) + private List getValidFunctionList(String productKey) { + return iotProductThinkModelService + .getProductThinkModelListByProductKey(productKey) .stream() - .filter(function -> IotProductThingModelTypeEnum.PROPERTY.getType().equals(function.getType())) + .filter(function -> IotProductThinkModelTypeEnum.PROPERTY.getType().equals(function.getType())) .toList(); } - private List filterAndCollectValidFields(Map params, List functionList, IotDeviceDO device, Long time) { + private List filterAndCollectValidFields(Map params, List functionList, IotDeviceDO device, Long time) { // 1. 获取属性标识符集合 - Set propertyIdentifiers = CollectionUtils.convertSet(functionList, IotProductThingModelDO::getIdentifier); + Set propertyIdentifiers = CollectionUtils.convertSet(functionList, IotProductThinkModelDO::getIdentifier); // 2. 构建属性标识符和属性的映射 - Map functionMap = functionList.stream() - .collect(Collectors.toMap(IotProductThingModelDO::getIdentifier, function -> function)); + Map functionMap = functionList.stream() + .collect(Collectors.toMap(IotProductThinkModelDO::getIdentifier, function -> function)); // 3. 过滤并收集有效的属性字段 List schemaFieldValues = new ArrayList<>(); @@ -124,22 +124,22 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ * 缓存设备属性 * * @param device 设备信息 - * @param iotProductThingModelDO 物模型属性 + * @param iotProductThinkModelDO 物模型属性 * @param val 属性值 * @param time 时间 */ - private void setDeviceDataCache(IotDeviceDO device, IotProductThingModelDO iotProductThingModelDO, Object val, Long time) { + private void setDeviceDataCache(IotDeviceDO device, IotProductThinkModelDO iotProductThinkModelDO, Object val, Long time) { // TODO @puhui999: 需要重构 IotDeviceDataDO deviceData = IotDeviceDataDO.builder() .productKey(device.getProductKey()) .deviceName(device.getDeviceName()) - .identifier(iotProductThingModelDO.getIdentifier()) + .identifier(iotProductThinkModelDO.getIdentifier()) .value(val != null ? val.toString() : null) .updateTime(DateUtil.toLocalDateTime(new Date(time))) .deviceId(device.getId()) - .thinkModelFunctionId(iotProductThingModelDO.getId()) - .name(iotProductThingModelDO.getName()) - //.dataType(iotProductThingModelDO.getProperty().getDataType().getDataType()) + .thinkModelFunctionId(iotProductThinkModelDO.getId()) + .name(iotProductThinkModelDO.getName()) + //.dataType(iotProductThinkModelDO.getProperty().getDataType().getDataType()) .build(); deviceDataRedisDAO.set(deviceData); } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodel/IotProductThinkModelService.java similarity index 58% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelService.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodel/IotProductThinkModelService.java index 413b6b0143..34e7fc1498 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodel/IotProductThinkModelService.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.module.iot.service.productthingmodel; +package cn.iocoder.yudao.module.iot.service.thinkmodel; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelPageReqVO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelSaveReqVO; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; import jakarta.validation.Valid; import java.util.List; @@ -13,7 +13,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface IotProductThingModelService { +public interface IotProductThinkModelService { /** * 创建产品物模型 @@ -21,21 +21,21 @@ public interface IotProductThingModelService { * @param createReqVO 创建信息 * @return 编号 */ - Long createProductThingModel(@Valid IotProductThingModelSaveReqVO createReqVO); + Long createProductThinkModel(@Valid IotProductThinkModelSaveReqVO createReqVO); /** * 更新产品物模型 * * @param updateReqVO 更新信息 */ - void updateProductThingModel(@Valid IotProductThingModelSaveReqVO updateReqVO); + void updateProductThinkModel(@Valid IotProductThinkModelSaveReqVO updateReqVO); /** * 删除产品物模型 * * @param id 编号 */ - void deleteProductThingModel(Long id); + void deleteProductThinkModel(Long id); /** * 获得产品物模型 @@ -43,7 +43,7 @@ public interface IotProductThingModelService { * @param id 编号 * @return 产品物模型 */ - IotProductThingModelDO getProductThingModel(Long id); + IotProductThinkModelDO getProductThinkModel(Long id); /** * 获得产品物模型列表 @@ -51,7 +51,7 @@ public interface IotProductThingModelService { * @param productId 产品编号 * @return 产品物模型列表 */ - List getProductThingModelListByProductId(Long productId); + List getProductThinkModelListByProductId(Long productId); /** * 获得产品物模型分页 @@ -59,7 +59,7 @@ public interface IotProductThingModelService { * @param pageReqVO 分页查询 * @return 产品物模型分页 */ - PageResult getProductThingModelPage(IotProductThingModelPageReqVO pageReqVO); + PageResult getProductThinkModelPage(IotProductThinkModelPageReqVO pageReqVO); /** * 创建超级表数据模型 @@ -74,6 +74,6 @@ public interface IotProductThingModelService { * @param productKey 产品 Key * @return 产品物模型列表 */ - List getProductThingModelListByProductKey(String productKey); + List getProductThinkModelListByProductKey(String productKey); } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodel/IotProductThinkModelServiceImpl.java similarity index 66% rename from yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelServiceImpl.java rename to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodel/IotProductThinkModelServiceImpl.java index f5efd37bcc..862d8b95c3 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodel/IotProductThinkModelServiceImpl.java @@ -1,23 +1,23 @@ -package cn.iocoder.yudao.module.iot.service.productthingmodel; +package cn.iocoder.yudao.module.iot.service.thinkmodel; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelEvent; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelService; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelArgument; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelArrayDataSpecs; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelDateOrTextDataSpecs; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; -import cn.iocoder.yudao.module.iot.convert.productthingmodel.IotProductThingModelConvert; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelEvent; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelProperty; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.ThinkModelService; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType.ThinkModelArgument; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType.ThinkModelArrayDataSpecs; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.model.dataType.ThinkModelDateOrTextDataSpecs; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelPageReqVO; +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodel.vo.IotProductThinkModelSaveReqVO; +import cn.iocoder.yudao.module.iot.convert.thinkmodel.IotProductThinkModelConvert; import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; -import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; -import cn.iocoder.yudao.module.iot.dal.mysql.thinkmodelfunction.IotProductThingModelMapper; +import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodel.IotProductThinkModelDO; +import cn.iocoder.yudao.module.iot.dal.mysql.thinkmodel.IotProductThinkModelMapper; import cn.iocoder.yudao.module.iot.enums.product.IotProductStatusEnum; -import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; +import cn.iocoder.yudao.module.iot.enums.thinkmodel.IotProductThinkModelTypeEnum; import cn.iocoder.yudao.module.iot.service.product.IotProductService; import cn.iocoder.yudao.module.iot.service.tdengine.IotSuperTableService; import jakarta.annotation.Resource; @@ -41,10 +41,10 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*; @Service @Validated @Slf4j -public class IotProductThingModelServiceImpl implements IotProductThingModelService { +public class IotProductThinkModelServiceImpl implements IotProductThinkModelService { @Resource - private IotProductThingModelMapper productThingModelMapper; + private IotProductThinkModelMapper productThinkModelMapper; @Resource private IotProductService productService; @@ -53,7 +53,7 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ @Override @Transactional(rollbackFor = Exception.class) - public Long createProductThingModel(IotProductThingModelSaveReqVO createReqVO) { + public Long createProductThinkModel(IotProductThinkModelSaveReqVO createReqVO) { // 1. 校验功能标识符在同一产品下是否唯一 validateIdentifierUnique(createReqVO.getProductId(), createReqVO.getIdentifier()); @@ -67,11 +67,11 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ validateProductStatus(createReqVO.getProductId()); // 5. 插入数据库 - IotProductThingModelDO function = IotProductThingModelConvert.INSTANCE.convert(createReqVO); - productThingModelMapper.insert(function); + IotProductThinkModelDO function = IotProductThinkModelConvert.INSTANCE.convert(createReqVO); + productThinkModelMapper.insert(function); // 6. 如果创建的是属性,需要更新默认的事件和服务 - if (Objects.equals(createReqVO.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { + if (Objects.equals(createReqVO.getType(), IotProductThinkModelTypeEnum.PROPERTY.getType())) { //createDefaultEventsAndServices(createReqVO.getProductId(), createReqVO.getProductKey()); } return function.getId(); @@ -95,14 +95,14 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ } private void validateNameUnique(Long productId, String name) { - IotProductThingModelDO function = productThingModelMapper.selectByProductIdAndName(productId, name); + IotProductThinkModelDO function = productThinkModelMapper.selectByProductIdAndName(productId, name); if (function != null) { throw exception(THINK_MODEL_FUNCTION_NAME_EXISTS); } } private void validateIdentifierUnique(Long productId, String identifier) { - IotProductThingModelDO function = productThingModelMapper.selectByProductIdAndIdentifier(productId, identifier); + IotProductThinkModelDO function = productThinkModelMapper.selectByProductIdAndIdentifier(productId, identifier); if (function != null) { throw exception(THINK_MODEL_FUNCTION_IDENTIFIER_EXISTS); } @@ -110,9 +110,9 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ @Override @Transactional(rollbackFor = Exception.class) - public void updateProductThingModel(IotProductThingModelSaveReqVO updateReqVO) { + public void updateProductThinkModel(IotProductThinkModelSaveReqVO updateReqVO) { // 1. 校验功能是否存在 - validateproductThingModelMapperExists(updateReqVO.getId()); + validateproductThinkModelMapperExists(updateReqVO.getId()); // 2. 校验功能标识符是否唯一 validateIdentifierUniqueForUpdate(updateReqVO.getId(), updateReqVO.getProductId(), updateReqVO.getIdentifier()); @@ -121,17 +121,17 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ validateProductStatus(updateReqVO.getProductId()); // 4. 更新数据库 - IotProductThingModelDO productThingModelDO = IotProductThingModelConvert.INSTANCE.convert(updateReqVO); - productThingModelMapper.updateById(productThingModelDO); + IotProductThinkModelDO productThinkModelDO = IotProductThinkModelConvert.INSTANCE.convert(updateReqVO); + productThinkModelMapper.updateById(productThinkModelDO); // 5. 如果更新的是属性,需要更新默认的事件和服务 - if (Objects.equals(updateReqVO.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { + if (Objects.equals(updateReqVO.getType(), IotProductThinkModelTypeEnum.PROPERTY.getType())) { createDefaultEventsAndServices(updateReqVO.getProductId(), updateReqVO.getProductKey()); } } private void validateIdentifierUniqueForUpdate(Long id, Long productId, String identifier) { - IotProductThingModelDO function = productThingModelMapper.selectByProductIdAndIdentifier(productId, identifier); + IotProductThinkModelDO function = productThinkModelMapper.selectByProductIdAndIdentifier(productId, identifier); if (function != null && ObjectUtil.notEqual(function.getId(), id)) { throw exception(THINK_MODEL_FUNCTION_IDENTIFIER_EXISTS); } @@ -139,9 +139,9 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ @Override @Transactional(rollbackFor = Exception.class) - public void deleteProductThingModel(Long id) { + public void deleteProductThinkModel(Long id) { // 1. 校验功能是否存在 - IotProductThingModelDO functionDO = productThingModelMapper.selectById(id); + IotProductThinkModelDO functionDO = productThinkModelMapper.selectById(id); if (functionDO == null) { throw exception(THINK_MODEL_FUNCTION_NOT_EXISTS); } @@ -150,10 +150,10 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ validateProductStatus(functionDO.getProductId()); // 2. 删除功能 - productThingModelMapper.deleteById(id); + productThinkModelMapper.deleteById(id); // 3. 如果删除的是属性,需要更新默认的事件和服务 - if (Objects.equals(functionDO.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { + if (Objects.equals(functionDO.getType(), IotProductThinkModelTypeEnum.PROPERTY.getType())) { createDefaultEventsAndServices(functionDO.getProductId(), functionDO.getProductKey()); } } @@ -163,25 +163,25 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ * * @param id 功能编号 */ - private void validateproductThingModelMapperExists(Long id) { - if (productThingModelMapper.selectById(id) == null) { + private void validateproductThinkModelMapperExists(Long id) { + if (productThinkModelMapper.selectById(id) == null) { throw exception(THINK_MODEL_FUNCTION_NOT_EXISTS); } } @Override - public IotProductThingModelDO getProductThingModel(Long id) { - return productThingModelMapper.selectById(id); + public IotProductThinkModelDO getProductThinkModel(Long id) { + return productThinkModelMapper.selectById(id); } @Override - public List getProductThingModelListByProductId(Long productId) { - return productThingModelMapper.selectListByProductId(productId); + public List getProductThinkModelListByProductId(Long productId) { + return productThinkModelMapper.selectListByProductId(productId); } @Override - public PageResult getProductThingModelPage(IotProductThingModelPageReqVO pageReqVO) { - return productThingModelMapper.selectPage(pageReqVO); + public PageResult getProductThinkModelPage(IotProductThinkModelPageReqVO pageReqVO) { + return productThinkModelMapper.selectPage(pageReqVO); } @Override @@ -190,15 +190,15 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ IotProductDO product = productService.getProduct(productId); // 2. 查询产品的物模型功能列表 - List functionList = productThingModelMapper.selectListByProductId(productId); + List functionList = productThinkModelMapper.selectListByProductId(productId); // 3. 生成 TDengine 的数据模型 dbStructureDataService.createSuperTableDataModel(product, functionList); } @Override - public List getProductThingModelListByProductKey(String productKey) { - return productThingModelMapper.selectListByProductKey(productKey); + public List getProductThinkModelListByProductKey(String productKey) { + return productThinkModelMapper.selectListByProductKey(productKey); } // TODO @puhui999: 需要重构 @@ -207,82 +207,82 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ */ public void createDefaultEventsAndServices(Long productId, String productKey) { // 1. 获取当前属性列表 - List propertyList = productThingModelMapper - .selectListByProductIdAndType(productId, IotProductThingModelTypeEnum.PROPERTY.getType()); + List propertyList = productThinkModelMapper + .selectListByProductIdAndType(productId, IotProductThinkModelTypeEnum.PROPERTY.getType()); // 2. 生成新的事件和服务列表 - List newFunctionList = new ArrayList<>(); + List newFunctionList = new ArrayList<>(); // 生成属性上报事件 - ThingModelEvent propertyPostEvent = generatePropertyPostEvent(propertyList); + ThinkModelEvent propertyPostEvent = generatePropertyPostEvent(propertyList); if (propertyPostEvent != null) { - IotProductThingModelDO eventFunction = buildEventFunctionDO(productId, productKey, propertyPostEvent); + IotProductThinkModelDO eventFunction = buildEventFunctionDO(productId, productKey, propertyPostEvent); newFunctionList.add(eventFunction); } // 生成属性设置服务 - ThingModelService propertySetService = generatePropertySetService(propertyList); + ThinkModelService propertySetService = generatePropertySetService(propertyList); if (propertySetService != null) { - IotProductThingModelDO setServiceFunction = buildServiceFunctionDO(productId, productKey, propertySetService); + IotProductThinkModelDO setServiceFunction = buildServiceFunctionDO(productId, productKey, propertySetService); newFunctionList.add(setServiceFunction); } // 生成属性获取服务 - ThingModelService propertyGetService = generatePropertyGetService(propertyList); + ThinkModelService propertyGetService = generatePropertyGetService(propertyList); if (propertyGetService != null) { - IotProductThingModelDO getServiceFunction = buildServiceFunctionDO(productId, productKey, propertyGetService); + IotProductThinkModelDO getServiceFunction = buildServiceFunctionDO(productId, productKey, propertyGetService); newFunctionList.add(getServiceFunction); } // 3. 获取数据库中的默认的旧事件和服务列表 - List oldFunctionList = productThingModelMapper.selectListByProductIdAndIdentifiersAndTypes( + List oldFunctionList = productThinkModelMapper.selectListByProductIdAndIdentifiersAndTypes( productId, Arrays.asList("post", "set", "get"), - Arrays.asList(IotProductThingModelTypeEnum.EVENT.getType(), IotProductThingModelTypeEnum.SERVICE.getType()) + Arrays.asList(IotProductThinkModelTypeEnum.EVENT.getType(), IotProductThinkModelTypeEnum.SERVICE.getType()) ); // 3.1 使用 diffList 方法比较新旧列表 - List> diffResult = diffList(oldFunctionList, newFunctionList, + List> diffResult = diffList(oldFunctionList, newFunctionList, // 继续使用 identifier 和 type 进行比较:这样可以准确地匹配对应的功能对象。 (oldFunc, newFunc) -> Objects.equals(oldFunc.getIdentifier(), newFunc.getIdentifier()) && Objects.equals(oldFunc.getType(), newFunc.getType())); - List createList = diffResult.get(0); // 需要新增的 - List updateList = diffResult.get(1); // 需要更新的 - List deleteList = diffResult.get(2); // 需要删除的 + List createList = diffResult.get(0); // 需要新增的 + List updateList = diffResult.get(1); // 需要更新的 + List deleteList = diffResult.get(2); // 需要删除的 // 3.2 批量执行数据库操作 // 新增数据库中的新事件和服务列表 if (CollUtil.isNotEmpty(createList)) { - productThingModelMapper.insertBatch(createList); + productThinkModelMapper.insertBatch(createList); } // 更新数据库中的事件和服务列表 if (CollUtil.isNotEmpty(updateList)) { // 首先,为每个需要更新的对象设置其对应的 ID updateList.forEach(updateFunc -> { - IotProductThingModelDO oldFunc = findFunctionByIdentifierAndType( + IotProductThinkModelDO oldFunc = findFunctionByIdentifierAndType( oldFunctionList, updateFunc.getIdentifier(), updateFunc.getType()); if (oldFunc != null) { updateFunc.setId(oldFunc.getId()); } }); // 过滤掉没有设置 ID 的对象 - List validUpdateList = updateList.stream() + List validUpdateList = updateList.stream() .filter(func -> func.getId() != null) .collect(Collectors.toList()); // 执行批量更新 if (CollUtil.isNotEmpty(validUpdateList)) { - productThingModelMapper.updateBatch(validUpdateList); + productThinkModelMapper.updateBatch(validUpdateList); } } // 删除数据库中的旧事件和服务列表 if (CollUtil.isNotEmpty(deleteList)) { - Set idsToDelete = CollectionUtils.convertSet(deleteList, IotProductThingModelDO::getId); - productThingModelMapper.deleteByIds(idsToDelete); + Set idsToDelete = CollectionUtils.convertSet(deleteList, IotProductThinkModelDO::getId); + productThinkModelMapper.deleteByIds(idsToDelete); } } /** * 根据标识符和类型查找功能对象 */ - private IotProductThingModelDO findFunctionByIdentifierAndType(List functionList, + private IotProductThinkModelDO findFunctionByIdentifierAndType(List functionList, String identifier, Integer type) { return CollUtil.findOne(functionList, func -> Objects.equals(func.getIdentifier(), identifier) && Objects.equals(func.getType(), type)); @@ -291,40 +291,40 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ /** * 构建事件功能对象 */ - private IotProductThingModelDO buildEventFunctionDO(Long productId, String productKey, ThingModelEvent event) { - return new IotProductThingModelDO() + private IotProductThinkModelDO buildEventFunctionDO(Long productId, String productKey, ThinkModelEvent event) { + return new IotProductThinkModelDO() .setProductId(productId) .setProductKey(productKey) .setIdentifier(event.getIdentifier()) .setName(event.getName()) .setDescription(event.getDescription()) - .setType(IotProductThingModelTypeEnum.EVENT.getType()) + .setType(IotProductThinkModelTypeEnum.EVENT.getType()) .setEvent(event); } /** * 构建服务功能对象 */ - private IotProductThingModelDO buildServiceFunctionDO(Long productId, String productKey, ThingModelService service) { - return new IotProductThingModelDO() + private IotProductThinkModelDO buildServiceFunctionDO(Long productId, String productKey, ThinkModelService service) { + return new IotProductThinkModelDO() .setProductId(productId) .setProductKey(productKey) .setIdentifier(service.getIdentifier()) .setName(service.getName()) .setDescription(service.getDescription()) - .setType(IotProductThingModelTypeEnum.SERVICE.getType()) + .setType(IotProductThinkModelTypeEnum.SERVICE.getType()) .setService(service); } /** * 生成属性上报事件 */ - private ThingModelEvent generatePropertyPostEvent(List propertyList) { + private ThinkModelEvent generatePropertyPostEvent(List propertyList) { if (CollUtil.isEmpty(propertyList)) { return null; } - ThingModelEvent event = new ThingModelEvent() + ThinkModelEvent event = new ThinkModelEvent() .setIdentifier("post") .setName("属性上报") .setType("info") @@ -332,11 +332,11 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ .setMethod("thing.event.property.post"); // 将属性列表转换为事件的输出参数 - List outputData = new ArrayList<>(); + List outputData = new ArrayList<>(); // TODO @puhui999: 需要重构 - for (IotProductThingModelDO functionDO : propertyList) { - ThingModelProperty property = functionDO.getProperty(); - ThingModelArgument arg = new ThingModelArgument() + for (IotProductThinkModelDO functionDO : propertyList) { + ThinkModelProperty property = functionDO.getProperty(); + ThinkModelArgument arg = new ThinkModelArgument() .setIdentifier(property.getIdentifier()) .setName(property.getName()) //.setDataType(property.getDataType()) @@ -351,17 +351,17 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ /** * 生成属性设置服务 */ - private ThingModelService generatePropertySetService(List propertyList) { + private ThinkModelService generatePropertySetService(List propertyList) { if (propertyList == null || propertyList.isEmpty()) { return null; } - List inputData = new ArrayList<>(); + List inputData = new ArrayList<>(); // TODO @puhui999: 需要重构 - for (IotProductThingModelDO functionDO : propertyList) { - ThingModelProperty property = functionDO.getProperty(); - //if (IotProductThingModelAccessModeEnum.WRITE.getMode().equals(property.getAccessMode()) || IotProductThingModelAccessModeEnum.READ_WRITE.getMode().equals(property.getAccessMode())) { - // ThingModelArgument arg = new ThingModelArgument() + for (IotProductThinkModelDO functionDO : propertyList) { + ThinkModelProperty property = functionDO.getProperty(); + //if (IotProductThinkModelAccessModeEnum.WRITE.getMode().equals(property.getAccessMode()) || IotProductThinkModelAccessModeEnum.READ_WRITE.getMode().equals(property.getAccessMode())) { + // ThinkModelArgument arg = new ThinkModelArgument() // .setIdentifier(property.getIdentifier()) // .setName(property.getName()) // .setDataType(property.getDataType()) @@ -376,7 +376,7 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ } // 属性设置服务一般不需要输出参数 - return new ThingModelService() + return new ThinkModelService() .setIdentifier("set") .setName("属性设置") .setCallType("async") @@ -390,17 +390,17 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ /** * 生成属性获取服务 */ - private ThingModelService generatePropertyGetService(List propertyList) { + private ThinkModelService generatePropertyGetService(List propertyList) { if (propertyList == null || propertyList.isEmpty()) { return null; } // TODO @puhui999: 需要重构 - List outputData = new ArrayList<>(); - for (IotProductThingModelDO functionDO : propertyList) { - ThingModelProperty property = functionDO.getProperty(); + List outputData = new ArrayList<>(); + for (IotProductThinkModelDO functionDO : propertyList) { + ThinkModelProperty property = functionDO.getProperty(); //if (ObjectUtils.equalsAny(property.getAccessMode(), - // IotProductThingModelAccessModeEnum.READ.getMode(), IotProductThingModelAccessModeEnum.READ_WRITE.getMode())) { - // ThingModelArgument arg = new ThingModelArgument() + // IotProductThinkModelAccessModeEnum.READ.getMode(), IotProductThinkModelAccessModeEnum.READ_WRITE.getMode())) { + // ThinkModelArgument arg = new ThinkModelArgument() // .setIdentifier(property.getIdentifier()) // .setName(property.getName()) // .setDataType(property.getDataType()) @@ -414,7 +414,7 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ return null; } - ThingModelService service = new ThingModelService() + ThinkModelService service = new ThinkModelService() .setIdentifier("get") .setName("属性获取") .setCallType("async") @@ -422,17 +422,17 @@ public class IotProductThingModelServiceImpl implements IotProductThingModelServ .setMethod("thing.service.property.get"); // 定义输入参数:属性标识符列表 - ThingModelArgument inputArg = new ThingModelArgument() + ThinkModelArgument inputArg = new ThinkModelArgument() .setIdentifier("properties") .setName("属性标识符列表") .setDescription("需要获取的属性标识符列表") .setDirection("input"); // 设置为输入参数 // 创建数组类型,元素类型为文本类型(字符串) - ThingModelArrayDataSpecs arrayType = new ThingModelArrayDataSpecs(); + ThinkModelArrayDataSpecs arrayType = new ThinkModelArrayDataSpecs(); arrayType.setDataType("array"); - //ThingModelArraySpecs arraySpecs = new ThingModelArraySpecs(); - ThingModelDateOrTextDataSpecs textType = new ThingModelDateOrTextDataSpecs(); + //ThinkModelArraySpecs arraySpecs = new ThinkModelArraySpecs(); + ThinkModelDateOrTextDataSpecs textType = new ThinkModelDateOrTextDataSpecs(); textType.setDataType("text"); //arraySpecs.setItem(textType); //arrayType.setSpecs(arraySpecs);