修改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)){
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.getAvgValue()).setScale(4, RoundingMode.UP).doubleValue());
vo.setAvgValue(BigDecimal.valueOf(statisticalDataDTO.getAvgValue()).setScale(4, RoundingMode.UP).doubleValue());
} else {
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());
Map<String, List<ThdDataVO>> collect = thdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
collect.forEach((k,v)->{
if(!CollectionUtil.isEmpty(v)){
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(v.get(0),thdDataVO);
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
thdDataVO.setPhase("avg");
result.add(thdDataVO);
}
});
// 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));
// collect.forEach((k,v)->{
// if(!CollectionUtil.isEmpty(v)){
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
// ThdDataVO thdDataVO = new ThdDataVO();
// BeanUtils.copyProperties(v.get(0),thdDataVO);
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
// thdDataVO.setPhase("avg");
// result.add(thdDataVO);
//
// }
// });
// 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));
@@ -212,17 +212,16 @@ public class MqttMessageHandler {
}
});
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();
BeanUtils.copyProperties(temp,thdDataVO);
temp.setUnit("%");
temp.setStatisticalName("load_Rate");
thdDataVO.setUnit("%");
thdDataVO.setStatisticalName("load_Rate");
thdDataVO.setAnotherName("负载率");
if (capacity<=0){
temp.setStatisticalData(3.1415926);
thdDataVO.setStatisticalData(3.1415926);
}else {
double v = temp.getStatisticalData() / capacity;
thdDataVO.setStatisticalData(Double.valueOf(df.format(v)));