From 90672fe6a9d2cd09133185d9ca26efbd991eb791 Mon Sep 17 00:00:00 2001 From: xiwa Date: Fri, 16 Jun 2023 23:05:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=88=9D=E5=A7=8B=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/init/sys_menu.json | 32 +++++++-------- .../data/service/DeviceInfoDataImpl.java | 39 +++++++++---------- .../controller/RuleEngineController.java | 33 ++++------------ .../controller/VirtualDeviceController.java | 4 +- 4 files changed, 43 insertions(+), 65 deletions(-) diff --git a/data/init/sys_menu.json b/data/init/sys_menu.json index d04f84aa..b8ae77fb 100644 --- a/data/init/sys_menu.json +++ b/data/init/sys_menu.json @@ -2415,7 +2415,7 @@ "menuName": "品类管理", "menuType": "C", "orderNum": 1, - "parentId": 1658357918741422082, + "parentId": 2200, "path": "categories", "perms": null, "queryParam": null, @@ -2459,7 +2459,7 @@ "menuName": "拆分组件demo", "menuType": "C", "orderNum": 1, - "parentId": 1660167072208510978, + "parentId": 2202, "path": "disperseDemo", "perms": null, "queryParam": null, @@ -2503,7 +2503,7 @@ "menuName": "产品管理", "menuType": "C", "orderNum": 2, - "parentId": 1658357918741422082, + "parentId": 2200, "path": "products", "perms": null, "queryParam": null, @@ -2525,7 +2525,7 @@ "menuName": "设备列表", "menuType": "C", "orderNum": 4, - "parentId": 1658357918741422082, + "parentId": 2200, "path": "devices", "perms": null, "queryParam": null, @@ -2547,7 +2547,7 @@ "menuName": "虚拟设备", "menuType": "C", "orderNum": 5, - "parentId": 1658357918741422082, + "parentId": 2200, "path": "virtualDevices", "perms": null, "queryParam": null, @@ -2591,7 +2591,7 @@ "menuName": "设备消息转换器", "menuType": "C", "orderNum": 1, - "parentId": 1662732793483530242, + "parentId": 2208, "path": "convertors", "perms": null, "queryParam": null, @@ -2613,7 +2613,7 @@ "menuName": "通讯组件管理", "menuType": "C", "orderNum": 2, - "parentId": 1662732793483530242, + "parentId": 2208, "path": "components", "perms": null, "queryParam": null, @@ -2657,7 +2657,7 @@ "menuName": "规则管理", "menuType": "C", "orderNum": 1, - "parentId": 1662793849241243650, + "parentId": 2211, "path": "ruleSys", "perms": null, "queryParam": null, @@ -2679,7 +2679,7 @@ "menuName": "定时任务", "menuType": "C", "orderNum": 1, - "parentId": 1662793849241243650, + "parentId": 2211, "path": "scheduledTask", "perms": null, "queryParam": null, @@ -2701,7 +2701,7 @@ "menuName": "设备详情", "menuType": "C", "orderNum": 1, - "parentId": 1658357918741422082, + "parentId": 2200, "path": "devicesDetail/:id", "perms": null, "queryParam": null, @@ -2723,7 +2723,7 @@ "menuName": "虚拟设备详情", "menuType": "C", "orderNum": 16, - "parentId": 1658357918741422082, + "parentId": 2200, "path": "virtualDeviceConfig/:id", "perms": null, "queryParam": null, @@ -2765,7 +2765,7 @@ "menuName": "消息列表", "menuType": "C", "orderNum": 1, - "parentId": 1664635724467126274, + "parentId": 2216, "path": "messageCenterList", "perms": null, "queryParam": null, @@ -2809,7 +2809,7 @@ "menuName": "通道配置", "menuType": "C", "orderNum": 1, - "parentId": 1664638344103575553, + "parentId": 2218, "path": "channelConfig", "perms": null, "queryParam": null, @@ -2831,7 +2831,7 @@ "menuName": "模板配置", "menuType": "C", "orderNum": 2, - "parentId": 1664638344103575553, + "parentId": 2218, "path": "template", "perms": null, "queryParam": null, @@ -2875,7 +2875,7 @@ "menuName": "告警列表", "menuType": "C", "orderNum": 1, - "parentId": 1664827474452238338, + "parentId": 2221, "path": "list", "perms": null, "queryParam": null, @@ -2897,7 +2897,7 @@ "menuName": "告警配置", "menuType": "C", "orderNum": 2, - "parentId": 1664827474452238338, + "parentId": 2221, "path": "config", "perms": null, "queryParam": null, diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java index f2a74f9e..e1ac2041 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java @@ -30,7 +30,7 @@ import java.util.stream.Collectors; @Primary @Service -public class DeviceInfoDataImpl implements IDeviceInfoData,IJPACommData { +public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData { @Autowired private DeviceInfoRepository deviceInfoRepository; @@ -170,7 +170,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData,IJPACommData findByParentId(String parentId) { - return parseVoToDto(deviceInfoRepository.findByParentId(parentId )); + return parseVoToDto(deviceInfoRepository.findByParentId(parentId)); } @Override @@ -192,7 +192,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData,IJPACommData(DeviceIdGroup.class)); //取设备标签 - List tags = list.size() == 0 ? new ArrayList<>() : - jdbcTemplate.query("\n" + - "SELECT\n" + - "a.id,\n" + - "a.code,\n" + - "a.name,\n" + - "a.value\n" + - "FROM device_tag a " + - String.format("WHERE a.device_id IN(%s)", deviceIds), new BeanPropertyRowMapper<>(TbDeviceTag.class)); +// List tags = list.size() == 0 ? new ArrayList<>() : +// jdbcTemplate.query("\n" + +// "SELECT\n" + +// "a.id,\n" + +// "a.code,\n" + +// "a.name,\n" + +// "a.value\n" + +// "FROM device_tag a " + +// String.format("WHERE a.device_id IN(%s)", deviceIds), new BeanPropertyRowMapper<>(TbDeviceTag.class)); for (DeviceInfo device : list) { //设置设备分组 @@ -314,11 +314,11 @@ public class DeviceInfoDataImpl implements IDeviceInfoData,IJPACommData tagMap = new HashMap<>(); - tags.stream().filter(t -> device.getDeviceId().equals(t.getDeviceId())) - .forEach(t -> tagMap.put(t.getCode(), - new DeviceInfo.Tag(t.getCode(), t.getName(), t.getValue()))); - device.setTag(tagMap); +// Map tagMap = new HashMap<>(); +// tags.stream().filter(t -> device.getDeviceId().equals(t.getDeviceId())) +// .forEach(t -> tagMap.put(t.getCode(), +// new DeviceInfo.Tag(t.getCode(), t.getName(), t.getValue()))); +// device.setTag(tagMap); } return new Paging<>(total, list); @@ -375,7 +375,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData,IJPACommData (long) item.getValue()))) + Collectors.summarizingLong(item -> (long) item.getValue()))) .forEach((key, sum) -> stats.add(new DataItem(key, sum.getSum()))); return stats; @@ -444,7 +444,6 @@ public class DeviceInfoDataImpl implements IDeviceInfoData,IJPACommData ruleInfoBo) { return ruleEngineService.saveRule(ruleInfoBo.getData()); - } @ApiOperation("暂停规则") @@ -152,6 +133,7 @@ public class RuleEngineController { return ruleEngineService.deleteTask(taskId); } + @ApiOperation("定时任务日志list") @PostMapping("/taskLogs/list") public Paging getTaskLogs( @@ -160,9 +142,10 @@ public class RuleEngineController { return ruleEngineService.selectTaskLogPageList(request); } + @ApiOperation("清除定时任务日志") @PostMapping("/taskLogs/clear") - public boolean clearTaskLogs( @Validated @RequestBody PageRequest request) { + public boolean clearTaskLogs( @Validated @RequestBody Request request) { return ruleEngineService.clearTaskLogs(request.getData()); } diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java index 4e94b61d..4661f251 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java @@ -51,7 +51,6 @@ public class VirtualDeviceController { @Autowired private IVirtualDeviceLogData virtualDeviceLogData; - @ApiOperation("获取虚拟设备列表") @PostMapping("/list") public Paging getDevices( @@ -127,7 +126,7 @@ public class VirtualDeviceController { * 删除 */ @ApiOperation("删除虚拟设备") - @DeleteMapping("/delete") + @PostMapping("/delete") public void delete(@Validated @RequestBody Request bo) { String id = bo.getData(); checkOwner(id); @@ -185,7 +184,6 @@ public class VirtualDeviceController { return virtualDeviceLogData.findByVirtualDeviceId(data.getDeviceId(), bo.getPageNum(), bo.getPageSize()); } - private VirtualDevice checkOwner(String id) { VirtualDevice oldData = virtualDeviceData.findById(id); if (oldData == null) {