1.台账汇总->配网台账统计接口修改

This commit is contained in:
wr
2023-10-11 16:10:07 +08:00
parent 52aa0cfd6f
commit 17e1a7cfdf
8 changed files with 99 additions and 17 deletions

View File

@@ -17,10 +17,10 @@ public class PmsSummaryStatisticsVO {
@ApiModelProperty(name = "name", value = "统计名称") @ApiModelProperty(name = "name", value = "统计名称")
private String name; private String name;
@ApiModelProperty(name = "name", value = "统计的监测点数量") @ApiModelProperty(name = "monitorCount", value = "统计的监测点数量")
private Integer monitorCount; private Integer monitorCount;
@ApiModelProperty(name = "name", value = "统计的设备数量") @ApiModelProperty(name = "terminalCount", value = "统计的设备数量")
private Integer terminalCount; private Integer terminalCount;
@ApiModelProperty(name = "statisticsVOList", value = "干扰源类型统计") @ApiModelProperty(name = "statisticsVOList", value = "干扰源类型统计")
@@ -31,10 +31,10 @@ public class PmsSummaryStatisticsVO {
@ApiModelProperty(name = "name", value = "统计名称") @ApiModelProperty(name = "name", value = "统计名称")
private String name; private String name;
@ApiModelProperty(name = "name", value = "统计的监测点数量") @ApiModelProperty(name = "monitorCount", value = "统计的监测点数量")
private Integer monitorCount; private Integer monitorCount;
@ApiModelProperty(name = "name", value = "统计的设备数量") @ApiModelProperty(name = "terminalCount", value = "统计的设备数量")
private Integer terminalCount; private Integer terminalCount;

View File

@@ -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.po.PowerDistributionarea;
import com.njcn.device.pms.pojo.vo.DoubleUserVO; import com.njcn.device.pms.pojo.vo.DoubleUserVO;
import com.njcn.device.pms.pojo.vo.PmsPowerTreeMonitorVO; 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.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@@ -38,6 +39,17 @@ public interface DistributionMonitorMapper extends MppBaseMapper<DistributionMon
*/ */
List<PmsMonitorBaseDTO> getIdByOrgId(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam); List<PmsMonitorBaseDTO> getIdByOrgId(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam);
/**
* @Description: 新获取配网配网信息
* @param orgIds
* @return: java.util.List<com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO>
* @Author: wr
* @Date: 2023/10/11 15:18
*/
PmsSummaryStatisticsVO.SummaryVO getMonitorAndDevice(@Param("orgIds")List<String> orgIds);
/** /**
* 获取指定部门下的用电发电用户 * 获取指定部门下的用电发电用户
* @author cdf * @author cdf

View File

@@ -399,5 +399,17 @@
</if> </if>
</select> </select>
<select id="getMonitorAndDevice" resultType="com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO$SummaryVO">
SELECT
count(Monitor_Id) as monitorCount,
count(Terminal_Id) as terminalCount
FROM
pms_distribution_monitor
WHERE org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>

View File

@@ -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.param.TaiZhangDelParam;
import com.njcn.device.pms.pojo.po.DistributionMonitor; import com.njcn.device.pms.pojo.po.DistributionMonitor;
import com.njcn.device.pms.pojo.vo.DoubleUserVO; import com.njcn.device.pms.pojo.vo.DoubleUserVO;
import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO;
import java.util.List; import java.util.List;
@@ -33,6 +34,14 @@ public interface IDistributionMonitorService extends IMppService<DistributionMon
*/ */
List<PmsMonitorBaseDTO> getMonitorByCondition(List<String> deptIdList, PmsDeviceInfoParam pmsDeviceInfoParam); List<PmsMonitorBaseDTO> getMonitorByCondition(List<String> deptIdList, PmsDeviceInfoParam pmsDeviceInfoParam);
/**
* 获取组织机构下的配网监测点数量和终端数量
* @author wr
* @date 2023/10/11
* @param
*/
PmsSummaryStatisticsVO.SummaryVO getMonitorAndDevice(List<String> deptIdList);
/** /**
* 获取指定组装下的发电用电用户 * 获取指定组装下的发电用电用户

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pms.service.majornetwork;
import com.njcn.common.pojo.dto.SimpleDTO; import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO; import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO;
import java.util.List; import java.util.List;
@@ -34,5 +35,11 @@ public interface IPmsGeneralDeviceService {
List<String> getPwPmsMonitorIds(String deptId,List<String> monitorSortIds); List<String> getPwPmsMonitorIds(String deptId,List<String> monitorSortIds);
/**
* @param pmsDeviceInfoParam
* @Description: 查询监测点和终端数量
* @Author: wr
* @Date: 2023/10/11 15:34
*/
List<PmsSummaryStatisticsVO.SummaryVO> getPmsDeviceAndMonitor(PmsDeviceInfoParam pmsDeviceInfoParam);
} }

