辽宁功能调整
This commit is contained in:
@@ -21,6 +21,4 @@ public class HarmonicPublicParam extends DeviceInfoParam.BusinessParam{
|
||||
@ApiModelProperty(name = "type", value = "区分(0:pq 1:pms)")
|
||||
private Integer type=0;
|
||||
|
||||
@ApiModelProperty(name = "stationType", value = "(0:变电站 1:非变电站场站)")
|
||||
private Integer stationType;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ public class PollutionVO {
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("电网标志")
|
||||
private Integer powerFlag;
|
||||
|
||||
@ApiModelProperty("污染指标")
|
||||
private Double data = 3.14159;
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ public class THDistortionVO implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("监测对象id")
|
||||
private String objId;
|
||||
|
||||
@ApiModelProperty("电网标志")
|
||||
private Integer powerFlag;
|
||||
/**
|
||||
* 总畸变率
|
||||
*/
|
||||
|
||||
@@ -56,16 +56,6 @@ public class PollutionSubstationController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEnergyStationPollution")
|
||||
@ApiOperation("新能源场站污区图")
|
||||
@ApiImplicitParam(name = "pollutionSubstationQuryParam", value = "污染指标查询参数", required = true)
|
||||
public HttpResult<List<PollutionSubstationVO>> getEnergyStationPollution(@RequestBody @Validated PollutionSubstationQuryParam pollutionSubstationQuryParam) {
|
||||
String methodDescribe = getMethodDescribe ("getEnergyStationPollution");
|
||||
List<PollutionSubstationVO> list = pollutionSubstationService.getEnergyStationPollution(pollutionSubstationQuryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult (CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deptSubstationRelations")
|
||||
@ApiOperation("污区图-部门变电站关系")
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
A.Name name,
|
||||
C.IP networkParam,
|
||||
D.Name voltageLevel,
|
||||
A.Name lineName
|
||||
A.Name lineName,
|
||||
detail.obj_id
|
||||
FROM
|
||||
pq_line A,
|
||||
pq_line_detail detail,
|
||||
pq_voltage B,
|
||||
pq_device C,
|
||||
sys_dict_data D,
|
||||
@@ -24,6 +26,7 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
AND A.Pid = B.Id
|
||||
AND A.id = detail.Id
|
||||
AND B.Scale = D.Id
|
||||
AND A.Pid = A1.Id
|
||||
AND A1.Pid = C.Id
|
||||
|
||||
@@ -38,8 +38,6 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
List<PollutionSubstationVO> getPollutionSubstationData(PollutionSubstationQuryParam pollutionSubstationQuryParam);
|
||||
|
||||
|
||||
List<PollutionSubstationVO> getEnergyStationPollution(PollutionSubstationQuryParam pollutionSubstationQuryParam);
|
||||
|
||||
/**
|
||||
* @Description: getDeptSubstationRelations
|
||||
* @Param: [param]
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.harmonic.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
@@ -12,17 +13,24 @@ import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.harmonic.mapper.RStatComassesDMapper;
|
||||
import com.njcn.harmonic.pojo.dto.ComAssessDTO;
|
||||
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatComassesDPO;
|
||||
import com.njcn.harmonic.pojo.vo.ComAssessVO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.service.ComAssessService;
|
||||
import com.njcn.harmonic.utils.HarmonicComAssesUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -36,6 +44,7 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -55,6 +64,7 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
private final CommLineClient commLineClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public List<ComAssessVO> getComAccessData(DeviceInfoParam.BusinessParam comAccessParam) {
|
||||
@@ -64,44 +74,60 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
List<PollutionLineDTO> lineInfo = new ArrayList<>();
|
||||
|
||||
String systemType = commTerminalGeneralClient.isPqOrPms().getData();
|
||||
if(systemType.equals("pq")) {
|
||||
if (systemType.equals("pq")) {
|
||||
|
||||
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
//按部门分类的实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(comAccessParam).getData();
|
||||
deviceDataList.forEach(dept -> {
|
||||
lineList.addAll(dept.getLineIndexes());
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(lineList)) {
|
||||
PollutionParamDTO paramDTO = new PollutionParamDTO();
|
||||
paramDTO.setLineList(lineList);
|
||||
lineInfo = lineFeignClient.getLineInfo(paramDTO).getData();
|
||||
}
|
||||
Map<String, List<PollutionLineDTO>> map = lineInfo.stream().collect(Collectors.groupingBy(PollutionLineDTO::getSubstationId));
|
||||
deviceDataList.forEach(dept -> lineList.addAll(dept.getLineIndexes()));
|
||||
//查询所有信息
|
||||
List<PQSComAssesPO> comAccessData = getComAccessData(lineList, comAccessParam.getSearchBeginTime(), comAccessParam.getSearchEndTime());
|
||||
|
||||
//按变电站分类的实际运行终端综合信息
|
||||
// List<GeneralDeviceDTO> subDataList = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(comAccessParam).getData();
|
||||
if (!CollectionUtils.isEmpty(deviceDataList)) {
|
||||
for (GeneralDeviceDTO dept : deviceDataList) {
|
||||
if (CollectionUtils.isEmpty(dept.getLineIndexes())) {
|
||||
continue;
|
||||
}
|
||||
ComAssessVO comAssessVO = new ComAssessVO();
|
||||
comAssessVO.setName(dept.getName());
|
||||
comAssessVO.setMonitors(dept.getLineIndexes().size());
|
||||
|
||||
List<ComAssessDTO> childrenDTOS = new ArrayList<>();
|
||||
List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(dept.getLineIndexes()).getData();
|
||||
List<ComAssessVO> children = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(dept.getSubIndexes())) {
|
||||
dept.getSubIndexes().forEach(sub -> {
|
||||
if (CollUtil.isNotEmpty(lineDetailList)) {
|
||||
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)) {
|
||||
Map<String, List<LineDetail>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(LineDetail::getObjId));
|
||||
objMap.forEach((obj, list) -> {
|
||||
ComAssessVO comAssessVO = new ComAssessVO();
|
||||
if (userLedgerVOMap.containsKey(obj)) {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj);
|
||||
comAssessVO.setId(userLedgerVO.getId());
|
||||
comAssessVO.setName(userLedgerVO.getProjectName());
|
||||
comAssessVO.setData(3.14159f);
|
||||
comAssessVO.setMonitors(list.size());
|
||||
children.add(comAssessVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(powerLedgerList)) {
|
||||
List<String> ids = powerLedgerList.stream().map(LineDetail::getId).collect(Collectors.toList());
|
||||
PollutionParamDTO paramDTO = new PollutionParamDTO();
|
||||
paramDTO.setLineList(ids);
|
||||
lineInfo = lineFeignClient.getLineInfo(paramDTO).getData();
|
||||
Map<String, List<PollutionLineDTO>> map = lineInfo.stream().collect(Collectors.groupingBy(PollutionLineDTO::getSubstationId));
|
||||
List<ComAssessDTO> childrenDTOS = new ArrayList<>();
|
||||
map.forEach((sub,list) -> {
|
||||
//获取变电站信息
|
||||
List<PollutionLineDTO> l1 = map.get(sub);
|
||||
ComAssessVO child = new ComAssessVO();
|
||||
child.setName(l1.get(0).getSubstation());
|
||||
child.setMonitors(l1.size());
|
||||
child.setName(list.get(0).getSubstation());
|
||||
child.setMonitors(list.size());
|
||||
//监测点id
|
||||
List<String> lineIds = l1.stream().map(PollutionLineDTO::getId).collect(Collectors.toList());
|
||||
List<String> lineIds = list.stream().map(PollutionLineDTO::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);
|
||||
@@ -111,8 +137,11 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
children.add(child);
|
||||
});
|
||||
}
|
||||
List<String> lineIds = dept.getLineIndexes();
|
||||
List<PQSComAssesPO> collect = comAccessData.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
}
|
||||
ComAssessVO comAssessVO = new ComAssessVO();
|
||||
comAssessVO.setName(dept.getName());
|
||||
comAssessVO.setMonitors(dept.getLineIndexes().size());
|
||||
List<PQSComAssesPO> collect = comAccessData.stream().filter(x -> dept.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||
List<ComAssessDTO> dtos = new ArrayList<>();
|
||||
setResults(collect, dtos);
|
||||
float allComAss = comAssesUtil.getAllComAss(dtos);
|
||||
@@ -122,13 +151,10 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
comAssessVO.setChildren(children);
|
||||
comAssessVOList.add(comAssessVO);
|
||||
}
|
||||
;
|
||||
|
||||
}
|
||||
List<ComAssessVO> list = comAssessVOList.stream().sorted(Comparator.comparing(ComAssessVO::getData).reversed()).collect(Collectors.toList());
|
||||
|
||||
return list;
|
||||
}else {
|
||||
} else {
|
||||
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.RUN.getCode(), DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
||||
PmsDeviceInfoParam param = new PmsDeviceInfoParam();
|
||||
param.setDeptIndex(comAccessParam.getDeptIndex());
|
||||
@@ -270,18 +296,18 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
|
||||
//获取综合评估等级
|
||||
private String getLevel(float synDatas) {
|
||||
if(synDatas==3.14159f){
|
||||
if (synDatas == 3.14159f) {
|
||||
return "(暂无数据)";
|
||||
}
|
||||
if(0<=synDatas&&synDatas<2){
|
||||
if (0 <= synDatas && synDatas < 2) {
|
||||
return "极差";
|
||||
}else if(2<=synDatas&&synDatas<3){
|
||||
} else if (2 <= synDatas && synDatas < 3) {
|
||||
return "较差";
|
||||
}else if(3<=synDatas&&synDatas<4){
|
||||
} else if (3 <= synDatas && synDatas < 4) {
|
||||
return "合格";
|
||||
}else if(4<=synDatas&&synDatas<4.5){
|
||||
} else if (4 <= synDatas && synDatas < 4.5) {
|
||||
return "良好";
|
||||
}else{
|
||||
} else {
|
||||
return "优质";
|
||||
}
|
||||
}
|
||||
@@ -290,6 +316,7 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
/**
|
||||
* influxDB查询综合评估相关信息
|
||||
* 返回每个监测点在时间段的各指标平均数
|
||||
*
|
||||
* @param lineIndexes
|
||||
* @param searchBeginTime
|
||||
* @param searchEndTime
|
||||
@@ -298,13 +325,12 @@ public class ComAssessServiceImpl extends ServiceImpl<RStatComassesDMapper, RSta
|
||||
List<PQSComAssesPO> avgCount = this.baseMapper.getAvgCount(lineIndexes,
|
||||
DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toString(),
|
||||
DateUtil.beginOfDay(DateUtil.parse(searchEndTime)).toString());
|
||||
if(CollUtil.isNotEmpty(avgCount)){
|
||||
if (CollUtil.isNotEmpty(avgCount)) {
|
||||
return avgCount;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
// //组装sql语句
|
||||
// StringBuilder builder = new StringBuilder();
|
||||
// builder.append("MEAN(vu_dev1)AS vu_dev1, MEAN(vu_dev2)AS vu_dev2, MEAN(vu_dev3)AS vu_dev3, MEAN(vu_dev4)AS vu_dev4, MEAN(vu_dev5)AS vu_dev5, MEAN(freq_dev1)AS freq_dev1, MEAN(freq_dev2)AS freq_dev2, MEAN(freq_dev3)AS freq_dev3, MEAN(freq_dev4)AS freq_dev4, MEAN(freq_dev5)AS freq_dev5, MEAN(data_plt1)AS data_plt1, MEAN(data_plt2)AS data_plt2, MEAN(data_plt3)AS data_plt3, MEAN(data_plt4)AS data_plt4, MEAN(data_plt5)AS data_plt5, MEAN(v_unbalance1)AS v_unbalance1, MEAN(v_unbalance2)AS v_unbalance2, MEAN(v_unbalance3)AS v_unbalance3, MEAN(v_unbalance4)AS v_unbalance4, MEAN(v_unbalance5)AS v_unbalance5, MEAN(v_thd1)AS v_thd1, MEAN(v_thd2)AS v_thd2, MEAN(v_thd3)AS v_thd3, MEAN(v_thd4)AS v_thd4, MEAN(v_thd5)AS v_thd5, MEAN(event1)AS event1, MEAN(event2)AS event2, MEAN(event3)AS event3, MEAN(event4)AS event4, MEAN(event5)AS event5");
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.*;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
@@ -195,31 +196,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PollutionSubstationVO> getEnergyStationPollution(PollutionSubstationQuryParam pollutionSubstationQuryParam) {
|
||||
List<PollutionSubstationVO> result = new ArrayList<>();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(pollutionSubstationQuryParam.getDeptIndex());
|
||||
deptGetLineParam.setLineRunFlag(RunFlagEnum.RUNNING.getStatus());
|
||||
List<DeptGetChildrenMoreDTO> deptLineList = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
if(CollUtil.isNotEmpty(deptLineList)){
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userLedgerList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
Map<String,UserLedgerVO> userMap = userLedgerList.stream().collect(Collectors.toMap(UserLedgerVO::getId,Function.identity()));
|
||||
|
||||
for(DeptGetChildrenMoreDTO dto : deptLineList){
|
||||
List<LineDevGetDTO> monitorList = dto.getLineBaseList();
|
||||
if(CollUtil.isEmpty(monitorList)){
|
||||
continue;
|
||||
}
|
||||
List<String> objIds = monitorList.stream().map(LineDevGetDTO::getObjId).distinct().collect(Collectors.toList());
|
||||
//List<UserLedgerVO>userLedgerList.stream().filter(it->objIds.contains(it.getId())).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: getDeptSubstationRelations
|
||||
@@ -238,7 +214,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
}
|
||||
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
Map<String,UserLedgerVO> userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId,Function.identity()));
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
if (harmonicPublicParam.getType() != 0) {
|
||||
/* PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
@@ -308,35 +284,37 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
List<PollutionVO> subPollutionVO = new ArrayList<>();
|
||||
|
||||
List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(temp.getLineIndexes()).getData();
|
||||
if(CollUtil.isNotEmpty(lineDetailList)){
|
||||
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)){
|
||||
if (CollUtil.isNotEmpty(lineDetailList)) {
|
||||
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());
|
||||
objIds.forEach(obj->{
|
||||
objIds.forEach(obj -> {
|
||||
PollutionVO pollutionsubVO = new PollutionVO();
|
||||
if(userLedgerVOMap.containsKey(obj)){
|
||||
if (userLedgerVOMap.containsKey(obj)) {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj);
|
||||
pollutionsubVO.setId(userLedgerVO.getId());
|
||||
pollutionsubVO.setName(userLedgerVO.getProjectName());
|
||||
pollutionsubVO.setPid(temp.getIndex());
|
||||
pollutionsubVO.setData(3.14159);
|
||||
pollutionsubVO.setPowerFlag(PowerFlagEnum.NO_GRID_SIDE.getCode());
|
||||
setSubData(harmonicPublicParam, pollutionType, searchBeginTime, harmonicPublicParam.getSearchEndTime(), pollutionsubVO, userLedgerVO.getId());
|
||||
subPollutionVO.add(pollutionsubVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(powerLedgerList)){
|
||||
if (CollUtil.isNotEmpty(powerLedgerList)) {
|
||||
List<String> ids = powerLedgerList.stream().map(LineDetail::getId).collect(Collectors.toList());
|
||||
List<Line> lineList = lineFeignClient.getBaseLineList(ids).getData();
|
||||
List<String> subIds = lineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||
List<String> subIds = lineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||
List<Line> subList = lineFeignClient.getBaseLineList(subIds).getData();
|
||||
subList.forEach(station->{
|
||||
subList.forEach(station -> {
|
||||
PollutionVO pollutionsubVO = new PollutionVO();
|
||||
pollutionsubVO.setId(station.getId());
|
||||
pollutionsubVO.setName(station.getName());
|
||||
pollutionsubVO.setPid(temp.getIndex());
|
||||
pollutionsubVO.setPowerFlag(PowerFlagEnum.GRID_SIDE.getCode());
|
||||
pollutionsubVO.setData(3.14159);
|
||||
setSubData(harmonicPublicParam, pollutionType, searchBeginTime, harmonicPublicParam.getSearchEndTime(), pollutionsubVO, station.getId());
|
||||
subPollutionVO.add(pollutionsubVO);
|
||||
@@ -891,7 +869,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
Map<String, String> lineOrgName = lineNameList.stream().collect(Collectors.toMap(LineDevGetDTO::getPointId, LineDevGetDTO::getUnitName));
|
||||
|
||||
//获取监测点集合
|
||||
LineBaseQueryParam param=new LineBaseQueryParam();
|
||||
LineBaseQueryParam param = new LineBaseQueryParam();
|
||||
param.setLineIds(new ArrayList<>(lineOrgName.keySet()));
|
||||
param.setSearchValue(searchValue);
|
||||
List<LineDetail> data = lineFeignClient.getByName(param).getData();
|
||||
@@ -923,10 +901,10 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
vo.setSubstationName(key);
|
||||
List<String> gridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 0)).map(LineDetail::getId).collect(Collectors.toList());
|
||||
List<String> notGridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
||||
vo.setDwLineList(lineNameList.stream().filter(x->gridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
|
||||
vo.setYhLineList(lineNameList.stream().filter(x->notGridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
|
||||
vo.setDwLineList(lineNameList.stream().filter(x -> gridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
|
||||
vo.setYhLineList(lineNameList.stream().filter(x -> notGridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
|
||||
value.forEach(item -> {
|
||||
if(monitorMap.containsKey(item.getId())){
|
||||
if (monitorMap.containsKey(item.getId())) {
|
||||
alarmTime.set(alarmTime.get() + monitorMap.get(item.getId()).getAllTime());
|
||||
}
|
||||
});
|
||||
@@ -944,7 +922,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<String> addList(List<RStatPollutionSubstationM> substationMlist) {
|
||||
List<String> info = new ArrayList<>();
|
||||
Integer num1 = 0;
|
||||
|
||||
@@ -11,8 +11,10 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalOnlineRateDataVO;
|
||||
@@ -20,12 +22,16 @@ import com.njcn.harmonic.mapper.RMpVThdMapper;
|
||||
import com.njcn.harmonic.mapper.THDistortionMapper;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpVThd;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.IRStatDataVDService;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
import com.njcn.harmonic.utils.PubUtils;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -55,7 +61,7 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final IRStatDataVDService statDataVDService;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public List<THDistortionVO> getTHDistortionData(DeviceInfoParam.BusinessParam thDistortionParam,Integer nodeType) {
|
||||
@@ -63,6 +69,13 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceList = generalDeviceInfoClient.getPracticalRunDeviceInfo(new DeviceInfoParam(thDistortionParam.getStatisticalType(), thDistortionParam.getDeptIndex(), generalInfo.getMicroServiceName(), thDistortionParam.getScale(), thDistortionParam.getManufacturer(), thDistortionParam.getLoadType())).getData();
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = new HashMap<>();
|
||||
if(Objects.isNull(thDistortionParam.getPowerFlag()) || Objects.equals(PowerFlagEnum.NO_GRID_SIDE.getCode(),thDistortionParam.getPowerFlag())){
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
}
|
||||
|
||||
|
||||
//组装监测点Top层集合
|
||||
for (GeneralDeviceDTO generalDeviceDTO : deviceList) {
|
||||
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
@@ -77,7 +90,7 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionParam.getSearchBeginTime(), thDistortionParam.getSearchEndTime());
|
||||
thDistortionVO.setDistortion(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
|
||||
//组装父级数据树
|
||||
List<THDistortionVO> treeList = getTreeData(lineIndexes, condition);
|
||||
List<THDistortionVO> treeList = getTreeData(lineIndexes, condition,userLedgerVOMap,thDistortionParam.getPowerFlag());
|
||||
thDistortionVO.setChildren(treeList);
|
||||
|
||||
|
||||
@@ -204,45 +217,78 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
return child.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void setChildesList(List<THDistortionVO> item, List<THDistortionVO> childes) {
|
||||
private void setChildesList(List<THDistortionVO> item, List<THDistortionVO> childes,List<THDistortionVO> userList) {
|
||||
//groupLine变电站索引和监测点集合
|
||||
Map<String, List<THDistortionVO>> groupLine;
|
||||
groupLine = childes.stream().collect(Collectors.groupingBy(thDistortionVO -> {
|
||||
String[] pid = thDistortionVO.getPidS().split(",");
|
||||
String[] pid = thDistortionVO.getPidS().split(StrUtil.COMMA);
|
||||
return pid[LineBaseEnum.SUB_LEVEL.getCode()];
|
||||
}));
|
||||
item.stream().peek(thDistortionVO -> {
|
||||
|
||||
Map<String,List<THDistortionVO>> userMap = userList.stream().collect(Collectors.groupingBy(THDistortionVO::getPid));
|
||||
item.forEach(thDistortionVO -> {
|
||||
List<THDistortionVO> temList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(groupLine.get(thDistortionVO.getId()))) {
|
||||
thDistortionVO.setChildren(groupLine.get(thDistortionVO.getId()));
|
||||
temList.addAll(groupLine.get(thDistortionVO.getId()));
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
if(userMap.containsKey(thDistortionVO.getId())){
|
||||
temList.addAll(userMap.get(thDistortionVO.getId()));
|
||||
}
|
||||
thDistortionVO.setChildren(temList);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取父级每层数据
|
||||
*/
|
||||
private List<THDistortionVO> getTreeData(List<String> lineIndexes,List<PublicDTO> condition) {
|
||||
private List<THDistortionVO> getTreeData(List<String> lineIndexes,List<PublicDTO> condition,Map<String,UserLedgerVO> userLedgerVOMap,Integer powerFlag) {
|
||||
//监测点集合
|
||||
List<THDistortionVO> monitorList = thDistortionMapper.getLineData(lineIndexes);
|
||||
//母线集合
|
||||
List<THDistortionVO> busBarList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//终端集合
|
||||
List<THDistortionVO> deviceList = thDistortionMapper.getLineInfoByList(busBarList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//变电站集合
|
||||
List<THDistortionVO> substationList = thDistortionMapper.getLineInfoByList(deviceList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//供电公司集合
|
||||
List<THDistortionVO> powerCompanyList = thDistortionMapper.getLineInfoByList(substationList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
|
||||
|
||||
if (!CollectionUtils.isEmpty(monitorList)) {
|
||||
Map<String, PublicDTO> map = condition.stream().collect(Collectors.toMap(PublicDTO::getId, Function.identity()));
|
||||
|
||||
for(THDistortionVO thDistortionVO:monitorList) {
|
||||
if (map.containsKey(thDistortionVO.getId())) {
|
||||
thDistortionVO.setDistortion(map.get(thDistortionVO.getId()).getData());
|
||||
}
|
||||
}
|
||||
setChildesList(substationList, monitorList);
|
||||
|
||||
List<THDistortionVO> userLedgerList = new ArrayList<>();
|
||||
List<THDistortionVO> powerLedgerList = new ArrayList<>();
|
||||
if(Objects.equals(PowerFlagEnum.NO_GRID_SIDE.getCode(),powerFlag)){
|
||||
userLedgerList = monitorList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}else if(Objects.equals(PowerFlagEnum.GRID_SIDE.getCode(),powerFlag)){
|
||||
powerLedgerList = monitorList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}else {
|
||||
userLedgerList = monitorList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
powerLedgerList = monitorList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}
|
||||
List<THDistortionVO> userTemList = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(userLedgerList)){
|
||||
Map<String,List<THDistortionVO>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(THDistortionVO::getObjId));
|
||||
objMap.forEach((obj,list) -> {
|
||||
THDistortionVO thDistortionVO = new THDistortionVO();
|
||||
if (userLedgerVOMap.containsKey(obj)) {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj);
|
||||
thDistortionVO.setId(userLedgerVO.getId());
|
||||
thDistortionVO.setName(userLedgerVO.getProjectName());
|
||||
thDistortionVO.setPid(userLedgerVO.getStationId());
|
||||
thDistortionVO.setDistortion(list.stream().filter(it->it.getDistortion()!=3.14159).mapToDouble(THDistortionVO::getDistortion).average().orElse(3.14159));
|
||||
thDistortionVO.setChildren(list);
|
||||
userTemList.add(thDistortionVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//母线集合
|
||||
// List<THDistortionVO> busBarList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//终端集合
|
||||
//List<THDistortionVO> deviceList = thDistortionMapper.getLineInfoByList(busBarList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//变电站集合
|
||||
List<THDistortionVO> substationList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(it->it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).distinct().collect(Collectors.toList()));
|
||||
//供电公司集合
|
||||
List<THDistortionVO> powerCompanyList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(it->it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.GD_LEVEL.getCode()]).distinct().collect(Collectors.toList()));
|
||||
|
||||
if (!CollectionUtils.isEmpty(monitorList)) {
|
||||
setChildesList(substationList, powerLedgerList,userTemList);
|
||||
setFatherDistortion(substationList);
|
||||
powerCompanyList = powerCompanyList.stream().peek(item -> item.setChildren(getChildCategoryList(item, substationList))).collect(Collectors.toList());
|
||||
// setFatherDistortion(powerCompanyList);
|
||||
|
||||
Reference in New Issue
Block a user