1.专项分析-指标总览算法修改

This commit is contained in:
wr
2024-03-06 18:47:17 +08:00
parent 3782ac6900
commit cf0324bff5
6 changed files with 36 additions and 25 deletions

View File

@@ -53,6 +53,11 @@ public class RStatHarmonicOrgM implements Serializable {
* 数据类型,字典表01主网测点 02配网测点 * 数据类型,字典表01主网测点 02配网测点
*/ */
private String dataType; private String dataType;
public void setOverLimitMeasurementAverage(Float overLimitMeasurementAverage) {
this.overLimitMeasurementAverage = NumberUtil.round(overLimitMeasurementAverage*100,2).floatValue();;
}
public void setOverLimitMeasurementRatioAverage(Float overLimitMeasurementRatioAverage) { public void setOverLimitMeasurementRatioAverage(Float overLimitMeasurementRatioAverage) {
this.overLimitMeasurementRatioAverage = NumberUtil.round(overLimitMeasurementRatioAverage*100,2).floatValue(); this.overLimitMeasurementRatioAverage = NumberUtil.round(overLimitMeasurementRatioAverage*100,2).floatValue();
} }

View File

@@ -53,6 +53,9 @@ public class RStatHarmonicOrgQ implements Serializable {
* 数据类型,字典表01主网测点 02配网测点 * 数据类型,字典表01主网测点 02配网测点
*/ */
private String dataType; private String dataType;
public void setOverLimitMeasurementAverage(Float overLimitMeasurementAverage) {
this.overLimitMeasurementAverage = NumberUtil.round(overLimitMeasurementAverage*100,2).floatValue();;
}
public void setOverLimitMeasurementRatioAverage(Float overLimitMeasurementRatioAverage) { public void setOverLimitMeasurementRatioAverage(Float overLimitMeasurementRatioAverage) {
this.overLimitMeasurementRatioAverage = NumberUtil.round(overLimitMeasurementRatioAverage*100,2).floatValue(); this.overLimitMeasurementRatioAverage = NumberUtil.round(overLimitMeasurementRatioAverage*100,2).floatValue();
} }

View File

@@ -54,6 +54,9 @@ public class RStatHarmonicOrgY implements Serializable {
*/ */
private String dataType; private String dataType;
public void setOverLimitMeasurementAverage(Float overLimitMeasurementAverage) {
this.overLimitMeasurementAverage = NumberUtil.round(overLimitMeasurementAverage*100,2).floatValue();;
}
public void setOverLimitMeasurementRatioAverage(Float overLimitMeasurementRatioAverage) { public void setOverLimitMeasurementRatioAverage(Float overLimitMeasurementRatioAverage) {
this.overLimitMeasurementRatioAverage = NumberUtil.round(overLimitMeasurementRatioAverage*100,2).floatValue(); this.overLimitMeasurementRatioAverage = NumberUtil.round(overLimitMeasurementRatioAverage*100,2).floatValue();
} }

View File

@@ -43,6 +43,6 @@ public class WindFarmIndexOverviewPO implements Serializable {
/** /**
* 平均超标天数 * 平均超标天数
*/ */
private Integer avgExcessiveDays; private Double avgExcessiveDays;
} }

View File

@@ -114,8 +114,8 @@ public class WindFarmIndexOverviewServiceImpl implements WindFarmIndexOverview {
RStatOrgWfIndexOverviewVO vo = new RStatOrgWfIndexOverviewVO(); RStatOrgWfIndexOverviewVO vo = new RStatOrgWfIndexOverviewVO();
vo.setMonitorNum(po.getMonitorNum()); vo.setMonitorNum(po.getMonitorNum());
vo.setType(dataMap.get(po.getOrgNo())); vo.setType(dataMap.get(po.getOrgNo()));
vo.setHistograms(po.getAvgExcessiveDays().toString()); vo.setHistograms(po.getProportionOfExcessPoints().toString());
vo.setLineCharts(po.getMonitorNum().toString()); vo.setLineCharts(po.getAvgExcessiveDays().toString());
vo.setMonitorTag(po.getMonitorTag()); vo.setMonitorTag(po.getMonitorTag());
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

View File

@@ -62,7 +62,6 @@ public class SpecialAnalysisIndexOverviewServiceImpl implements SpecialAnalysisI
Date date = DateUtil.parse(jobParam.getDataDate()); Date date = DateUtil.parse(jobParam.getDataDate());
for (DeptGetChildrenMoreDTO deptGetChildrenMoreDTO : data1) { for (DeptGetChildrenMoreDTO deptGetChildrenMoreDTO : data1) {
Map<String, List<String>> lineBaseMap = new HashMap<>();
List<LineDevGetDTO> lineBaseList = new ArrayList<>(); List<LineDevGetDTO> lineBaseList = new ArrayList<>();
if(CollUtil.isNotEmpty(deptGetChildrenMoreDTO.getLineBaseList())){ if(CollUtil.isNotEmpty(deptGetChildrenMoreDTO.getLineBaseList())){
@@ -92,10 +91,11 @@ public class SpecialAnalysisIndexOverviewServiceImpl implements SpecialAnalysisI
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()); List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
List<RStatLimitRateDPO> rStatLimitRateMS = rStatLimitRateDMapper.selectList(new LambdaQueryWrapper<RStatLimitRateDPO>(). List<RStatLimitRateDPO> rStatLimitRateMS = rStatLimitRateDMapper.selectList(new LambdaQueryWrapper<RStatLimitRateDPO>()
in(RStatLimitRateDPO::getLineId, collect1). .eq(RStatLimitRateDPO::getPhasicType, "T")
ge(StrUtil.isNotBlank(jobParam.getBeginTime()), RStatLimitRateDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(jobParam.getBeginTime()))). .in(RStatLimitRateDPO::getLineId, collect1)
le(StrUtil.isNotBlank(jobParam.getEndTime()), RStatLimitRateDPO::getTime, DateUtil.endOfDay(DateUtil.parse(jobParam.getEndTime())))); .ge(StrUtil.isNotBlank(jobParam.getBeginTime()), RStatLimitRateDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(jobParam.getBeginTime())))
.le(StrUtil.isNotBlank(jobParam.getEndTime()), RStatLimitRateDPO::getTime, DateUtil.endOfDay(DateUtil.parse(jobParam.getEndTime()))));
if (CollectionUtils.isEmpty(rStatLimitRateMS)){ if (CollectionUtils.isEmpty(rStatLimitRateMS)){
//单位下没数据不补0,0,0的数据 //单位下没数据不补0,0,0的数据
return; return;
@@ -144,17 +144,17 @@ public class SpecialAnalysisIndexOverviewServiceImpl implements SpecialAnalysisI
vIndexCount.getAndIncrement(); vIndexCount.getAndIncrement();
} }
collect3.forEach((day, temp) -> { collect3.forEach((day, temp) -> {
if(isOverLimit(rStatLimitRateDPOList,1)){ if(isOverLimit(temp,1)){
iDayCount.getAndIncrement(); iDayCount.getAndIncrement();
} }
if(isOverLimit(rStatLimitRateDPOList,2)){ if(isOverLimit(temp,2)){
iDayCount.getAndIncrement(); vDayCount.getAndIncrement();
} }
if(isOverLimit(rStatLimitRateDPOList,3)){ if(isOverLimit(temp,3)){
iDayCount.getAndIncrement(); iDayIndexCount.getAndIncrement();
} }
if(isOverLimit(rStatLimitRateDPOList,4)){ if(isOverLimit(temp,4)){
iDayCount.getAndIncrement(); vDayIndexCount.getAndIncrement();
} }
}); });
@@ -167,29 +167,29 @@ public class SpecialAnalysisIndexOverviewServiceImpl implements SpecialAnalysisI
specialAnalysisIndexOverviewPO.setVoltageIndexExceedsNum(vIndexCount.get()); specialAnalysisIndexOverviewPO.setVoltageIndexExceedsNum(vIndexCount.get());
specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicElectricExceedsProportion( specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicElectricExceedsProportion(
this.divideAndKeepTwoDecimalPlaces(iCount.get(),collect2.size()) this.divideAndKeepTwoDecimalPlaces(iCount.get()*100.0,rStatLimitRateMS.size())
); );
specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicElectricExceedsAvgDays( specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicElectricExceedsAvgDays(
this.divideAndKeepTwoDecimalPlaces(iDayCount.get(),iCount.get()) this.divideAndKeepTwoDecimalPlaces(iDayCount.get()*1.0,iCount.get())
); );
specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicVoltageContentExceedsProportion( specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicVoltageContentExceedsProportion(
this.divideAndKeepTwoDecimalPlaces(vCount.get(),collect2.size()) this.divideAndKeepTwoDecimalPlaces(vCount.get()*100.0,rStatLimitRateMS.size())
); );
specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicVoltageContentExceedsAvgDays( specialAnalysisIndexOverviewDetailedPO.setMonitorHarmonicVoltageContentExceedsAvgDays(
this.divideAndKeepTwoDecimalPlaces(vDayCount.get(),vCount.get()) this.divideAndKeepTwoDecimalPlaces(vDayCount.get()*1.0,vCount.get())
); );
specialAnalysisIndexOverviewDetailedPO.setElectricIndexExceedsProportion( specialAnalysisIndexOverviewDetailedPO.setElectricIndexExceedsProportion(
this.divideAndKeepTwoDecimalPlaces(iIndexCount.get(),collect2.size()) this.divideAndKeepTwoDecimalPlaces(iIndexCount.get()*100.0,rStatLimitRateMS.size())
); );
specialAnalysisIndexOverviewDetailedPO.setElectricIndexExceedsAvgDays( specialAnalysisIndexOverviewDetailedPO.setElectricIndexExceedsAvgDays(
this.divideAndKeepTwoDecimalPlaces(iCount.get(),iIndexCount.get()) this.divideAndKeepTwoDecimalPlaces(iDayIndexCount.get()*1.0,iIndexCount.get())
); );
specialAnalysisIndexOverviewDetailedPO.setVoltageIndexExceedsProportion( specialAnalysisIndexOverviewDetailedPO.setVoltageIndexExceedsProportion(
this.divideAndKeepTwoDecimalPlaces(iDayIndexCount.get(),collect2.size()) this.divideAndKeepTwoDecimalPlaces(vDayIndexCount.get()*100.0,rStatLimitRateMS.size())
); );
specialAnalysisIndexOverviewDetailedPO.setVoltageIndexExceedsAvgDays( specialAnalysisIndexOverviewDetailedPO.setVoltageIndexExceedsAvgDays(
this.divideAndKeepTwoDecimalPlaces(vDayIndexCount.get(),vIndexCount.get()) this.divideAndKeepTwoDecimalPlaces(vDayIndexCount.get()*1.0,vIndexCount.get())
); );
specialAnalysisIndexOverviewPOList.add(specialAnalysisIndexOverviewPO); specialAnalysisIndexOverviewPOList.add(specialAnalysisIndexOverviewPO);
@@ -381,11 +381,11 @@ public class SpecialAnalysisIndexOverviewServiceImpl implements SpecialAnalysisI
* @Author: clam * @Author: clam
* @Date: 2023/11/2 * @Date: 2023/11/2
*/ */
public double divideAndKeepTwoDecimalPlaces(int a, int b) { public double divideAndKeepTwoDecimalPlaces(double a, int b) {
if (b == 0) { if (b == 0) {
return 0.00; return 0.00;
} }
double result = (double) a / b; double result = a / b;
DecimalFormat df = new DecimalFormat("#.00"); DecimalFormat df = new DecimalFormat("#.00");
return Double.parseDouble(df.format(result)); return Double.parseDouble(df.format(result));
} }