污染值列表

This commit is contained in:
wr
2025-09-09 17:02:52 +08:00
parent a34876c9c5
commit 134b5b7257
3 changed files with 54 additions and 60 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.harmonic.pojo.excel.pollution; package com.njcn.harmonic.pojo.excel.pollution;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@@ -13,53 +14,62 @@ public class LinePollution implements Serializable {
* 供电公司名称 * 供电公司名称
*/ */
@Excel(name = "供电公司", width = 30) @Excel(name = "供电公司", width = 30)
@ApiModelProperty("供电公司")
private String gdName; private String gdName;
/** /**
* 所属变电站 * 所属变电站
*/ */
@Excel(name = "变电站", width = 30) @Excel(name = "变电站", width = 30)
@ApiModelProperty("变电站")
private String subStationName; private String subStationName;
/** /**
* 终端名称 * 终端名称
*/ */
@Excel(name = "终端名称", width = 30) @Excel(name = "终端名称", width = 30)
@ApiModelProperty("终端名称")
private String devName; private String devName;
/** /**
* 终端厂家 * 终端厂家
*/ */
@Excel(name = "终端厂家", width = 30) @Excel(name = "终端厂家", width = 30)
@ApiModelProperty("终端厂家")
private String manufacturer; private String manufacturer;
/** /**
* 终端型号 * 终端型号
*/ */
@Excel(name = "终端型号", width = 30) @Excel(name = "终端型号", width = 30)
@ApiModelProperty("终端型号")
private String devType; private String devType;
/** /**
* 终端投运时间 * 终端投运时间
*/ */
@Excel(name = "投运时间", width = 30) @Excel(name = "投运时间", width = 30)
@ApiModelProperty("投运时间")
private String loginTime; private String loginTime;
/** /**
* 监测点索引 * 监测点索引
*/ */
@ApiModelProperty("监测点索引")
private String lineId; private String lineId;
/** /**
* 监测点名称 * 监测点名称
*/ */
@Excel(name = "监测点名称", width = 30) @Excel(name = "监测点名称", width = 30)
@ApiModelProperty("监测点名称")
private String lineName; private String lineName;
/** /**
* 位置,电网侧&非电网侧 * 位置,电网侧&非电网侧
*/ */
@Excel(name = "监测位置", width = 30) @Excel(name = "监测位置", width = 30)
@ApiModelProperty("监测位置")
private String powerFlag; private String powerFlag;
/** /**
@@ -67,24 +77,28 @@ public class LinePollution implements Serializable {
* 监测点电压等级 * 监测点电压等级
*/ */
@Excel(name = "监测点电压等级", width = 30) @Excel(name = "监测点电压等级", width = 30)
@ApiModelProperty("监测点电压等级")
private String lineVoltage; private String lineVoltage;
/** /**
* 干扰源类型 * 干扰源类型
*/ */
@Excel(name = "干扰源类型", width = 30) @Excel(name = "干扰源类型", width = 30)
@ApiModelProperty("干扰源类型")
private String loadType; private String loadType;
/** /**
* 监测对象 * 监测对象
*/ */
@Excel(name = "监测对象名称", width = 30) @Excel(name = "监测对象名称", width = 30)
@ApiModelProperty("监测对象名称")
private String objName; private String objName;
/** /**
* 统计间隔 * 统计间隔
*/ */
@Excel(name = "统计间隔",type = 10, width = 30) @Excel(name = "统计间隔",type = 10, width = 30)
@ApiModelProperty("统计间隔")
private Integer interval; private Integer interval;
/** /**
@@ -92,6 +106,7 @@ public class LinePollution implements Serializable {
* 在线率 * 在线率
*/ */
@Excel(name = "在线率(%)",type = 10, width = 30) @Excel(name = "在线率(%)",type = 10, width = 30)
@ApiModelProperty("在线率(%)")
private Float onlineRate; private Float onlineRate;
/** /**
@@ -99,25 +114,22 @@ public class LinePollution implements Serializable {
* 完整性 * 完整性
*/ */
@Excel(name = "完整率(%)",type = 10, width = 30) @Excel(name = "完整率(%)",type = 10, width = 30)
@ApiModelProperty("完整率(%)")
private Double integrity; private Double integrity;
/** /**
* 谐波电压污染值 * 谐波电压污染值
*/ */
@Excel(name = "谐波电压污染值",type = 10, width = 20) @Excel(name = "谐波电压污染值",type = 10, width = 20)
private Double vHarmonicValue; @ApiModelProperty("谐波污染值")
private Double HarmonicValue;
/**
* 谐波电压污染值
*/
@Excel(name = "谐波电流污染值",type = 10, width = 20)
private Double iHarmonicValue;
/** /**
* 暂升次数 1.1~1.8 * 暂升次数 1.1~1.8
* 10ms ~ 1min * 10ms ~ 1min
*/ */
@Excel(name = "暂升次数(次)",type = 10, width = 20) @Excel(name = "暂升次数(次)",type = 10, width = 20)
@ApiModelProperty("暂升次数(次)")
private Integer upCounts; private Integer upCounts;
/** /**
@@ -125,6 +137,7 @@ public class LinePollution implements Serializable {
* 10ms ~ 1min * 10ms ~ 1min
*/ */
@Excel(name = "电压暂降(次)",type = 10, width = 20) @Excel(name = "电压暂降(次)",type = 10, width = 20)
@ApiModelProperty("电压暂降(次)")
private Integer downCounts; private Integer downCounts;
/** /**
@@ -132,15 +145,19 @@ public class LinePollution implements Serializable {
* 10ms ~ 1min * 10ms ~ 1min
*/ */
@Excel(name = "短时中断(次)",type = 10, width = 20) @Excel(name = "短时中断(次)",type = 10, width = 20)
@ApiModelProperty("短时中断(次")
private Integer breakCounts; private Integer breakCounts;
@Excel(name = "是否关联敏感用户", width = 30, replace = "/_null") @Excel(name = "是否关联敏感用户", width = 30, replace = "/_null")
@ApiModelProperty("是否关联敏感用户")
private String isMg; private String isMg;
@Excel(name = "敏感及重要用户", width = 30,replace = "/_null") @Excel(name = "敏感及重要用户", width = 30,replace = "/_null")
@ApiModelProperty("敏感及重要用户")
private String importUser; private String importUser;
@Excel(name = "一类监测点", width = 30,replace = "/_null") @Excel(name = "一类监测点", width = 30,replace = "/_null")
@ApiModelProperty("一类监测点")
private String monitorId; private String monitorId;
// /** // /**

View File

@@ -1,5 +1,6 @@
package com.njcn.harmonic.controller; package com.njcn.harmonic.controller;
import cn.hutool.core.date.DateUtil;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -124,13 +125,11 @@ public class PollutionSubstationController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation(value ="监测点谐波污染值列表",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ApiOperation(value ="监测点谐波污染值列表",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@GetMapping(value ="/downPollutionLineCalc",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @PostMapping(value ="/downPollutionLineCalc",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public HttpResult<List<LinePollution>> downPollutionLineCalc(@RequestParam(value = "startTime") String startTime, public HttpResult<List<LinePollution>> downPollutionLineCalc(@RequestBody StatSubstationBizBaseParam param) {
@RequestParam(value = "endTime") String endTime) {
String methodDescribe = getMethodDescribe("getSubstationInfo"); String methodDescribe = getMethodDescribe("getSubstationInfo");
StatSubstationBizBaseParam param=new StatSubstationBizBaseParam(); param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
param.setStartTime(startTime); param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
param.setEndTime(endTime);
List<LinePollution> linePollutions = pollutionSubstationService.downPollutionLineCalc(param); List<LinePollution> linePollutions = pollutionSubstationService.downPollutionLineCalc(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, linePollutions, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, linePollutions, methodDescribe);
} }

View File

@@ -972,25 +972,27 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override @Override
public List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param) { public List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param) {
String startDate = DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(); List<LinePollution> finalLinePollutionList = pollutionCalcList(param);
String endDate = DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString();
List<LinePollution> finalLinePollutionList = pollutionCalcList(startDate, endDate);
// 全部监测点计算完毕后根据污染值从大到小进行排序 // 全部监测点计算完毕后根据污染值从大到小进行排序
finalLinePollutionList = finalLinePollutionList.stream() finalLinePollutionList = finalLinePollutionList.stream()
.sorted(Comparator.comparing(LinePollution::getVHarmonicValue).reversed()) .sorted(Comparator.comparing(LinePollution::getHarmonicValue).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
return finalLinePollutionList; return finalLinePollutionList;
} }
private List<LinePollution> pollutionCalcList(String startDate,String endDate) { private List<LinePollution> pollutionCalcList(StatSubstationBizBaseParam param) {
String startDate = param.getStartTime();
String endDate = param.getEndTime();
List<LinePollution> linePollutionList = new ArrayList<>(); List<LinePollution> linePollutionList = new ArrayList<>();
List<String> lineIdList = commTerminalGeneralClient.getRunMonitorIds().getData();
GridDiagramParam eventParam = new GridDiagramParam(); GridDiagramParam eventParam = new GridDiagramParam();
List<String> lineIdList = generalDeviceInfoClient.deptGetRunLine(param.getId()).getData();
eventParam.setIds(lineIdList); eventParam.setIds(lineIdList);
eventParam.setSearchBeginTime(startDate); eventParam.setSearchBeginTime(param.getStartTime());
eventParam.setSearchEndTime(endDate); eventParam.setSearchEndTime(param.getEndTime());
List<EventCount> eventCounts = detailFeignClient.getEventCount(eventParam).getData(); List<EventCount> eventCounts = detailFeignClient.getEventCount(eventParam).getData();
Map<String, EventCount> eventMap = new HashMap<>(); Map<String, EventCount> eventMap = new HashMap<>();
@@ -1011,14 +1013,11 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
List<RStatOnlinerateVO> onLineRateVOS = generalDeviceInfoClient.getOnlineRateByDevIds(onlineRateParam).getData(); List<RStatOnlinerateVO> onLineRateVOS = generalDeviceInfoClient.getOnlineRateByDevIds(onlineRateParam).getData();
Map<String, Float> onlineRateMap = onLineRateVOS.stream().collect(Collectors.toMap(RStatOnlinerateVO::getDevIndex, RStatOnlinerateVO::getOnlineRate)); Map<String, Float> onlineRateMap = onLineRateVOS.stream().collect(Collectors.toMap(RStatOnlinerateVO::getDevIndex, RStatOnlinerateVO::getOnlineRate));
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.POLLUTION_CALC.getCode()).getData(); List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(lineIdList, param.getIds(), startDate, endDate);
Map<String, String> dictData = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, DictData::getId));
String vHarmonicLimit = dictData.get(DicDataEnum.V_HARMONIC_LIMIT.getCode());
String iAllLimit = dictData.get(DicDataEnum.I_ALL_LIMIT.getCode());
List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(lineIdList, Arrays.asList(vHarmonicLimit, iAllLimit), startDate, endDate);
Map<String, Double> calcMap = new HashMap<>(); Map<String, Double> calcMap = new HashMap<>();
if (CollUtil.isNotEmpty(rMpPollutionDPOS)) { if (CollUtil.isNotEmpty(rMpPollutionDPOS)) {
calcMap.putAll(rMpPollutionDPOS.stream().collect(Collectors.toMap(x -> x.getLineId() + "_" + x.getPollutionType(), RMpPollutionDPO::getValue))); //谐波电压
calcMap.putAll(rMpPollutionDPOS.stream().collect(Collectors.toMap(x -> x.getLineId(), RMpPollutionDPO::getValue)));
} }
if (CollUtil.isNotEmpty(lineIdList)) { if (CollUtil.isNotEmpty(lineIdList)) {
// 获取谐波电压数据&总畸变率&越限限值计算基础污染值 // 获取谐波电压数据&总畸变率&越限限值计算基础污染值
@@ -1027,7 +1026,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
LinePollution linePollution = new LinePollution(); LinePollution linePollution = new LinePollution();
linePollution.setLineId(lineId); linePollution.setLineId(lineId);
//获取监测点数据完整性 //获取监测点数据完整性
linePollution.setIntegrity(Objects.isNull(integrityMap.get(lineId)) ? 0.0 : integrityMap.get(lineId)); linePollution.setIntegrity(Objects.isNull(integrityMap.get(lineId)) ? 0.0 : integrityMap.get(lineId)>100?100.0:integrityMap.get(lineId));
//获取监测点限值 //获取监测点限值
Overlimit overlimit = commTerminalGeneralClient.getOverLimitData(lineId).getData(); Overlimit overlimit = commTerminalGeneralClient.getOverLimitData(lineId).getData();
LineDevGetDTO lineDetailData = commTerminalGeneralClient.getMonitorDetail(lineId).getData(); LineDevGetDTO lineDetailData = commTerminalGeneralClient.getMonitorDetail(lineId).getData();
@@ -1037,10 +1036,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
} }
linePollution.setLineName(lineDetailData.getPointName()); linePollution.setLineName(lineDetailData.getPointName());
linePollution.setInterval(lineDetailData.getInterval()); linePollution.setInterval(lineDetailData.getInterval());
// 计算谐波电压的污染值 // 计算谐波的污染值
linePollution.setVHarmonicValue(calcMap.containsKey(lineId+"_"+vHarmonicLimit)?calcMap.get(lineId+"_"+vHarmonicLimit):0.0); linePollution.setHarmonicValue(calcMap.containsKey(lineId)?calcMap.get(lineId)>100?100.0:integrityMap.get(lineId):0.0);
// 计算谐波电流的污染值
linePollution.setIHarmonicValue(calcMap.containsKey(lineId+"_"+iAllLimit )?calcMap.get(lineId+"_"+iAllLimit):0.0);
// 获取暂态数据 // 获取暂态数据
BeanUtil.copyProperties(eventMap.get(lineId), linePollution); BeanUtil.copyProperties(eventMap.get(lineId), linePollution);
//获取该监测点其他元信息 //获取该监测点其他元信息
@@ -1060,9 +1057,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override @Override
public void downPollutionUserCalc(StatSubstationBizBaseParam param) { public void downPollutionUserCalc(StatSubstationBizBaseParam param) {
// 处理干扰源用户的报告 // 处理干扰源用户的报告
String startDate = DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(); List<LinePollution> loadTypeLineList = pollutionCalcList(param);
String endDate = DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString();
List<LinePollution> loadTypeLineList = pollutionCalcList(startDate, endDate);
/** /**
* 1、首先过滤重要变电站、一类变电站、跨省计量关点 todo...待优化 * 1、首先过滤重要变电站、一类变电站、跨省计量关点 todo...待优化
* 2、过滤后以监测对象分组统计数据有多个测点的需要出结果 * 2、过滤后以监测对象分组统计数据有多个测点的需要出结果
@@ -1081,14 +1076,11 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
// objPollution.setBusinessType(linePollutions.get(0).getBusinessType()); // objPollution.setBusinessType(linePollutions.get(0).getBusinessType());
// 求出平均污染值 // 求出平均污染值
double objVValue = linePollutions.stream() double objVValue = linePollutions.stream()
.mapToDouble(o -> o.getVHarmonicValue()) .mapToDouble(o -> o.getHarmonicValue())
.sum(); .sum();
objPollution.setObjVValue(PubUtils.doubleRound(2, objVValue) + ""); objPollution.setObjVValue(PubUtils.doubleRound(2, objVValue) + "");
double objIValue = linePollutions.stream()
.mapToDouble(o -> o.getIHarmonicValue())
.sum();
objPollution.setObjIValue(PubUtils.doubleRound(2, objIValue) + "");
// 处理该监测对象下面监测点的信息 // 处理该监测对象下面监测点的信息
List<LoadTypeLineItemPollution> loadTypeLineItemPollutions = new ArrayList<>(); List<LoadTypeLineItemPollution> loadTypeLineItemPollutions = new ArrayList<>();
@@ -1104,15 +1096,13 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
objPollutions= objPollutions.stream() objPollutions= objPollutions.stream()
.sorted(Comparator.comparing(ObjPollution::getObjVValue).reversed()) .sorted(Comparator.comparing(ObjPollution::getObjVValue).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
ExcelUtil.exportExcel("用户谐波电压污染值" + endDate + ".xlsx", ObjPollution.class, objPollutions); ExcelUtil.exportExcel("用户谐波电压污染值" + param.getEndTime() + ".xlsx", ObjPollution.class, objPollutions);
} }
@Override @Override
public void downPollutionSubCalc(StatSubstationBizBaseParam param) { public void downPollutionSubCalc(StatSubstationBizBaseParam param) {
// 处理干扰源用户的报告 // 处理干扰源用户的报告
String startDate = DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(); List<LinePollution> linePollutionList = pollutionCalcList(param);
String endDate = DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString();
List<LinePollution> linePollutionList = pollutionCalcList(startDate, endDate);
// 整合变电站待导出的数据 // 整合变电站待导出的数据
List<GdPollution> gdPollutionList = new ArrayList<>(); List<GdPollution> gdPollutionList = new ArrayList<>();
// 以供电公司分组 // 以供电公司分组
@@ -1147,19 +1137,13 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
if (CollUtil.isNotEmpty(temp)) { if (CollUtil.isNotEmpty(temp)) {
// 计算电网侧下所有监测点谐波电压平均污染值 // 计算电网侧下所有监测点谐波电压平均污染值
double subVValue = temp.stream() double subVValue = temp.stream()
.mapToDouble(o -> o.getVHarmonicValue()) .mapToDouble(o -> o.getHarmonicValue())
.average() .average()
.orElse(0.0); .orElse(0.0);
// 电网侧污染值 // 电网侧污染值
powerFlagPollution1.setPowerVValue(PubUtils.doubleRound(2, subVValue) + ""); powerFlagPollution1.setPowerVValue(PubUtils.doubleRound(2, subVValue) + "");
// 计算电网侧下所有监测点谐波电流平均污染值
double subIValue = temp.stream()
.mapToDouble(o -> o.getIHarmonicValue())
.average()
.orElse(0.0);
// 电网侧污染值
powerFlagPollution1.setPowerIValue(PubUtils.doubleRound(2, subIValue) + "");
// 设备信息 // 设备信息
for (LinePollution linePollution : temp) { for (LinePollution linePollution : temp) {
@@ -1185,19 +1169,13 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
if (CollUtil.isNotEmpty(temp1)) { if (CollUtil.isNotEmpty(temp1)) {
// 计算电网侧下所有监测点谐波电压平均污染值 // 计算电网侧下所有监测点谐波电压平均污染值
double subVValue = temp1.stream() double subVValue = temp1.stream()
.mapToDouble(o -> o.getVHarmonicValue()) .mapToDouble(o -> o.getHarmonicValue())
.average() .average()
.orElse(0.0); .orElse(0.0);
// 电网侧污染值 // 电网侧污染值
powerFlagPollution2.setPowerVValue(PubUtils.doubleRound(2, subVValue) + ""); powerFlagPollution2.setPowerVValue(PubUtils.doubleRound(2, subVValue) + "");
// 计算电网侧下所有监测点谐波电流平均污染值
double subIValue = temp1.stream()
.mapToDouble(o -> o.getIHarmonicValue())
.average()
.orElse(0.0);
// 电网侧污染值 // 电网侧污染值
powerFlagPollution2.setPowerIValue(PubUtils.doubleRound(2, subIValue) + "");
for (LinePollution linePollution : temp1) { for (LinePollution linePollution : temp1) {
LineItemPollution lineItemPollution = new LineItemPollution(); LineItemPollution lineItemPollution = new LineItemPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true); BeanUtil.copyProperties(linePollution, lineItemPollution, true);
@@ -1236,7 +1214,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
gdPollution.setSubstationPollutionList(substationPollutions); gdPollution.setSubstationPollutionList(substationPollutions);
gdPollutionList.add(gdPollution); gdPollutionList.add(gdPollution);
} }
ExcelUtil.exportExcel("变电站谐波电压污染值" + endDate + ".xlsx", GdPollution.class, gdPollutionList); ExcelUtil.exportExcel("变电站谐波电压污染值" + param.getEndTime() + ".xlsx", GdPollution.class, gdPollutionList);
} }