修改bug

This commit is contained in:
huangzj
2023-11-08 09:47:44 +08:00
parent 973c429dc1
commit 34a3e91fbf
2 changed files with 20 additions and 21 deletions

View File

@@ -170,7 +170,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
if (!Objects.isNull(statisticalDataDTO)){ if (!Objects.isNull(statisticalDataDTO)){
vo.setMaxValue(BigDecimal.valueOf(statisticalDataDTO.getMaxValue()).setScale(4, RoundingMode.UP).doubleValue()); vo.setMaxValue(BigDecimal.valueOf(statisticalDataDTO.getMaxValue()).setScale(4, RoundingMode.UP).doubleValue());
vo.setMinValue(BigDecimal.valueOf(statisticalDataDTO.getMinValue()).setScale(4, RoundingMode.UP).doubleValue()); vo.setMinValue(BigDecimal.valueOf(statisticalDataDTO.getMinValue()).setScale(4, RoundingMode.UP).doubleValue());
vo.setMinValue(BigDecimal.valueOf(statisticalDataDTO.getAvgValue()).setScale(4, RoundingMode.UP).doubleValue()); vo.setAvgValue(BigDecimal.valueOf(statisticalDataDTO.getAvgValue()).setScale(4, RoundingMode.UP).doubleValue());
} else { } else {
vo.setMaxValue(3.1415956); vo.setMaxValue(3.1415956);

View File

@@ -145,19 +145,19 @@ public class MqttMessageHandler {
}); });
}); });
//过滤谐波电流,谐波电压畸变率求平均值 //过滤谐波电流,谐波电压畸变率求平均值
List<ThdDataVO> thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdU(%)")).collect(Collectors.toList()); // List<ThdDataVO> thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdU(%)")).collect(Collectors.toList());
Map<String, List<ThdDataVO>> collect = thdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId)); // Map<String, List<ThdDataVO>> collect = thdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
collect.forEach((k,v)->{ // collect.forEach((k,v)->{
if(!CollectionUtil.isEmpty(v)){ // if(!CollectionUtil.isEmpty(v)){
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble(); // double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
ThdDataVO thdDataVO = new ThdDataVO(); // ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(v.get(0),thdDataVO); // BeanUtils.copyProperties(v.get(0),thdDataVO);
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble))); // thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
thdDataVO.setPhase("avg"); // thdDataVO.setPhase("avg");
result.add(thdDataVO); // result.add(thdDataVO);
//
} // }
}); // });
// List<ThdDataVO> thdV = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdI(%)")).collect(Collectors.toList()); // List<ThdDataVO> thdV = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdI(%)")).collect(Collectors.toList());
// Map<String, List<ThdDataVO>> collect1 = thdV.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId)); // Map<String, List<ThdDataVO>> collect1 = thdV.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
@@ -212,17 +212,16 @@ public class MqttMessageHandler {
} }
}); });
Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData(); Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
//获取输出电流计算负载率
List<ThdDataVO> iTolOut = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
result.addAll(iTolOut);
iTolOut.forEach(temp->{
apfRmsI.forEach(temp->{
ThdDataVO thdDataVO = new ThdDataVO(); ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(temp,thdDataVO); BeanUtils.copyProperties(temp,thdDataVO);
temp.setUnit("%"); thdDataVO.setUnit("%");
temp.setStatisticalName("load_Rate"); thdDataVO.setStatisticalName("load_Rate");
thdDataVO.setAnotherName("负载率");
if (capacity<=0){ if (capacity<=0){
temp.setStatisticalData(3.1415926); thdDataVO.setStatisticalData(3.1415926);
}else { }else {
double v = temp.getStatisticalData() / capacity; double v = temp.getStatisticalData() / capacity;
thdDataVO.setStatisticalData(Double.valueOf(df.format(v))); thdDataVO.setStatisticalData(Double.valueOf(df.format(v)));