From 7a89586d7754d5ff1c38cbfdbda6c357507f5620 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期一, 09 六月 2025 13:34:15 +0800 Subject: [PATCH] feat:退款按比例自动计算 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 379bf86..48708f5 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -353,6 +353,7 @@ RefundPrice = a.RefundPrice, ChannelName = b.ChannlesName, ActualRechargeAmount = a.RechargeAmount, + ActualReceivedAmount = a.ActualReceivedAmount, PlatformDeductionAmount = a.PlatformDeductionAmount, ACOOLYStatus = a.ACOOLYStatus, LifePayRefundStatus = a.LifePayRefundStatus, @@ -453,6 +454,7 @@ PremiumPrice = orderpirce.PremiumPrice, Profit = orderpirce.Profit, RefundOrderNo = order.RefundOrderNo, + ActualReceivedAmount = order.ActualReceivedAmount }; return result; @@ -1376,12 +1378,12 @@ var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); - if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�) - { - return; - } + //if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�) + //{ + // return; + //} - // order.PlatformDeductionAmount = payAmount; + order.ActualReceivedAmount = actualParValue; if (acoolyOrderNo.IsNotNullOrEmpty()) { @@ -1400,7 +1402,14 @@ order.LifePayOrderStatus = status; order.ACOOLYStatus = acoolyStatus; - order.FinishTime = DateTime.Now; + if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴� + || order.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆�) + { + order.FinishTime = DateTime.Now; + order.PlatformDeductionAmount = Math.Round((order.ActualReceivedAmount ?? 0) * (order.PlatformRate ?? 0) / 100, 2); + order.RefundPrice = Math.Round((1 - ((order.ActualReceivedAmount ?? 0) / (order.RechargeAmount ?? 0))) * (order.PayAmount ?? 0), 2); + } + await _lifePayOrderRepository.UpdateAsync(order); if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�) @@ -1508,6 +1517,8 @@ order.RefundTime = DateTime.Now; order.RefundCheckUserId = CurrentUser.Id; order.RefundPrice = input.RefundPrice; + order.ActualReceivedAmount = Math.Round((1 - ((order.RefundPrice ?? 0) / (order.PayAmount ?? 0))) * (order.RechargeAmount ?? 0), 2); + order.PlatformDeductionAmount = Math.Round((order.ActualReceivedAmount ?? 0) * (order.PlatformRate ?? 0) / 100, 2); //await _lifePayOrderRepository.UpdateAsync(order); -- Gitblit v1.9.1