优化网关机、设备、信号逻辑
This commit is contained in:
parent
2df7cbd1ea
commit
68b03ba53f
@ -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<DeviceSignal> page) {
|
||||
public ResponseResult getDeviceSignalPage(String mainDeviceId, String componentId, String signalName, Page<DeviceSignal> page) {
|
||||
//参数校验 辅控设备ID不能为空
|
||||
if (StrUtil.isBlank(deviceId)) {
|
||||
if (StrUtil.isBlank(componentId)) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
Page<DeviceSignal> deviceSignalPage = deviceSignalService.getDeviceSignalPage(deviceId, signalName, page);
|
||||
Page<DeviceSignal> 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<DeviceSignal> 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<DeviceSignal> 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<String, Object> map = deviceSignalService.querySignalDataById(signalId);
|
||||
return ResponseResult.successData(map);
|
||||
|
@ -48,7 +48,7 @@ public class DeviceSignal implements Serializable {
|
||||
/**
|
||||
* 关联一次设备中部件ID,iis_substation_component
|
||||
*/
|
||||
private String mainCompnentId;
|
||||
private String mainComponentId;
|
||||
|
||||
/**
|
||||
* 信号类型 0-普通信号 1-告警信号
|
||||
|
@ -16,9 +16,23 @@ import java.util.List;
|
||||
*/
|
||||
public interface DeviceWorkDataMapper extends BaseMapper<DeviceWorkData> {
|
||||
|
||||
Page<DeviceWorkData> getDeviceWorkDataPage(Page<DeviceWorkData> page,String signalId, String startDate, String endDate);
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站设备运行记录
|
||||
* 参数说明 page 分页参数
|
||||
* 参数说明 signalId 信号Id
|
||||
* 参数说明 startDate 开始时间
|
||||
* 参数说明 endDate 结束时间
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain
|
||||
* .DeviceWorkData>
|
||||
***********************************/
|
||||
Page<DeviceWorkData> getDeviceWorkDataPage(Page<DeviceWorkData> page, String signalId, String startDate,
|
||||
String endDate);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询历史曲线
|
||||
* 参数说明 signalId 信号id
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData>
|
||||
***********************************/
|
||||
List<DeviceWorkData> getHistoricalCurve(String signalId);
|
||||
|
||||
|
||||
}
|
||||
|
@ -46,15 +46,27 @@ public interface IDeviceSignalService extends IService<DeviceSignal> {
|
||||
|
||||
/**********************************
|
||||
* 用途说明:
|
||||
* 参数说明 deviceId 设备ID
|
||||
* mainDeviceId 主设备设备ID
|
||||
* componentId 部件ID
|
||||
* 参数说明 signalName 信号名称
|
||||
* 参数说明 page
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain.DeviceSignal>
|
||||
***********************************/
|
||||
Page<DeviceSignal> getDeviceSignalPage(String deviceId, String signalName, Page<DeviceSignal> page);
|
||||
Page<DeviceSignal> getDeviceSignalPage(String mainDeviceId, String componentId, String signalName, Page<DeviceSignal> page);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 获取信号集合
|
||||
* 参数说明 stationCode 变电站编号
|
||||
* 参数说明 signalName 信号名称
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
List<Map<String, Object>> getDeviceSignalMaps(String stationCode, String signalName);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据信号id查询信号信息
|
||||
* 参数说明 signalId 信号ID
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
Map<String, Object> querySignalDataById(String signalId);
|
||||
|
||||
}
|
||||
|
@ -28,8 +28,21 @@ public interface IDeviceWorkDataService extends IService<DeviceWorkData> {
|
||||
***********************************/
|
||||
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<com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData>
|
||||
***********************************/
|
||||
Page<DeviceWorkData> getDeviceWorkDataPage(Page<DeviceWorkData> page,String signalId, String startDate, String endDate);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询历史曲线
|
||||
* 参数说明 signalId 信号id
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData>
|
||||
***********************************/
|
||||
List<DeviceWorkData> getHistoricalCurve(String signalId);
|
||||
|
||||
}
|
||||
|
@ -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<DeviceSignalMapper, Dev
|
||||
|
||||
@Resource
|
||||
private DeviceSignalMapper deviceSignalMapper;
|
||||
@Resource
|
||||
private SubstationComponentMapper substationComponentMapper;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 修改变电站辅控设备信号
|
||||
@ -87,6 +91,14 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
public boolean addDeviceSignal(DeviceSignal deviceSignal) {
|
||||
deviceSignal.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
deviceSignal.setLastmodifydate(new Timestamp(System.currentTimeMillis()));
|
||||
String compnentId = deviceSignal.getMainComponentId();
|
||||
if (StrUtil.isNotBlank(compnentId)) {
|
||||
SubstationComponent substationComponent = substationComponentMapper.selectById(compnentId);
|
||||
if (substationComponent == null) {
|
||||
throw new RuntimeException("当前部件不存在");
|
||||
}
|
||||
deviceSignal.setMainDeviceId(substationComponent.getMainDeviceId());
|
||||
}
|
||||
return this.saveOrUpdate(deviceSignal);
|
||||
}
|
||||
|
||||
@ -99,6 +111,14 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
public boolean updateDeviceSignal(DeviceSignal deviceSignal) {
|
||||
deviceSignal.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
deviceSignal.setLastmodifydate(new Timestamp(System.currentTimeMillis()));
|
||||
String componentId = deviceSignal.getMainComponentId();
|
||||
if (StrUtil.isNotBlank(componentId)) {
|
||||
SubstationComponent substationComponent = substationComponentMapper.selectById(componentId);
|
||||
if (substationComponent == null) {
|
||||
throw new RuntimeException("当前部件不存在");
|
||||
}
|
||||
deviceSignal.setMainDeviceId(substationComponent.getMainDeviceId());
|
||||
}
|
||||
return this.saveOrUpdate(deviceSignal);
|
||||
}
|
||||
|
||||
@ -111,28 +131,42 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
* .DeviceSignal>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<DeviceSignal> getDeviceSignalPage(String deviceId, String signalName, Page<DeviceSignal> page) {
|
||||
public Page<DeviceSignal> getDeviceSignalPage(String mainDeviceId, String componentId, String signalName,
|
||||
Page<DeviceSignal> page) {
|
||||
LambdaQueryWrapper<DeviceSignal> 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<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
@Override
|
||||
public List<Map<String, Object>> getDeviceSignalMaps(String stationCode, String signalName) {
|
||||
return deviceSignalMapper.getDeviceSignalMaps(stationCode, signalName);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据信号id查询信号信息
|
||||
* 参数说明 signalId 信号ID
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
@Override
|
||||
public Map<String, Object> querySignalDataById(String signalId) {
|
||||
return deviceSignalMapper.querySignalDataById(signalId);
|
||||
|
@ -71,11 +71,24 @@ public class DeviceWorkDataServiceImpl extends ServiceImpl<DeviceWorkDataMapper,
|
||||
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站设备运行记录
|
||||
* 参数说明 page 分页参数
|
||||
* 参数说明 signalId 信号Id
|
||||
* 参数说明 startDate 开始时间
|
||||
* 参数说明 endDate 结束时间
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<DeviceWorkData> getDeviceWorkDataPage(Page<DeviceWorkData> page,String signalId, String startDate, String endDate) {
|
||||
return deviceWorkDataMapper.getDeviceWorkDataPage(page,signalId,startDate,endDate);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询历史曲线
|
||||
* 参数说明 signalId 信号id
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.auxcontrol.domain.DeviceWorkData>
|
||||
***********************************/
|
||||
@Override
|
||||
public List<DeviceWorkData> getHistoricalCurve(String signalId) {
|
||||
return deviceWorkDataMapper.getHistoricalCurve(signalId);
|
||||
|
@ -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<GatewayDeviceMapper, G
|
||||
this.update(queryWrapper);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站网关设备
|
||||
* 参数说明 deviceName 设备名称
|
||||
* 参数说明 deviceModel 设备型号
|
||||
* 参数说明 deviceType 设备类型
|
||||
* 参数说明 status 状态
|
||||
* 参数说明 page
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain.GatewayDevice>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<GatewayDevice> getGatewayDevicePage(String stationId, String deviceName, String deviceModel,
|
||||
String deviceType,
|
||||
@ -106,6 +116,9 @@ public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, G
|
||||
throw new RuntimeException("当前ip已经有网关机绑定");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(gatewayDevice.getIpAddr()) && !Validator.isIpv4(gatewayDevice.getIpAddr())) {
|
||||
throw new RuntimeException("当前ip地址不规范");
|
||||
}
|
||||
return this.saveOrUpdate(gatewayDevice);
|
||||
}
|
||||
|
||||
@ -125,6 +138,11 @@ public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, G
|
||||
throw new RuntimeException("当前ip已经有网关机绑定");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(gatewayDevice.getIpAddr()) && !Validator.isIpv4(gatewayDevice.getIpAddr())) {
|
||||
throw new RuntimeException("当前ip地址不规范");
|
||||
}
|
||||
|
||||
return this.saveOrUpdate(gatewayDevice);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -28,6 +29,16 @@ import java.util.Map;
|
||||
@Service
|
||||
public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, MeterDevice> implements IMeterDeviceService {
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备
|
||||
* 参数说明 deviceName 设备名称
|
||||
* 参数说明 deviceModel设备型号
|
||||
* 参数说明 deviceType设备类型
|
||||
* 参数说明 status 状态
|
||||
* 参数说明 systemcode 系统编码
|
||||
* 参数说明 page
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain.MeterDevice>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<MeterDevice> getDevicePage(String deviceName, String deviceModel, String deviceType, String status,
|
||||
String systemcode, Page<MeterDevice> page) {
|
||||
@ -54,6 +65,9 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
||||
throw new RuntimeException("当前ip已经有设备绑定");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(meterDevice.getIpAddr()) && !Validator.isIpv4(meterDevice.getIpAddr())) {
|
||||
throw new RuntimeException("当前ip地址不规范");
|
||||
}
|
||||
meterDevice.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
//当前操作时间 最近修改时间
|
||||
meterDevice.setLastmodifydate(new Timestamp(System.currentTimeMillis()));
|
||||
@ -76,6 +90,9 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
||||
throw new RuntimeException("当前ip已经有设备绑定");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(meterDevice.getIpAddr()) && !Validator.isIpv4(meterDevice.getIpAddr())) {
|
||||
throw new RuntimeException("当前ip地址不规范");
|
||||
}
|
||||
meterDevice.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
//当前操作时间 最近修改时间
|
||||
meterDevice.setLastmodifydate(new Timestamp(System.currentTimeMillis()));
|
||||
@ -90,6 +107,9 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean batchUpdateDeviceIp(List<String> ids, String ip) {
|
||||
if (StrUtil.isNotBlank(ip) && !Validator.isIpv4(ip)) {
|
||||
throw new RuntimeException("当前ip地址不规范");
|
||||
}
|
||||
LambdaUpdateWrapper<MeterDevice> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.in(MeterDevice::getDeviceId, ids).set(MeterDevice::getNetdeviceIp, ip);
|
||||
return this.update(updateWrapper);
|
||||
|
@ -466,4 +466,10 @@ public class SubstationMaindeviceController {
|
||||
List<TreeNode> treeNodes = substationMaindeviceService.getDeviceSignalTree(stationCode,signalName);
|
||||
return ResponseResult.successData(treeNodes);
|
||||
}
|
||||
@GetMapping("/getComponentTree")
|
||||
@ApiOperation("获取部件树(前台)")
|
||||
public ResponseResult getComponentTree(String stationCode,String componentName) {
|
||||
List<TreeNode> treeNodes = substationMaindeviceService.getComponentTree(stationCode,componentName);
|
||||
return ResponseResult.successData(treeNodes);
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,28 @@ public interface ISubstationMaindeviceService extends IService<SubstationMaindev
|
||||
***********************************/
|
||||
List<Map<String, Object>> 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<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
List<TreeNode> getDeviceSignalTree(String stationCode,String signalName);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 获取部件树(前台)
|
||||
* 参数说明 stationCode 变电站编号
|
||||
* 参数说明 componentName 部件名称
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
List<TreeNode> getComponentTree(String stationCode, String componentName);
|
||||
|
||||
}
|
||||
|
@ -661,6 +661,12 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl<SubstationMaind
|
||||
return mainDeviceTree;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 获取主设备树(前台)
|
||||
* 参数说明 stationCode 变电站编号
|
||||
* 参数说明 mainDeviceName 主设备名称
|
||||
* 返回值说明: com.yfd.platform.modules.basedata.domain.TreeNode
|
||||
***********************************/
|
||||
@Override
|
||||
public TreeNode getSubstationMainTree(String stationCode, String mainDeviceName) {
|
||||
|
||||
@ -680,6 +686,12 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl<SubstationMaind
|
||||
return treeNodes.get(0);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 获取信号树(前台)
|
||||
* 参数说明 stationCode 变电站编号
|
||||
* 参数说明 signalName 信号名称
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
@Override
|
||||
public List<TreeNode> getDeviceSignalTree(String stationCode, String signalName) {
|
||||
List<Map<String, Object>> dataList = deviceSignalService.getDeviceSignalMaps(stationCode, signalName);
|
||||
@ -690,6 +702,111 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl<SubstationMaind
|
||||
return treeNodes.get(0).getChildren();
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 获取部件树(前台)
|
||||
* 参数说明 stationCode 变电站编号
|
||||
* 参数说明 componentName 信号名称
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
@Override
|
||||
public List<TreeNode> getComponentTree(String stationCode, String componentName) {
|
||||
LambdaQueryWrapper<SubstationComponent> 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<Map<String, Object>> dataList = substationComponentMapper.selectMaps(queryWrapper);
|
||||
List<TreeNode> treeNodes = buildComponentTree(dataList);
|
||||
if (treeNodes.size() <= 0) {
|
||||
return treeNodes;
|
||||
}
|
||||
return treeNodes.get(0).getChildren();
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 构造树
|
||||
* 参数说明 dataList 名称
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
public List<TreeNode> buildComponentTree(List<Map<String, Object>> dataList) {
|
||||
// 存储所有节点(使用ID作为键)
|
||||
Map<String, TreeNode> nodeMap = new HashMap<>();
|
||||
// 存储最终返回的根节点列表
|
||||
List<TreeNode> roots = new ArrayList<>();
|
||||
// 遍历原始数据
|
||||
for (Map<String, Object> 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<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
public List<TreeNode> buildSignalTree(List<Map<String, Object>> dataList) {
|
||||
// 存储所有节点(使用ID作为键)
|
||||
Map<String, TreeNode> nodeMap = new HashMap<>();
|
||||
@ -770,6 +887,11 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl<SubstationMaind
|
||||
return roots;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 构建主设备树
|
||||
* 参数说明 dataList 数据
|
||||
* 返回值说明: java.util.List<com.yfd.platform.modules.basedata.domain.TreeNode>
|
||||
***********************************/
|
||||
public List<TreeNode> buildTree(List<Map<String, Object>> dataList) {
|
||||
// 存储所有节点(使用ID作为键)
|
||||
Map<String, TreeNode> nodeMap = new HashMap<>();
|
||||
|
@ -133,11 +133,15 @@ public class SysDictionaryItemsServiceImpl extends ServiceImpl<SysDictionaryItem
|
||||
SysDictionary sysDictionary =
|
||||
sysDictionaryMapper.selectOne(new LambdaQueryWrapper<SysDictionary>().eq(SysDictionary::getDictCode,
|
||||
dictcode));
|
||||
if (sysDictionary == null) {
|
||||
return null;
|
||||
}
|
||||
String id = sysDictionary.getId();
|
||||
LambdaQueryWrapper<SysDictionaryItems> 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<Map<String, Object>> maps = sysDictionaryItemsMapper.selectMaps(queryWrapper);
|
||||
List<Map<String, Object>> itemCode = maps.stream().sorted(Comparator.comparing(m -> Integer.valueOf(m.get(
|
||||
"orderno").toString()))).collect(Collectors.toList());
|
||||
|
Loading…
Reference in New Issue
Block a user