From 34a3e91fbf5b8fd1566c4e6034607c94855e84b6 Mon Sep 17 00:00:00 2001 From: huangzj <826100833@qq.com> Date: Wed, 8 Nov 2023 09:47:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CsGroupServiceImpl.java | 2 +- .../handler/MqttMessageHandler.java | 39 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java index 9c1253e..469e238 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java @@ -170,7 +170,7 @@ public class CsGroupServiceImpl extends ServiceImpl 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); diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java index 4709607..96146a6 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java @@ -145,19 +145,19 @@ public class MqttMessageHandler { }); }); //过滤谐波电流,谐波电压畸变率求平均值 - List thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdU(%)")).collect(Collectors.toList()); - Map> 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 thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdU(%)")).collect(Collectors.toList()); +// Map> 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 thdV = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdI(%)")).collect(Collectors.toList()); // Map> collect1 = thdV.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId)); @@ -212,17 +212,16 @@ public class MqttMessageHandler { } }); Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData(); - //获取输出电流计算负载率 - List 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)));