1.台账查询bug提交

2.污区图代码更新
This commit is contained in:
wurui
2023-03-06 11:40:04 +08:00
parent 779b95d6b5
commit f3f04ae66e
4 changed files with 113 additions and 98 deletions

View File

@@ -5,7 +5,7 @@
<select id="getIdByOrgId" resultType="com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO">
SELECT
t.Operation_Id operationId,t.Power_Station_Id powerrId,t.Line_Id lineId,t.id monitorId
t.Operation_Id operationId,t.Power_Station_Id powerrId,t.Line_Id lineId,t.id monitorId,b.Terminal_Id terminalId
FROM
(
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_client WHERE org_id IN

View File

@@ -146,6 +146,7 @@ public class PmsGeneralDeviceServiceImpl implements IPmsGeneralDeviceService {
//获取monitor详细数据
List<PmsMonitorBaseDTO> monitorList = iDistributionMonitorService.getMonitorByCondition(deptIdList,pmsDeviceInfoParam);
pmsGeneralDeviceDTO.setPowerrIdList(monitorList.stream().map(PmsMonitorBaseDTO::getPowerrId).distinct().collect(Collectors.toList()));
pmsGeneralDeviceDTO.setTerminalIdList(monitorList.stream().map(PmsMonitorBaseDTO::getTerminalId).distinct().collect(Collectors.toList()));
pmsGeneralDeviceDTO.setLineIdList(monitorList.stream().map(PmsMonitorBaseDTO::getLineId).distinct().collect(Collectors.toList()));
pmsGeneralDeviceDTO.setMonitorIdList(monitorList.stream().map(PmsMonitorBaseDTO::getMonitorId).distinct().collect(Collectors.toList()));
return pmsGeneralDeviceDTO;

View File

@@ -4,16 +4,13 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.mapper.majornetwork.MonitorMapper;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsSummaryStatisticsParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO;
import com.njcn.device.pms.service.distribution.IPwMonitorService;
import com.njcn.device.pms.service.majornetwork.IPmsGeneralDeviceService;
import com.njcn.device.pms.service.majornetwork.PmsSummaryStatisticsService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
@@ -37,8 +34,8 @@ public class PmsSummaryStatisticsServiceImpl implements PmsSummaryStatisticsServ
private final DeptFeignClient deptFeignClient;
private final MonitorMapper monitorMapper;
private final IPwMonitorService iPwMonitorService;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final IPmsGeneralDeviceService generalPmsDeviceService;;
@Override
public List<PmsSummaryStatisticsVO.SummaryVO> getSeparate(PmsSummaryStatisticsParam param) {
@@ -49,7 +46,7 @@ public class PmsSummaryStatisticsServiceImpl implements PmsSummaryStatisticsServ
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getOrgId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> deptData = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
List<PmsGeneralDeviceDTO> deptData = generalPmsDeviceService.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam);
deptData.forEach(item -> {
PmsSummaryStatisticsVO.SummaryVO vo = new PmsSummaryStatisticsVO.SummaryVO();
vo.setName(item.getName());
@@ -59,7 +56,7 @@ public class PmsSummaryStatisticsServiceImpl implements PmsSummaryStatisticsServ
});
} else {
//获取当前部门下的子部门
List<DeptDTO> data = deptFeignClient.getDepSonDetailByDeptId(param.getOrgId()).getData();
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getOrgId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = data.stream().map(DeptDTO::getCode).collect(Collectors.toList());
@@ -190,41 +187,18 @@ public class PmsSummaryStatisticsServiceImpl implements PmsSummaryStatisticsServ
public List<PmsSummaryStatisticsVO.SummaryVO> getDistributionPoint(PmsSummaryStatisticsParam.PwSummaryStatisticsParam param) {
List<PmsSummaryStatisticsVO.SummaryVO> vos = new ArrayList<>();
PwPmsMonitorParam pwParam = new PwPmsMonitorParam();
pwParam.setOrgId(param.getOrgId());
List<PwPmsMonitorDTO> pwSubsetMonitorList = iPwMonitorService.getPwSubsetMonitorList(pwParam);
//获取配网监测点,统计配网有多少监测点
Map<String, List<PwPmsMonitorDTO>> pwMonitor = pwSubsetMonitorList.stream().collect(Collectors.groupingBy(PwPmsMonitorDTO::getOrgId));
//获取当前部门下的子部门
List<DeptDTO> data = deptFeignClient.getDepSonDetailByDeptId(param.getOrgId()).getData();
Map<String, String> deptMap = data.stream().collect(Collectors.toMap(DeptDTO::getCode, DeptDTO::getName));
ArrayList<PwPmsMonitorDTO> monitorsCounts = pwSubsetMonitorList.stream().collect(Collectors.collectingAndThen
(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getOrgId() + ";" + o.getTerminalId()))), ArrayList::new));
//根据部门统计有多少终端(终端数量)
Map<String, Long> monitorsTerminalCount = monitorsCounts.stream()
.collect(Collectors.groupingBy(PwPmsMonitorDTO::getOrgId, Collectors.counting()));
deptMap.forEach((key, value) -> {
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getOrgId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> deptData = generalPmsDeviceService.getPmsDeviceInfoByOrgId(pmsDeviceInfoParam);
deptData.forEach(item -> {
PmsSummaryStatisticsVO.SummaryVO vo = new PmsSummaryStatisticsVO.SummaryVO();
if (pwMonitor.containsKey(key)) {
vo.setName(value);
vo.setMonitorCount(pwMonitor.get(key).size());
vo.setTerminalCount(Math.toIntExact(monitorsTerminalCount.get(key)));
} else {
vo.setName(value);
//监测点数量
vo.setMonitorCount(0);
//设备数量
vo.setTerminalCount(0);
}
vo.setName(item.getName());
vo.setMonitorCount(item.getMonitorIdList().size());
vo.setTerminalCount(item.getTerminalIdList().size());
vos.add(vo);
});
return vos;
}

View File

@@ -1,11 +1,11 @@
package com.njcn.harmonic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.MonitorClient;
@@ -28,6 +28,8 @@ import com.njcn.harmonic.pojo.po.*;
import com.njcn.harmonic.pojo.vo.PollutionSubstationVO;
import com.njcn.harmonic.pojo.vo.PollutionVO;
import com.njcn.harmonic.service.PollutionSubstationService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import com.njcn.web.utils.RequestUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -37,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -59,6 +62,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final StatationStatClient statationStatClient;
private final MonitorClient monitorClient;
private final DeptFeignClient deptFeignClient;
private final RStatPollutionSubstationMMapper pollutionSubstationMMapper;
private final RStatPollutionSubstationYPOMapper pollutionSubstationYPOMapper;
@@ -170,7 +174,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
return list;
}
if (harmonicPublicParam.getType() == 0) {
if (harmonicPublicParam.getType() != 0) {
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(harmonicPublicParam.getDeptIndex());
//获取统计类型
@@ -187,6 +191,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pollutionVO.setData (-1.0);
setData(harmonicPublicParam, pollutionType, searchBeginTime, pollutionVO, detpid);
if(CollectionUtil.isNotEmpty(powers)){
//子集变电站
List<PollutionVO> powersVO = new ArrayList<>();
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
@@ -203,13 +208,17 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
pollutionsubVO.setId (power.getPowerId());
pollutionsubVO.setName ( power.getPowerName ());
pollutionsubVO.setPid (temp.getIndex ());
if(CollectionUtil.isNotEmpty(stringDoubleMap)){
if(stringDoubleMap.containsKey(power.getPowerId())){
pollutionsubVO.setData(stringDoubleMap.get(power.getPowerId()));
}
}
powersVO.add (pollutionsubVO) ;
});
}
powersVO.sort((item1, item2) -> item2.getData().compareTo(item1.getData()));
pollutionVO.setChildren (powersVO);
}
list.add (pollutionVO);
});
@@ -378,15 +387,22 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
String searchBeginTime = deptParam.getSearchBeginTime ( ).substring (0,10);
List<PollutionSubstationDTO> list = new ArrayList<>();
if (deptParam.getType() == 0) {
if (deptParam.getType() != 0) {
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(deptParam.getDeptIndex());
//根据部门code获取部门id
Dept dept = deptFeignClient.getDeptByCode(deptParam.getDeptIndex()).getData();
if(ObjectUtil.isNull(dept)){
return list;
}
pmsDeviceInfoParam.setDeptIndex(dept.getId());
//获取统计类型
pmsDeviceInfoParam.setStatisticalType(deptParam.getStatisticalType());
//获取主网台账信息
List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
deviceList.forEach(temp->{
List<String> powers = temp.getPowerrIdList ( );
//变电站不为空
if(CollectionUtil.isNotEmpty(powers)){
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
param.setPowerIds(powers);
List<PmsStatationStatInfoDTO> data = statationStatClient.getStatationStatInfo(param).getData();
@@ -401,12 +417,16 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
dto.setId(power.getPowerId());
dto.setName(power.getPowerName());
dto.setVoltageLevel(power.getPowerVoltageLevel());
if(CollectionUtil.isNotEmpty(stringDoubleMap)){
if(stringDoubleMap.containsKey(power.getPowerId())){
dto.setData(stringDoubleMap.get(power.getPowerId()));
}
}
list.add (dto) ;
});
}
}
});
}else{
deptParam.setServerName(generalInfo.getMicroServiceName());
@@ -487,9 +507,10 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
if (StringUtils.isBlank(RequestUtil.getDeptIndex())){
return list;
}
if (harmonicPublicParam.getType() == 0) {
if (harmonicPublicParam.getType() != 0) {
PmsStatationStatInfoParam param=new PmsStatationStatInfoParam();
param.setPowerIds(Arrays.asList(harmonicPublicParam.getId()));
//获取变电站详情
List<PmsStatationStatInfoDTO> data = statationStatClient.getStatationStatInfo(param).getData();
if(CollectionUtil.isNotEmpty(data)){
List<String> monitorId = data.stream().map(PmsStatationStatInfoDTO::getMonitorId).collect(Collectors.toList());
@@ -504,9 +525,11 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
dto.setSubstation(power.getPowerName());
dto.setSubstationId(power.getPowerId());
dto.setBusBar(power.getGeneratrixName());
if(CollectionUtil.isNotEmpty(lineMap)){
if(lineMap.containsKey(power.getMonitorId())){
dto.setData(lineMap.get(power.getMonitorId()));
}
}
list.add (dto) ;
}
}
@@ -539,6 +562,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override
public List<PollutionLineDTO> getLineRank(HarmonicPublicParam param) {
List<PollutionLineDTO> list= new ArrayList<>();
String pollutionType = param.getStatisticalType ( ).getId ();
String searchBeginTime = "";
if(Objects.equals (param.getReportFlag (),BizParamConstant.STAT_BIZ_YEAR) ){
@@ -564,22 +588,38 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
});
if(CollectionUtil.isNotEmpty(monitorIdList)){
//获取监测点数据
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList ( monitorIdList,pollutionType,searchBeginTime);
if(CollectionUtil.isEmpty(lineData)){
return list;
}
//获取主网监测点信息
List<Monitor> data = monitorClient.getMonitorList(monitorIdList).getData();
Map<String, Monitor> monitorMap = data.stream().collect(Collectors.toMap(Monitor::getId, Function.identity(), (key1, kye2) -> key1));
lineData.sort((item1, item2) -> item2.getValue().compareTo(item1.getValue()));
if (lineData.size() > Param.UP_LIMIT) {
lineData = lineData.subList(Param.DOWN_LIMIT, Param.UP_LIMIT);
}
List<Monitor> data = monitorClient.getMonitorList(monitorIdList).getData();
PollutionLineDTO dto;
for (RMpPollutionDPO lineDatum : lineData) {
if(monitorMap.containsKey(lineDatum.getLineId())){
Monitor monitor = monitorMap.get(lineDatum.getLineId());
dto=new PollutionLineDTO();
dto.setId(monitor.getId());
dto.setName(monitor.getName());
dto.setPowerCompany(monitor.getOrgName());
dto.setSubstation(monitor.getPowerrId());
dto.setSubstationId(monitor.getPowerrName());
dto.setBusBar(monitor.getLineName());
dto.setData(lineDatum.getValue());
list.add(dto);
}
deviceList.forEach(temp->{
});
return null;
}
}
return list;
}