From 919c64a463684bbacf49bb1488adc101424c9cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E6=9C=A8c?= <857448963@qq.com> Date: Fri, 12 May 2023 15:25:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B0=E8=B4=A6=E7=AE=97=E6=B3=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../njcn/device/biz/pojo/dto/DeptGetBase.java | 25 + .../device/biz/pojo/dto/DeptGetBusBarDTO.java | 24 + .../biz/pojo/dto/DeptGetChildrenMoreDTO.java | 24 + .../device/biz/pojo/dto/DeptGetDeviceDTO.java | 24 + .../biz/pojo/dto/DeptGetSubStationDTO.java | 24 + .../biz/pojo/dto/LineDevGetBandDTO.java | 21 + .../device/biz/pojo/dto/LineDevGetDTO.java | 50 ++ .../device/biz/pojo/dto/TerminalGetBase.java | 23 + pqs-device/device-boot/pom.xml | 5 +- .../pms/pojo/dto/PmsMonitorBaseDTO.java | 10 + .../device/pms/pojo/po/GeneratrixWire.java | 4 + .../ledgerManger/CommTerminalController.java | 177 +++++++ .../ledgerManger/DeptMonitorController.java | 50 -- .../DistributionMonitorMapper.java | 3 + .../majornetwork/PmsGeneratrixWireMapper.java | 6 + .../mapping/DistributionMonitorMapper.xml | 202 ++++---- .../mapping/PmsGeneratrixWireMapper.xml | 7 + .../ledgerManger/CommTerminalService.java | 80 ++++ .../impl/CommTerminalServiceImpl.java | 437 ++++++++++++++++++ .../majornetwork/impl/MonitorServiceImpl.java | 12 + .../pq/controller/CommTerminalController.java | 181 +++++--- .../njcn/device/pq/mapper/DeptLineMapper.java | 8 +- .../com/njcn/device/pq/mapper/LineMapper.java | 9 + .../pq/mapper/mapping/DeptLineMapper.xml | 66 +++ .../device/pq/mapper/mapping/LineMapper.xml | 24 + .../pq/service/CommTerminalService.java | 80 ++++ .../device/pq/service/DeptLineService.java | 20 + .../service/impl/CommTerminalServiceImpl.java | 297 ++++++++++++ .../pq/service/impl/DeptLineServiceImpl.java | 16 +- .../service/impl/ComAssessServiceImpl.java | 7 +- .../njcn/system/enums/DicDataTypeEnum.java | 5 +- 31 files changed, 1722 insertions(+), 199 deletions(-) create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBase.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBusBarDTO.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetChildrenMoreDTO.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetDeviceDTO.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetSubStationDTO.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetBandDTO.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetDTO.java create mode 100644 pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/TerminalGetBase.java create mode 100644 pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/CommTerminalController.java delete mode 100644 pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/DeptMonitorController.java create mode 100644 pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/ledgerManger/CommTerminalService.java create mode 100644 pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/ledgerManger/impl/CommTerminalServiceImpl.java create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/CommTerminalService.java create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommTerminalServiceImpl.java diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBase.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBase.java new file mode 100644 index 000000000..0bbf95ecd --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBase.java @@ -0,0 +1,25 @@ +package com.njcn.device.biz.pojo.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2023/5/10 + */ +@Data +public class DeptGetBase implements Serializable { + + private static final long serialVersionUID = 1L; + + private String unitId; + + private String unitName; + + private List unitChildrenList; + +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBusBarDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBusBarDTO.java new file mode 100644 index 000000000..1ce57cc02 --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetBusBarDTO.java @@ -0,0 +1,24 @@ +package com.njcn.device.biz.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * 母线 + * @author cdf + * @date 2023/4/24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeptGetBusBarDTO extends DeptGetBase { + + @ApiModelProperty(name = "busBarIds",value = "母线/线路信息") + private List busBarIds; + + @ApiModelProperty(name = "pwBusBarIds",value = "配网母线/线路信息") + private List pwBusBarIds; +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetChildrenMoreDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetChildrenMoreDTO.java new file mode 100644 index 000000000..296a6975c --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetChildrenMoreDTO.java @@ -0,0 +1,24 @@ +package com.njcn.device.biz.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2023/4/24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeptGetChildrenMoreDTO extends DeptGetBase { + + @ApiModelProperty(name = "lineBaseList",value = "监测点信息") + private List lineBaseList; + + @ApiModelProperty(name = "pwMonitorIds",value = "配网监测点信息") + private List pwMonitorIds; +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetDeviceDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetDeviceDTO.java new file mode 100644 index 000000000..0978e52ca --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetDeviceDTO.java @@ -0,0 +1,24 @@ +package com.njcn.device.biz.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * 母线 + * @author cdf + * @date 2023/4/24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeptGetDeviceDTO extends DeptGetBase { + + @ApiModelProperty(name = "deviceList",value = "装置信息") + private List deviceList; + + @ApiModelProperty(name = "pwDeviceList",value = "配网装置信息") + private List pwDeviceList; +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetSubStationDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetSubStationDTO.java new file mode 100644 index 000000000..99536d9d9 --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/DeptGetSubStationDTO.java @@ -0,0 +1,24 @@ +package com.njcn.device.biz.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2023/4/24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeptGetSubStationDTO extends DeptGetBase { + + @ApiModelProperty(name = "stationIds",value = "电站信息") + private List stationIds; + + @ApiModelProperty(name = "pwStationIds",value = "配网电站信息") + private List pwStationIds; +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetBandDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetBandDTO.java new file mode 100644 index 000000000..3b7f05260 --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetBandDTO.java @@ -0,0 +1,21 @@ +package com.njcn.device.biz.pojo.dto; + +import lombok.Data; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2023/5/11 + */ +@Data +public class LineDevGetBandDTO { + + private List zwList; + + private List pwList; + + +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetDTO.java new file mode 100644 index 000000000..3cbb30d60 --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDevGetDTO.java @@ -0,0 +1,50 @@ +package com.njcn.device.biz.pojo.dto; + +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * pqs + * + * @author cdf + * @date 2023/5/10 + */ +@Data +public class LineDevGetDTO { + /** + * 部门索引 + */ + private String unitId; + + /** + * 监测点索引 + */ + private String pointId; + + /** + * 监测点电压等级 + */ + private String voltageLevel; + + /** + * 监测点统计间隔 + */ + private Integer interval; + + /** + * 装置索引 + */ + private String devId; + + private Integer type; + + /** + * 装置通讯状态 + */ + private Integer comFlag; + + private LocalDateTime updateTime; + + +} diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/TerminalGetBase.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/TerminalGetBase.java new file mode 100644 index 000000000..1a90a0a46 --- /dev/null +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/TerminalGetBase.java @@ -0,0 +1,23 @@ +package com.njcn.device.biz.pojo.dto; + +import lombok.Data; + +/** + * pqs + * + * @author cdf + * @date 2023/5/10 + */ +@Data +public class TerminalGetBase { + + /** + * 单位id + */ + private String unitId; + + /** + * 台账(监测点,母线,装置,电站,供电公司)id + */ + private String ledgerId; +} diff --git a/pqs-device/device-boot/pom.xml b/pqs-device/device-boot/pom.xml index 03e054944..91973a7ab 100644 --- a/pqs-device/device-boot/pom.xml +++ b/pqs-device/device-boot/pom.xml @@ -19,13 +19,14 @@ + + com.njcn pq-device-boot ${project.version} - - + + pq_dept_line.id unitId, + point.id pointId, + lineDetail.Time_Interval as `interval`, + dic.value voltageLevel, + dev.id devId, + device.com_flag comFlag + + + + DISTINCT + pq_dept_line.id unitId, + dic.value voltageLevel, + voltage.id pointId + + + + + DISTINCT + pq_dept_line.id unitId, + dev.id devId, + dic.value voltageLevel, + 1 as type , + device.update_time + + from pq_dept_line pq_dept_line + inner join pq_line point on pq_dept_line.line_id = point.id + inner join pq_line_detail lineDetail on point.id = lineDetail.id + inner join pq_line voltage on point.pid = voltage.id + inner join pq_voltage pq_voltage on voltage.id = pq_voltage.id + inner join sys_dict_data dic on pq_voltage.Scale= dic.id + inner join pq_line dev on voltage.pid = dev.id + inner join pq_device device on dev.id = device.id + where device.Dev_Model = 1 + and point.state = 1 + and device.Dev_Data_Type in + + #{item} + + + + + + diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml index 6aa582758..cbd771756 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml @@ -1065,4 +1065,28 @@ and a.state = 1 + + + diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/CommTerminalService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/CommTerminalService.java new file mode 100644 index 000000000..2b80502bb --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/CommTerminalService.java @@ -0,0 +1,80 @@ +package com.njcn.device.pq.service; + +import com.njcn.device.biz.pojo.dto.*; +import com.njcn.device.biz.pojo.param.DeptGetLineParam; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2023/5/10 + */ + +public interface CommTerminalService { + + + /** + *通过部门获取所有子集部门所拥有的监测点 + * @author cdf + * @date 2023/5/10 + */ + List deptGetLineList(DeptGetLineParam deptGetLineParam); + + /** + * 根据单位获取所有子单位信息 + * @author cdf + * @date 2023/5/10 + */ + List getDeptChildrenByParent(DeptGetLineParam deptGetLineParam); + + /** + * 根据单位获取单位监测点 + * @author cdf + * @date 2023/5/10 + */ + List deptGetLine(DeptGetLineParam deptGetLineParam); + + /** + * 根据单位获取所有变电站 + * @author cdf + * @date 2023/5/10 + */ + List deptSubStation(DeptGetLineParam deptGetLineParam); + + + /** + * 根据单位获取所有变电站 + * @author cdf + * @date 2023/5/10 + */ + List deptBusBar(DeptGetLineParam deptGetLineParam); + + + /** + * 根据单位获取所有装置 + * @author cdf + * @date 2023/5/10 + */ + List deptGetDevice(DeptGetLineParam deptGetLineParam); + + /** + * 根据单位获取所有装置 + * @author cdf + * @date 2023/5/10 + */ + List substationGetLine(String substationId); + + + /** + * 根据母线获取监测点信息 + * @author cdf + * @date 2023/5/10 + */ + List busBarGetLine(String busBarId); + + + + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeptLineService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeptLineService.java index 5b068a6f0..649132dc7 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeptLineService.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeptLineService.java @@ -1,6 +1,7 @@ package com.njcn.device.pq.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.web.pojo.param.DeptLineParam; @@ -64,4 +65,23 @@ public interface DeptLineService extends IService { + /** + * 获取根据单位分组的监测点集合信息 + * param devType 装置类型 0暂态 1稳态 2 双类型 + * param type 装置类型 1监测点 2母线 3 装置 + * @author cdf + * @date 2023/5/10 + */ + Map> lineDevGet(List devType,Integer type); + + + + /** + * 获取根据单位分组的变电站集合信息 + * @author cdf + * @date 2023/5/10 + */ + Map> orgSubStationGet(List devType); + + } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommTerminalServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommTerminalServiceImpl.java new file mode 100644 index 000000000..e297fcc77 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommTerminalServiceImpl.java @@ -0,0 +1,297 @@ +package com.njcn.device.pq.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.njcn.common.pojo.enums.common.ServerEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.utils.EnumUtils; +import com.njcn.device.biz.pojo.dto.*; +import com.njcn.device.biz.pojo.param.DeptGetLineParam; +import com.njcn.device.pq.mapper.LineMapper; +import com.njcn.device.pq.service.CommTerminalService; +import com.njcn.device.pq.service.DeptLineService; +import com.njcn.redis.utils.RedisUtil; +import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.pojo.dto.DeptDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * pqs + * + * @author cdf + * @date 2023/5/10 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class CommTerminalServiceImpl implements CommTerminalService { + + private final String commTerminal = "commTerminal#"; + + private final DeptLineService deptLineService; + + private final DeptFeignClient deptFeignClient; + + private final RedisUtil redisUtil; + + private final LineMapper lineMapper; + + + + + + /** + * 基础获取单位信息 + * @author cdf + * @date 2023/5/10 + */ + @Override + public List getDeptChildrenByParent(DeptGetLineParam deptGetLineParam) { + /*List redisResult = (List) redisUtil.getObjectByKey(commTerminal + deptGetLineParam.getDeptId()); + if (CollectionUtil.isNotEmpty(redisResult)) { + return redisResult; + }*/ + List result = new ArrayList<>(); + List deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptGetLineParam.getDeptId(), Stream.of(0, 1).collect(Collectors.toList())).getData(); + deptDTOList.forEach(it -> { + DeptGetBase deptGetBase = new DeptGetBase(); + deptGetBase.setUnitId(it.getId()); + deptGetBase.setUnitName(it.getName()); + List deptChildren = deptDTOList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList()); + deptChildren.add(it.getId()); + deptGetBase.setUnitChildrenList(deptChildren); + result.add(deptGetBase); + }); + redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(),result); + return result; + } + + + @Override + public List deptGetLine(DeptGetLineParam deptGetLineParam) { + List result = new ArrayList<>(); + List temDept = getDeptChildrenByParent(deptGetLineParam); + Map> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),1); + temDept.forEach(item -> { + DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO(); + deptGetChildrenMoreDTO.setUnitId(item.getUnitId()); + deptGetChildrenMoreDTO.setUnitName(item.getUnitName()); + deptGetChildrenMoreDTO.setUnitChildrenList(item.getUnitChildrenList()); + List deptIds = item.getUnitChildrenList(); + if (CollectionUtil.isNotEmpty(deptIds)) { + List lineList = new ArrayList<>(); + deptIds.forEach(i -> { + if (map.containsKey(i)) { + lineList.addAll(map.get(i)); + } + }); + deptGetChildrenMoreDTO.setLineBaseList(lineList); + } + result.add(deptGetChildrenMoreDTO); + }); + return result; + } + + + @Override + public List deptSubStation(DeptGetLineParam deptGetLineParam) { + List result = new ArrayList<>(); + List temDept = getDeptChildrenByParent(deptGetLineParam); + Map> map = deptLineService.orgSubStationGet(filterDataTypeNew(deptGetLineParam.getServerName())); + temDept.forEach(item -> { + DeptGetSubStationDTO deptGetSubStationDTO = new DeptGetSubStationDTO(); + deptGetSubStationDTO.setUnitId(item.getUnitId()); + deptGetSubStationDTO.setUnitName(item.getUnitName()); + deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList()); + List deptIds = item.getUnitChildrenList(); + if (CollectionUtil.isNotEmpty(deptIds)) { + List lineList = new ArrayList<>(); + deptIds.forEach(i -> { + if (map.containsKey(i)) { + lineList.addAll(map.get(i)); + } + }); + deptGetSubStationDTO.setStationIds(lineList); + } + result.add(deptGetSubStationDTO); + }); + return result; + } + + @Override + public List deptBusBar(DeptGetLineParam deptGetLineParam) { + List result = new ArrayList<>(); + List temDept = getDeptChildrenByParent(deptGetLineParam); + Map> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),2); + temDept.forEach(item -> { + DeptGetBusBarDTO deptGetBusBarDTO = new DeptGetBusBarDTO(); + deptGetBusBarDTO.setUnitId(item.getUnitId()); + deptGetBusBarDTO.setUnitName(item.getUnitName()); + deptGetBusBarDTO.setUnitChildrenList(item.getUnitChildrenList()); + List deptIds = item.getUnitChildrenList(); + if (CollectionUtil.isNotEmpty(deptIds)) { + List lineList = new ArrayList<>(); + deptIds.forEach(i -> { + if (map.containsKey(i)) { + lineList.addAll(map.get(i).stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList())); + } + }); + deptGetBusBarDTO.setBusBarIds(lineList); + } + result.add(deptGetBusBarDTO); + }); + return result; + } + + @Override + public List deptGetDevice(DeptGetLineParam deptGetLineParam) { + List result = new ArrayList<>(); + List temDept = getDeptChildrenByParent(deptGetLineParam); + Map> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),3); + temDept.forEach(item -> { + DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO(); + deptGetDeviceDTO.setUnitId(item.getUnitId()); + deptGetDeviceDTO.setUnitName(item.getUnitName()); + deptGetDeviceDTO.setUnitChildrenList(item.getUnitChildrenList()); + List deptIds = item.getUnitChildrenList(); + if (CollectionUtil.isNotEmpty(deptIds)) { + List devGetDTOList = new ArrayList<>(); + deptIds.forEach(i -> { + if (map.containsKey(i)) { + devGetDTOList.addAll(map.get(i)); + } + }); + deptGetDeviceDTO.setDeviceList(devGetDTOList); + } + result.add(deptGetDeviceDTO); + }); + return result; + } + + @Override + public List substationGetLine(String substationId) { + return lineMapper.getLineBySubStation(substationId); + } + + @Override + public List busBarGetLine(String busBarId) { + return lineMapper.getLineBySubStation(busBarId); + } + + + private void getChildrenByParent(List deptAllList, List res) { + deptAllList.forEach(it -> { + DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO(); + deptGetChildrenMoreDTO.setUnitId(it.getId()); + deptGetChildrenMoreDTO.setUnitName(it.getName()); + List deptChildren = deptAllList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList()); + deptChildren.add(it.getId()); + deptGetChildrenMoreDTO.setUnitChildrenList(deptChildren); + res.add(deptGetChildrenMoreDTO); + }); + } + + + private List filterDataTypeNew(String serverName) { + List devType = new ArrayList<>(); + devType.add(2); + ServerEnum serverEnum = EnumUtils.getServerEnumByName(serverName); + switch (serverEnum) { + case EVENT: + devType.add(0); + break; + case HARMONIC: + devType.add(1); + break; + default: + devType.add(0); + devType.add(1); + break; + } + return devType; + } + + + + + + + + + + + + + /*-------------------------------------------------------------------------------------*/ + + /** + * @author cdf + * @date 2023/5/10 + */ + @Override + public List deptGetLineList(DeptGetLineParam deptGetLineParam) { + List all = new ArrayList<>(); + List deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptGetLineParam.getDeptId(), Stream.of(0, 1).collect(Collectors.toList())).getData(); + getAllChildren(deptGetLineParam.getDeptId(), deptDTOList, all); + Map> map = deptLineService.getLineByDeptRelation(filterDataType(deptGetLineParam.getServerName())); + all.forEach(item -> { + List itemDeptChildren = item.getDeptChildren(); + if (CollectionUtil.isNotEmpty(itemDeptChildren)) { + List lineIds = new ArrayList<>(); + itemDeptChildren.forEach(i -> { + if (map.containsKey(i)) { + lineIds.addAll(map.get(i)); + } + }); + item.setLineIds(lineIds); + } + }); + return all; + } + + /** + * 筛选数据类型 + */ + private Integer filterDataType(String serverName) { + ServerEnum serverEnum = EnumUtils.getServerEnumByName(serverName); + switch (serverEnum) { + case EVENT: + return 0; + case HARMONIC: + return 1; + default: + throw new BusinessException(CommonResponseEnum.INVALID_PARAMETER); + } + + } + + + /** + * 获取指定部门所有子孙部门id + * + * @author cdf + * @date 2023/4/24 + */ + private void getAllChildren(String deptId, List deptAllList, List res) { + deptAllList.stream().filter(item -> item.getPid().equals(deptId)).forEach(it -> { + List deptChildren = deptAllList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList()); + deptChildren.add(it.getId()); + DeptGetChildrenDTO generalDeviceDTO = new DeptGetChildrenDTO(); + generalDeviceDTO.setDeptId(it.getId()); + generalDeviceDTO.setDeptName(it.getName()); + generalDeviceDTO.setDeptChildren(deptChildren); + res.add(generalDeviceDTO); + getAllChildren(it.getId(), deptAllList, res); + }); + } + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java index 770ac049a..2806d651d 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java @@ -2,7 +2,9 @@ package com.njcn.device.pq.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.device.biz.pojo.dto.TerminalGetBase; import com.njcn.device.pq.mapper.DeptLineMapper; +import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.service.DeptLineService; import com.njcn.web.pojo.param.DeptLineParam; @@ -11,7 +13,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -85,5 +86,18 @@ public class DeptLineServiceImpl extends ServiceImpl i return deptLines.stream ( ).collect (Collectors.groupingBy (DeptLine::getId, Collectors.mapping (DeptLine::getLineId,Collectors.toList ()))); } + @Override + public Map> lineDevGet(List devDataType,Integer type) { + List deptLines = deptLineMapper.lineDevGet(devDataType,type); + return deptLines.stream ().collect (Collectors.groupingBy (LineDevGetDTO::getUnitId)); + } + + @Override + public Map> orgSubStationGet(List devDataType) { + List deptLines = deptLineMapper.orgSubStationGet(devDataType); + return deptLines.stream ().collect (Collectors.groupingBy (TerminalGetBase::getUnitId, Collectors.mapping (TerminalGetBase::getLedgerId,Collectors.toList ()))); + } + + } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java index 7cbae57f8..c3b823699 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java @@ -63,7 +63,10 @@ public class ComAssessServiceImpl extends ServiceImpl subDataList = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(comAccessParam).getData(); if (!CollectionUtils.isEmpty(deviceDataList)) { - deviceDataList.forEach(dept-> { + for(GeneralDeviceDTO dept : deviceDataList){ + if(CollectionUtils.isEmpty(dept.getLineIndexes())){ + continue; + } ComAssessVO comAssessVO = new ComAssessVO(); comAssessVO.setName(dept.getName()); comAssessVO.setMonitors(dept.getLineIndexes().size()); @@ -98,7 +101,7 @@ public class ComAssessServiceImpl extends ServiceImpl list = comAssessVOList.stream().sorted(Comparator.comparing(ComAssessVO::getData).reversed()).collect(Collectors.toList()); diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java index 387262251..57aff0d27 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java @@ -22,7 +22,10 @@ public enum DicDataTypeEnum { DEV_LEVEL("终端等级","Dev_Level"), DEV_CONNECT("接线方式","Dev_Connect"), DEV_MANUFACTURER("制造厂商","Dev_Manufacturers"), + //电压等级用去pq不区分交直流 DEV_VOLTAGE("电压等级","Dev_Voltage"), + //标准电压等级用去pms区分交直流 + DEV_VOLTAGE_STAND("标准电压等级","Dev_Voltage_Stand"), EVENT_REASON("暂降原因","Event_Reason"), EVENT_TYPE("暂降类型","Event_Type"), BUSINESS_TYPE("行业类型","Business_Type"), @@ -63,7 +66,7 @@ public enum DicDataTypeEnum { WORK_ORDER_PROCESS("工单流程","Work_Order_Process"), ASSESS_RESULT("评估结果","Assess_Result"), WORK_ORDER_TYPE("工单类型","Work_Order_Type"), - DEV_VOLTAGE_STAND("标准电压等级","Dev_Voltage_Stand"), + PRIMARY_TYPE("一级业务类型","Primary_Type"), DEV_CLASS("终端类型(治理)","Dev_Class"), CS_STATISTICAL_TYPE("治理统计类型","Cs_Statistical_Type"),