diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/controller/DeviceSignalController.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/controller/DeviceSignalController.java index 3443500..b481b0b 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/controller/DeviceSignalController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/controller/DeviceSignalController.java @@ -41,22 +41,24 @@ public class DeviceSignalController { /********************************** * 用途说明: 分页查询变电站辅控设备信号 * 参数说明 - * deviceId 辅控设备ID + * mainDeviceId 主设备设备ID + * componentId 部件ID * signalName 信号名称 * pageNum 当前页 * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 ***********************************/ @GetMapping("/page") @ApiOperation("分页查询变电站辅控设备信号") - public ResponseResult getDeviceSignalPage(String deviceId, String signalName, Page page) { + public ResponseResult getDeviceSignalPage(String mainDeviceId, String componentId, String signalName, Page page) { //参数校验 辅控设备ID不能为空 - if (StrUtil.isBlank(deviceId)) { + if (StrUtil.isBlank(componentId)) { return ResponseResult.error("参数为空"); } - Page deviceSignalPage = deviceSignalService.getDeviceSignalPage(deviceId, signalName, page); + Page deviceSignalPage = deviceSignalService.getDeviceSignalPage(mainDeviceId,componentId, signalName, page); return ResponseResult.successData(deviceSignalPage); } + /********************************** * 用途说明: 查询遥信遥测数据 * 参数说明 @@ -67,7 +69,7 @@ public class DeviceSignalController { @ApiOperation("查询遥信遥测数据") public ResponseResult queryYxYcData(String mainDeviceId, String componentId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(StrUtil.isNotBlank(mainDeviceId), DeviceSignal::getMainDeviceId, mainDeviceId).eq(StrUtil.isNotBlank(componentId), DeviceSignal::getMainCompnentId, componentId); + queryWrapper.eq(StrUtil.isNotBlank(mainDeviceId), DeviceSignal::getMainDeviceId, mainDeviceId).eq(StrUtil.isNotBlank(componentId), DeviceSignal::getMainComponentId, componentId); List list = deviceSignalService.list(queryWrapper); return ResponseResult.successData(list); } @@ -75,11 +77,11 @@ public class DeviceSignalController { /********************************** * 用途说明: 查询信号信息 * 参数说明 - * areaid 区域ID + * signalId 区域ID * 返回值说明: 变电站辅控设备信号集合 ***********************************/ @GetMapping("/querySignalDataById") - @ApiOperation("查询信号信息") + @ApiOperation("根据信号id查询信号信息") public ResponseResult querySignalDataById(String signalId) { Map map = deviceSignalService.querySignalDataById(signalId); return ResponseResult.successData(map); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/domain/DeviceSignal.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/domain/DeviceSignal.java index b2d3464..90cfce9 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/domain/DeviceSignal.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/domain/DeviceSignal.java @@ -48,7 +48,7 @@ public class DeviceSignal implements Serializable { /** * 关联一次设备中部件ID,iis_substation_component */ - private String mainCompnentId; + private String mainComponentId; /** * 信号类型 0-普通信号 1-告警信号 diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/mapper/DeviceWorkDataMapper.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/mapper/DeviceWorkDataMapper.java index f39e6fc..b20b6de 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/mapper/DeviceWorkDataMapper.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/mapper/DeviceWorkDataMapper.java @@ -16,9 +16,23 @@ import java.util.List; */ public interface DeviceWorkDataMapper extends BaseMapper { - Page getDeviceWorkDataPage(Page page,String signalId, String startDate, String endDate); + /********************************** + * 用途说明: 分页查询变电站设备运行记录 + * 参数说明 page 分页参数 + * 参数说明 signalId 信号Id + * 参数说明 startDate 开始时间 + * 参数说明 endDate 结束时间 + * 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page + ***********************************/ + Page getDeviceWorkDataPage(Page page, String signalId, String startDate, + String endDate); + /********************************** + * 用途说明: 查询历史曲线 + * 参数说明 signalId 信号id + * 返回值说明: java.util.List + ***********************************/ List getHistoricalCurve(String signalId); - } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceSignalService.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceSignalService.java index d37e595..86efefb 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceSignalService.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceSignalService.java @@ -46,15 +46,27 @@ public interface IDeviceSignalService extends IService { /********************************** * 用途说明: - * 参数说明 deviceId 设备ID + * mainDeviceId 主设备设备ID + * componentId 部件ID * 参数说明 signalName 信号名称 * 参数说明 page * 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page ***********************************/ - Page getDeviceSignalPage(String deviceId, String signalName, Page page); + Page getDeviceSignalPage(String mainDeviceId, String componentId, String signalName, Page page); + /********************************** + * 用途说明: 获取信号集合 + * 参数说明 stationCode 变电站编号 + * 参数说明 signalName 信号名称 + * 返回值说明: java.util.List + ***********************************/ List> getDeviceSignalMaps(String stationCode, String signalName); + /********************************** + * 用途说明: 根据信号id查询信号信息 + * 参数说明 signalId 信号ID + * 返回值说明: java.util.Map + ***********************************/ Map querySignalDataById(String signalId); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceWorkDataService.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceWorkDataService.java index 1ec6977..abb746c 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceWorkDataService.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/IDeviceWorkDataService.java @@ -28,8 +28,21 @@ public interface IDeviceWorkDataService extends IService { ***********************************/ void insertData(String from, String slave_ip, String address, String value, String dateTimeString); + /********************************** + * 用途说明: 分页查询变电站设备运行记录 + * 参数说明 page 分页参数 + * 参数说明 signalId 信号Id + * 参数说明 startDate 开始时间 + * 参数说明 endDate 结束时间 + * 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page + ***********************************/ Page getDeviceWorkDataPage(Page page,String signalId, String startDate, String endDate); + /********************************** + * 用途说明: 查询历史曲线 + * 参数说明 signalId 信号id + * 返回值说明: java.util.List + ***********************************/ List getHistoricalCurve(String signalId); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceSignalServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceSignalServiceImpl.java index 0a2aa9a..95842ee 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceSignalServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceSignalServiceImpl.java @@ -9,6 +9,8 @@ import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal; import com.yfd.platform.modules.auxcontrol.mapper.DeviceSignalMapper; import com.yfd.platform.modules.auxcontrol.service.IDeviceSignalService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yfd.platform.modules.basedata.domain.SubstationComponent; +import com.yfd.platform.modules.basedata.mapper.SubstationComponentMapper; import com.yfd.platform.utils.SecurityUtils; import com.yfd.platform.utils.StringUtils; import org.springframework.stereotype.Service; @@ -34,6 +36,8 @@ public class DeviceSignalServiceImpl extends ServiceImpl ***********************************/ @Override - public Page getDeviceSignalPage(String deviceId, String signalName, Page page) { + public Page getDeviceSignalPage(String mainDeviceId, String componentId, String signalName, + Page page) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); //如果信号名称signalName不为空 模糊搜索 if (StrUtil.isNotBlank(signalName)) { //查询条件拼接模糊 queryWrapper.like(DeviceSignal::getSignalName, signalName); } - //如果辅控设备ID deviceId不为空 - if (StrUtil.isNotBlank(deviceId)) { - queryWrapper.eq(DeviceSignal::getMeterDeviceId, deviceId); + if (StrUtil.isNotBlank(mainDeviceId)) { + queryWrapper.eq(DeviceSignal::getMainDeviceId, mainDeviceId); + } + + if (StrUtil.isNotBlank(componentId)) { + queryWrapper.eq(DeviceSignal::getMainComponentId, componentId); } //排序 queryWrapper.orderByDesc(DeviceSignal::getSignalCode); return deviceSignalMapper.selectPage(page, queryWrapper); - } + /********************************** + * 用途说明: 获取信号集合 + * 参数说明 stationCode 变电站编号 + * 参数说明 signalName 信号名称 + * 返回值说明: java.util.List + ***********************************/ @Override public List> getDeviceSignalMaps(String stationCode, String signalName) { return deviceSignalMapper.getDeviceSignalMaps(stationCode, signalName); } + /********************************** + * 用途说明: 根据信号id查询信号信息 + * 参数说明 signalId 信号ID + * 返回值说明: java.util.Map + ***********************************/ @Override public Map querySignalDataById(String signalId) { return deviceSignalMapper.querySignalDataById(signalId); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java index 9d95267..712d760 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/DeviceWorkDataServiceImpl.java @@ -71,11 +71,24 @@ public class DeviceWorkDataServiceImpl extends ServiceImpl + ***********************************/ @Override public Page getDeviceWorkDataPage(Page page,String signalId, String startDate, String endDate) { return deviceWorkDataMapper.getDeviceWorkDataPage(page,signalId,startDate,endDate); } + /********************************** + * 用途说明: 查询历史曲线 + * 参数说明 signalId 信号id + * 返回值说明: java.util.List + ***********************************/ @Override public List getHistoricalCurve(String signalId) { return deviceWorkDataMapper.getHistoricalCurve(signalId); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/GatewayDeviceServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/GatewayDeviceServiceImpl.java index ef228e4..6ec2f0e 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/GatewayDeviceServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/auxcontrol/service/impl/GatewayDeviceServiceImpl.java @@ -1,5 +1,6 @@ package com.yfd.platform.modules.auxcontrol.service.impl; +import cn.hutool.core.lang.Validator; import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; @@ -61,6 +62,15 @@ public class GatewayDeviceServiceImpl extends ServiceImpl + ***********************************/ @Override public Page getGatewayDevicePage(String stationId, String deviceName, String deviceModel, String deviceType, @@ -106,6 +116,9 @@ public class GatewayDeviceServiceImpl extends ServiceImpl implements IMeterDeviceService { + /********************************** + * 用途说明: 分页查询变电站辅控设备 + * 参数说明 deviceName 设备名称 + * 参数说明 deviceModel设备型号 + * 参数说明 deviceType设备类型 + * 参数说明 status 状态 + * 参数说明 systemcode 系统编码 + * 参数说明 page + * 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page + ***********************************/ @Override public Page getDevicePage(String deviceName, String deviceModel, String deviceType, String status, String systemcode, Page page) { @@ -54,6 +65,9 @@ public class MeterDeviceServiceImpl extends ServiceImpl ids, String ip) { + if (StrUtil.isNotBlank(ip) && !Validator.isIpv4(ip)) { + throw new RuntimeException("当前ip地址不规范"); + } LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.in(MeterDevice::getDeviceId, ids).set(MeterDevice::getNetdeviceIp, ip); return this.update(updateWrapper); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java index bbeb2ba..16f393d 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java @@ -466,4 +466,10 @@ public class SubstationMaindeviceController { List treeNodes = substationMaindeviceService.getDeviceSignalTree(stationCode,signalName); return ResponseResult.successData(treeNodes); } + @GetMapping("/getComponentTree") + @ApiOperation("获取部件树(前台)") + public ResponseResult getComponentTree(String stationCode,String componentName) { + List treeNodes = substationMaindeviceService.getComponentTree(stationCode,componentName); + return ResponseResult.successData(treeNodes); + } } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java index 3bdb88a..8670d29 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java @@ -122,7 +122,28 @@ public interface ISubstationMaindeviceService extends IService> getSubstationMainDeviceTree(String stationCode,String mainDeviceName); + /********************************** + * 用途说明: 获取主设备树(前台) + * 参数说明 stationCode 变电站编号 + * 参数说明 mainDeviceName 主设备名称 + * 返回值说明: com.yfd.platform.modules.basedata.domain.TreeNode + ***********************************/ TreeNode getSubstationMainTree(String stationCode, String mainDeviceName); + /********************************** + * 用途说明: 获取信号树(前台) + * 参数说明 stationCode 变电站编号 + * 参数说明 signalName 信号名称 + * 返回值说明: java.util.List + ***********************************/ List getDeviceSignalTree(String stationCode,String signalName); + + /********************************** + * 用途说明: 获取部件树(前台) + * 参数说明 stationCode 变电站编号 + * 参数说明 componentName 部件名称 + * 返回值说明: java.util.List + ***********************************/ + List getComponentTree(String stationCode, String componentName); + } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java index 2ba56b9..a48fdd4 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java @@ -661,6 +661,12 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl + ***********************************/ @Override public List getDeviceSignalTree(String stationCode, String signalName) { List> dataList = deviceSignalService.getDeviceSignalMaps(stationCode, signalName); @@ -690,6 +702,111 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl + ***********************************/ + @Override + public List getComponentTree(String stationCode, String componentName) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotBlank(stationCode), SubstationComponent::getStationCode, stationCode); + queryWrapper.like(StrUtil.isNotBlank(componentName), SubstationComponent::getComponentName, componentName); + queryWrapper.select(SubstationComponent::getStationCode, + SubstationComponent::getStationName, SubstationComponent::getStationName, + SubstationComponent::getAreaId, + SubstationComponent::getAreaName, SubstationComponent::getBayId, SubstationComponent::getBayName, + SubstationComponent::getMainDeviceId, SubstationComponent::getMainDeviceName, + SubstationComponent::getComponentId, SubstationComponent::getComponentName); + List> dataList = substationComponentMapper.selectMaps(queryWrapper); + List treeNodes = buildComponentTree(dataList); + if (treeNodes.size() <= 0) { + return treeNodes; + } + return treeNodes.get(0).getChildren(); + } + + /********************************** + * 用途说明: 构造树 + * 参数说明 dataList 名称 + * 返回值说明: java.util.List + ***********************************/ + public List buildComponentTree(List> dataList) { + // 存储所有节点(使用ID作为键) + Map nodeMap = new HashMap<>(); + // 存储最终返回的根节点列表 + List roots = new ArrayList<>(); + // 遍历原始数据 + for (Map data : dataList) { + // 1. 解析各层级信息(根据实际字段名称调整) + String stationCode = (String) data.get("stationCode"); + String stationName = (String) data.get("stationName"); + String areaId = (String) data.get("areaId"); + String areaName = (String) data.get("areaName"); + String bayId = (String) data.get("bayId"); + String bayName = (String) data.get("bayName"); + String mainDeviceId = (String) data.get("mainDeviceId"); + String mainDeviceName = (String) data.get("mainDeviceName"); + String componentId = (String) data.get("componentId"); + String componentName = (String) data.get("componentName"); + + TreeNode stationNode = nodeMap.computeIfAbsent(stationCode, + k -> { + TreeNode node = new TreeNode(stationCode, stationName); + roots.add(node); // 将变电站作为根节点 + return node; + }); + if (StrUtil.isNotBlank(areaId)) { + // 处理变电站层级 + TreeNode areaNode = nodeMap.computeIfAbsent(areaId, + k -> { + TreeNode node = new TreeNode(areaId, areaName); + stationNode.getChildren().add(node); // 将变电站作为根节点 + return node; + }); + + // 处理区域层级 + if (StrUtil.isNotBlank(bayId)) { + TreeNode bayNode = nodeMap.computeIfAbsent(bayId, + k -> { + TreeNode node = new TreeNode(bayId, bayName); + areaNode.getChildren().add(node); + return node; + }); + + // 处理间隔层级 + if (StrUtil.isNotBlank(mainDeviceId)) { + TreeNode mainDeviceNode = nodeMap.computeIfAbsent(mainDeviceId, + k -> { + TreeNode node = new TreeNode(mainDeviceId, mainDeviceName); + bayNode.getChildren().add(node); + return node; + }); + + // 处理主设备层级 + if (StrUtil.isNotBlank(componentId)) { + TreeNode componentNode = nodeMap.computeIfAbsent(componentId, + k -> { + TreeNode node = new TreeNode(componentId, componentName); + mainDeviceNode.getChildren().add(node); + return node; + }); + } + + } + } + } + + } + return roots; + } + + /********************************** + * 用途说明: 构造树 + * 参数说明 dataList 数据 + * 返回值说明: java.util.List + ***********************************/ public List buildSignalTree(List> dataList) { // 存储所有节点(使用ID作为键) Map nodeMap = new HashMap<>(); @@ -770,6 +887,11 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl + ***********************************/ public List buildTree(List> dataList) { // 存储所有节点(使用ID作为键) Map nodeMap = new HashMap<>(); diff --git a/riis-system/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java index 26f98a5..0d97311 100644 --- a/riis-system/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/system/service/impl/SysDictionaryItemsServiceImpl.java @@ -133,11 +133,15 @@ public class SysDictionaryItemsServiceImpl extends ServiceImpl().eq(SysDictionary::getDictCode, dictcode)); + if (sysDictionary == null) { + return null; + } String id = sysDictionary.getId(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SysDictionaryItems::getDictId, id); queryWrapper.select(SysDictionaryItems::getId, SysDictionaryItems::getItemCode, - SysDictionaryItems::getDictName,SysDictionaryItems::getCustom1, SysDictionaryItems::getCustom2,SysDictionaryItems::getOrderNo); + SysDictionaryItems::getDictName, SysDictionaryItems::getCustom1, SysDictionaryItems::getCustom2, + SysDictionaryItems::getOrderNo); List> maps = sysDictionaryItemsMapper.selectMaps(queryWrapper); List> itemCode = maps.stream().sorted(Comparator.comparing(m -> Integer.valueOf(m.get( "orderno").toString()))).collect(Collectors.toList());