From 4762cdefcb16d1582c3289a36326724c71f60dcd Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 29 May 2024 17:06:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=9C=88=E6=8A=A5=E5=8F=91=E7=94=B5=E9=87=8F=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E7=82=B9=E4=BF=9D=E7=95=99=E5=90=8E=E4=B8=A4=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/service/impl/OperStationMonthReportServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java index 22f47b4..3983c33 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java @@ -525,9 +525,11 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor StationRunReportVO stationRunReportVO=new StationRunReportVO(); stationRunReportVO.setStationName("合计"); if (CollectionUtil.isNotEmpty(reportVOS)){ - double sumPowerMonPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerMonPlan).sum(); + double sumPowerMonPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerMonPlan) + .reduce(0, (a, b) -> new BigDecimal(a).add(new BigDecimal(b)).setScale(2,BigDecimal.ROUND_UP).doubleValue()); stationRunReportVO.setPowerMonPlan(new BigDecimal(sumPowerMonPlan).setScale(2,BigDecimal.ROUND_UP).doubleValue()); - double sumFinishPowerMon = reportVOS.stream().map(StationRunReportVO::getFinishPowerMon).mapToDouble(s -> Double.valueOf(s)).sum(); + double sumFinishPowerMon = reportVOS.stream().map(StationRunReportVO::getFinishPowerMon).mapToDouble(s -> Double.valueOf(s)) + .reduce(0, (a, b) -> new BigDecimal(a).add(new BigDecimal(b)).setScale(2,BigDecimal.ROUND_UP).doubleValue()); stationRunReportVO.setFinishPowerMon(new BigDecimal(sumFinishPowerMon).setScale(2,BigDecimal.ROUND_UP).toString()); if (!ObjectUtils.isEmpty(sumPowerMonPlan)) { BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan),4,BigDecimal.ROUND_UP)