Commit 9e98768022f004d0a5832e6e65ab3d29c993ab8e
1 parent
f930f31f
【功能完善】IoT: 产品物模型 CRUD 接口测试
Showing
20 changed files
with
382 additions
and
231 deletions
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.http
0 → 100644
| 1 | +### 请求 /iot/product-thing-model/create 接口 => 成功 | |
| 2 | +POST {{baseUrl}}/iot/product-thing-model/create | |
| 3 | +Content-Type: application/json | |
| 4 | +tenant-id: {{adminTenentId}} | |
| 5 | +Authorization: Bearer {{token}} | |
| 6 | + | |
| 7 | +{ | |
| 8 | + "productId": 12, | |
| 9 | + "productKey": "CJVS54fObwZJ9Qe5CJVS54fObwZJ9Qe5", | |
| 10 | + "identifier": "Temperature", | |
| 11 | + "name": "温度", | |
| 12 | + "description": "当前温度值", | |
| 13 | + "type": 1, | |
| 14 | + "property": { | |
| 15 | + "identifier": "Temperature", | |
| 16 | + "name": "温度", | |
| 17 | + "accessMode": "r", | |
| 18 | + "required": true, | |
| 19 | + "dataType": "int", | |
| 20 | + "dataSpecs": { | |
| 21 | + "dataType": "int", | |
| 22 | + "max": "200", | |
| 23 | + "min": "0", | |
| 24 | + "step": "10", | |
| 25 | + "defaultValue": "30", | |
| 26 | + "unit": "%", | |
| 27 | + "unitName": "百分比" | |
| 28 | + }, | |
| 29 | + "description": "当前温度值" | |
| 30 | + } | |
| 31 | +} | |
| 32 | + | |
| 33 | +### 请求 /iot/product-thing-model/create 接口 => 成功 | |
| 34 | +POST {{baseUrl}}/iot/product-thing-model/create | |
| 35 | +Content-Type: application/json | |
| 36 | +tenant-id: {{adminTenentId}} | |
| 37 | +Authorization: Bearer {{token}} | |
| 38 | + | |
| 39 | +{ | |
| 40 | + "productId": 12, | |
| 41 | + "productKey": "CJVS54fObwZJ9Qe5CJVS54fObwZJ9Qe5", | |
| 42 | + "identifier": "switch", | |
| 43 | + "name": "开关", | |
| 44 | + "description": "温度计开关", | |
| 45 | + "type": 1, | |
| 46 | + "property": { | |
| 47 | + "identifier": "switch", | |
| 48 | + "name": "开关", | |
| 49 | + "description": "温度计开关", | |
| 50 | + "accessMode": "rw", | |
| 51 | + "required": true, | |
| 52 | + "dataType": "bool", | |
| 53 | + "dataSpecsList": [ | |
| 54 | + { | |
| 55 | + "dataType": "bool", | |
| 56 | + "name": "关", | |
| 57 | + "value": 0 | |
| 58 | + }, | |
| 59 | + { | |
| 60 | + "dataType": "bool", | |
| 61 | + "name": "开", | |
| 62 | + "value": 1 | |
| 63 | + } | |
| 64 | + ] | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 68 | +### 请求 /iot/product-thing-model/create 接口 => 成功 | |
| 69 | +POST {{baseUrl}}/iot/product-thing-model/create | |
| 70 | +Content-Type: application/json | |
| 71 | +tenant-id: {{adminTenentId}} | |
| 72 | +Authorization: Bearer {{token}} | |
| 73 | + | |
| 74 | +{ | |
| 75 | + "productId": 12, | |
| 76 | + "productKey": "CJVS54fObwZJ9Qe5CJVS54fObwZJ9Qe5", | |
| 77 | + "identifier": "argb", | |
| 78 | + "name": "温度计 argb 颜色", | |
| 79 | + "description": "温度计 argb 颜色", | |
| 80 | + "type": 1, | |
| 81 | + "property": { | |
| 82 | + "identifier": "argb", | |
| 83 | + "name": "温度计 argb 颜色", | |
| 84 | + "description": "温度计 argb 颜色", | |
| 85 | + "accessMode": "rw", | |
| 86 | + "required": true, | |
| 87 | + "dataType": "array", | |
| 88 | + "dataSpecs": { | |
| 89 | + "dataType": "array", | |
| 90 | + "size": 10, | |
| 91 | + "childDataType": "struct", | |
| 92 | + "dataSpecsList": [ | |
| 93 | + { | |
| 94 | + "identifier": "switch", | |
| 95 | + "name": "开关", | |
| 96 | + "description": "温度计开关", | |
| 97 | + "accessMode": "rw", | |
| 98 | + "required": true, | |
| 99 | + "dataType": "struct", | |
| 100 | + "childDataType": "bool", | |
| 101 | + "dataSpecsList": [ | |
| 102 | + { | |
| 103 | + "dataType": "bool", | |
| 104 | + "name": "关", | |
| 105 | + "value": 0 | |
| 106 | + }, | |
| 107 | + { | |
| 108 | + "dataType": "bool", | |
| 109 | + "name": "开", | |
| 110 | + "value": 1 | |
| 111 | + } | |
| 112 | + ] | |
| 113 | + }, | |
| 114 | + { | |
| 115 | + "identifier": "Temperature", | |
| 116 | + "name": "温度", | |
| 117 | + "accessMode": "r", | |
| 118 | + "required": true, | |
| 119 | + "dataType": "struct", | |
| 120 | + "childDataType": "int", | |
| 121 | + "dataSpecs": { | |
| 122 | + "dataType": "int", | |
| 123 | + "max": "200", | |
| 124 | + "min": "0", | |
| 125 | + "step": "10", | |
| 126 | + "defaultValue": "30", | |
| 127 | + "unit": "%", | |
| 128 | + "unitName": "百分比" | |
| 129 | + }, | |
| 130 | + "description": "当前温度值" | |
| 131 | + } | |
| 132 | + ] | |
| 133 | + } | |
| 134 | + } | |
| 135 | +} | |
| 136 | + | |
| 137 | +### 请求 /iot/product-thing-model/update 接口 => 成功 | |
| 138 | +PUT {{baseUrl}}/iot/product-thing-model/update | |
| 139 | +Content-Type: application/json | |
| 140 | +tenant-id: {{adminTenentId}} | |
| 141 | +Authorization: Bearer {{token}} | |
| 142 | + | |
| 143 | +{ | |
| 144 | + "id": 33, | |
| 145 | + "productId": 12, | |
| 146 | + "productKey": "CJVS54fObwZJ9Qe5CJVS54fObwZJ9Qe5", | |
| 147 | + "identifier": "switch", | |
| 148 | + "name": "开关", | |
| 149 | + "description": "温度计开关", | |
| 150 | + "type": 1, | |
| 151 | + "property": { | |
| 152 | + "identifier": "switch", | |
| 153 | + "name": "开关", | |
| 154 | + "description": "温度计开关", | |
| 155 | + "accessMode": "r", | |
| 156 | + "required": true, | |
| 157 | + "dataType": "bool", | |
| 158 | + "dataSpecsList": [ | |
| 159 | + { | |
| 160 | + "dataType": "bool", | |
| 161 | + "name": "关", | |
| 162 | + "value": 0 | |
| 163 | + }, | |
| 164 | + { | |
| 165 | + "dataType": "bool", | |
| 166 | + "name": "开", | |
| 167 | + "value": 1 | |
| 168 | + } | |
| 169 | + ] | |
| 170 | + } | |
| 171 | +} | |
| 172 | + | |
| 173 | +### 请求 /iot/product-thing-model/delete 接口 => 成功 | |
| 174 | +DELETE {{baseUrl}}/iot/product-thing-model/delete?id=36 | |
| 175 | +tenant-id: {{adminTenentId}} | |
| 176 | +Authorization: Bearer {{token}} | |
| 177 | + | |
| 178 | +### 请求 /iot/product-thing-model/get 接口 => 成功 | |
| 179 | +GET {{baseUrl}}/iot/product-thing-model/get?id=40 | |
| 180 | +tenant-id: {{adminTenentId}} | |
| 181 | +Authorization: Bearer {{token}} | |
| 182 | + | |
| 183 | + | |
| 184 | +### 请求 /iot/product-thing-model/list-by-product-id 接口 => 成功 | |
| 185 | +GET {{baseUrl}}/iot/product-thing-model/list-by-product-id?productId=1001 | |
| 186 | +tenant-id: {{adminTenentId}} | |
| 187 | +Authorization: Bearer {{token}} | |
| 0 | 188 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotProductThingModelController.java
| ... | ... | @@ -3,12 +3,12 @@ package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionRespVO; | |
| 8 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionSaveReqVO; | |
| 9 | -import cn.iocoder.yudao.module.iot.convert.thinkmodelfunction.IotThinkModelFunctionConvert; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelRespVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.convert.productthingmodel.IotProductThingModelConvert; | |
| 10 | 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; |
| 11 | -import cn.iocoder.yudao.module.iot.service.thinkmodelfunction.IotThinkModelFunctionService; | |
| 11 | +import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; | |
| 12 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | 13 | import io.swagger.v3.oas.annotations.Parameter; |
| 14 | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -24,61 +24,61 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 24 | 24 | |
| 25 | 25 | @Tag(name = "管理后台 - IoT 产品物模型") |
| 26 | 26 | @RestController |
| 27 | -@RequestMapping("/iot/think-model-function") | |
| 27 | +@RequestMapping("/iot/product-thing-model") | |
| 28 | 28 | @Validated |
| 29 | 29 | public class IotProductThingModelController { |
| 30 | 30 | |
| 31 | 31 | @Resource |
| 32 | - private IotThinkModelFunctionService thinkModelFunctionService; | |
| 32 | + private IotProductThingModelService thinkModelFunctionService; | |
| 33 | 33 | |
| 34 | 34 | @PostMapping("/create") |
| 35 | 35 | @Operation(summary = "创建产品物模型") |
| 36 | - @PreAuthorize("@ss.hasPermission('iot:think-model-function:create')") | |
| 37 | - public CommonResult<Long> createThinkModelFunction(@Valid @RequestBody IotThinkModelFunctionSaveReqVO createReqVO) { | |
| 38 | - return success(thinkModelFunctionService.createThinkModelFunction(createReqVO)); | |
| 36 | + @PreAuthorize("@ss.hasPermission('iot:product-thing-model:create')") | |
| 37 | + public CommonResult<Long> createProductThingModel(@Valid @RequestBody IotProductThingModelSaveReqVO createReqVO) { | |
| 38 | + return success(thinkModelFunctionService.createProductThingModel(createReqVO)); | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | @PutMapping("/update") |
| 42 | 42 | @Operation(summary = "更新产品物模型") |
| 43 | - @PreAuthorize("@ss.hasPermission('iot:think-model-function:update')") | |
| 44 | - public CommonResult<Boolean> updateThinkModelFunction(@Valid @RequestBody IotThinkModelFunctionSaveReqVO updateReqVO) { | |
| 45 | - thinkModelFunctionService.updateThinkModelFunction(updateReqVO); | |
| 43 | + @PreAuthorize("@ss.hasPermission('iot:product-thing-model:update')") | |
| 44 | + public CommonResult<Boolean> updateProductThingModel(@Valid @RequestBody IotProductThingModelSaveReqVO updateReqVO) { | |
| 45 | + thinkModelFunctionService.updateProductThingModel(updateReqVO); | |
| 46 | 46 | return success(true); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | @DeleteMapping("/delete") |
| 50 | 50 | @Operation(summary = "删除产品物模型") |
| 51 | 51 | @Parameter(name = "id", description = "编号", required = true) |
| 52 | - @PreAuthorize("@ss.hasPermission('iot:think-model-function:delete')") | |
| 53 | - public CommonResult<Boolean> deleteThinkModelFunction(@RequestParam("id") Long id) { | |
| 54 | - thinkModelFunctionService.deleteThinkModelFunction(id); | |
| 52 | + @PreAuthorize("@ss.hasPermission('iot:product-thing-model:delete')") | |
| 53 | + public CommonResult<Boolean> deleteProductThingModel(@RequestParam("id") Long id) { | |
| 54 | + thinkModelFunctionService.deleteProductThingModel(id); | |
| 55 | 55 | return success(true); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | @GetMapping("/get") |
| 59 | 59 | @Operation(summary = "获得产品物模型") |
| 60 | 60 | @Parameter(name = "id", description = "编号", required = true) |
| 61 | - @PreAuthorize("@ss.hasPermission('iot:think-model-function:query')") | |
| 62 | - public CommonResult<IotThinkModelFunctionRespVO> getThinkModelFunction(@RequestParam("id") Long id) { | |
| 63 | - IotProductThingModelDO function = thinkModelFunctionService.getThinkModelFunction(id); | |
| 64 | - return success(IotThinkModelFunctionConvert.INSTANCE.convert(function)); | |
| 61 | + @PreAuthorize("@ss.hasPermission('iot:product-thing-model:query')") | |
| 62 | + public CommonResult<IotProductThingModelRespVO> getProductThingModel(@RequestParam("id") Long id) { | |
| 63 | + IotProductThingModelDO function = thinkModelFunctionService.getProductThingModel(id); | |
| 64 | + return success(IotProductThingModelConvert.INSTANCE.convert(function)); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | @GetMapping("/list-by-product-id") |
| 68 | 68 | @Operation(summary = "获得产品物模型") |
| 69 | 69 | @Parameter(name = "productId", description = "产品ID", required = true, example = "1024") |
| 70 | - @PreAuthorize("@ss.hasPermission('iot:think-model-function:query')") | |
| 71 | - public CommonResult<List<IotThinkModelFunctionRespVO>> getThinkModelFunctionListByProductId(@RequestParam("productId") Long productId) { | |
| 72 | - List<IotProductThingModelDO> list = thinkModelFunctionService.getThinkModelFunctionListByProductId(productId); | |
| 73 | - return success(IotThinkModelFunctionConvert.INSTANCE.convertList(list)); | |
| 70 | + @PreAuthorize("@ss.hasPermission('iot:product-thing-model:query')") | |
| 71 | + public CommonResult<List<IotProductThingModelRespVO>> getProductThingModelListByProductId(@RequestParam("productId") Long productId) { | |
| 72 | + List<IotProductThingModelDO> list = thinkModelFunctionService.getProductThingModelListByProductId(productId); | |
| 73 | + return success(IotProductThingModelConvert.INSTANCE.convertList(list)); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | @GetMapping("/page") |
| 77 | 77 | @Operation(summary = "获得产品物模型分页") |
| 78 | - @PreAuthorize("@ss.hasPermission('iot:think-model-function:query')") | |
| 79 | - public CommonResult<PageResult<IotThinkModelFunctionRespVO>> getThinkModelFunctionPage(@Valid IotThinkModelFunctionPageReqVO pageReqVO) { | |
| 80 | - PageResult<IotProductThingModelDO> pageResult = thinkModelFunctionService.getThinkModelFunctionPage(pageReqVO); | |
| 81 | - return success(BeanUtils.toBean(pageResult, IotThinkModelFunctionRespVO.class)); | |
| 78 | + @PreAuthorize("@ss.hasPermission('iot:product-thing-model:query')") | |
| 79 | + public CommonResult<PageResult<IotProductThingModelRespVO>> getProductThingModelPage(@Valid IotProductThingModelPageReqVO pageReqVO) { | |
| 80 | + PageResult<IotProductThingModelDO> pageResult = thinkModelFunctionService.getProductThingModelPage(pageReqVO); | |
| 81 | + return success(BeanUtils.toBean(pageResult, IotProductThingModelRespVO.class)); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/IotThinkModelFunctionController.http deleted
| 1 | -### 请求 /iot/think-model-function/create 接口 => 成功 | |
| 2 | -POST {{baseUrl}}/iot/think-model-function/create | |
| 3 | -Content-Type: application/json | |
| 4 | -tenant-id: {{adminTenentId}} | |
| 5 | -Authorization: Bearer {{token}} | |
| 6 | - | |
| 7 | -{ | |
| 8 | - "productId": 1001, | |
| 9 | - "productKey": "smart-sensor-001", | |
| 10 | - "identifier": "Temperature", | |
| 11 | - "name": "温度", | |
| 12 | - "description": "当前温度值", | |
| 13 | - "type": 1, | |
| 14 | - "property": { | |
| 15 | - "identifier": "Temperature", | |
| 16 | - "name": "温度", | |
| 17 | - "accessMode": "r", | |
| 18 | - "required": true, | |
| 19 | - "dataType": { | |
| 20 | - "type": "float", | |
| 21 | - "specs": { | |
| 22 | - "min": -10.0, | |
| 23 | - "max": 100.0, | |
| 24 | - "step": 0.1, | |
| 25 | - "unit": "℃" | |
| 26 | - } | |
| 27 | - }, | |
| 28 | - "description": "当前温度值" | |
| 29 | - } | |
| 30 | -} | |
| 31 | - | |
| 32 | -### 请求 /iot/think-model-function/create 接口 => 成功 | |
| 33 | -POST {{baseUrl}}/iot/think-model-function/create | |
| 34 | -Content-Type: application/json | |
| 35 | -tenant-id: {{adminTenentId}} | |
| 36 | -Authorization: Bearer {{token}} | |
| 37 | - | |
| 38 | -{ | |
| 39 | - "productId": 1001, | |
| 40 | - "productKey": "smart-sensor-001", | |
| 41 | - "identifier": "Humidity", | |
| 42 | - "name": "湿度", | |
| 43 | - "description": "当前湿度值", | |
| 44 | - "type": 1, | |
| 45 | - "property": { | |
| 46 | - "identifier": "Humidity", | |
| 47 | - "name": "湿度", | |
| 48 | - "accessMode": "r", | |
| 49 | - "required": true, | |
| 50 | - "dataType": { | |
| 51 | - "type": "float", | |
| 52 | - "specs": { | |
| 53 | - "min": 0.0, | |
| 54 | - "max": 100.0, | |
| 55 | - "step": 0.1, | |
| 56 | - "unit": "%" | |
| 57 | - } | |
| 58 | - }, | |
| 59 | - "description": "当前湿度值" | |
| 60 | - } | |
| 61 | -} | |
| 62 | - | |
| 63 | - | |
| 64 | - | |
| 65 | - | |
| 66 | -### 请求 /iot/think-model-function/update 接口 => 成功 | |
| 67 | -PUT {{baseUrl}}/iot/think-model-function/update | |
| 68 | -Content-Type: application/json | |
| 69 | -tenant-id: {{adminTenentId}} | |
| 70 | -Authorization: Bearer {{token}} | |
| 71 | - | |
| 72 | -{ | |
| 73 | - "id": 11, | |
| 74 | - "productId": 1001, | |
| 75 | - "productKey": "smart-sensor-001", | |
| 76 | - "identifier": "Temperature", | |
| 77 | - "name": "温度", | |
| 78 | - "description": "当前温度值", | |
| 79 | - "type": 1, | |
| 80 | - "property": { | |
| 81 | - "identifier": "Temperature", | |
| 82 | - "name": "温度", | |
| 83 | - "accessMode": "r", | |
| 84 | - "required": true, | |
| 85 | - "dataType": { | |
| 86 | - "type": "float", | |
| 87 | - "specs": { | |
| 88 | - "min": -111.0, | |
| 89 | - "max": 222.0, | |
| 90 | - "step": 0.1, | |
| 91 | - "unit": "℃" | |
| 92 | - } | |
| 93 | - }, | |
| 94 | - "description": "当前温度值" | |
| 95 | - } | |
| 96 | -} | |
| 97 | - | |
| 98 | -### 请求 /iot/think-model-function/delete 接口 => 成功 | |
| 99 | -DELETE {{baseUrl}}/iot/think-model-function/delete?id=7 | |
| 100 | -tenant-id: {{adminTenentId}} | |
| 101 | -Authorization: Bearer {{token}} | |
| 102 | - | |
| 103 | -### 请求 /iot/think-model-function/get 接口 => 成功 | |
| 104 | -GET {{baseUrl}}/iot/think-model-function/get?id=10 | |
| 105 | -tenant-id: {{adminTenentId}} | |
| 106 | -Authorization: Bearer {{token}} | |
| 107 | - | |
| 108 | - | |
| 109 | -### 请求 /iot/think-model-function/list-by-product-id 接口 => 成功 | |
| 110 | -GET {{baseUrl}}/iot/think-model-function/list-by-product-id?productId=1001 | |
| 111 | -tenant-id: {{adminTenentId}} | |
| 112 | -Authorization: Bearer {{token}} | |
| 113 | 0 | \ No newline at end of file |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelArrayDataSpecs.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 3 | 5 | import lombok.Data; |
| 6 | +import lombok.EqualsAndHashCode; | |
| 4 | 7 | |
| 5 | 8 | import java.util.List; |
| 6 | 9 | |
| ... | ... | @@ -10,24 +13,21 @@ import java.util.List; |
| 10 | 13 | * @author HUIHUI |
| 11 | 14 | */ |
| 12 | 15 | @Data |
| 16 | +@EqualsAndHashCode(callSuper = true) | |
| 17 | +@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 | |
| 13 | 18 | public class ThingModelArrayDataSpecs extends ThingModelDataSpecs { |
| 14 | 19 | |
| 15 | 20 | /** |
| 16 | 21 | * 数组中的元素个数。 |
| 17 | 22 | */ |
| 18 | - private Long size; | |
| 23 | + private Integer size; | |
| 19 | 24 | /** |
| 20 | 25 | * 数组中的元素的数据类型。可选值:struct、int、float、double 或 text。 |
| 21 | 26 | */ |
| 22 | 27 | private String childDataType; |
| 23 | 28 | /** |
| 24 | - * 数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中。 | |
| 25 | - * 仅当 dataType 不是列表型时,才传入此字段。 | |
| 26 | - */ | |
| 27 | - private ThingModelDataSpecs dataSpecs; | |
| 28 | - /** | |
| 29 | - * 数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中。 | |
| 30 | - * 仅当 dataType 是列表型时,才传入此字段。 | |
| 29 | + * 数据类型(childDataType)为列表型 struct 的数据规范存储在 dataSpecsList 中。 | |
| 30 | + * 此时 struct 取值范围为:int、float、double、text、date、enum、bool | |
| 31 | 31 | */ |
| 32 | 32 | private List<ThingModelDataSpecs> dataSpecsList; |
| 33 | 33 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelBoolOrEnumDataSpecs.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; |
| 2 | 2 | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 3 | 4 | import lombok.Data; |
| 4 | 5 | import lombok.EqualsAndHashCode; |
| 5 | 6 | |
| ... | ... | @@ -12,6 +13,7 @@ import lombok.EqualsAndHashCode; |
| 12 | 13 | */ |
| 13 | 14 | @Data |
| 14 | 15 | @EqualsAndHashCode(callSuper = true) |
| 16 | +@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 | |
| 15 | 17 | public class ThingModelBoolOrEnumDataSpecs extends ThingModelDataSpecs { |
| 16 | 18 | |
| 17 | 19 | /** | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDataSpecs.java
| ... | ... | @@ -22,7 +22,8 @@ import lombok.Data; |
| 22 | 22 | @JsonSubTypes.Type(value = ThingModelDateOrTextDataSpecs.class, name = "date"), |
| 23 | 23 | @JsonSubTypes.Type(value = ThingModelBoolOrEnumDataSpecs.class, name = "bool"), |
| 24 | 24 | @JsonSubTypes.Type(value = ThingModelBoolOrEnumDataSpecs.class, name = "enum"), |
| 25 | - @JsonSubTypes.Type(value = ThingModelArrayDataSpecs.class, name = "array") | |
| 25 | + @JsonSubTypes.Type(value = ThingModelArrayDataSpecs.class, name = "array"), | |
| 26 | + @JsonSubTypes.Type(value = ThingModelStructDataSpecs.class, name = "struct") | |
| 26 | 27 | }) |
| 27 | 28 | public abstract class ThingModelDataSpecs { |
| 28 | 29 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelDateOrTextDataSpecs.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; |
| 2 | 2 | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 3 | 4 | import lombok.Data; |
| 5 | +import lombok.EqualsAndHashCode; | |
| 4 | 6 | |
| 5 | 7 | /** |
| 6 | 8 | * 物模型数据类型为时间型或文本型的 DataSpec 定义 |
| ... | ... | @@ -10,6 +12,8 @@ import lombok.Data; |
| 10 | 12 | * @author HUIHUI |
| 11 | 13 | */ |
| 12 | 14 | @Data |
| 15 | +@EqualsAndHashCode(callSuper = true) | |
| 16 | +@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 | |
| 13 | 17 | public class ThingModelDateOrTextDataSpecs extends ThingModelDataSpecs { |
| 14 | 18 | |
| 15 | 19 | /** | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelNumericDataSpec.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; |
| 2 | 2 | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 3 | 4 | import lombok.Data; |
| 5 | +import lombok.EqualsAndHashCode; | |
| 4 | 6 | |
| 5 | 7 | /** |
| 6 | 8 | * 物模型数据类型为数值的 DataSpec 定义 |
| ... | ... | @@ -10,6 +12,8 @@ import lombok.Data; |
| 10 | 12 | * @author HUIHUI |
| 11 | 13 | */ |
| 12 | 14 | @Data |
| 15 | +@EqualsAndHashCode(callSuper = true) | |
| 16 | +@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 | |
| 13 | 17 | public class ThingModelNumericDataSpec extends ThingModelDataSpecs { |
| 14 | 18 | |
| 15 | 19 | /** | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/thingmodel/dataType/ThingModelStructDataSpecs.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelAccessModeEnum; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 物模型数据类型为 struct 的 DataSpec 定义 | |
| 12 | + * | |
| 13 | + * @author HUIHUI | |
| 14 | + */ | |
| 15 | +@Data | |
| 16 | +@EqualsAndHashCode(callSuper = true) | |
| 17 | +@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复。 | |
| 18 | +public class ThingModelStructDataSpecs extends ThingModelDataSpecs { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 属性标识符 | |
| 22 | + */ | |
| 23 | + private String identifier; | |
| 24 | + /** | |
| 25 | + * 属性名称 | |
| 26 | + */ | |
| 27 | + private String name; | |
| 28 | + /** | |
| 29 | + * 属性描述 | |
| 30 | + */ | |
| 31 | + private String description; | |
| 32 | + /** | |
| 33 | + * 云端可以对该属性进行的操作类型 | |
| 34 | + * 关联枚举 {@link IotProductThingModelAccessModeEnum} | |
| 35 | + */ | |
| 36 | + private String accessMode; | |
| 37 | + /** | |
| 38 | + * 是否是标准品类的必选服务。 | |
| 39 | + * | |
| 40 | + * - true:是 | |
| 41 | + * - false:否 | |
| 42 | + */ | |
| 43 | + private Boolean required; | |
| 44 | + /** | |
| 45 | + * struct 数据的数据类型 | |
| 46 | + */ | |
| 47 | + private String childDataType; | |
| 48 | + /** | |
| 49 | + * 数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中 | |
| 50 | + */ | |
| 51 | + private ThingModelDataSpecs dataSpecs; | |
| 52 | + /** | |
| 53 | + * 数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中 | |
| 54 | + */ | |
| 55 | + private List<ThingModelDataSpecs> dataSpecsList; | |
| 56 | + | |
| 57 | +} | |
| 58 | + | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotThinkModelFunctionPageReqVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelPageReqVO.java
| ... | ... | @@ -13,7 +13,7 @@ import lombok.ToString; |
| 13 | 13 | @Data |
| 14 | 14 | @EqualsAndHashCode(callSuper = true) |
| 15 | 15 | @ToString(callSuper = true) |
| 16 | -public class IotThinkModelFunctionPageReqVO extends PageParam { | |
| 16 | +public class IotProductThingModelPageReqVO extends PageParam { | |
| 17 | 17 | |
| 18 | 18 | @Schema(description = "功能标识") |
| 19 | 19 | private String identifier; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotThinkModelFunctionRespVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelRespVO.java
| ... | ... | @@ -13,7 +13,7 @@ import java.time.LocalDateTime; |
| 13 | 13 | @Schema(description = "管理后台 - IoT 产品物模型 Response VO") |
| 14 | 14 | @Data |
| 15 | 15 | @ExcelIgnoreUnannotated |
| 16 | -public class IotThinkModelFunctionRespVO { | |
| 16 | +public class IotProductThingModelRespVO { | |
| 17 | 17 | |
| 18 | 18 | @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21816") |
| 19 | 19 | @ExcelProperty("产品ID") | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotThinkModelFunctionSaveReqVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/productthingmodel/vo/IotProductThingModelSaveReqVO.java
| ... | ... | @@ -12,7 +12,7 @@ import lombok.Data; |
| 12 | 12 | |
| 13 | 13 | @Schema(description = "管理后台 - IoT 产品物模型新增/修改 Request VO") |
| 14 | 14 | @Data |
| 15 | -public class IotThinkModelFunctionSaveReqVO { | |
| 15 | +public class IotProductThingModelSaveReqVO { | |
| 16 | 16 | |
| 17 | 17 | @Schema(description = "编号", example = "1") |
| 18 | 18 | private Long id; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/thinkmodelfunction/IotThinkModelFunctionConvert.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/productthingmodel/IotProductThingModelConvert.java
| 1 | -package cn.iocoder.yudao.module.iot.convert.thinkmodelfunction; | |
| 1 | +package cn.iocoder.yudao.module.iot.convert.productthingmodel; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelEvent; |
| 4 | 4 | import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelProperty; |
| 5 | 5 | import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.ThingModelService; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionRespVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelRespVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; | |
| 8 | 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; |
| 9 | 9 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; |
| 10 | 10 | import org.mapstruct.Mapper; |
| 11 | 11 | import org.mapstruct.Mapping; |
| 12 | +import org.mapstruct.Named; | |
| 12 | 13 | import org.mapstruct.factory.Mappers; |
| 13 | 14 | |
| 14 | 15 | import java.util.List; |
| 15 | 16 | import java.util.Objects; |
| 16 | 17 | |
| 17 | 18 | @Mapper |
| 18 | -public interface IotThinkModelFunctionConvert { | |
| 19 | +public interface IotProductThingModelConvert { | |
| 19 | 20 | |
| 20 | - IotThinkModelFunctionConvert INSTANCE = Mappers.getMapper(IotThinkModelFunctionConvert.class); | |
| 21 | + IotProductThingModelConvert INSTANCE = Mappers.getMapper(IotProductThingModelConvert.class); | |
| 21 | 22 | |
| 22 | 23 | // 将 SaveReqVO 转换为 DO |
| 23 | 24 | @Mapping(target = "property", expression = "java(convertToProperty(bean))") |
| 24 | 25 | @Mapping(target = "event", expression = "java(convertToEvent(bean))") |
| 25 | 26 | @Mapping(target = "service", expression = "java(convertToService(bean))") |
| 26 | - IotProductThingModelDO convert(IotThinkModelFunctionSaveReqVO bean); | |
| 27 | + IotProductThingModelDO convert(IotProductThingModelSaveReqVO bean); | |
| 27 | 28 | |
| 28 | - default ThingModelProperty convertToProperty(IotThinkModelFunctionSaveReqVO bean) { | |
| 29 | + // 将 DO 转换为 RespVO | |
| 30 | + @Mapping(target = "property", source = "property") | |
| 31 | + @Mapping(target = "event", source = "event") | |
| 32 | + @Mapping(target = "service", source = "service") | |
| 33 | + IotProductThingModelRespVO convert(IotProductThingModelDO bean); | |
| 34 | + | |
| 35 | + // 批量转换 | |
| 36 | + List<IotProductThingModelRespVO> convertList(List<IotProductThingModelDO> list); | |
| 37 | + | |
| 38 | + @Named("convertToProperty") | |
| 39 | + default ThingModelProperty convertToProperty(IotProductThingModelSaveReqVO bean) { | |
| 29 | 40 | if (Objects.equals(bean.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { |
| 30 | 41 | return bean.getProperty(); |
| 31 | 42 | } |
| 32 | 43 | return null; |
| 33 | 44 | } |
| 34 | 45 | |
| 35 | - default ThingModelEvent convertToEvent(IotThinkModelFunctionSaveReqVO bean) { | |
| 46 | + @Named("convertToEvent") | |
| 47 | + default ThingModelEvent convertToEvent(IotProductThingModelSaveReqVO bean) { | |
| 36 | 48 | if (Objects.equals(bean.getType(), IotProductThingModelTypeEnum.EVENT.getType())) { |
| 37 | 49 | return bean.getEvent(); |
| 38 | 50 | } |
| 39 | 51 | return null; |
| 40 | 52 | } |
| 41 | 53 | |
| 42 | - default ThingModelService convertToService(IotThinkModelFunctionSaveReqVO bean) { | |
| 54 | + @Named("convertToService") | |
| 55 | + default ThingModelService convertToService(IotProductThingModelSaveReqVO bean) { | |
| 43 | 56 | if (Objects.equals(bean.getType(), IotProductThingModelTypeEnum.SERVICE.getType())) { |
| 44 | 57 | return bean.getService(); |
| 45 | 58 | } |
| 46 | 59 | return null; |
| 47 | 60 | } |
| 48 | 61 | |
| 49 | - // 将 DO 转换为 RespVO | |
| 50 | - @Mapping(target = "property", source = "property") | |
| 51 | - @Mapping(target = "event", source = "event") | |
| 52 | - @Mapping(target = "service", source = "service") | |
| 53 | - IotThinkModelFunctionRespVO convert(IotProductThingModelDO bean); | |
| 54 | - | |
| 55 | - // 批量转换 | |
| 56 | - List<IotThinkModelFunctionRespVO> convertList(List<IotProductThingModelDO> list); | |
| 57 | 62 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/productthingmodel/IotProductThingModelDO.java
| ... | ... | @@ -23,8 +23,8 @@ import lombok.NoArgsConstructor; |
| 23 | 23 | * |
| 24 | 24 | * @author 芋道源码 |
| 25 | 25 | */ |
| 26 | -@TableName(value = "iot_think_model_function", autoResultMap = true) | |
| 27 | -@KeySequence("iot_think_model_function_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 26 | +@TableName(value = "iot_product_thing_model", autoResultMap = true) | |
| 27 | +@KeySequence("iot_product_thing_model_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 28 | 28 | @Data |
| 29 | 29 | @Builder |
| 30 | 30 | @NoArgsConstructor | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodelfunction/IotThinkModelFunctionMapper.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thinkmodelfunction/IotProductThingModelMapper.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.dal.mysql.thinkmodelfunction; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; | |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| ... | ... | @@ -15,9 +15,9 @@ import java.util.List; |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | 17 | @Mapper |
| 18 | -public interface IotThinkModelFunctionMapper extends BaseMapperX<IotProductThingModelDO> { | |
| 18 | +public interface IotProductThingModelMapper extends BaseMapperX<IotProductThingModelDO> { | |
| 19 | 19 | |
| 20 | - default PageResult<IotProductThingModelDO> selectPage(IotThinkModelFunctionPageReqVO reqVO) { | |
| 20 | + default PageResult<IotProductThingModelDO> selectPage(IotProductThingModelPageReqVO reqVO) { | |
| 21 | 21 | return selectPage(reqVO, new LambdaQueryWrapperX<IotProductThingModelDO>() |
| 22 | 22 | .eqIfPresent(IotProductThingModelDO::getIdentifier, reqVO.getIdentifier()) |
| 23 | 23 | .likeIfPresent(IotProductThingModelDO::getName, reqVO.getName()) | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceDataServiceImpl.java
| ... | ... | @@ -15,7 +15,7 @@ import cn.iocoder.yudao.module.iot.dal.tdengine.TdEngineDMLMapper; |
| 15 | 15 | import cn.iocoder.yudao.module.iot.enums.IotConstants; |
| 16 | 16 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; |
| 17 | 17 | import cn.iocoder.yudao.module.iot.service.tdengine.IotThingModelMessageService; |
| 18 | -import cn.iocoder.yudao.module.iot.service.thinkmodelfunction.IotThinkModelFunctionService; | |
| 18 | +import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; | |
| 19 | 19 | import jakarta.annotation.Resource; |
| 20 | 20 | import jakarta.validation.Valid; |
| 21 | 21 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -40,7 +40,7 @@ public class IotDeviceDataServiceImpl implements IotDeviceDataService { |
| 40 | 40 | @Resource |
| 41 | 41 | private IotThingModelMessageService thingModelMessageService; |
| 42 | 42 | @Resource |
| 43 | - private IotThinkModelFunctionService thinkModelFunctionService; | |
| 43 | + private IotProductThingModelService thinkModelFunctionService; | |
| 44 | 44 | @Resource |
| 45 | 45 | private TdEngineDMLMapper tdEngineDMLMapper; |
| 46 | 46 | |
| ... | ... | @@ -73,7 +73,7 @@ public class IotDeviceDataServiceImpl implements IotDeviceDataService { |
| 73 | 73 | // 1. 获取设备信息 |
| 74 | 74 | IotDeviceDO device = deviceService.getDevice(deviceDataReqVO.getDeviceId()); |
| 75 | 75 | // 2. 获取设备属性最新数据 |
| 76 | - List<IotProductThingModelDO> thinkModelFunctionList = thinkModelFunctionService.getThinkModelFunctionListByProductKey(device.getProductKey()); | |
| 76 | + List<IotProductThingModelDO> thinkModelFunctionList = thinkModelFunctionService.getProductThingModelListByProductKey(device.getProductKey()); | |
| 77 | 77 | thinkModelFunctionList = thinkModelFunctionList.stream() |
| 78 | 78 | .filter(function -> IotProductThingModelTypeEnum.PROPERTY.getType() |
| 79 | 79 | .equals(function.getType())).toList(); | ... | ... |
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 |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.dal.mysql.product.IotProductMapper; |
| 9 | 9 | import cn.iocoder.yudao.module.iot.enums.product.IotProductStatusEnum; |
| 10 | -import cn.iocoder.yudao.module.iot.service.thinkmodelfunction.IotThinkModelFunctionService; | |
| 10 | +import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; | |
| 11 | 11 | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| 12 | 12 | import jakarta.annotation.Resource; |
| 13 | 13 | import org.springframework.context.annotation.Lazy; |
| ... | ... | @@ -34,7 +34,7 @@ public class IotProductServiceImpl implements IotProductService { |
| 34 | 34 | |
| 35 | 35 | @Resource |
| 36 | 36 | @Lazy |
| 37 | - private IotThinkModelFunctionService thinkModelFunctionService; | |
| 37 | + private IotProductThingModelService thinkModelFunctionService; | |
| 38 | 38 | |
| 39 | 39 | @Override |
| 40 | 40 | public Long createProduct(IotProductSaveReqVO createReqVO) { | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodelfunction/IotThinkModelFunctionService.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelService.java
| 1 | -package cn.iocoder.yudao.module.iot.service.thinkmodelfunction; | |
| 1 | +package cn.iocoder.yudao.module.iot.service.productthingmodel; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionSaveReqVO; | |
| 4 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; | |
| 6 | 6 | import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; |
| 7 | 7 | import jakarta.validation.Valid; |
| 8 | 8 | |
| ... | ... | @@ -13,7 +13,7 @@ import java.util.List; |
| 13 | 13 | * |
| 14 | 14 | * @author 芋道源码 |
| 15 | 15 | */ |
| 16 | -public interface IotThinkModelFunctionService { | |
| 16 | +public interface IotProductThingModelService { | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * 创建产品物模型 |
| ... | ... | @@ -21,7 +21,7 @@ public interface IotThinkModelFunctionService { |
| 21 | 21 | * @param createReqVO 创建信息 |
| 22 | 22 | * @return 编号 |
| 23 | 23 | */ |
| 24 | - Long createThinkModelFunction(@Valid IotThinkModelFunctionSaveReqVO createReqVO); | |
| 24 | + Long createProductThingModel(@Valid IotProductThingModelSaveReqVO createReqVO); | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | /** |
| ... | ... | @@ -29,14 +29,14 @@ public interface IotThinkModelFunctionService { |
| 29 | 29 | * |
| 30 | 30 | * @param updateReqVO 更新信息 |
| 31 | 31 | */ |
| 32 | - void updateThinkModelFunction(@Valid IotThinkModelFunctionSaveReqVO updateReqVO); | |
| 32 | + void updateProductThingModel(@Valid IotProductThingModelSaveReqVO updateReqVO); | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * 删除产品物模型 |
| 36 | 36 | * |
| 37 | 37 | * @param id 编号 |
| 38 | 38 | */ |
| 39 | - void deleteThinkModelFunction(Long id); | |
| 39 | + void deleteProductThingModel(Long id); | |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * 获得产品物模型 |
| ... | ... | @@ -44,7 +44,7 @@ public interface IotThinkModelFunctionService { |
| 44 | 44 | * @param id 编号 |
| 45 | 45 | * @return 产品物模型 |
| 46 | 46 | */ |
| 47 | - IotProductThingModelDO getThinkModelFunction(Long id); | |
| 47 | + IotProductThingModelDO getProductThingModel(Long id); | |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * 获得产品物模型列表 |
| ... | ... | @@ -52,7 +52,7 @@ public interface IotThinkModelFunctionService { |
| 52 | 52 | * @param productId 产品编号 |
| 53 | 53 | * @return 产品物模型列表 |
| 54 | 54 | */ |
| 55 | - List<IotProductThingModelDO> getThinkModelFunctionListByProductId(Long productId); | |
| 55 | + List<IotProductThingModelDO> getProductThingModelListByProductId(Long productId); | |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * 获得产品物模型分页 |
| ... | ... | @@ -60,7 +60,7 @@ public interface IotThinkModelFunctionService { |
| 60 | 60 | * @param pageReqVO 分页查询 |
| 61 | 61 | * @return 产品物模型分页 |
| 62 | 62 | */ |
| 63 | - PageResult<IotProductThingModelDO> getThinkModelFunctionPage(IotThinkModelFunctionPageReqVO pageReqVO); | |
| 63 | + PageResult<IotProductThingModelDO> getProductThingModelPage(IotProductThingModelPageReqVO pageReqVO); | |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * 创建超级表数据模型 |
| ... | ... | @@ -75,5 +75,6 @@ public interface IotThinkModelFunctionService { |
| 75 | 75 | * @param productKey 产品 Key |
| 76 | 76 | * @return 产品物模型列表 |
| 77 | 77 | */ |
| 78 | - List<IotProductThingModelDO> getThinkModelFunctionListByProductKey(String productKey); | |
| 78 | + List<IotProductThingModelDO> getProductThingModelListByProductKey(String productKey); | |
| 79 | + | |
| 79 | 80 | } |
| 80 | 81 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thinkmodelfunction/IotThinkModelFunctionServiceImpl.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/productthingmodel/IotProductThingModelServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.iot.service.thinkmodelfunction; | |
| 1 | +package cn.iocoder.yudao.module.iot.service.productthingmodel; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjectUtil; |
| ... | ... | @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel |
| 10 | 10 | import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelArgument; |
| 11 | 11 | import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelArrayDataSpecs; |
| 12 | 12 | import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.thingmodel.dataType.ThingModelDateOrTextDataSpecs; |
| 13 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionPageReqVO; | |
| 14 | -import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotThinkModelFunctionSaveReqVO; | |
| 15 | -import cn.iocoder.yudao.module.iot.convert.thinkmodelfunction.IotThinkModelFunctionConvert; | |
| 13 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelPageReqVO; | |
| 14 | +import cn.iocoder.yudao.module.iot.controller.admin.productthingmodel.vo.IotProductThingModelSaveReqVO; | |
| 15 | +import cn.iocoder.yudao.module.iot.convert.productthingmodel.IotProductThingModelConvert; | |
| 16 | 16 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 17 | 17 | import cn.iocoder.yudao.module.iot.dal.dataobject.productthingmodel.IotProductThingModelDO; |
| 18 | -import cn.iocoder.yudao.module.iot.dal.mysql.thinkmodelfunction.IotThinkModelFunctionMapper; | |
| 18 | +import cn.iocoder.yudao.module.iot.dal.mysql.thinkmodelfunction.IotProductThingModelMapper; | |
| 19 | 19 | import cn.iocoder.yudao.module.iot.enums.product.IotProductStatusEnum; |
| 20 | 20 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; |
| 21 | 21 | import cn.iocoder.yudao.module.iot.service.product.IotProductService; |
| ... | ... | @@ -41,10 +41,10 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*; |
| 41 | 41 | @Service |
| 42 | 42 | @Validated |
| 43 | 43 | @Slf4j |
| 44 | -public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionService { | |
| 44 | +public class IotProductThingModelServiceImpl implements IotProductThingModelService { | |
| 45 | 45 | |
| 46 | 46 | @Resource |
| 47 | - private IotThinkModelFunctionMapper thinkModelFunctionMapper; | |
| 47 | + private IotProductThingModelMapper productThingModelMapper; | |
| 48 | 48 | |
| 49 | 49 | @Resource |
| 50 | 50 | private IotProductService productService; |
| ... | ... | @@ -53,7 +53,7 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 53 | 53 | |
| 54 | 54 | @Override |
| 55 | 55 | @Transactional(rollbackFor = Exception.class) |
| 56 | - public Long createThinkModelFunction(IotThinkModelFunctionSaveReqVO createReqVO) { | |
| 56 | + public Long createProductThingModel(IotProductThingModelSaveReqVO createReqVO) { | |
| 57 | 57 | // 1. 校验功能标识符在同一产品下是否唯一 |
| 58 | 58 | validateIdentifierUnique(createReqVO.getProductId(), createReqVO.getIdentifier()); |
| 59 | 59 | |
| ... | ... | @@ -67,12 +67,12 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 67 | 67 | validateProductStatus(createReqVO.getProductId()); |
| 68 | 68 | |
| 69 | 69 | // 5. 插入数据库 |
| 70 | - IotProductThingModelDO function = IotThinkModelFunctionConvert.INSTANCE.convert(createReqVO); | |
| 71 | - thinkModelFunctionMapper.insert(function); | |
| 70 | + IotProductThingModelDO function = IotProductThingModelConvert.INSTANCE.convert(createReqVO); | |
| 71 | + productThingModelMapper.insert(function); | |
| 72 | 72 | |
| 73 | 73 | // 6. 如果创建的是属性,需要更新默认的事件和服务 |
| 74 | 74 | if (Objects.equals(createReqVO.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { |
| 75 | - createDefaultEventsAndServices(createReqVO.getProductId(), createReqVO.getProductKey()); | |
| 75 | + //createDefaultEventsAndServices(createReqVO.getProductId(), createReqVO.getProductKey()); | |
| 76 | 76 | } |
| 77 | 77 | return function.getId(); |
| 78 | 78 | } |
| ... | ... | @@ -95,14 +95,14 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | private void validateNameUnique(Long productId, String name) { |
| 98 | - IotProductThingModelDO function = thinkModelFunctionMapper.selectByProductIdAndName(productId, name); | |
| 98 | + IotProductThingModelDO function = productThingModelMapper.selectByProductIdAndName(productId, name); | |
| 99 | 99 | if (function != null) { |
| 100 | 100 | throw exception(THINK_MODEL_FUNCTION_NAME_EXISTS); |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | private void validateIdentifierUnique(Long productId, String identifier) { |
| 105 | - IotProductThingModelDO function = thinkModelFunctionMapper.selectByProductIdAndIdentifier(productId, identifier); | |
| 105 | + IotProductThingModelDO function = productThingModelMapper.selectByProductIdAndIdentifier(productId, identifier); | |
| 106 | 106 | if (function != null) { |
| 107 | 107 | throw exception(THINK_MODEL_FUNCTION_IDENTIFIER_EXISTS); |
| 108 | 108 | } |
| ... | ... | @@ -110,9 +110,9 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 110 | 110 | |
| 111 | 111 | @Override |
| 112 | 112 | @Transactional(rollbackFor = Exception.class) |
| 113 | - public void updateThinkModelFunction(IotThinkModelFunctionSaveReqVO updateReqVO) { | |
| 113 | + public void updateProductThingModel(IotProductThingModelSaveReqVO updateReqVO) { | |
| 114 | 114 | // 1. 校验功能是否存在 |
| 115 | - validateThinkModelFunctionExists(updateReqVO.getId()); | |
| 115 | + validateproductThingModelMapperExists(updateReqVO.getId()); | |
| 116 | 116 | |
| 117 | 117 | // 2. 校验功能标识符是否唯一 |
| 118 | 118 | validateIdentifierUniqueForUpdate(updateReqVO.getId(), updateReqVO.getProductId(), updateReqVO.getIdentifier()); |
| ... | ... | @@ -121,8 +121,8 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 121 | 121 | validateProductStatus(updateReqVO.getProductId()); |
| 122 | 122 | |
| 123 | 123 | // 4. 更新数据库 |
| 124 | - IotProductThingModelDO thinkModelFunction = IotThinkModelFunctionConvert.INSTANCE.convert(updateReqVO); | |
| 125 | - thinkModelFunctionMapper.updateById(thinkModelFunction); | |
| 124 | + IotProductThingModelDO productThingModelDO = IotProductThingModelConvert.INSTANCE.convert(updateReqVO); | |
| 125 | + productThingModelMapper.updateById(productThingModelDO); | |
| 126 | 126 | |
| 127 | 127 | // 5. 如果更新的是属性,需要更新默认的事件和服务 |
| 128 | 128 | if (Objects.equals(updateReqVO.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { |
| ... | ... | @@ -131,7 +131,7 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | private void validateIdentifierUniqueForUpdate(Long id, Long productId, String identifier) { |
| 134 | - IotProductThingModelDO function = thinkModelFunctionMapper.selectByProductIdAndIdentifier(productId, identifier); | |
| 134 | + IotProductThingModelDO function = productThingModelMapper.selectByProductIdAndIdentifier(productId, identifier); | |
| 135 | 135 | if (function != null && ObjectUtil.notEqual(function.getId(), id)) { |
| 136 | 136 | throw exception(THINK_MODEL_FUNCTION_IDENTIFIER_EXISTS); |
| 137 | 137 | } |
| ... | ... | @@ -139,9 +139,9 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 139 | 139 | |
| 140 | 140 | @Override |
| 141 | 141 | @Transactional(rollbackFor = Exception.class) |
| 142 | - public void deleteThinkModelFunction(Long id) { | |
| 142 | + public void deleteProductThingModel(Long id) { | |
| 143 | 143 | // 1. 校验功能是否存在 |
| 144 | - IotProductThingModelDO functionDO = thinkModelFunctionMapper.selectById(id); | |
| 144 | + IotProductThingModelDO functionDO = productThingModelMapper.selectById(id); | |
| 145 | 145 | if (functionDO == null) { |
| 146 | 146 | throw exception(THINK_MODEL_FUNCTION_NOT_EXISTS); |
| 147 | 147 | } |
| ... | ... | @@ -150,7 +150,7 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 150 | 150 | validateProductStatus(functionDO.getProductId()); |
| 151 | 151 | |
| 152 | 152 | // 2. 删除功能 |
| 153 | - thinkModelFunctionMapper.deleteById(id); | |
| 153 | + productThingModelMapper.deleteById(id); | |
| 154 | 154 | |
| 155 | 155 | // 3. 如果删除的是属性,需要更新默认的事件和服务 |
| 156 | 156 | if (Objects.equals(functionDO.getType(), IotProductThingModelTypeEnum.PROPERTY.getType())) { |
| ... | ... | @@ -163,25 +163,25 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 163 | 163 | * |
| 164 | 164 | * @param id 功能编号 |
| 165 | 165 | */ |
| 166 | - private void validateThinkModelFunctionExists(Long id) { | |
| 167 | - if (thinkModelFunctionMapper.selectById(id) == null) { | |
| 166 | + private void validateproductThingModelMapperExists(Long id) { | |
| 167 | + if (productThingModelMapper.selectById(id) == null) { | |
| 168 | 168 | throw exception(THINK_MODEL_FUNCTION_NOT_EXISTS); |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | @Override |
| 173 | - public IotProductThingModelDO getThinkModelFunction(Long id) { | |
| 174 | - return thinkModelFunctionMapper.selectById(id); | |
| 173 | + public IotProductThingModelDO getProductThingModel(Long id) { | |
| 174 | + return productThingModelMapper.selectById(id); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | @Override |
| 178 | - public List<IotProductThingModelDO> getThinkModelFunctionListByProductId(Long productId) { | |
| 179 | - return thinkModelFunctionMapper.selectListByProductId(productId); | |
| 178 | + public List<IotProductThingModelDO> getProductThingModelListByProductId(Long productId) { | |
| 179 | + return productThingModelMapper.selectListByProductId(productId); | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | @Override |
| 183 | - public PageResult<IotProductThingModelDO> getThinkModelFunctionPage(IotThinkModelFunctionPageReqVO pageReqVO) { | |
| 184 | - return thinkModelFunctionMapper.selectPage(pageReqVO); | |
| 183 | + public PageResult<IotProductThingModelDO> getProductThingModelPage(IotProductThingModelPageReqVO pageReqVO) { | |
| 184 | + return productThingModelMapper.selectPage(pageReqVO); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | @Override |
| ... | ... | @@ -190,23 +190,24 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 190 | 190 | IotProductDO product = productService.getProduct(productId); |
| 191 | 191 | |
| 192 | 192 | // 2. 查询产品的物模型功能列表 |
| 193 | - List<IotProductThingModelDO> functionList = thinkModelFunctionMapper.selectListByProductId(productId); | |
| 193 | + List<IotProductThingModelDO> functionList = productThingModelMapper.selectListByProductId(productId); | |
| 194 | 194 | |
| 195 | 195 | // 3. 生成 TDengine 的数据模型 |
| 196 | 196 | dbStructureDataService.createSuperTableDataModel(product, functionList); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | @Override |
| 200 | - public List<IotProductThingModelDO> getThinkModelFunctionListByProductKey(String productKey) { | |
| 201 | - return thinkModelFunctionMapper.selectListByProductKey(productKey); | |
| 200 | + public List<IotProductThingModelDO> getProductThingModelListByProductKey(String productKey) { | |
| 201 | + return productThingModelMapper.selectListByProductKey(productKey); | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | + // TODO @puhui999: 需要重构 | |
| 204 | 205 | /** |
| 205 | 206 | * 创建默认的事件和服务 |
| 206 | 207 | */ |
| 207 | 208 | public void createDefaultEventsAndServices(Long productId, String productKey) { |
| 208 | 209 | // 1. 获取当前属性列表 |
| 209 | - List<IotProductThingModelDO> propertyList = thinkModelFunctionMapper | |
| 210 | + List<IotProductThingModelDO> propertyList = productThingModelMapper | |
| 210 | 211 | .selectListByProductIdAndType(productId, IotProductThingModelTypeEnum.PROPERTY.getType()); |
| 211 | 212 | |
| 212 | 213 | // 2. 生成新的事件和服务列表 |
| ... | ... | @@ -231,7 +232,7 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 231 | 232 | } |
| 232 | 233 | |
| 233 | 234 | // 3. 获取数据库中的默认的旧事件和服务列表 |
| 234 | - List<IotProductThingModelDO> oldFunctionList = thinkModelFunctionMapper.selectListByProductIdAndIdentifiersAndTypes( | |
| 235 | + List<IotProductThingModelDO> oldFunctionList = productThingModelMapper.selectListByProductIdAndIdentifiersAndTypes( | |
| 235 | 236 | productId, |
| 236 | 237 | Arrays.asList("post", "set", "get"), |
| 237 | 238 | Arrays.asList(IotProductThingModelTypeEnum.EVENT.getType(), IotProductThingModelTypeEnum.SERVICE.getType()) |
| ... | ... | @@ -249,7 +250,7 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 249 | 250 | // 3.2 批量执行数据库操作 |
| 250 | 251 | // 新增数据库中的新事件和服务列表 |
| 251 | 252 | if (CollUtil.isNotEmpty(createList)) { |
| 252 | - thinkModelFunctionMapper.insertBatch(createList); | |
| 253 | + productThingModelMapper.insertBatch(createList); | |
| 253 | 254 | } |
| 254 | 255 | // 更新数据库中的事件和服务列表 |
| 255 | 256 | if (CollUtil.isNotEmpty(updateList)) { |
| ... | ... | @@ -267,14 +268,14 @@ public class IotThinkModelFunctionServiceImpl implements IotThinkModelFunctionSe |
| 267 | 268 | .collect(Collectors.toList()); |
| 268 | 269 | // 执行批量更新 |
| 269 | 270 | if (CollUtil.isNotEmpty(validUpdateList)) { |
| 270 | - thinkModelFunctionMapper.updateBatch(validUpdateList); | |
| 271 | + productThingModelMapper.updateBatch(validUpdateList); | |
| 271 | 272 | } |
| 272 | 273 | } |
| 273 | 274 | |
| 274 | 275 | // 删除数据库中的旧事件和服务列表 |
| 275 | 276 | if (CollUtil.isNotEmpty(deleteList)) { |
| 276 | 277 | Set<Long> idsToDelete = CollectionUtils.convertSet(deleteList, IotProductThingModelDO::getId); |
| 277 | - thinkModelFunctionMapper.deleteByIds(idsToDelete); | |
| 278 | + productThingModelMapper.deleteByIds(idsToDelete); | |
| 278 | 279 | } |
| 279 | 280 | } |
| 280 | 281 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/tdengine/IotThingModelMessageServiceImpl.java
| ... | ... | @@ -19,7 +19,7 @@ import cn.iocoder.yudao.module.iot.enums.IotConstants; |
| 19 | 19 | import cn.iocoder.yudao.module.iot.enums.device.IotDeviceStatusEnum; |
| 20 | 20 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotProductThingModelTypeEnum; |
| 21 | 21 | import cn.iocoder.yudao.module.iot.service.device.IotDeviceService; |
| 22 | -import cn.iocoder.yudao.module.iot.service.thinkmodelfunction.IotThinkModelFunctionService; | |
| 22 | +import cn.iocoder.yudao.module.iot.service.productthingmodel.IotProductThingModelService; | |
| 23 | 23 | import jakarta.annotation.Resource; |
| 24 | 24 | import lombok.extern.slf4j.Slf4j; |
| 25 | 25 | import org.springframework.beans.factory.annotation.Value; |
| ... | ... | @@ -47,7 +47,7 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ |
| 47 | 47 | private String url; |
| 48 | 48 | |
| 49 | 49 | @Resource |
| 50 | - private IotThinkModelFunctionService iotThinkModelFunctionService; | |
| 50 | + private IotProductThingModelService iotProductThingModelService; | |
| 51 | 51 | @Resource |
| 52 | 52 | private IotDeviceService iotDeviceService; |
| 53 | 53 | @Resource |
| ... | ... | @@ -91,8 +91,8 @@ public class IotThingModelMessageServiceImpl implements IotThingModelMessageServ |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | private List<IotProductThingModelDO> getValidFunctionList(String productKey) { |
| 94 | - return iotThinkModelFunctionService | |
| 95 | - .getThinkModelFunctionListByProductKey(productKey) | |
| 94 | + return iotProductThingModelService | |
| 95 | + .getProductThingModelListByProductKey(productKey) | |
| 96 | 96 | .stream() |
| 97 | 97 | .filter(function -> IotProductThingModelTypeEnum.PROPERTY.getType().equals(function.getType())) |
| 98 | 98 | .toList(); | ... | ... |