辽宁功能调整

This commit is contained in:
2025-05-06 15:53:07 +08:00
parent a8b4a9615b
commit 8e5cab30c9
12 changed files with 212 additions and 72 deletions

View File

@@ -364,4 +364,6 @@ import java.util.Map;
@GetMapping("/getMonitorByObjId") @GetMapping("/getMonitorByObjId")
HttpResult<List<LineDetail>> getMonitorByObjId(@RequestParam("objId") String objId); HttpResult<List<LineDetail>> getMonitorByObjId(@RequestParam("objId") String objId);
@PostMapping("/getPowerStationByMonitorIds")
HttpResult<List<PollutionSubstationDTO>> getPowerStationByMonitorIds(@RequestBody List<String> ids);
} }

View File

@@ -300,6 +300,12 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
log.error("{}异常,降级处理,异常为:{}", "根据监测对象id查测点集合信息: ", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "根据监测对象id查测点集合信息: ", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<PollutionSubstationDTO>> getPowerStationByMonitorIds(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}", "根据监测id集合查询场站用户信息: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -32,6 +32,8 @@ public class PollutionSubstationDTO {
@ApiModelProperty(name ="lat",value = "变电站纬度") @ApiModelProperty(name ="lat",value = "变电站纬度")
private BigDecimal lat; private BigDecimal lat;
private Integer powerFlag;
@ApiModelProperty("数据") @ApiModelProperty("数据")
private Double data = 3.14159; private Double data = 3.14159;

View File

@@ -19,6 +19,12 @@ public class PowerQualityIndicatorsVO {
//所属终端名称 //所属终端名称
@ApiModelProperty(name = "devName",value = "所属终端名称") @ApiModelProperty(name = "devName",value = "所属终端名称")
private String devName; private String devName;
@ApiModelProperty(name = "devName",value = "网络参数")
private String ip;
@ApiModelProperty(name = "manufacturer",value = "所属厂商")
private String manufacturer;
//所属电站 //所属电站
@ApiModelProperty(name = "stationName",value = "所属电站") @ApiModelProperty(name = "stationName",value = "所属电站")
private String stationName; private String stationName;

View File

@@ -564,4 +564,13 @@ public class LineController extends BaseController {
List<LineDetail> list = lineService.getMonitorByObjId(objId); List<LineDetail> list = lineService.getMonitorByObjId(objId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据监测点集合获取电网侧以及用户侧场站")
@PostMapping("/getPowerStationByMonitorIds")
public HttpResult<List<PollutionSubstationDTO>> getPowerStationByMonitorIds(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("getPowerStationByMonitorIds");
List<PollutionSubstationDTO> list = lineService.getPowerStationByMonitorIds(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
} }

View File

@@ -238,6 +238,8 @@ public interface LineService extends IService<Line> {
List<LineDetail> getMonitorByObjId(String objId); List<LineDetail> getMonitorByObjId(String objId);
List<PollutionSubstationDTO> getPowerStationByMonitorIds(List<String> ids);
/** /**
* 获取污区值监测点相关信息 * 获取污区值监测点相关信息
* @author hongawen * @author hongawen

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pq.service.impl; package com.njcn.device.pq.service.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.*; import cn.hutool.core.date.*;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
@@ -742,6 +743,8 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
it.setStationName(areaLineInfoVO.getSubName()); it.setStationName(areaLineInfoVO.getSubName());
it.setDevName(areaLineInfoVO.getDeviceName()); it.setDevName(areaLineInfoVO.getDeviceName());
it.setVoltageLevel(areaLineInfoVO.getVoltageScale()); it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
it.setManufacturer(areaLineInfoVO.getManufacturer());
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) { if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName()); it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
} }

View File

@@ -22,12 +22,10 @@ import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO; import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.enums.LineBaseEnum; import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.enums.PowerFlagEnum;
import com.njcn.device.pq.mapper.*; import com.njcn.device.pq.mapper.*;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.dto.*;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO; import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.MonitorPowerDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
@@ -37,6 +35,9 @@ import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.PqsCommunicateMapper; import com.njcn.influx.imapper.PqsCommunicateMapper;
import com.njcn.influx.pojo.po.PqsCommunicate; import com.njcn.influx.pojo.po.PqsCommunicate;
import com.njcn.influx.query.InfluxQueryWrapper; import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
import com.njcn.system.api.AreaFeignClient; import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
@@ -44,6 +45,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.Area; import com.njcn.system.pojo.po.Area;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.api.UserFeignClient;
import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.pojo.vo.LineDataVO; import com.njcn.web.pojo.vo.LineDataVO;
import com.njcn.web.utils.GeneralUtil; import com.njcn.web.utils.GeneralUtil;
@@ -100,6 +102,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
private final TerminalMaintainMapper terminalMaintainMapper; private final TerminalMaintainMapper terminalMaintainMapper;
private final DeptFeignClient deptFeignClient; private final DeptFeignClient deptFeignClient;
private final DeptLineService deptLineService; private final DeptLineService deptLineService;
private final UserLedgerFeignClient userLedgerFeignClient;
@Override @Override
public LineDetailDataVO getLineDetailData(String id) { public LineDetailDataVO getLineDetailData(String id) {
@@ -753,6 +756,50 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
return result; return result;
} }
@Override
public List<PollutionSubstationDTO> getPowerStationByMonitorIds(List<String> ids) {
List<PollutionSubstationDTO> result = new ArrayList<>();
List<LineDetail> lineDetailList = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().in(LineDetail::getId, ids));
List<LineDetail> userLedgerList = lineDetailList.stream().filter(it->StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
List<LineDetail> powerLedgerList = lineDetailList.stream().filter(it->StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(userLedgerList)){
List<String> objIds = userLedgerList.stream().map(LineDetail::getObjId).distinct().collect(Collectors.toList());
List<NewUserReportVO> newUserReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
Map<String,NewUserReportVO> map = newUserReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
Map<String,DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
map.forEach((objId,item)->{
PollutionSubstationDTO pollutionSubstationDTO = new PollutionSubstationDTO();
pollutionSubstationDTO.setPowerFlag(PowerFlagEnum.NO_GRID_SIDE.getCode());
pollutionSubstationDTO.setId(objId);
pollutionSubstationDTO.setName(item.getProjectName());
pollutionSubstationDTO.setLng(item.getLongitude());
pollutionSubstationDTO.setLat(item.getLatitude());
pollutionSubstationDTO.setVoltageLevel(dictDataMap.get(item.getVoltageLevel()).getName());
result.add(pollutionSubstationDTO);
});
}
if(CollUtil.isNotEmpty(powerLedgerList)){
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId, powerLedgerList.stream().map(LineDetail::getId).distinct().collect(Collectors.toList())).eq(Line::getState, DataStateEnum.ENABLE.getCode()));
List<String> stationIds = lineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).collect(Collectors.toList());
List<SubstationDTO> stationList = substationMapper.getSubstationById(stationIds);
stationList.forEach(item->{
PollutionSubstationDTO pollutionSubstationDTO = new PollutionSubstationDTO();
pollutionSubstationDTO.setPowerFlag(PowerFlagEnum.GRID_SIDE.getCode());
pollutionSubstationDTO.setId(item.getId());
pollutionSubstationDTO.setName(item.getName());
pollutionSubstationDTO.setLng(item.getLng());
pollutionSubstationDTO.setLat(item.getLat());
pollutionSubstationDTO.setVoltageLevel(item.getScale());
result.add(pollutionSubstationDTO);
});
}
return result;
}
@Override @Override
public List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> lineId) { public List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> lineId) {
List<PollutionLineInfoDTO> pollutionLineInfoDTOList; List<PollutionLineInfoDTO> pollutionLineInfoDTOList;

View File

@@ -104,11 +104,18 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
objMap.forEach((obj, list) -> { objMap.forEach((obj, list) -> {
ComAssessVO comAssessVO = new ComAssessVO(); ComAssessVO comAssessVO = new ComAssessVO();
if (userLedgerVOMap.containsKey(obj)) { if (userLedgerVOMap.containsKey(obj)) {
List<ComAssessDTO> childrenDTOS = new ArrayList<>();
UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj); UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj);
comAssessVO.setId(userLedgerVO.getId()); comAssessVO.setId(userLedgerVO.getId());
comAssessVO.setName(userLedgerVO.getProjectName()); comAssessVO.setName(userLedgerVO.getProjectName());
comAssessVO.setData(3.14159f); List<String> lineIds = list.stream().map(LineDetail::getId).collect(Collectors.toList());
List<PQSComAssesPO> collect = comAccessData.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
setResults(collect, childrenDTOS);
float allComAss = comAssesUtil.getAllComAss(childrenDTOS);
String lv = getLevel(allComAss);
comAssessVO.setMonitors(list.size()); comAssessVO.setMonitors(list.size());
comAssessVO.setData(allComAss);
comAssessVO.setLevel(lv);
children.add(comAssessVO); children.add(comAssessVO);
} }
}); });

View File

@@ -470,17 +470,17 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
public List<PollutionSubstationDTO> getSubstationInfoById(HarmonicPublicParam deptParam) { public List<PollutionSubstationDTO> getSubstationInfoById(HarmonicPublicParam deptParam) {
String pollutionType = deptParam.getStatisticalType().getId(); String pollutionType = deptParam.getStatisticalType().getId();
String searchBeginTime = deptParam.getSearchBeginTime().substring(0, 10); String searchBeginTime = deptParam.getSearchBeginTime().substring(0, 10);
if (deptParam.getType() != 0) {
List<PollutionSubstationDTO> list = new ArrayList<>(); List<PollutionSubstationDTO> list = new ArrayList<>();
if (deptParam.getType() != 0) {
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
//根据部门code获取部门id //根据部门code获取部门id
Dept dept = deptFeignClient.getDeptByCode(deptParam.getDeptIndex()).getData(); Dept dept = deptFeignClient.getDeptByCode(deptParam.getDeptIndex()).getData();
if (ObjectUtil.isNull(dept)) { if (ObjectUtil.isNull(dept)) {
return list; return list;
} }
pmsDeviceInfoParam.setDeptIndex(dept.getId());
//获取统计类型 //获取统计类型
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(dept.getId());
pmsDeviceInfoParam.setStatisticalType(deptParam.getStatisticalType()); pmsDeviceInfoParam.setStatisticalType(deptParam.getStatisticalType());
//获取主网台账信息 //获取主网台账信息
List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData(); List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
@@ -494,7 +494,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
//去重解决重复数据 //去重解决重复数据
ArrayList<PmsStatationStatInfoDTO> dsData = data.stream().collect(Collectors.collectingAndThen ArrayList<PmsStatationStatInfoDTO> dsData = data.stream().collect(Collectors.collectingAndThen
(Collectors.toCollection(() -> (Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getPowerId()))), ArrayList::new)); new TreeSet<>(Comparator.comparing(PmsStatationStatInfoDTO::getPowerId))), ArrayList::new));
Map<String, Double> stringDoubleMap = setPmsSubData(deptParam, pollutionType, searchBeginTime, powers); Map<String, Double> stringDoubleMap = setPmsSubData(deptParam, pollutionType, searchBeginTime, powers);
if (CollectionUtil.isNotEmpty(data)) { if (CollectionUtil.isNotEmpty(data)) {
dsData.forEach(power -> { dsData.forEach(power -> {
@@ -513,54 +513,84 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
} }
}); });
if (!CollectionUtils.isEmpty(list)) {
return list.stream().sorted(Comparator.comparing(PollutionSubstationDTO::getData).reversed().thenComparing(PollutionSubstationDTO::getName)).collect(Collectors.toList());
}
} else { } else {
List<PollutionSubstationDTO> list = new ArrayList<>();
deptParam.setServerName(generalInfo.getMicroServiceName()); deptParam.setServerName(generalInfo.getMicroServiceName());
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(deptParam).getData(); List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(deptParam).getData();
sub.forEach(item -> { List<String> lineIds = sub.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
PollutionSubstationDTO pollutionSubstationDTO = lineFeignClient.getSubstationInfo(item.getIndex()).getData(); if (CollUtil.isEmpty(lineIds)) {
String id = pollutionSubstationDTO.getId(); return list;
}
list = lineFeignClient.getPowerStationByMonitorIds(lineIds).getData();
List<String> powerIds = list.stream().map(PollutionSubstationDTO::getId).collect(Collectors.toList());
if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_YEAR)) { if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_YEAR)) {
QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<>(); QueryWrapper<RStatPollutionSubstationYPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id). wrapper.in("substation_id", powerIds).
eq("pollution_type", pollutionType). eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime); eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationYPO rStatPollutionSubstationYPO = pollutionSubstationYPOMapper.selectOne(wrapper); List<RStatPollutionSubstationYPO> rStatPollutionSubstationYPO = pollutionSubstationYPOMapper.selectList(wrapper);
Map<String, RStatPollutionSubstationYPO> yMap = rStatPollutionSubstationYPO.stream().collect(Collectors.toMap(RStatPollutionSubstationYPO::getSubstationId, Function.identity()));
Optional.ofNullable(rStatPollutionSubstationYPO).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue())); list.forEach(pollutionSubstationDTO -> {
if (yMap.containsKey(pollutionSubstationDTO.getId())) {
pollutionSubstationDTO.setData(yMap.get(pollutionSubstationDTO.getId()).getValue());
} else {
pollutionSubstationDTO.setData(3.14159);
}
});
} else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_QUARTER)) { } else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_QUARTER)) {
QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<>(); QueryWrapper<RStatPollutionSubstationQPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id). wrapper.in("substation_id", powerIds).
eq("pollution_type", pollutionType). eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime); eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationQPO rStatPollutionSubstationQPO = pollutionSubstationQPOMapper.selectOne(wrapper); List<RStatPollutionSubstationQPO> rStatPollutionSubstationQPO = pollutionSubstationQPOMapper.selectList(wrapper);
Map<String, RStatPollutionSubstationQPO> qMap = rStatPollutionSubstationQPO.stream().collect(Collectors.toMap(RStatPollutionSubstationQPO::getSubstationId, Function.identity()));
Optional.ofNullable(rStatPollutionSubstationQPO).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue())); list.forEach(pollutionSubstationDTO -> {
if (qMap.containsKey(pollutionSubstationDTO.getId())) {
pollutionSubstationDTO.setData(qMap.get(pollutionSubstationDTO.getId()).getValue());
} else {
pollutionSubstationDTO.setData(3.14159);
}
});
} else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_MONTH)) { } else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_MONTH)) {
QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<>(); QueryWrapper<RStatPollutionSubstationM> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id). wrapper.in("substation_id", powerIds).
eq("pollution_type", pollutionType). eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime); eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationM rStatPollutionSubstationM = pollutionSubstationMMapper.selectOne(wrapper); List<RStatPollutionSubstationM> rStatPollutionSubstationM = pollutionSubstationMMapper.selectList(wrapper);
Optional.ofNullable(rStatPollutionSubstationM).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue()));
Map<String, RStatPollutionSubstationM> mMap = rStatPollutionSubstationM.stream().collect(Collectors.toMap(RStatPollutionSubstationM::getSubstationId, Function.identity()));
list.forEach(pollutionSubstationDTO -> {
if (mMap.containsKey(pollutionSubstationDTO.getId())) {
pollutionSubstationDTO.setData(mMap.get(pollutionSubstationDTO.getId()).getValue());
} else {
pollutionSubstationDTO.setData(3.14159);
}
});
} else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_DAY)) { } else if (Objects.equals(deptParam.getReportFlag(), BizParamConstant.STAT_BIZ_DAY)) {
QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<>(); QueryWrapper<RStatPollutionSubstationDPO> wrapper = new QueryWrapper<>();
wrapper.eq("substation_id", id). wrapper.in("substation_id", powerIds).
eq("pollution_type", pollutionType). eq("pollution_type", pollutionType).
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime); eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", searchBeginTime);
RStatPollutionSubstationDPO rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectOne(wrapper); List<RStatPollutionSubstationDPO> rStatPollutionSubstationDPO = pollutionSubstationDPOMapper.selectList(wrapper);
Map<String, RStatPollutionSubstationDPO> dMap = rStatPollutionSubstationDPO.stream().collect(Collectors.toMap(RStatPollutionSubstationDPO::getSubstationId, Function.identity()));
Optional.ofNullable(rStatPollutionSubstationDPO).ifPresent(t -> pollutionSubstationDTO.setData(t.getValue())); list.forEach(pollutionSubstationDTO -> {
if (dMap.containsKey(pollutionSubstationDTO.getId())) {
pollutionSubstationDTO.setData(dMap.get(pollutionSubstationDTO.getId()).getValue());
} else {
pollutionSubstationDTO.setData(3.14159);
} }
list.add(pollutionSubstationDTO);
}); });
} }
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
return list.stream().sorted(Comparator.comparing(PollutionSubstationDTO::getData).reversed().thenComparing(PollutionSubstationDTO::getName)).collect(Collectors.toList()); return list.stream().sorted(Comparator.comparing(PollutionSubstationDTO::getData).reversed().thenComparing(PollutionSubstationDTO::getName)).collect(Collectors.toList());
} }
return list; }
return Collections.emptyList();
} }
/** /**
@@ -607,6 +637,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
} }
} }
} else { } else {
if (PowerFlagEnum.GRID_SIDE.getCode().equals(harmonicPublicParam.getPowerFlag())) {
List<String> line = new ArrayList<>(); List<String> line = new ArrayList<>();
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(harmonicPublicParam).getData(); List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(harmonicPublicParam).getData();
sub.forEach(item -> { sub.forEach(item -> {
@@ -616,21 +647,35 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
} }
} }
}); });
if (!CollectionUtils.isEmpty(line)) { return commDataDeal(line,paramDTO,harmonicPublicParam);
paramDTO.setLineList(line);
list = lineFeignClient.getLineInfo(paramDTO).getData();
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList(line, pollutionType, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
if (!CollectionUtils.isEmpty(lineData)) {
list.stream().map(list1 -> lineData.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getLineId())).findAny().map(m -> {
list1.setData(m.getValue());
return list1;
})).collect(Collectors.toList());
}
} else { } else {
List<LineDetail> lineDetailList = lineFeignClient.getMonitorByObjId(harmonicPublicParam.getId()).getData();
if (CollUtil.isNotEmpty(lineDetailList)) {
List<String> ids = lineDetailList.stream().map(LineDetail::getId).collect(Collectors.toList());
return commDataDeal(ids,paramDTO,harmonicPublicParam);
}
}
}
return list; return list;
} }
private List<PollutionLineDTO> commDataDeal(List<String> ids,PollutionParamDTO paramDTO,HarmonicPublicParam harmonicPublicParam){
paramDTO.setLineList(ids);
List<PollutionLineDTO> list = lineFeignClient.getLineInfo(paramDTO).getData();
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList(ids, harmonicPublicParam.getStatisticalType().getId(), harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
Map<String,RMpPollutionDPO> map = lineData.stream().collect(Collectors.toMap(RMpPollutionDPO::getLineId,Function.identity()));
if (!CollectionUtils.isEmpty(lineData)) {
list.stream().sorted(Comparator.comparing(PollutionLineDTO::getData).reversed().thenComparing(PollutionLineDTO::getName)).forEach(item->{
if(map.containsKey(item.getId())){
item.setData(map.get(item.getId()).getValue());
}else {
item.setData(3.14159);
} }
return list.stream().sorted(Comparator.comparing(PollutionLineDTO::getData).reversed().thenComparing(PollutionLineDTO::getName)).collect(Collectors.toList()); });
}
return list;
} }

View File

@@ -438,7 +438,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
if (!CollectionUtils.isEmpty(harmonicCurrent)) { if (!CollectionUtils.isEmpty(harmonicCurrent)) {
steadyQualifyVO.setHarmonicCurrent(NumberUtil.round(harmonicCurrent.stream().mapToDouble(SteadyQualifyVO::getHarmonicCurrent).average().orElse(100), 2).doubleValue()); steadyQualifyVO.setHarmonicCurrent(NumberUtil.round(harmonicCurrent.stream().mapToDouble(SteadyQualifyVO::getHarmonicCurrent).average().orElse(100), 2).doubleValue());
} }
if (!CollectionUtils.isEmpty(flicker)) { if (!CollectionUtils.isEmpty(interHarmonic)) {
steadyQualifyVO.setInterHarmonic(NumberUtil.round(interHarmonic.stream().mapToDouble(SteadyQualifyVO::getInterHarmonic).average().orElse(100), 2).doubleValue()); steadyQualifyVO.setInterHarmonic(NumberUtil.round(interHarmonic.stream().mapToDouble(SteadyQualifyVO::getInterHarmonic).average().orElse(100), 2).doubleValue());
} }
} }

View File

@@ -3,6 +3,8 @@ package com.njcn.supervision.pojo.vo.user;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* @author web2023 * @author web2023
@@ -28,6 +30,15 @@ public class NewUserReportVO {
@ApiModelProperty(value = "额定功率 单位MW") @ApiModelProperty(value = "额定功率 单位MW")
private Double ratePower; private Double ratePower;
@ApiModelProperty(value = "经度")
private BigDecimal longitude;
@ApiModelProperty(value = "维度")
private BigDecimal latitude;
@ApiModelProperty(value = "电压等级")
private String voltageLevel;
} }