From 775d5d6142a717e8bc87da3aa3f5d8c1f52ef9a6 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 24 三月 2025 17:57:34 +0800
Subject: [PATCH] fix:bug修复

---
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs |   57 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 0db8bd2..e4a7211 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -246,8 +246,8 @@
     {
         var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWords)).Select(x => x.ChannlesNum).ToListAsync();
         var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
-                      .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime)
-                                            .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime)
+                      .WhereIf(input.BeginRefundTime.HasValue, x => x.FinishTime >= input.BeginRefundTime)
+                                            .WhereIf(input.EndRefundTime.HasValue, x => x.FinishTime <= input.EndRefundTime)
                                             .WhereIf(input.BeginPayTime.HasValue, x => x.PayTime >= input.BeginPayTime)
                                             .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType)
                                             .WhereIf(input.EndPayTime.HasValue, x => x.PayTime <= input.EndPayTime)
@@ -356,8 +356,6 @@
     /// <returns></returns>
     public async Task<List<LifePayRefundOrderListTemplate>> GetLifePayRefudOrderPageExport(QueryLifePayRefundOrderListInput input)
     {
-
-     
         var result = await (await GetLifePayRefundOrderListFilter(input)).Select(x => new LifePayRefundOrderListTemplate
         {
             FinishTime = x.FinishTime,
@@ -367,7 +365,13 @@
             PayAmount = x.PayAmount,
             PhoneNumber = x.PhoneNumber,
             RefundOrderNo = x.RefundOrderNo,
-            ChannelName = x.ChannelName
+            ChannelName = x.ChannelName,
+            CreationTime = x.CreationTime,
+            ACOOLYStatus = x.ACOOLYStatus,
+            RechargeAmount = x.RechargeAmount,
+            ActualReceivedAmount = x.ActualReceivedAmount.ToString("F2"),
+            LifePayRefundStatus = x.LifePayRefundStatus,
+
         }).OrderByDescending(r => r.CreationTime).ToListAsync();
         var i = 0;
         result.ForEach(s =>
@@ -378,7 +382,7 @@
             s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
             s.RechargeAmountStr = s.RechargeAmount.ToString("F2");
             s.ActualReceivedAmount = s.ActualReceivedAmount;
-            s.LifePayRefundStatus = s.LifePayRefundStatus.GetDescription();
+            s.LifePayRefundStatusStr = s.LifePayRefundStatus.GetDescription();
             s.PayAmountStr = s.PayAmount.ToString("F2");
             s.LifePayTypeStr = s.LifePayType.GetDescription();
             s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
@@ -717,11 +721,12 @@
         {
             DiscountAmount = x.DiscountAmount,
             FinishTime = x.FinishTime,
-            LifePayOrderStatus = x.LifePayOrderStatus,
+            //LifePayOrderStatus = x.LifePayOrderStatus,
             LifePayOrderType = x.LifePayOrderType,
             LifePayType = x.LifePayType,
             OrderNo = x.OrderNo,
             PayAmount = x.PayAmount,
+            ActualRechargeAmount = x.ActualRechargeAmount.HasValue?x.ActualRechargeAmount.Value:0,
             PhoneNumber = x.PhoneNumber,
             RechargeAmount = x.RechargeAmount,
             OutOrderNo = x.OutOrderNo,
@@ -729,8 +734,11 @@
             PayTime = x.PayTime,
             ACOOLYOrderNo = x.ACOOLYOrderNo,
             CreationTime = x.CreationTime,
-            RefundApplyRemark = x.RefundApplyRemark,
-            ChannelName = x.ChannelName
+            LifePayRefundStatus = x.LifePayRefundStatus,
+            ACOOLYStatus = x.ACOOLYStatus,
+            //RefundApplyRemark = x.RefundApplyRemark,
+            ChannelName = x.ChannelName,
+            PlatformPrice = x.PlatformDeductionAmount.HasValue ? x.PlatformDeductionAmount.Value : 0
         }).OrderByDescending(r => r.CreationTime).ToListAsync();
         var i = 0;
         result.ForEach(s =>
@@ -743,7 +751,10 @@
             s.PayTimeStr = !s.PayTime.HasValue ? string.Empty : s.PayTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
             s.LifePayTypeStr = s.LifePayType.GetDescription();
             s.PayStatusStr = s.PayStatus.GetDescription();
-            s.LifePayOrderStatusStr = s.LifePayOrderStatus.GetDescription();
+            s.ActualRechargeAmountStr = s.ActualRechargeAmount.ToString("F2");
+            s.LifePayRefundStatusStr = s.LifePayRefundStatusStr.GetDescription();
+            s.ACOOLYStatusStr = s.ACOOLYStatus.GetDescription();
+            //s.LifePayOrderStatusStr = s.LifePayOrderStatus.GetDescription();
             s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
         });
         return result;
@@ -839,8 +850,10 @@
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
             PlatformRate = platformRate.Rate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate /100,
             ChannleRate = channle.ChannlesRate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
+            //ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100
         };
 
         await CreateLifePayOrder(orderInput);
@@ -1253,6 +1266,24 @@
         await _lifePayOrderRepository.UpdateAsync(order);
     }
 
+    public async Task WxPayDomesticRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus)
+    {
+        var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
+        CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
+        order.LifePayRefundStatus = refundStatus;
+        switch (refundStatus)
+        {
+            case LifePayRefundStatusEnum.宸查��娆�:
+                order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
+                order.ACOOLYStatus = ACOOLYStatusEnum.宸查��娆�;
+                break;
+            case LifePayRefundStatusEnum.閫�娆句腑:
+                order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆句腑;
+                break;
+            default:break;
+        }
+    }
+
     /// <summary>
     /// ACOOLYO璁㈠崟閫氱煡澶勭悊
     /// </summary>
@@ -1342,6 +1373,7 @@
                     order.LifePayOrderStatus = LifePayOrderStatusEnum.寰呴��娆�;
                     order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
                 }
+
                 break;
             case LifePayTypeEnum.AliPay:
                 var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = Convert.ToInt32(input.RefundPrice * 100).ToString() });
@@ -1349,7 +1381,9 @@
                 {
                     throw new UserFriendlyException("閫�娆惧け璐�");
                 }
+
                 order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
+                order.LifePayRefundStatus = LifePayRefundStatusEnum.宸查��娆�;
                 break;
             default: throw new UserFriendlyException("閫�娆惧け璐�");
         }
@@ -1394,9 +1428,9 @@
             && order.LifePayOrderStatus != LifePayOrderStatusEnum.寰呴��娆� && order.LifePayOrderStatus != LifePayOrderStatusEnum.宸查��娆�)
         {
             order.LifePayOrderStatus = LifePayOrderStatusEnum.寰呴��娆�;
+            order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
             order.RefundApplyRemark = input.RefundApplyRemark;
             order.RefundApplyTime = DateTime.Now;
-
             await _lifePayOrderRepository.UpdateAsync(order);
         }
         else if (order.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || order.LifePayRefundStatus == LifePayRefundStatusEnum.寰呴��娆� ||
@@ -2015,6 +2049,7 @@
                                 PlatformDeductionAmount = a.PlatformDeductionAmount,
                                 ACOOLYStatus = a.ACOOLYStatus,
                                 LifePayRefundStatus = a.LifePayRefundStatus,
+                                ActualReceivedAmount = a.ActualReceivedAmount.HasValue? a.ActualReceivedAmount.Value : 0
                             });
         return result;
     }

--
Gitblit v1.9.1