From bb18fbb5291e13b0545b90e8d8641c8392f7a112 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 06 十一月 2024 16:25:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
index 9a4ec48..b97dde3 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -154,6 +154,7 @@
             List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq);
             int chargingSecond = 0;
             BigDecimal paymentAmount = new BigDecimal("0");
+            BigDecimal rechargeAmount = new BigDecimal("0");
             BigDecimal orderAmount = new BigDecimal("0");
             BigDecimal electrovalence = new BigDecimal("0");
             BigDecimal serviceCharge = new BigDecimal("0");
@@ -265,7 +266,7 @@
                 if (data3!=null)tChargingOrder.setUserName(data3.getName());
                 // 累加实收金额 支付结算金额
                 if (tChargingOrder.getChargeAmount()!=null){
-                    paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount());
+                    paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount());
                 }
                 // 总金额
                 if (tChargingOrder.getOrderAmount()!=null){
@@ -274,6 +275,9 @@
                 // 累加累计电费
                 if (tChargingOrder.getElectrovalence()!=null){
                     electrovalence = electrovalence.add(tChargingOrder.getElectrovalence());
+                }
+                if (tChargingOrder.getRechargeAmount()!=null){
+                    rechargeAmount = rechargeAmount.add(tChargingOrder.getRechargeAmount());
                 }
                 List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2)
                         .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list();
@@ -312,7 +316,7 @@
                 chargingBillVO.setPaymentAmount(BigDecimal.ZERO);
             }
 
-            chargingBillListVO.setPaymentAmount(paymentAmount);
+            chargingBillListVO.setPaymentAmount(rechargeAmount);
             chargingBillListVO.setOrderAmount(paymentAmount == null?BigDecimal.ZERO:orderAmount.subtract(sharingAmount).subtract(commissionAmount));
             chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount);
             chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence);
@@ -320,7 +324,7 @@
             chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2,BigDecimal.ROUND_DOWN));
             chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount);
             chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity);
-            chargingBillListVO.setBillMoney(paymentAmount.subtract(refundAmount==null?BigDecimal.ZERO:refundAmount)
+            chargingBillListVO.setBillMoney(rechargeAmount.subtract(refundAmount==null?BigDecimal.ZERO:refundAmount)
                             .subtract(commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)).subtract(sharingAmount).setScale(2, BigDecimal.ROUND_DOWN));
             switch (chargingBillListVO.getType()){
                 case 1:
@@ -379,7 +383,7 @@
             chargingBillVO.setExportList(tChargingOrders);
             for (TChargingOrder tChargingOrder : tChargingOrders) {
                 if (tChargingOrder.getOrderAmount()!=null){
-                    paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount());
+                    paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getRechargeAmount());
                 }
 
                 // 累加订单金额
@@ -640,8 +644,8 @@
                     paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount());
                 }
                 // 总金额
-                if (tChargingOrder.getOrderAmount()!=null){
-                orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount());
+                if (tChargingOrder.getRechargeAmount()!=null){
+                orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount());
                 }
                 // 累加累计电费
                 if (tChargingOrder.getElectrovalence()!=null){
@@ -675,9 +679,9 @@
             // 格式化为字符串
             String timeString = String.format("%d小时%d分钟%d秒", hours, minutes, seconds);
             chargingBillVO.setChargingTime(timeString);
+            chargingBillListVO.setOrderAmount(orderAmount.subtract(refundAmount));
 
-            chargingBillListVO.setPaymentAmount(orderAmount.subtract(commissionAmount).subtract(sharingAmount).setScale(2,BigDecimal.ROUND_DOWN));
-            chargingBillListVO.setOrderAmount(orderAmount);
+            chargingBillListVO.setPaymentAmount(chargingBillListVO.getOrderAmount().subtract(commissionAmount).subtract(sharingAmount).setScale(2,BigDecimal.ROUND_DOWN));
             chargingBillListVO.setElectrovalence(electrovalence);
             chargingBillListVO.setServiceCharge(serviceCharge.setScale(2,BigDecimal.ROUND_DOWN));
             chargingBillListVO.setCommissionAmount(commissionAmount.setScale(2,BigDecimal.ROUND_DOWN));
@@ -749,9 +753,9 @@
                     paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount());
                 }
                 // 累加订单金额
-                if (tChargingOrder.getOrderAmount()!=null){
-                    orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount());
-                    orderAmountTotal = orderAmountTotal.add(tChargingOrder.getPaymentAmount());
+                if (tChargingOrder.getRechargeAmount()!=null){
+                    orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount());
+                    orderAmountTotal = orderAmountTotal.add(tChargingOrder.getRechargeAmount());
                 }
                 // 累加累计电费
                 if (tChargingOrder.getElectrovalence()!=null){

--
Gitblit v1.7.1