Browse Source

#空指针bug修改

zhongwei
yang_shj 9 months ago
parent
commit
62ae021ac4
  1. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -1549,10 +1549,13 @@ public class HydropowerServiceImpl implements HydropowerService {
// 天气区间 // 天气区间
hydropower.setMaxTemp(this.intervalTemp(weekWeather,station.getCode(),true)); hydropower.setMaxTemp(this.intervalTemp(weekWeather,station.getCode(),true));
hydropower.setMinTemp(this.intervalTemp(weekWeather,station.getCode(),false)); hydropower.setMinTemp(this.intervalTemp(weekWeather,station.getCode(),false));
if(CollectionUtil.isEmpty(reals)){
return hydropower;
}
// 装机容量 // 装机容量
hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getInstalledCapacity())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
// 负荷 // 负荷
hydropower.setLoad(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum()); hydropower.setLoad(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getActivePower())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum());
// 出力 // 出力
if(Math.abs(hydropower.getCapacity()) > 0){ if(Math.abs(hydropower.getCapacity()) > 0){
hydropower.setOutput(BigDecimal.valueOf(hydropower.getLoad() / hydropower.getCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); hydropower.setOutput(BigDecimal.valueOf(hydropower.getLoad() / hydropower.getCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());

Loading…
Cancel
Save