1.变压器bug修改。

2.冀北首页变压器统计相关业务代码提交
This commit is contained in:
wr
2023-08-09 19:11:21 +08:00
parent 5670524153
commit dc15bd5d20
14 changed files with 205 additions and 42 deletions

View File

@@ -15,12 +15,15 @@ import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.harmonic.mapper.RStatPollutionSubstationDPOMapper;
import com.njcn.harmonic.mapper.majornetwork.PVOverviewMapper;
import com.njcn.harmonic.pojo.param.PVOverviewParam;
import com.njcn.harmonic.pojo.po.RStatPollutionSubstationDPO;
import com.njcn.harmonic.service.majornetwork.PVOverviewService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -29,6 +32,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author wr
@@ -44,8 +48,11 @@ public class PVOverviewServiceImpl implements PVOverviewService {
private final RStatPollutionSubstationDPOMapper pollutionSubstationDPOMapper;
private final StatationStatClient statationStatClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final DeptFeignClient deptFeignClient;
@Override
public List<Integer> getPVSynthesisCount(StatisticsBizBaseParam param) {
DeptGetLineParam deptGetLineParam=new DeptGetLineParam();
@@ -64,11 +71,22 @@ public class PVOverviewServiceImpl implements PVOverviewService {
public List<PollutionLineDTO.PVPollution> getPVPollution(PVOverviewParam param) {
List<PollutionLineDTO.PVPollution> info=new ArrayList<>();
//查询主网台账信息获取遍变电站信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
pmsDeviceInfoParam.setDeptIndex(param.getId());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
List<String> powers= data.stream().flatMap(dto -> dto.getPowerrIdList().stream()).collect(Collectors.toList());
List<String> powers;
Boolean fly=param.getSum()!=null&&param.getSum()>0;
if(fly){
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
pmsDeviceInfoParam.setDeptIndex(param.getId());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
powers= data.stream().flatMap(dto -> dto.getPowerrIdList().stream()).collect(Collectors.toList());
}else{
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
List<String> orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
PmsStatationStatInfoParam infoParam = new PmsStatationStatInfoParam();
infoParam.setOrgIds(orgIDs);
List<StatationStat> data = statationStatClient.getPowerInfo(infoParam).getData();
powers=data.stream().map(StatationStat::getPowerId).collect(Collectors.toList());
}
if(CollUtil.isEmpty(powers)){
return info;
}
@@ -79,7 +97,7 @@ public class PVOverviewServiceImpl implements PVOverviewService {
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationDPO::getDataDate,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatPollutionSubstationDPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
.orderByDesc(RStatPollutionSubstationDPO::getValue)
.last("limit "+param.getSum()));
.last(fly,"limit "+param.getSum()));
if(CollUtil.isNotEmpty(substationDPOS)){
List<String> powerIds = substationDPOS.stream().map(RStatPollutionSubstationDPO::getSubstationId).collect(Collectors.toList());
PmsStatationStatInfoParam statInfoParam=new PmsStatationStatInfoParam();