| | |
| | | * @param query |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public void chargeMonitoring(UploadRealTimeMonitoringDataQuery query) { |
| | | if(com.ruoyi.common.core.utils.StringUtils.isNotEmpty(query.getTransaction_serial_number())){ |
| | | //获取当前的计费策略 |
| | |
| | | BigDecimal residualAmount = chargingOrder.getRechargeAmount().subtract(t).setScale(4, RoundingMode.HALF_EVEN); |
| | | chargingOrder.setResidualAmount(residualAmount); |
| | | if(query.getOutput_current().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal divide = query.getOutput_current().multiply(query.getOutput_voltage()).divide(new BigDecimal(1000)); |
| | | BigDecimal divide = (query.getOutput_current().multiply(query.getOutput_voltage())).divide(new BigDecimal(1000)); |
| | | chargingOrder.setChargingPower(divide); |
| | | chargingOrder.setCurrent(query.getOutput_current()); |
| | | chargingOrder.setVoltage(query.getOutput_voltage()); |
| | | chargingOrder.setPower(query.getOutput_current().multiply(query.getOutput_voltage())); |
| | | chargingOrder.setNeedElec(query.getOutput_current()); |
| | | |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | chargingGun.setChargingPower(divide); |
| | | chargingGun.setSoc(query.getSoc()); |
| | | chargingGunClient.updateChargingGunById(chargingGun); |
| | | } |
| | | chargingOrder.setElectricity(query.getCharging_degree()); |
| | | chargingOrder.setTotalElectricity(new BigDecimal(100 - query.getSoc())); |
| | |
| | | order.setEndMode(1); |
| | | } |
| | | order.setResidualAmount(rechargeAmount.subtract(total)); |
| | | order.setEndTime(LocalDateTime.now()); |
| | | order.setStartTime(LocalDateTime.parse(vo.getStart_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setEndTime(LocalDateTime.parse(vo.getEnd_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setStatus(5); |
| | | order.setOrderAmount(orderAmount); |
| | | order.setVipDiscountAmount(discountAmount); |
| | | order.setServiceCharge(periodServicePrice_total); |
| | | order.setElectrovalence(periodElectricPrice_total); |
| | | order.setChargingCapacity(vo.getTotal_electricity()); |
| | | |
| | | //计算优惠券 |
| | | if(null != chargingOrder.getAppCouponId()){ |
| | |
| | | // 将枪状态重置为空闲 |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); |
| | | chargingGun.setStatus(2); |
| | | chargingGun.setChargingPower(BigDecimal.ZERO); |
| | | chargingGun.setSoc(0); |
| | | chargingGunClient.updateChargingGunById(chargingGun); |
| | | |
| | | //添加积分 |