Browse Source

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

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

7
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 { }else {
stationRunReportVO.setPowerMonRate("0.0"); 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); 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)); stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear));
if (!ObjectUtils.isEmpty(sumPowerYearPlan)){ if (!ObjectUtils.isEmpty(sumPowerYearPlan)){
BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan),4,BigDecimal.ROUND_UP) BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan),4,BigDecimal.ROUND_UP)

Loading…
Cancel
Save