1.调整全景稳态统计超标监测点占比

2.优化稳态word报告
This commit is contained in:
wr
2025-12-15 13:32:38 +08:00
parent 65805e4f50
commit 47b08d4797
5 changed files with 114 additions and 10 deletions

View File

@@ -15,7 +15,7 @@ import lombok.EqualsAndHashCode;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("distribution_area") @TableName("fbs_distribution_area")
public class DistributionArea extends BaseEntity { public class DistributionArea extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -17,7 +17,7 @@ import java.time.LocalDate;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("power_generation_user") @TableName("fbs_power_generation_user")
public class GenerationUser extends BaseEntity { public class GenerationUser extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -32,6 +32,9 @@ public class EvaluationVo {
@ApiModelProperty("越限占比") @ApiModelProperty("越限占比")
private Double ratio = 3.14159; private Double ratio = 3.14159;
@ApiModelProperty("超标监测点数量")
private Integer size=0;
} }
} }

View File

@@ -2,6 +2,7 @@ package com.njcn.harmonic.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient; import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO; import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
@@ -305,13 +306,9 @@ public class GridServiceImpl implements IGridService {
}); });
result.setChildrenList(childrenList); result.setChildrenList(childrenList);
if (CollUtil.isNotEmpty(childrenList)) { if (CollUtil.isNotEmpty(childrenList)) {
OptionalDouble optionalAvg = childrenList.stream() int sum = childrenList.stream().mapToInt(EvaluationVo.Children::getSize).sum();
.filter(child -> child.getRatio() != null && !child.getRatio().equals(3.14159)) if (lineList.size()!=0) {
.mapToDouble(EvaluationVo.Children::getRatio) result.setLineRatio(NumberUtil.round(sum/lineList.size(),2).doubleValue());
.average();
if (optionalAvg.isPresent()) {
double avg = optionalAvg.getAsDouble();
result.setLineRatio(PubUtils.doubleRound(2, avg));
} }
} }
} }
@@ -821,6 +818,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList0 = limitRateList.stream() List<RStatLimitRateDPO> filteredList0 = limitRateList.stream()
.filter(data -> data.getFreqDevOvertime() + data.getVoltageDevOvertime() + data.getFlickerOvertime() + data.getUaberranceOvertime() + data.getUbalanceOvertime() > 0) .filter(data -> data.getFreqDevOvertime() + data.getVoltageDevOvertime() + data.getFlickerOvertime() + data.getUaberranceOvertime() + data.getUbalanceOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList0.size());
children.setRatio(PubUtils.doubleRound(2, filteredList0.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList0.size() * 100.0 / limitRateList.size()));
break; break;
//电压偏差 //电压偏差
@@ -828,6 +826,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList1 = limitRateList.stream() List<RStatLimitRateDPO> filteredList1 = limitRateList.stream()
.filter(data -> data.getVoltageDevOvertime() > 0) .filter(data -> data.getVoltageDevOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList1.size());
children.setRatio(PubUtils.doubleRound(2, filteredList1.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList1.size() * 100.0 / limitRateList.size()));
break; break;
//频率偏差 //频率偏差
@@ -835,6 +834,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList2 = limitRateList.stream() List<RStatLimitRateDPO> filteredList2 = limitRateList.stream()
.filter(data -> data.getFreqDevOvertime() > 0) .filter(data -> data.getFreqDevOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList2.size());
children.setRatio(PubUtils.doubleRound(2, filteredList2.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList2.size() * 100.0 / limitRateList.size()));
break; break;
//电压总谐波畸变率 //电压总谐波畸变率
@@ -842,6 +842,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList3 = limitRateList.stream() List<RStatLimitRateDPO> filteredList3 = limitRateList.stream()
.filter(data -> data.getUaberranceOvertime() > 0) .filter(data -> data.getUaberranceOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList3.size());
children.setRatio(PubUtils.doubleRound(2, filteredList3.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList3.size() * 100.0 / limitRateList.size()));
break; break;
//电压闪变 //电压闪变
@@ -849,6 +850,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList4 = limitRateList.stream() List<RStatLimitRateDPO> filteredList4 = limitRateList.stream()
.filter(data -> data.getFlickerOvertime() > 0) .filter(data -> data.getFlickerOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList4.size());
children.setRatio(PubUtils.doubleRound(2, filteredList4.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList4.size() * 100.0 / limitRateList.size()));
break; break;
//三相电压不平衡度 //三相电压不平衡度
@@ -856,6 +858,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList5 = limitRateList.stream() List<RStatLimitRateDPO> filteredList5 = limitRateList.stream()
.filter(data -> data.getUbalanceOvertime() > 0) .filter(data -> data.getUbalanceOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList5.size());
children.setRatio(PubUtils.doubleRound(2, filteredList5.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList5.size() * 100.0 / limitRateList.size()));
break; break;
// 谐波电压 // 谐波电压
@@ -864,6 +867,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList6 = limitRateList.stream() List<RStatLimitRateDPO> filteredList6 = limitRateList.stream()
.filter(x -> getLimitRateStats(x, 2, 26, "uharm", "Overtime") || x.getUaberranceOvertime() > 0) .filter(x -> getLimitRateStats(x, 2, 26, "uharm", "Overtime") || x.getUaberranceOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList6.size());
children.setRatio(PubUtils.doubleRound(2, filteredList6.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList6.size() * 100.0 / limitRateList.size()));
break; break;
//谐波电流 //谐波电流
@@ -871,6 +875,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList7 = limitRateList.stream() List<RStatLimitRateDPO> filteredList7 = limitRateList.stream()
.filter(x -> getLimitRateStats(x, 2, 26, "iharm", "Overtime")) .filter(x -> getLimitRateStats(x, 2, 26, "iharm", "Overtime"))
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList7.size());
children.setRatio(PubUtils.doubleRound(2, filteredList7.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList7.size() * 100.0 / limitRateList.size()));
break; break;
//间谐波电压 //间谐波电压
@@ -878,6 +883,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList8 = limitRateList.stream() List<RStatLimitRateDPO> filteredList8 = limitRateList.stream()
.filter(x -> getLimitRateStats(x, 1, 16, "inuharm", "Overtime")) .filter(x -> getLimitRateStats(x, 1, 16, "inuharm", "Overtime"))
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList8.size());
children.setRatio(PubUtils.doubleRound(2, filteredList8.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList8.size() * 100.0 / limitRateList.size()));
break; break;
//负序电流 //负序电流
@@ -885,6 +891,7 @@ public class GridServiceImpl implements IGridService {
List<RStatLimitRateDPO> filteredList9 = limitRateList.stream() List<RStatLimitRateDPO> filteredList9 = limitRateList.stream()
.filter(data -> data.getINegOvertime() > 0) .filter(data -> data.getINegOvertime() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
children.setSize(filteredList9.size());
children.setRatio(PubUtils.doubleRound(2, filteredList9.size() * 100.0 / limitRateList.size())); children.setRatio(PubUtils.doubleRound(2, filteredList9.size() * 100.0 / limitRateList.size()));
break; break;
default: default:

View File

@@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.harmonic.mapper.RStatDataHarmRateVDMapper;
import com.njcn.harmonic.mapper.RStatDataIDMapper; import com.njcn.harmonic.mapper.RStatDataIDMapper;
import com.njcn.harmonic.mapper.RStatDataInharmVDMapper; import com.njcn.harmonic.mapper.RStatDataInharmVDMapper;
import com.njcn.harmonic.mapper.ReportMapper; import com.njcn.harmonic.mapper.ReportMapper;
import com.njcn.harmonic.pojo.po.RStatDataVD; import com.njcn.harmonic.pojo.po.RStatDataVD;
import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateVDPO;
import com.njcn.harmonic.pojo.po.day.RStatDataIDPO; import com.njcn.harmonic.pojo.po.day.RStatDataIDPO;
import com.njcn.harmonic.pojo.param.ReportQueryParam; import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO; import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO;
@@ -32,6 +34,7 @@ public class ReportServiceImpl implements ReportService {
private final ReportMapper reportMapper; private final ReportMapper reportMapper;
private final IRStatDataVDService statDataVDService; private final IRStatDataVDService statDataVDService;
private final RStatDataHarmRateVDMapper rStatDataHarmRateVDMapper;
private final RStatDataIDMapper rStatDataIDMapper; private final RStatDataIDMapper rStatDataIDMapper;
private final RStatDataInharmVDMapper rStatDataInharmVDMapper; private final RStatDataInharmVDMapper rStatDataInharmVDMapper;
@@ -220,7 +223,7 @@ public class ReportServiceImpl implements ReportService {
} }
//获取电压含有率,不包含基波 //获取电压含有率,不包含基波
List<ReportValue> listRate = dataV(param, Arrays.asList("A", "B", "C"), 2, 51, false, 1); List<ReportValue> listRate = dataHarmV(param, Arrays.asList("A", "B", "C"), 2, 51, false, 1);
if (CollUtil.isEmpty(listRate)) { if (CollUtil.isEmpty(listRate)) {
for (int i = 0; i < 49; i++) { for (int i = 0; i < 49; i++) {
@@ -382,6 +385,76 @@ public class ReportServiceImpl implements ReportService {
return a; return a;
} }
/**
* 电压信息
*
* @param param 查询条件
* @param valueTypes 区分类别 例如"A","B","C"
* @param num 循环开始
* @param size 循环结束
* @param fly 否是启用获取属性电压
* @param index 获取属性位置名称
* @return
*/
private List<ReportValue> dataHarmV(ReportQueryParam param, List<String> valueTypes, Integer num, Integer size, Boolean fly, Integer index) {
List<RStatDataHarmrateVDPO> harmRateVDPOS = rStatDataHarmRateVDMapper.selectList(new LambdaQueryWrapper<RStatDataHarmrateVDPO>()
.eq(RStatDataHarmrateVDPO::getLineId, param.getLineId())
.in(CollUtil.isNotEmpty(valueTypes), RStatDataHarmrateVDPO::getPhaseType, valueTypes)
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatDataHarmrateVDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatDataHarmrateVDPO::getTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
String max = "MAX";
String avg = "AVG";
String min = "MIN";
String cp95 = "CP95";
List<ReportValue> a = new ArrayList<>();
Map<String, List<RStatDataHarmrateVDPO>> collect = harmRateVDPOS.stream().collect(Collectors.groupingBy(RStatDataHarmrateVDPO::getPhaseType));
collect.forEach((key, value) -> {
Map<String, List<RStatDataHarmrateVDPO>> valueTypeMap = value.stream().collect(Collectors.groupingBy(RStatDataHarmrateVDPO::getValueType));
for (int i = num; i < size; i++) {
ReportValue reportValue = new ReportValue();
String attribute = "";
if (fly) {
if (index == 0) {
attribute = attributeV(i);
} else {
attribute = attributeV(index);
}
} else {
attribute = "v" + i;
}
if (valueTypeMap.containsKey(max)) {
List<Float> aa = reflectDataHarmV(valueTypeMap.get(max), max, attribute);
reportValue.setPhaseType(key);
Float maxNum = aa.stream().distinct().max(Float::compareTo).get();
reportValue.setFmaxValue(maxNum);
}
if (valueTypeMap.containsKey(avg)) {
List<Float> aa = reflectDataHarmV(valueTypeMap.get(avg), avg, attribute);
reportValue.setPhaseType(key);
Double avgNum = aa.stream().distinct().collect(Collectors.averagingDouble(Float::doubleValue));
reportValue.setMeanValue(avgNum.floatValue());
}
if (valueTypeMap.containsKey(min)) {
List<Float> aa = reflectDataHarmV(valueTypeMap.get(min), min, attribute);
reportValue.setPhaseType(key);
double minNum = aa.stream().distinct().min(Float::compareTo).get();
reportValue.setMinValue((float) minNum);
}
if (valueTypeMap.containsKey(cp95)) {
List<Float> aa = reflectDataHarmV(valueTypeMap.get(cp95), cp95, attribute);
reportValue.setPhaseType(key);
List<Float> cp95Num = aa.stream().distinct().sorted(Comparator.comparing(Float::doubleValue).reversed()).collect(Collectors.toList());
reportValue.setCp95Value(cp95Num.get(0).floatValue());
}
a.add(reportValue);
}
});
return a;
}
/** /**
* 电压反射取属性值 * 电压反射取属性值
* *
@@ -411,6 +484,27 @@ public class ReportServiceImpl implements ReportService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private List<Float> reflectDataHarmV(List<RStatDataHarmrateVDPO> value, String name, String attribute) {
Field field = null;
try {
field = RStatDataHarmrateVDPO.class.getDeclaredField(attribute);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
field.setAccessible(true);
Field finalField = field;
return value.stream().filter(x -> x.getValueType().equals(name)).map(temp -> {
BigDecimal o = null;
try {
o = (BigDecimal) finalField.get(temp);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return o.floatValue();
}).collect(Collectors.toList());
}
/** /**
* 电压反射取属性值 * 电压反射取属性值
* *