View File

@@ -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.param.TaiZhangDelParam;
import com.njcn.device.pms.pojo.po.*; import com.njcn.device.pms.pojo.po.*;
import com.njcn.device.pms.pojo.vo.DoubleUserVO; 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.device.pms.service.majornetwork.IDistributionMonitorService;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
@@ -78,6 +79,11 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
return this.baseMapper.getIdByOrgId(deptIdList, pmsDeviceInfoParam); return this.baseMapper.getIdByOrgId(deptIdList, pmsDeviceInfoParam);
} }
@Override
public PmsSummaryStatisticsVO.SummaryVO getMonitorAndDevice(List<String> deptIdList) {
return this.baseMapper.getMonitorAndDevice(deptIdList);
}
@Override @Override
public List<DoubleUserVO> getDoubleUserByDept(String orgId) { public List<DoubleUserVO> getDoubleUserByDept(String orgId) {
return this.baseMapper.getDoubleUserByDept(orgId); return this.baseMapper.getDoubleUserByDept(orgId);

View File

@@ -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.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; 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.IDistributionMonitorService;
import com.njcn.device.pms.service.majornetwork.IMonitorService; import com.njcn.device.pms.service.majornetwork.IMonitorService;
import com.njcn.device.pms.service.majornetwork.IPmsGeneralDeviceService; import com.njcn.device.pms.service.majornetwork.IPmsGeneralDeviceService;
@@ -111,6 +112,37 @@ public class PmsGeneralDeviceServiceImpl implements IPmsGeneralDeviceService {
return iDistributionMonitorService.getBaseDisMonitorIds(deptIds,monitorSortIds); return iDistributionMonitorService.getBaseDisMonitorIds(deptIds,monitorSortIds);
} }
@Override
public List<PmsSummaryStatisticsVO.SummaryVO> getPmsDeviceAndMonitor(PmsDeviceInfoParam pmsDeviceInfoParam) {
List<PmsSummaryStatisticsVO.SummaryVO> deviceInfos = new ArrayList<>();
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(pmsDeviceInfoParam.getDeptIndex(), Stream.of(0,1).collect(Collectors.toList())).getData();
List<DeptDTO> directDeptInfos = deptInfos.stream()
.filter(deptDTO -> deptDTO.getPid().equals(pmsDeviceInfoParam.getDeptIndex()))
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(directDeptInfos)) {
//没有直接子部门,获取当前部门所有信息
List<DeptDTO> 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<DeptDTO> descendantDeptDTO = deptInfos.stream()
.filter(d -> d.getPids().contains(deptDTO.getId()))
.collect(Collectors.toList());
//形成需要查询监测点的部门索引
List<String> deptIdList = descendantDeptDTO.stream()
.map(DeptDTO::getCode)
.distinct()
.collect(Collectors.toList());
deptIdList.add(deptDTO.getCode());
deviceInfos.add(getPmsDeviceAndMonitorCount(deptDTO, deptIdList));
}
}
return deviceInfos;
}
/** /**
* 查询当前部门pms台账信息 * 查询当前部门pms台账信息
* @param deptDTO 部门信息 * @param deptDTO 部门信息
@@ -157,4 +189,19 @@ public class PmsGeneralDeviceServiceImpl implements IPmsGeneralDeviceService {
pmsGeneralDeviceDTO.setMonitorIdList(monitorList.stream().map(PmsMonitorBaseDTO::getMonitorId).distinct().collect(Collectors.toList())); pmsGeneralDeviceDTO.setMonitorIdList(monitorList.stream().map(PmsMonitorBaseDTO::getMonitorId).distinct().collect(Collectors.toList()));
return pmsGeneralDeviceDTO; return pmsGeneralDeviceDTO;
} }
private PmsSummaryStatisticsVO.SummaryVO getPmsDeviceAndMonitorCount(DeptDTO deptDTO, List<String> 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;
}
} }

View File

@@ -185,21 +185,10 @@ public class PmsSummaryStatisticsServiceImpl implements PmsSummaryStatisticsServ
@Override @Override
public List<PmsSummaryStatisticsVO.SummaryVO> getDistributionPoint(PmsSummaryStatisticsParam.PwSummaryStatisticsParam param) { public List<PmsSummaryStatisticsVO.SummaryVO> getDistributionPoint(PmsSummaryStatisticsParam.PwSummaryStatisticsParam param) {
List<PmsSummaryStatisticsVO.SummaryVO> vos = new ArrayList<>();
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getOrgId()); pmsDeviceInfoParam.setDeptIndex(param.getOrgId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO()); pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> deptData = generalPmsDeviceService.getPmsDeviceInfoByOrgId(pmsDeviceInfoParam); return generalPmsDeviceService.getPmsDeviceAndMonitor(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;
} }
} }