Browse Source

修正:统计月报发电量小数点保留后两位

zhongwei
ty 6 months ago
parent
commit
4762cdefcb
  1. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java

6
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 stationRunReportVO=new StationRunReportVO();
stationRunReportVO.setStationName("合计"); stationRunReportVO.setStationName("合计");
if (CollectionUtil.isNotEmpty(reportVOS)){ 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()); 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()); stationRunReportVO.setFinishPowerMon(new BigDecimal(sumFinishPowerMon).setScale(2,BigDecimal.ROUND_UP).toString());
if (!ObjectUtils.isEmpty(sumPowerMonPlan)) { if (!ObjectUtils.isEmpty(sumPowerMonPlan)) {
BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan),4,BigDecimal.ROUND_UP) BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan),4,BigDecimal.ROUND_UP)

Loading…
Cancel
Save