diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/PmsSummaryStatisticsVO.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/PmsSummaryStatisticsVO.java index 64aada3e1..b55757010 100644 --- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/PmsSummaryStatisticsVO.java +++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/PmsSummaryStatisticsVO.java @@ -17,10 +17,10 @@ public class PmsSummaryStatisticsVO { @ApiModelProperty(name = "name", value = "统计名称") private String name; - @ApiModelProperty(name = "name", value = "统计的监测点数量") + @ApiModelProperty(name = "monitorCount", value = "统计的监测点数量") private Integer monitorCount; - @ApiModelProperty(name = "name", value = "统计的设备数量") + @ApiModelProperty(name = "terminalCount", value = "统计的设备数量") private Integer terminalCount; @ApiModelProperty(name = "statisticsVOList", value = "干扰源类型统计") @@ -31,10 +31,10 @@ public class PmsSummaryStatisticsVO { @ApiModelProperty(name = "name", value = "统计名称") private String name; - @ApiModelProperty(name = "name", value = "统计的监测点数量") + @ApiModelProperty(name = "monitorCount", value = "统计的监测点数量") private Integer monitorCount; - @ApiModelProperty(name = "name", value = "统计的设备数量") + @ApiModelProperty(name = "terminalCount", value = "统计的设备数量") private Integer terminalCount; diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/DistributionMonitorMapper.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/DistributionMonitorMapper.java index f42ee5775..b2d10d1c4 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/DistributionMonitorMapper.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/DistributionMonitorMapper.java @@ -16,6 +16,7 @@ import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.PowerDistributionarea; import com.njcn.device.pms.pojo.vo.DoubleUserVO; import com.njcn.device.pms.pojo.vo.PmsPowerTreeMonitorVO; +import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -38,6 +39,17 @@ public interface DistributionMonitorMapper extends MppBaseMapper getIdByOrgId(@Param("orgIds")List orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam); + /** + * @Description: 新获取配网配网信息 + * @param orgIds + * @return: java.util.List + * @Author: wr + * @Date: 2023/10/11 15:18 + */ + PmsSummaryStatisticsVO.SummaryVO getMonitorAndDevice(@Param("orgIds")List orgIds); + + + /** * 获取指定部门下的用电发电用户 * @author cdf diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml index f8d0edd06..3bdfa64c4 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml @@ -399,5 +399,17 @@ + + diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IDistributionMonitorService.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IDistributionMonitorService.java index 24d072793..50f9a5700 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IDistributionMonitorService.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IDistributionMonitorService.java @@ -11,6 +11,7 @@ import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; import com.njcn.device.pms.pojo.param.TaiZhangDelParam; import com.njcn.device.pms.pojo.po.DistributionMonitor; import com.njcn.device.pms.pojo.vo.DoubleUserVO; +import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO; import java.util.List; @@ -33,6 +34,14 @@ public interface IDistributionMonitorService extends IMppService getMonitorByCondition(List deptIdList, PmsDeviceInfoParam pmsDeviceInfoParam); + /** + * 获取组织机构下的配网监测点数量和终端数量 + * @author wr + * @date 2023/10/11 + * @param + */ + PmsSummaryStatisticsVO.SummaryVO getMonitorAndDevice(List deptIdList); + /** * 获取指定组装下的发电用电用户 diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IPmsGeneralDeviceService.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IPmsGeneralDeviceService.java index 7ae044309..f925f155a 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IPmsGeneralDeviceService.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/IPmsGeneralDeviceService.java @@ -3,6 +3,7 @@ package com.njcn.device.pms.service.majornetwork; import com.njcn.common.pojo.dto.SimpleDTO; import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO; import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; +import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO; import java.util.List; @@ -34,5 +35,11 @@ public interface IPmsGeneralDeviceService { List getPwPmsMonitorIds(String deptId,List monitorSortIds); - + /** + * @param pmsDeviceInfoParam + * @Description: 查询监测点和终端数量 + * @Author: wr + * @Date: 2023/10/11 15:34 + */ + List getPmsDeviceAndMonitor(PmsDeviceInfoParam pmsDeviceInfoParam); } diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/DistributionMonitorServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/DistributionMonitorServiceImpl.java index 1073d9405..c24ec37f5 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/DistributionMonitorServiceImpl.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/DistributionMonitorServiceImpl.java @@ -23,6 +23,7 @@ import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; import com.njcn.device.pms.pojo.param.TaiZhangDelParam; import com.njcn.device.pms.pojo.po.*; import com.njcn.device.pms.pojo.vo.DoubleUserVO; +import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO; import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataEnum; @@ -78,6 +79,11 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl deptIdList) { + return this.baseMapper.getMonitorAndDevice(deptIdList); + } + @Override public List getDoubleUserByDept(String orgId) { return this.baseMapper.getDoubleUserByDept(orgId); diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsGeneralDeviceServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsGeneralDeviceServiceImpl.java index 1b8c53e7b..08df07195 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsGeneralDeviceServiceImpl.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsGeneralDeviceServiceImpl.java @@ -5,6 +5,7 @@ import com.njcn.common.pojo.dto.SimpleDTO; import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO; import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; +import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO; import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService; import com.njcn.device.pms.service.majornetwork.IMonitorService; import com.njcn.device.pms.service.majornetwork.IPmsGeneralDeviceService; @@ -111,6 +112,37 @@ public class PmsGeneralDeviceServiceImpl implements IPmsGeneralDeviceService { return iDistributionMonitorService.getBaseDisMonitorIds(deptIds,monitorSortIds); } + @Override + public List getPmsDeviceAndMonitor(PmsDeviceInfoParam pmsDeviceInfoParam) { + List deviceInfos = new ArrayList<>(); + List deptInfos = deptFeignClient.getDeptDescendantIndexes(pmsDeviceInfoParam.getDeptIndex(), Stream.of(0,1).collect(Collectors.toList())).getData(); + List directDeptInfos = deptInfos.stream() + .filter(deptDTO -> deptDTO.getPid().equals(pmsDeviceInfoParam.getDeptIndex())) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(directDeptInfos)) { + //没有直接子部门,获取当前部门所有信息 + List dept = deptInfos.stream() + .filter(deptDTO -> deptDTO.getId().equals(pmsDeviceInfoParam.getDeptIndex())) + .collect(Collectors.toList()); + deviceInfos.add(getPmsDeviceAndMonitorCount(dept.get(0), Collections.singletonList(dept.get(0).getCode()))); + }else{ + for (DeptDTO deptDTO : directDeptInfos) { + //筛选上级部门pids包含该id的所有部门 + List descendantDeptDTO = deptInfos.stream() + .filter(d -> d.getPids().contains(deptDTO.getId())) + .collect(Collectors.toList()); + //形成需要查询监测点的部门索引 + List deptIdList = descendantDeptDTO.stream() + .map(DeptDTO::getCode) + .distinct() + .collect(Collectors.toList()); + deptIdList.add(deptDTO.getCode()); + deviceInfos.add(getPmsDeviceAndMonitorCount(deptDTO, deptIdList)); + } + } + return deviceInfos; + } + /** * 查询当前部门pms台账信息 * @param deptDTO 部门信息 @@ -157,4 +189,19 @@ public class PmsGeneralDeviceServiceImpl implements IPmsGeneralDeviceService { pmsGeneralDeviceDTO.setMonitorIdList(monitorList.stream().map(PmsMonitorBaseDTO::getMonitorId).distinct().collect(Collectors.toList())); return pmsGeneralDeviceDTO; } + + + private PmsSummaryStatisticsVO.SummaryVO getPmsDeviceAndMonitorCount(DeptDTO deptDTO, List deptIdList) { + PmsSummaryStatisticsVO.SummaryVO pmsGeneralDeviceDTO = new PmsSummaryStatisticsVO.SummaryVO(); + if (deptDTO.getType() == 0) { + pmsGeneralDeviceDTO.setName(deptDTO.getArea()); + } else { + pmsGeneralDeviceDTO.setName(deptDTO.getName()); + } + //获取monitor详细数据 + PmsSummaryStatisticsVO.SummaryVO monitorAndDevice = iDistributionMonitorService.getMonitorAndDevice(deptIdList); + pmsGeneralDeviceDTO.setMonitorCount(monitorAndDevice.getMonitorCount()); + pmsGeneralDeviceDTO.setTerminalCount(monitorAndDevice.getTerminalCount()); + return pmsGeneralDeviceDTO; + } } diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsSummaryStatisticsServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsSummaryStatisticsServiceImpl.java index 9e84c4953..5ac582cdc 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsSummaryStatisticsServiceImpl.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/PmsSummaryStatisticsServiceImpl.java @@ -185,21 +185,10 @@ public class PmsSummaryStatisticsServiceImpl implements PmsSummaryStatisticsServ @Override public List getDistributionPoint(PmsSummaryStatisticsParam.PwSummaryStatisticsParam param) { - List vos = new ArrayList<>(); - PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); pmsDeviceInfoParam.setDeptIndex(param.getOrgId()); pmsDeviceInfoParam.setStatisticalType(new SimpleDTO()); - List deptData = generalPmsDeviceService.getPmsDeviceInfoByOrgId(pmsDeviceInfoParam); - deptData.forEach(item -> { - PmsSummaryStatisticsVO.SummaryVO vo = new PmsSummaryStatisticsVO.SummaryVO(); - vo.setName(item.getName()); - vo.setMonitorCount(item.getMonitorIdList().size()); - vo.setTerminalCount(item.getTerminalIdList().size()); - vos.add(vo); - }); - - return vos; + return generalPmsDeviceService.getPmsDeviceAndMonitor(pmsDeviceInfoParam); } }