From 906dbfc74b270b958ba959b9c54f0d2133b41e44 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期五, 11 四月 2025 13:57:27 +0800
Subject: [PATCH] fix;主动计算平台扣款金额

---
 LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs |    4 +---
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs      |   11 ++---------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
index 6f8ca5a..5c80d3f 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -546,7 +546,7 @@
 
             var repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo
                    && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).AnyAsync();
-            if (repeat)
+            if (!repeat)
             {
                 await _lifePayConsumption.InsertAsync(lifePayConsumption);
             }
@@ -572,8 +572,6 @@
                     FinishTime = x.FinishTime,
                     CreationTime = x.CreationTime,
                 });
-
-
             return list;
         }
 
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 5a4b83b..50a9914 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -936,9 +936,6 @@
         && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).AnyAsync();
          CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�");
 
-        //var rate = await GetRate();
-        //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
-
         var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸);
 
         var amount = CalculateAmount(input.ProductData.ParValue, rate);
@@ -964,7 +961,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);
@@ -990,8 +986,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();
@@ -1007,7 +1001,6 @@
             OrderNo = channle.ChannlesNum + CreateOrderNo(),
             LifePayOrderStatus = LifePayOrderStatusEnum.鍏呭�间腑,
             LifePayOrderType = LifePayOrderTypeEnum.ElectricOrder,
-            // LifePayType = input.LifePayType,
             OrderParamDetailJsonStr = JsonConvert.SerializeObject(input.ProductData),
             UserId = user.Id,
             PayStatus = LifePayStatusEnum.鏈敮浠�,
@@ -1017,6 +1010,7 @@
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
             PlatformRate = platformRate.Rate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };
@@ -1044,8 +1038,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();
@@ -1073,6 +1065,7 @@
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
             PlatformRate = platformRate.Rate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };

--
Gitblit v1.9.1