1.提交场站评估代码
This commit is contained in:
@@ -74,7 +74,10 @@ public class PollutionLineInfoDTO {
|
||||
* 电压等级
|
||||
*/
|
||||
private String lineVoltage;
|
||||
|
||||
/**
|
||||
* 变电站电压等级
|
||||
*/
|
||||
private String subVoltage;
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
|
||||
@@ -364,6 +364,7 @@
|
||||
deviceDetail.login_Time AS loginTime,
|
||||
deviceDetail.id deviceId,
|
||||
pv.scale lineVoltage,
|
||||
pqsub.scale subVoltage,
|
||||
lineDetail.monitor_id monitorId
|
||||
FROM
|
||||
pq_line line,
|
||||
@@ -372,6 +373,7 @@
|
||||
pq_line device,
|
||||
pq_device deviceDetail,
|
||||
pq_line substation,
|
||||
pq_substation pqsub,
|
||||
pq_line gdinfo,
|
||||
pq_voltage pv
|
||||
WHERE line.id in
|
||||
@@ -384,6 +386,7 @@
|
||||
AND device.id = deviceDetail.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.pid = gdinfo.id
|
||||
AND substation.id = pqsub.id
|
||||
AND subv.id = pv.id
|
||||
</select>
|
||||
|
||||
|
||||
@@ -860,6 +860,11 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
Optional<DictData> temp4 = voltageList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getLineVoltage())).findAny();
|
||||
pollutionLineInfoDTO.setLineVoltage(temp4.map(DictData::getName).orElse(null));
|
||||
|
||||
// 变电站电压等级
|
||||
Optional<DictData> temp5 = voltageList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getSubVoltage())).findAny();
|
||||
pollutionLineInfoDTO.setSubVoltage(temp5.map(DictData::getName).orElse(null));
|
||||
|
||||
|
||||
// 电网侧
|
||||
pollutionLineInfoDTO.setPowerFlag(pollutionLineInfoDTO.getPowerFlag().equals("0") ? "电网侧" : "非电网侧");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -13,46 +14,51 @@ public class LineItemPollution implements Serializable {
|
||||
* 终端名称
|
||||
*/
|
||||
@Excel(name = "终端名称", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("终端名称")
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 终端厂家
|
||||
*/
|
||||
@Excel(name = "终端厂家", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 终端型号
|
||||
*/
|
||||
@Excel(name = "终端型号", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("终端型号")
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 终端投运时间
|
||||
*/
|
||||
@Excel(name = "投运时间", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("投运时间")
|
||||
private String loginTime;
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@Excel(name = "监测点名称", width = 35, replace = "/_null")
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
/**
|
||||
* 统计间隔
|
||||
*/
|
||||
@Excel(name = "统计间隔", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("统计间隔")
|
||||
private Integer interval;
|
||||
|
||||
/**
|
||||
* 谐波电压污染值
|
||||
*/
|
||||
@Excel(name = "谐波电压污染值", width = 35, replace = "/_null")
|
||||
@Excel(name = "谐波污染值", width = 35, replace = "/_null")
|
||||
@ApiModelProperty("谐波污染值")
|
||||
private Double vHarmonicValue;
|
||||
|
||||
@Excel(name = "谐波电压污染值", width = 35, replace = "/_null")
|
||||
private Double iHarmonicValue;
|
||||
|
||||
/**
|
||||
* 暂升次数 1.1~1.8
|
||||
@@ -79,6 +85,7 @@ public class LineItemPollution implements Serializable {
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
@@ -80,6 +80,14 @@ public class LinePollution implements Serializable {
|
||||
@ApiModelProperty("监测点电压等级")
|
||||
private String lineVoltage;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* 监测点电压等级
|
||||
*/
|
||||
@Excel(name = "变电站电压等级", width = 30)
|
||||
@ApiModelProperty("变电站电压等级")
|
||||
private String subVoltage;
|
||||
|
||||
/**
|
||||
* 干扰源类型
|
||||
*/
|
||||
|
||||
@@ -1,35 +1,69 @@
|
||||
package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PowerFlagPollution implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@Excel(name = "监测点名称", width = 35, replace = "/_null")
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
|
||||
/**
|
||||
* 终端名称
|
||||
*/
|
||||
@Excel(name = "终端名称", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("终端名称")
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 终端厂家
|
||||
*/
|
||||
@Excel(name = "终端厂家", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 终端型号
|
||||
*/
|
||||
@Excel(name = "终端型号", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("终端型号")
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 终端投运时间
|
||||
*/
|
||||
@Excel(name = "投运时间", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("投运时间")
|
||||
private String loginTime;
|
||||
/**
|
||||
* 统计间隔
|
||||
*/
|
||||
@Excel(name = "统计间隔", width = 30, replace = "/_null")
|
||||
@ApiModelProperty("统计间隔")
|
||||
private Integer interval;
|
||||
|
||||
/**
|
||||
* 监测位置
|
||||
*/
|
||||
@Excel(name = "监测位置", width = 30, needMerge = true)
|
||||
@ApiModelProperty("监测位置")
|
||||
private String powerFlag;
|
||||
|
||||
|
||||
/**
|
||||
* 监测污染值
|
||||
* 谐波电压污染值
|
||||
*/
|
||||
@Excel(name = "监测谐波电压污染值", width = 40, needMerge = true, replace = "/_null")
|
||||
private String powerVValue;
|
||||
|
||||
@Excel(name = "监测谐波电流污染值", width = 40, needMerge = true, replace = "/_null")
|
||||
private String powerIValue;
|
||||
/**
|
||||
* 当前位置下,各测点的污染数据
|
||||
*/
|
||||
@ExcelCollection(name = "")
|
||||
private List<LineItemPollution> lineItemPollutionList;
|
||||
|
||||
@Excel(name = "谐波污染值", width = 35, replace = "/_null")
|
||||
@ApiModelProperty("谐波污染值")
|
||||
private Double vHarmonicValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -10,26 +11,34 @@ import java.util.List;
|
||||
@Data
|
||||
public class SubstationPollution implements Serializable {
|
||||
|
||||
/**
|
||||
* 供电公司名称
|
||||
*/
|
||||
@Excel(name = "供电公司", width = 30, needMerge = true)
|
||||
@ApiModelProperty("供电公司")
|
||||
private String gdName;
|
||||
|
||||
/**
|
||||
* 供电公司名称
|
||||
*/
|
||||
@Excel(name = "供电公司", width = 30, needMerge = true)
|
||||
@ApiModelProperty("供电公司")
|
||||
private String subVoltage;
|
||||
/**
|
||||
* 所属变电站
|
||||
*/
|
||||
@Excel(name = "变电站", width = 30, needMerge = true)
|
||||
@Excel(name = "变电站电压等级", width = 30, needMerge = true)
|
||||
@ApiModelProperty("变电站电压等级")
|
||||
private String subStationName;
|
||||
|
||||
/**
|
||||
* 电站污染值
|
||||
*/
|
||||
@Excel(name = "电站谐波电压污染值", width = 25, needMerge = true)
|
||||
@Excel(name = "电站谐波污染值", width = 25, needMerge = true)
|
||||
@ApiModelProperty("电站谐波污染值")
|
||||
private String subVStationValue;
|
||||
|
||||
|
||||
/**
|
||||
* 电站污染值
|
||||
*/
|
||||
@Excel(name = "电站谐波电流污染值", width = 25, needMerge = true)
|
||||
private String subIStationValue;
|
||||
|
||||
/**
|
||||
* 电网侧&非电网侧
|
||||
* name不要赋值
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
|
||||
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
@@ -146,15 +147,14 @@ public class PollutionSubstationController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation(value ="导出变电站谐波电压污染值",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@GetMapping(value ="/downPollutionSubCalc",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
public void downPollutionSubCalc(@RequestParam(value = "startTime") String startTime,
|
||||
@RequestParam(value = "endTime") String endTime) {
|
||||
StatSubstationBizBaseParam param=new StatSubstationBizBaseParam();
|
||||
param.setStartTime(startTime);
|
||||
param.setEndTime(endTime);
|
||||
pollutionSubstationService.downPollutionSubCalc(param);
|
||||
@ApiOperation(value ="变电站谐波污染值列表")
|
||||
@PostMapping(value ="/downPollutionSubCalc")
|
||||
public HttpResult<List<SubstationPollution>> downPollutionSubCalc(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("downPollutionSubCalc");
|
||||
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
|
||||
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
|
||||
List<SubstationPollution> gdPollutions = pollutionSubstationService.downPollutionSubCalc(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gdPollutions, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
|
||||
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
@@ -108,5 +109,5 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
* 变电站谐波电压污染值
|
||||
* @param param
|
||||
*/
|
||||
void downPollutionSubCalc(StatSubstationBizBaseParam param);
|
||||
List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.njcn.device.biz.commApi.CommLineClient;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.api.StatationStatClient;
|
||||
@@ -63,8 +62,6 @@ 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;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -908,21 +905,18 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
@Override
|
||||
public List<SubstationVo> getSubstationInfo(String deptIndex, String searchValue, String startTime, String endTime) {
|
||||
List<SubstationVo> result = new ArrayList<>();
|
||||
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(deptIndex);
|
||||
deptGetLineParam.setLineRunFlag(0);
|
||||
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
//获取所有监测信息
|
||||
List<LineDevGetDTO> lineNameList = list.stream().flatMap(x -> x.getLineBaseList().stream()).distinct().collect(Collectors.toList());
|
||||
Map<String, String> lineOrgName = lineNameList.stream().collect(Collectors.toMap(LineDevGetDTO::getPointId, LineDevGetDTO::getUnitName));
|
||||
deptGetLineParam.setMonitorStateRunning(false);
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
List<String> lineIds = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).flatMap(x -> x.getUnitChildrenList().stream()).distinct().collect(Collectors.toList());
|
||||
|
||||
//获取监测点集合
|
||||
LineBaseQueryParam param = new LineBaseQueryParam();
|
||||
param.setLineIds(new ArrayList<>(lineOrgName.keySet()));
|
||||
param.setSearchValue(searchValue);
|
||||
param.setLineIds(lineIds);
|
||||
List<LineDetail> data = lineFeignClient.getByName(param).getData();
|
||||
List<String> lineList = data.stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点的超标数据
|
||||
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAllOverTimes(lineList, startTime, endTime);
|
||||
@@ -941,31 +935,30 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
String i = dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL.getCode()).getData().getId();
|
||||
List<RMpPollutionDPO> harmonicI = lineData.stream().filter(x -> i.equals(x.getPollutionType())).collect(Collectors.toList());
|
||||
|
||||
//获取监测点详细信息
|
||||
Map<String, List<LineDetail>> lineDetailMap = data.stream().filter(x -> StrUtil.isNotBlank(x.getPowerSubstationName())).collect(Collectors.groupingBy(LineDetail::getPowerSubstationName));
|
||||
lineDetailMap.forEach((key, value) -> {
|
||||
List<SubGetBase> subNameMap = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).distinct().collect(Collectors.toList());
|
||||
for (SubGetBase subGetBase : subNameMap) {
|
||||
AtomicInteger alarmTime = new AtomicInteger();
|
||||
SubstationVo vo = new SubstationVo();
|
||||
vo.setDeptName(lineOrgName.get(value.get(0).getId()));
|
||||
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()));
|
||||
value.forEach(item -> {
|
||||
if (monitorMap.containsKey(item.getId())) {
|
||||
alarmTime.set(alarmTime.get() + monitorMap.get(item.getId()).getAllTime());
|
||||
vo.setDeptName(subGetBase.getOrgName());
|
||||
vo.setSubstationName(subGetBase.getName());
|
||||
List<String> unitChildrenList = subGetBase.getUnitChildrenList();
|
||||
List<LineDetail> lineDetails = data.stream().filter((x -> unitChildrenList.contains(x.getId()))).collect(Collectors.toList());
|
||||
List<String> gridSide = lineDetails.stream().filter(t -> Objects.equals(t.getPowerFlag(), 0)).map(LineDetail::getId).collect(Collectors.toList());
|
||||
List<String> notGridSide = lineDetails.stream().filter(t -> Objects.equals(t.getPowerFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
||||
vo.setDwLineList(lineDetails.stream().filter(x -> gridSide.contains(x.getId())).map(LineDetail::getMonitorName).sorted().collect(Collectors.toList()));
|
||||
vo.setYhLineList(lineDetails.stream().filter(x -> notGridSide.contains(x.getId())).map(LineDetail::getMonitorName).sorted().collect(Collectors.toList()));
|
||||
unitChildrenList.forEach(item -> {
|
||||
if (monitorMap.containsKey(item)) {
|
||||
alarmTime.set(alarmTime.get() + monitorMap.get(item).getAllTime());
|
||||
}
|
||||
});
|
||||
vo.setAlarmFreq(NumberUtil.round(alarmTime.get() * 1.0 / value.size(), 2).doubleValue());
|
||||
//监测点id集合
|
||||
List<String> ids = value.stream().map(LineDetail::getId).collect(Collectors.toList());
|
||||
OptionalDouble maxV = harmonicV.stream().filter(x -> ids.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
|
||||
vo.setAlarmFreq(NumberUtil.round(alarmTime.get() * 1.0 / unitChildrenList.size(), 2).doubleValue());
|
||||
OptionalDouble maxV = harmonicV.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
|
||||
vo.setVPollutionData(maxV.isPresent() ? maxV.getAsDouble() : 0.0D);
|
||||
OptionalDouble maxI = harmonicI.stream().filter(x -> ids.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
|
||||
OptionalDouble maxI = harmonicI.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
|
||||
vo.setIPollutionData(maxI.isPresent() ? maxV.getAsDouble() : 0.0D);
|
||||
result.add(vo);
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1089,121 +1082,36 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downPollutionSubCalc(StatSubstationBizBaseParam param) {
|
||||
public List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param) {
|
||||
List<SubstationPollution> substationPollutions = new ArrayList<>();
|
||||
// 处理干扰源用户的报告
|
||||
List<LinePollution> linePollutionList = pollutionCalcList(param);
|
||||
// 整合变电站待导出的数据
|
||||
List<GdPollution> gdPollutionList = new ArrayList<>();
|
||||
// 以供电公司分组
|
||||
Map<String, List<LinePollution>> gdMap = linePollutionList.stream()
|
||||
.collect(Collectors.groupingBy(LinePollution::getGdName));
|
||||
// 同一供电公司以变电站分组
|
||||
Set<String> gdNameSet = gdMap.keySet();
|
||||
for (String gdName : gdNameSet) {
|
||||
// 初始化gd实体
|
||||
GdPollution gdPollution = new GdPollution();
|
||||
gdPollution.setGdName(gdName);
|
||||
List<LinePollution> gdLinePollution = gdMap.get(gdName);
|
||||
// 以变电站分组
|
||||
Map<String, List<LinePollution>> subMap = gdLinePollution.stream()
|
||||
.collect(Collectors.groupingBy(LinePollution::getSubStationName));
|
||||
Set<String> subNameMap = subMap.keySet();
|
||||
List<SubstationPollution> substationPollutions = new ArrayList<>();
|
||||
for (String subName : subNameMap) {
|
||||
// 初始化变电站实体
|
||||
Map<String, List<LinePollution>> subMap = linePollutionList.stream()
|
||||
.collect(Collectors.groupingBy(x->x.getGdName()+"_"+x.getSubStationName()+"_"+x.getSubVoltage()));
|
||||
subMap.forEach((key,value)->{
|
||||
String[] name = key.split("_");
|
||||
SubstationPollution substationPollution = new SubstationPollution();
|
||||
substationPollution.setSubStationName(subName);
|
||||
List<LinePollution> subLinePollution = subMap.get(subName);
|
||||
// 需要区分电网侧、非电网侧
|
||||
Map<String, List<LinePollution>> powerFlagLinePollution = subLinePollution.stream().collect(Collectors.groupingBy(LinePollution::getPowerFlag));
|
||||
|
||||
List<PowerFlagPollution> powerFlagPollutionList = new ArrayList<>();
|
||||
// 电网侧
|
||||
List<LinePollution> temp = powerFlagLinePollution.get("电网侧");
|
||||
PowerFlagPollution powerFlagPollution1 = new PowerFlagPollution();
|
||||
powerFlagPollution1.setPowerFlag("电网侧");
|
||||
List<LineItemPollution> lineItemPollutionList1 = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(temp)) {
|
||||
// 计算电网侧下所有监测点谐波电压平均污染值
|
||||
double subVValue = temp.stream()
|
||||
substationPollution.setGdName(name[0]);
|
||||
substationPollution.setSubStationName(name[1]);
|
||||
substationPollution.setSubVoltage(name[2]);
|
||||
double subVValue = value.stream()
|
||||
.mapToDouble(o -> o.getHarmonicValue())
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
// 电网侧污染值
|
||||
powerFlagPollution1.setPowerVValue(PubUtils.doubleRound(2, subVValue) + "");
|
||||
|
||||
|
||||
|
||||
// 设备信息
|
||||
for (LinePollution linePollution : temp) {
|
||||
LineItemPollution lineItemPollution = new LineItemPollution();
|
||||
substationPollution.setSubVStationValue(PubUtils.doubleRound(2, subVValue) + "");
|
||||
List<PowerFlagPollution> lineItemPollutionList = new ArrayList<>();
|
||||
for (LinePollution linePollution : value) {
|
||||
PowerFlagPollution lineItemPollution = new PowerFlagPollution();
|
||||
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
|
||||
lineItemPollutionList1.add(lineItemPollution);
|
||||
}
|
||||
} else {
|
||||
// 仅有非电网侧时,电网侧赋予空置
|
||||
LineItemPollution lineItemPollution = new LineItemPollution();
|
||||
lineItemPollutionList1.add(lineItemPollution);
|
||||
}
|
||||
// 设备信息注入监测位置对象中
|
||||
powerFlagPollution1.setLineItemPollutionList(lineItemPollutionList1);
|
||||
powerFlagPollutionList.add(powerFlagPollution1);
|
||||
|
||||
|
||||
// 非电网侧
|
||||
List<LinePollution> temp1 = powerFlagLinePollution.get("非电网侧");
|
||||
PowerFlagPollution powerFlagPollution2 = new PowerFlagPollution();
|
||||
powerFlagPollution2.setPowerFlag("非电网侧");
|
||||
List<LineItemPollution> lineItemPollutionList2 = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(temp1)) {
|
||||
// 计算电网侧下所有监测点谐波电压平均污染值
|
||||
double subVValue = temp1.stream()
|
||||
.mapToDouble(o -> o.getHarmonicValue())
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
// 电网侧污染值
|
||||
powerFlagPollution2.setPowerVValue(PubUtils.doubleRound(2, subVValue) + "");
|
||||
|
||||
// 电网侧污染值
|
||||
for (LinePollution linePollution : temp1) {
|
||||
LineItemPollution lineItemPollution = new LineItemPollution();
|
||||
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
|
||||
lineItemPollutionList2.add(lineItemPollution);
|
||||
}
|
||||
} else {
|
||||
// 仅有非电网侧时,电网侧赋予空置
|
||||
LineItemPollution lineItemPollution = new LineItemPollution();
|
||||
lineItemPollutionList2.add(lineItemPollution);
|
||||
}
|
||||
// 设备信息注入监测位置对象中
|
||||
powerFlagPollution2.setLineItemPollutionList(lineItemPollutionList2);
|
||||
powerFlagPollutionList.add(powerFlagPollution2);
|
||||
|
||||
substationPollution.setPowerFlagPollutionList(powerFlagPollutionList);
|
||||
// 如果电网侧有污染值,就作为变电站的污染值,否则就用非电网侧的污染值作为该变电站污染值
|
||||
if (Objects.nonNull(powerFlagPollution1.getPowerVValue())) {
|
||||
substationPollution.setSubVStationValue(powerFlagPollution1.getPowerVValue());
|
||||
} else {
|
||||
substationPollution.setSubVStationValue(powerFlagPollution2.getPowerVValue());
|
||||
}
|
||||
if (Objects.nonNull(powerFlagPollution1.getPowerIValue())) {
|
||||
substationPollution.setSubIStationValue(powerFlagPollution1.getPowerIValue());
|
||||
} else {
|
||||
substationPollution.setSubIStationValue(powerFlagPollution2.getPowerIValue());
|
||||
lineItemPollutionList.add(lineItemPollution);
|
||||
}
|
||||
substationPollution.setPowerFlagPollutionList(lineItemPollutionList);
|
||||
substationPollutions.add(substationPollution);
|
||||
}
|
||||
|
||||
// 针对这个供电公司下的变电站污染值排序
|
||||
});
|
||||
substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubVStationValue())));
|
||||
Collections.reverse(substationPollutions);
|
||||
// List<SubstationPollution> finalSubstation = substationPollutions.stream().sorted((Comparator.comparingDouble(SubstationPollution::getSubStationValue))
|
||||
// .reversed())
|
||||
// .collect(Collectors.toList());
|
||||
gdPollution.setSubstationPollutionList(substationPollutions);
|
||||
gdPollutionList.add(gdPollution);
|
||||
}
|
||||
ExcelUtil.exportExcel("变电站谐波电压污染值" + param.getEndTime() + ".xlsx", GdPollution.class, gdPollutionList);
|
||||
return substationPollutions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user