| | |
| | | BigDecimal total = vo.getPhotovoltaic().add(vo.getEnergyStorage()).add(vo.getCharge()); |
| | | vo.setTotal(total); |
| | | //计算比率 |
| | | vo.setPhotovoltaicRate(calculateRatio(vo.getPhotovoltaic(),vo.getTotal())); |
| | | vo.setEnergyStorageRate(calculateRatio(vo.getEnergyStorage(),vo.getTotal())); |
| | | vo.setChargeRate(calculateRatio(vo.getCharge(),vo.getTotal())); |
| | | vo.setPhotovoltaicRate(calculateRatio(vo.getPhotovoltaic(),vo.getTotal()).multiply(new BigDecimal("100"))); |
| | | vo.setEnergyStorageRate(calculateRatio(vo.getEnergyStorage(),vo.getTotal()).multiply(new BigDecimal("100"))); |
| | | vo.setChargeRate(calculateRatio(vo.getCharge(),vo.getTotal()).multiply(new BigDecimal("100"))); |
| | | |
| | | return vo; |
| | | } |
| | |
| | | throw new ArithmeticException("分母不能为零"); |
| | | } |
| | | |
| | | return part.divide(total, 2, RoundingMode.HALF_UP); |
| | | return part.divide(total, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | @Override |
| | |
| | | vo.setStorageDisCharge(storageDisCharge); |
| | | |
| | | |
| | | vo.setPhotovoltaic(new BigDecimal("9950")); |
| | | TSystemConfiguration sysConfig1 = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,4)); |
| | | vo.setPhotovoltaic(new BigDecimal(sysConfig1.getContent())); |
| | | vo.setGreenElectricity(vo.getPhotovoltaic().multiply(new BigDecimal("0.94")).setScale(2, RoundingMode.HALF_UP)); |
| | | return vo; |
| | | } |
| | | |