From 70082014b9b5c62f2edee1301343b3e54cfdc72e Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 25 十月 2024 11:27:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index 711e717..e9caa9b 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -792,6 +792,9 @@
 		one.setRefundStatus(2);
 		one.setRefundTime(LocalDateTime.now());
 		chargingOrderRefundService.updateById(one);
+		TChargingOrder chargingOrder = this.getById(one.getChargingOrderId());
+		chargingOrder.setPayTime(LocalDateTime.now());
+		this.updateById(chargingOrder);
 		return AjaxResult.success();
 	}
 
@@ -1280,8 +1283,8 @@
 			chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity());
 			chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount());
 			BigDecimal bigDecimal = new BigDecimal("0.006");
-			if (chargingOrderListVO.getServiceCharge()!=null){
-				chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getServiceCharge().multiply(bigDecimal));
+			if (chargingOrderListVO.getOrderAmount()!=null){
+				chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getOrderAmount().multiply(bigDecimal));
 			}
 			chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount());
 			chargingOrderListVO.setUid(chargingOrderListVO.getId()+"");
@@ -1497,8 +1500,8 @@
 
 		chargingOrderListInfoVO.setStatus(chargingOrder.getStatus());
 		BigDecimal bigDecimal = new BigDecimal("0.006");
-		if (chargingOrder.getServiceCharge()!=null){
-			chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getServiceCharge().multiply(bigDecimal));
+		if (chargingOrder.getOrderAmount()!=null){
+			chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getOrderAmount().multiply(bigDecimal));
 		}
 		chargingOrderListInfoVO.setElectrovalence(chargingOrder.getElectrovalence());
 		chargingOrderListInfoVO.setServiceCharge(chargingOrder.getServiceCharge());
@@ -1930,7 +1933,7 @@
 			chargingOrderRefund.setRefundTitle("充电完成退款");
 			chargingOrderRefund.setRefundContent("充电完成退款");
 			chargingOrderRefund.setRefundReason("充电完成退款");
-			chargingOrderRefund.setRefundRemark("充电完成退款");
+			chargingOrderRefund.setRefundRemark("实际充电消费金额:" + refundAmount);
 			chargingOrderRefund.setRefundTotalAmount(refundAmount);
 			chargingOrderRefund.setPayAmount(rechargeAmount);
 			if(1 == rechargePaymentType){
@@ -1960,6 +1963,8 @@
 					SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE");
 					AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date()));
 					if(success.isSuccess()){
+						chargingOrder.setPayTime(LocalDateTime.now());
+						this.updateById(chargingOrder);
 						chargingOrderRefundService.save(chargingOrderRefund);
 					}
 				}
@@ -2285,10 +2290,10 @@
 			}
 			if (tChargingOrder.getRefundStatus()!=null &&tChargingOrder.getRefundStatus() == 2){
 				// 如果成功退款 那么减去退款金额
-				paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount().subtract(tChargingOrder.getRefundAmount()));
+				paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount());
 			}else{
 				if (tChargingOrder.getPaymentAmount()!=null){
-					paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount());
+					paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount());
 				}
 			}
 		}
@@ -2296,8 +2301,8 @@
 		commissionAmount = sharingAmount.multiply(new BigDecimal("0.006"));
 		// 订单手续费 订单支付金额 - 退款金额*0.6%
 		orderCommission = paymentAmount.multiply(new BigDecimal("0.006"));
-		tSettlementConfirm.setSharingAmount(sharingAmount);
-		tSettlementConfirm.setCommissionAmount(commissionAmount);
+		tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN));
+		tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN));
 		tSettlementConfirm.setElectrovalence(electrovalence);
 		// 服务费=总服务费-三费收费-交易手续费-交易手续费-服务费会员抵扣-服务费优惠券抵扣
 		tSettlementConfirm.setServiceCharge(serviceCharge.subtract(commissionAmount).subtract(sharingAmount).subtract(orderCommission).subtract(vipDiscount).subtract(couponDiscount));

--
Gitblit v1.7.1