| | |
| | | if(1 == doubleIntegration){ |
| | | num1 *= 2; |
| | | } |
| | | |
| | | } |
| | | |
| | | GetInviteUser query = new GetInviteUser(); |
| | |
| | | } |
| | | |
| | | //已充电总度数 |
| | | BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge).setScale(2, RoundingMode.HALF_EVEN); |
| | | BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge).setScale(2, RoundingMode.HALF_EVEN); |
| | | BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge); |
| | | BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge); |
| | | BigDecimal serviceCharge = originalServicePrice; |
| | | BigDecimal vipDiscountAmount = BigDecimal.ZERO; |
| | | //计算优惠金额 |
| | | if(null != chargingOrder.getVipDiscount()){ |
| | | vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())).setScale(2, RoundingMode.HALF_EVEN); |
| | | serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()).setScale(2, RoundingMode.HALF_EVEN); |
| | | vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())); |
| | | serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()); |
| | | } |
| | | chargingOrderAccountingStrategy.setChargingCapacity(sharp_peak_charge); |
| | | chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge); |
| | | chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice); |
| | | chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount); |
| | | chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setCreateTime(LocalDateTime.now()); |
| | | chargingOrderAccountingStrategyService.save(chargingOrderAccountingStrategy); |
| | | |
| | |
| | | } |
| | | } |
| | | //会员折扣金额 |
| | | discountAmount = discountAmount.setScale(2, RoundingMode.HALF_EVEN); |
| | | discountAmount = discountAmount.setScale(4, RoundingMode.HALF_EVEN); |
| | | payAmount = payAmount.subtract(discountAmount); |
| | | periodServicePrice_total = periodServicePrice_total.subtract(discountAmount); |
| | | |
| | |
| | | order.setEndTime(LocalDateTime.parse(vo.getEnd_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setStatus(5); |
| | | order.setOrderAmount(orderAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setVipDiscountAmount(discountAmount); |
| | | order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setChargingCapacity(vo.getTotal_electricity()); |
| | | order.setElectricity(vo.getTotal_electricity()); |
| | |
| | | } |
| | | } |
| | | //优惠券优惠金额 |
| | | couponDiscount = couponDiscount.setScale(2, RoundingMode.HALF_EVEN); |
| | | couponDiscount = couponDiscount.setScale(4, RoundingMode.HALF_EVEN); |
| | | refundAmount = refundAmount.add(couponDiscount); |
| | | payAmount = payAmount.subtract(couponDiscount); |
| | | if(periodServicePrice_total.compareTo(BigDecimal.ZERO) > 0){ |
| | | periodServicePrice_total = periodServicePrice_total.subtract(couponDiscount); |
| | | } |
| | | order.setCouponDiscountAmount(couponDiscount); |
| | | order.setCouponDiscountAmount(couponDiscount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setPaymentAmount(payAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setRefundAmount(refundAmount.setScale(2, RoundingMode.HALF_EVEN)); |