From 658c08d01489fc20a33ead726a60b683c7096b90 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 29 May 2024 16:55:51 +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 | 7 +++++-- 1 file changed, 5 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 4ea709d..22f47b4 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 @@ -536,9 +536,12 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor }else { stationRunReportVO.setPowerMonRate("0.0"); } - double sumPowerYearPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerYearPlan).sum(); + double sumPowerYearPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerYearPlan) + .reduce(0, (a, b) -> new BigDecimal(a).add(new BigDecimal(b)).setScale(2,BigDecimal.ROUND_UP).doubleValue()); stationRunReportVO.setPowerYearPlan(sumPowerYearPlan); - double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)).sum(); +// double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)).sum(); + double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)) + .reduce(0, (a, b) -> new BigDecimal(a).add(new BigDecimal(b)).setScale(2,BigDecimal.ROUND_UP).doubleValue()); stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear)); if (!ObjectUtils.isEmpty(sumPowerYearPlan)){ BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan),4,BigDecimal.ROUND_UP)