From 516e3a238776c87bc9c95127ed112eac65be2e51 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 30 Mar 2025 09:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91IoT=EF=BC=9A=E5=9C=BA=E6=99=AF=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E7=9A=84=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/controller/admin/device/IotDeviceController.java | 3 ++- .../iot/controller/admin/product/IotProductController.java | 6 ++++++ .../module/iot/dal/dataobject/rule/IotRuleSceneDO.java | 1 + .../yudao/module/iot/service/device/IotDeviceService.java | 2 +- .../module/iot/service/device/IotDeviceServiceImpl.java | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceController.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceController.java index ecc4726e7b..0eed0fbc78 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceController.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceController.java @@ -185,11 +185,12 @@ public class IotDeviceController { return success(deviceService.getMqttConnectionParams(deviceId)); } + // TODO @haohao:可以使用 @RequestParam("productKey") String productKey, @RequestParam("deviceNames") List deviceNames 来接收哇? @GetMapping("/list-by-product-key-and-names") @Operation(summary = "通过产品标识和设备名称列表获取设备") @PreAuthorize("@ss.hasPermission('iot:device:query')") public CommonResult> getDevicesByProductKeyAndNames(@Valid IotDeviceByProductKeyAndNamesReqVO reqVO) { - List devices = deviceService.getDevicesByProductKeyAndNames(reqVO.getProductKey(), reqVO.getDeviceNames()); + List devices = deviceService.getDeviceListByProductKeyAndNames(reqVO.getProductKey(), reqVO.getDeviceNames()); return success(BeanUtils.toBean(devices, IotDeviceRespVO.class)); } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java index 08614d4a0a..17f7e2d3ec 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java @@ -84,6 +84,9 @@ public class IotProductController { @PreAuthorize("@ss.hasPermission('iot:product:query')") public CommonResult getProduct(@RequestParam("id") Long id) { IotProductDO product = productService.getProduct(id); + if (product == null) { + return success(null); + } // 拼接数据 IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId()); return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> { @@ -99,6 +102,9 @@ public class IotProductController { @PreAuthorize("@ss.hasPermission('iot:product:query')") public CommonResult getProductByKey(@RequestParam("productKey") String productKey) { IotProductDO product = productService.getProductByProductKey(productKey); + if (product == null) { + return success(null); + } // 拼接数据 IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId()); return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> { diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleSceneDO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleSceneDO.java index a1fa2cd852..b51ea844d9 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleSceneDO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleSceneDO.java @@ -145,6 +145,7 @@ public class IotRuleSceneDO extends TenantBaseDO { public static class TriggerConditionParameter { // TODO @芋艿: identifier0 存事件和服务的 identifier 属性的情况 identifier0 就为 null 解决前端回显问题 + // TODO @haohao:可以根据 TriggerCondition.type 判断,是服务、还是事件、还是属性么? /** * 标识符(事件、服务) * diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceService.java index 11a0767bcd..561fa1fd28 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceService.java @@ -226,6 +226,6 @@ public interface IotDeviceService { * @param deviceNames 设备名称列表 * @return 设备列表 */ - List getDevicesByProductKeyAndNames(String productKey, List deviceNames); + List getDeviceListByProductKeyAndNames(String productKey, List deviceNames); } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceServiceImpl.java index 785e376eb7..03073ad496 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceServiceImpl.java @@ -452,7 +452,7 @@ public class IotDeviceServiceImpl implements IotDeviceService { } @Override - public List getDevicesByProductKeyAndNames(String productKey, List deviceNames) { + public List getDeviceListByProductKeyAndNames(String productKey, List deviceNames) { if (StrUtil.isBlank(productKey) || CollUtil.isEmpty(deviceNames)) { return Collections.emptyList(); }