xuhy
2024-08-28 7473e0157c4f687c354ec351c3a22a40d1788ed5
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -500,7 +500,9 @@
       BigDecimal electronicMoney = new BigDecimal("0");
       BigDecimal serviceMoney = new BigDecimal("0");
      for (ChargingOrderVO chargingOrderVO : list) {
         total = total.add(chargingOrderVO.getChargingCapacity());
         if (chargingOrderVO.getChargingCapacity()!=null){
            total = total.add(chargingOrderVO.getChargingCapacity());
         }
         // 充电订单 明细记录
         List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>()
               .eq("charging_order_id", chargingOrderVO.getId()));
@@ -511,14 +513,18 @@
         LocalDateTime startTime = chargingOrderVO.getStartTime();
         LocalDateTime endTime = chargingOrderVO.getEndTime();
         // 计算时间差 秒 充电时长
         long between = ChronoUnit.SECONDS.between(startTime, endTime);
         chargingOrderVO.setChargingSecond(between);
         time += between;
         if (startTime!=null && endTime!=null){
            long between = ChronoUnit.SECONDS.between(startTime, endTime);
            chargingOrderVO.setChargingSecond(between);
            time += between;
         }
         // 总收入
         if (chargingOrderVO.getRefundStatus() == 2){
         if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){
            income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount()));
         }else{
            income = income.add(chargingOrderVO.getPaymentAmount());
            if (chargingOrderVO.getPaymentAmount()!=null){
               income = income.add(chargingOrderVO.getPaymentAmount());
            }
         }
         for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : chargingOrderId) {
            // 累计电费
@@ -540,11 +546,14 @@
            // 车牌号
            chargingOrderVO.setPhone(data.getPhone());
            List<Long> longs = new ArrayList<>();
            longs.add(chargingOrderVO.getAppUserCarId());
            List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData();
            if (!data1.isEmpty()){
               chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate());
            if (chargingOrderVO.getAppUserCarId()!=null){
               longs.add(chargingOrderVO.getAppUserCarId());
               List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData();
               if (!data1.isEmpty()){
                  chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate());
               }
            }
         }
      }
      tCharingOrderVO.setTotal(total);