From bf2d06ee46b254097c1d205c2ce37ab15a4ad91b Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 16 四月 2025 14:20:51 +0800
Subject: [PATCH] fix bug

---
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs |   40 ++++++++++++++++++----------------------
 1 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 526aca3..bb94bcb 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -280,16 +280,16 @@
                                 DiscountAmount = a.DiscountAmount ?? 0,
                                 FinishTime = a.FinishTime,
                                 Id = a.Id,
-                                LifePayOrderStatus = a.LifePayOrderStatus?? 0,
+                                LifePayOrderStatus = a.LifePayOrderStatus ?? 0,
                                 LifePayOrderType = a.LifePayOrderType,
                                 LifePayType = a.LifePayType,
                                 OrderNo = a.OrderNo,
                                 PayAmount = a.PayAmount ?? 0,
                                 PhoneNumber = a.PhoneNumber,
-                                RechargeAmount = a.RechargeAmount??0,
+                                RechargeAmount = a.RechargeAmount ?? 0,
                                 UserId = a.UserId,
                                 OutOrderNo = a.OutOrderNo,
-                                PayStatus = a.PayStatus?? 0,
+                                PayStatus = a.PayStatus ?? 0,
                                 PayTime = a.PayTime,
                                 ACOOLYOrderNo = a.ACOOLYOrderNo,
                                 RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(),
@@ -300,6 +300,7 @@
                                 RefundTime = a.RefundTime,
                                 ChannelName = b.ChannlesName,
                                 ActualRechargeAmount = a.RechargeAmount,
+                                ActualReceivedAmount = a.ActualReceivedAmount,
                                 PlatformDeductionAmount = a.PlatformDeductionAmount,
                                 ACOOLYStatus = a.ACOOLYStatus,
                                 LifePayRefundStatus = a.LifePayRefundStatus,
@@ -388,8 +389,9 @@
             ACOOLYStatus = x.ACOOLYStatus,
             RefundApplyRemark = x.RefundApplyRemark,
             RechargeAmount = x.RechargeAmount,
-            ActualReceivedAmount = x.ActualReceivedAmount.ToString("F2"),
+            ActualReceivedAmount = (x.ActualReceivedAmount ?? 0).ToString("F2"),
             LifePayRefundStatus = x.LifePayRefundStatus,
+            OrderNo = x.OrderNo,
 
         }).OrderByDescending(r => r.CreationTime).ToListAsync();
         var i = 0;
@@ -566,7 +568,7 @@
                                                         DiscountAmount = x.DiscountAmount ?? 0,
                                                         FinishTime = x.FinishTime,
                                                         Id = x.Id,
-                                                        LifePayOrderStatus = x.LifePayOrderStatus?? 0 ,
+                                                        LifePayOrderStatus = x.LifePayOrderStatus ?? 0,
                                                         LifePayOrderType = x.LifePayOrderType,
                                                         LifePayType = x.LifePayType,
                                                         OrderNo = x.OrderNo,
@@ -609,7 +611,7 @@
 
     public async Task<List<CreateEditPayChannelsInput>> GetLifePayChannlesAllList(QueryLifePayChannlesInput input)
     {
-        return await GetLifePayChannlesListFilter().WhereIf(input.Status.HasValue,x => x.Status == input.Status).ToListAsync();
+        return await GetLifePayChannlesListFilter().WhereIf(input.Status.HasValue, x => x.Status == input.Status).ToListAsync();
     }
 
     public async Task<CreateEditPayChannelsInput> GetLifePayChannlesDto(Guid id)
@@ -907,7 +909,7 @@
         return await _wxPayApi.WxPayTradeQuery(outTradeNo);
     }
 
-  
+
 
     #endregion
 
@@ -929,14 +931,11 @@
         var channle = await GetLifePayChannlesDtoByNum(input.ChannelId);
         CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�");
 
-        var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.PhoneOrder 
+        var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.PhoneOrder
         && x.PayStatus == LifePayStatusEnum.宸叉敮浠�
         && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑
         && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).AnyAsync();
-         CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�");
-
-        //var rate = await GetRate();
-        //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
+        CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�");
 
         var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸);
 
@@ -963,7 +962,6 @@
             PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
-            //ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100
         };
 
         await CreateLifePayOrder(orderInput);
@@ -989,8 +987,6 @@
         CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�");
         CheckExtensions.IfTrueThrowUserFriendlyException(channle.Status == LifePayChannelsStatsEnum.绂佺敤, "娓犻亾宸茶绂佺敤");
 
-        //var rate = await GetRate();
-        //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
         var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.ElectricOrder && x.PayStatus == LifePayStatusEnum.宸叉敮浠�
          && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricType)
          && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricAccount)).AnyAsync();
@@ -1006,7 +1002,6 @@
             OrderNo = channle.ChannlesNum + CreateOrderNo(),
             LifePayOrderStatus = LifePayOrderStatusEnum.鍏呭�间腑,
             LifePayOrderType = LifePayOrderTypeEnum.ElectricOrder,
-            // LifePayType = input.LifePayType,
             OrderParamDetailJsonStr = JsonConvert.SerializeObject(input.ProductData),
             UserId = user.Id,
             PayStatus = LifePayStatusEnum.鏈敮浠�,
@@ -1016,6 +1011,7 @@
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
             PlatformRate = platformRate.Rate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };
@@ -1043,8 +1039,6 @@
         CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�");
         CheckExtensions.IfTrueThrowUserFriendlyException(channle.Status == LifePayChannelsStatsEnum.绂佺敤, "娓犻亾宸茶绂佺敤");
 
-        //var rate = await GetRate();
-        //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
         var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.GasOrder && x.PayStatus == LifePayStatusEnum.宸叉敮浠�
         && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasOrgType)
         && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasAccount)).AnyAsync();
@@ -1072,6 +1066,7 @@
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
             PlatformRate = platformRate.Rate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };
@@ -1388,12 +1383,13 @@
         var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
         CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
 
-        if (order.LifePayOrderStatus >= LifePayOrderStatusEnum.宸插畬鎴�)
+        if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�)
         {
             return;
         }
 
-        order.PlatformDeductionAmount = payAmount;
+        // order.PlatformDeductionAmount = payAmount;
+
         if (acoolyOrderNo.IsNotNullOrEmpty())
         {
             order.ACOOLYOrderNo = acoolyOrderNo;
@@ -2276,12 +2272,12 @@
             default:
                 break;
         }
-        
+
         return new SetPayTypeReturn()
         {
             Desc = desc,
             OrderNo = order.OrderNo,
-            PayAmount = order.PayAmount.HasValue? order.PayAmount.Value : 0,
+            PayAmount = order.PayAmount.HasValue ? order.PayAmount.Value : 0,
             LifePayType = lifePayType,
         };
     }

--
Gitblit v1.9.1