From e452d5b2384236c1ccc9031dec6cadcddbbb585a Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期五, 21 三月 2025 15:54:11 +0800
Subject: [PATCH] fix:提交

---
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml |   20 ++++++++++
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs      |   22 +++++++++++
 LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs                     |   21 ++++++++++
 LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs       |    6 ++-
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs              |   39 +++++++++++++------
 5 files changed, 94 insertions(+), 14 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
index e38e3a3..f54f710 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
@@ -219,6 +219,28 @@
     /// </summary>
     public string? ChannelId { get; set; }
 
+
+
+    /// <summary>
+    /// 骞冲彴鎶樻墸姣斾緥
+    /// </summary>
+    public decimal? PlatformRate { get; set; }
+
+    /// <summary>
+    /// 娓犻亾鎶樻墸
+    /// </summary>
+    public decimal? ChannleRate { get; set; }
+
+    /// <summary>
+    /// 娓犻亾浣i噾姣斾緥
+    /// </summary>
+    public decimal? ChannlesRakeRate { get; set; }
+
+    /// <summary>
+    /// 鎵嬬画璐规瘮渚�
+    /// </summary>
+    public decimal PremiumRate { get; set; }
+
 }
 
 //public class ChannelsBaseInput : PageInput
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index e4e9294..577dd86 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -26,6 +26,7 @@
 using Volo.Abp.Domain.Entities;
 using Volo.Abp.ObjectMapping;
 using NPOI.SS.Formula.Functions;
+using StackExchange.Redis;
 
 namespace LifePayment.Application;
 
@@ -402,10 +403,8 @@
     public async Task<LifePayOrderOutput> GetLifePayOrderDetail(string orderNo)
     {
         var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
-        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
         var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId);
-        var premium = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync();
-        CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
+         CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
         var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId);
         
         var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channle.ChannlesRakeRate / 100;
@@ -436,16 +435,16 @@
             LifePayRefundStatus = order.LifePayRefundStatus,
             ActualRechargeAmount = order.ActualRechargeAmount,
             RefundPrice = order.RefundPrice,
-            PlatformRate = platformRate.Rate,
+            PlatformRate = order.PlatformRate,
             PlatformPrice = order.PlatformDeductionAmount,
             ElecBillUrl = order.ElecBillUrl.GetOssPath(),
             RefundElecBillUrl = order.RefundElecBillUrl.GetOssPath(),
             ChannleRate = channle.ChannlesRate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
             ChannlesRakePrice = channlesRakePrice.HasValue ? 0 : Math.Round(channlesRakePrice.Value, 2),
-            PremiumRate = premium == null ? 0 : premium.Rate,
-            PremiumPrice = premium == null ? 0 : Math.Round(order.PayAmount * premium.Rate, 2),
-            Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channle.ChannlesRakeRate / 100) - (premium == null ? 0 : Math.Round(order.PayAmount * premium.Rate, 2))
+            PremiumRate = order.PremiumRate,
+            PremiumPrice = Math.Round(order.PayAmount * order.PremiumRate, 2),
+            Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channle.ChannlesRakeRate / 100) - Math.Round(order.PayAmount * order.PremiumRate, 2)
         };
 
         return result;
@@ -833,6 +832,9 @@
 
         var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸).Rate);
 
+        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
+        
+
         var orderInput = new CreateLifePayOrderInput
         {
             OrderNo = channle.ChannlesNum + CreateOrderNo(),
@@ -846,7 +848,10 @@
             PayAmount = amount.PayAmont,
             DiscountAmount = amount.DiscountAmount,
             RechargeAmount = amount.RechargeAmount,
-            ChannelId = channle.ChannlesNum
+            ChannelId = channle.ChannlesNum,
+            PlatformRate = platformRate.Rate,
+            ChannleRate = channle.ChannlesRate,
+            ChannlesRakeRate = channle.ChannlesRakeRate,
         };
 
         await CreateLifePayOrder(orderInput);
@@ -877,6 +882,8 @@
 
         var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸).Rate);
 
+        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
+
         var orderInput = new CreateLifePayOrderInput
         {
             OrderNo = channle.ChannlesNum + CreateOrderNo(),
@@ -890,7 +897,10 @@
             PayAmount = amount.PayAmont,
             DiscountAmount = amount.DiscountAmount,
             RechargeAmount = amount.RechargeAmount,
-            ChannelId = channle.ChannlesNum
+            ChannelId = channle.ChannlesNum,
+            PlatformRate = platformRate.Rate,
+            ChannleRate = channle.ChannlesRate,
+            ChannlesRakeRate = channle.ChannlesRakeRate,
         };
 
         await CreateLifePayOrder(orderInput);
@@ -920,6 +930,8 @@
         CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
 
         var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸).Rate);
+
+        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
 
         var orderInput = new CreateLifePayOrderInput
         {
@@ -959,7 +971,8 @@
         CheckExtensions.IfTrueThrowUserFriendlyException(order.LifePayType.HasValue, "褰撳墠璁㈠崟宸查�夋嫨鏀粯绫诲瀷");
 
         order.LifePayType = input.LifePayType;
-
+        var premium = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync();
+        order.PremiumRate = premium == null ? 0 : premium.Rate;
         await _lifePayOrderRepository.UpdateAsync(order);
 
         var desc = "鐢熸椿缂磋垂-";
@@ -1304,13 +1317,15 @@
         {
             return;
         }
+
         if (input.RefundPrice > order.PayAmount)
         {
             throw new UserFriendlyException("閫�娆剧殑閲戦涓嶈兘澶т簬瀹炰粯閲戦");
         }
-        if (input.LifePayRefundType == LifePayRefundTypeEnum.鍏ㄩ閫�娆� && input.RefundPrice != order.PayAmount)
+
+        if (input.LifePayRefundType == LifePayRefundTypeEnum.鍏ㄩ閫�娆�)
         {
-            throw new UserFriendlyException("鍏ㄩ閫�娆剧殑閲戦涓庡疄浠橀噾棰濅笉涓�鑷�");
+            input.RefundPrice = order.PayAmount;
         }
 
         if (order.LifePayOrderStatus != LifePayOrderStatusEnum.宸插け璐� && order.PayStatus != LifePayStatusEnum.寰呴��娆� && order.LifePayOrderStatus != LifePayOrderStatusEnum.閫�娆惧緟瀹℃牳)
diff --git a/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs b/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
index 6832ba0..b64e9cf 100644
--- a/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
+++ b/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
@@ -43,15 +43,17 @@
         public async Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByType(QueryOperateHistoryByTypeInput input)
         {
             var query = _operateHistory.AsQueryable();
-
             switch (input.OperateHistoryType)
             {
-              
                 case OperateHistoryTypeEnum.AccountManage:
                     query = query.Where(x => x.UserId == input.TypeId
                                           && LifePaymentConstant.LogsSpecies.AccountManageOperateNameList.Contains(x.OperateName));
 
                     break;
+                case OperateHistoryTypeEnum.LifePayChannles:
+                    query = query.Where(x => x.RelationId == input.TypeId);
+
+                    break;
                 default:
                     query = query.Where(x => x.RelationId == input.TypeId);
 
diff --git a/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs b/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs
index 580901f..d36b20e 100644
--- a/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs
+++ b/LifePayment/LifePayment.Domain/LifePay/LifePayOrder.cs
@@ -167,5 +167,26 @@
         /// </summary>
         public string? RefundElecBillUrl { get; set; }
 
+
+        /// <summary>
+        /// 骞冲彴鎶樻墸姣斾緥
+        /// </summary>
+        public decimal? PlatformRate { get; set; }
+
+        /// <summary>
+        /// 娓犻亾鎶樻墸
+        /// </summary>
+        public decimal? ChannleRate { get; set; }
+
+        /// <summary>
+        /// 娓犻亾浣i噾姣斾緥
+        /// </summary>
+        public decimal? ChannlesRakeRate { get; set; }
+
+        /// <summary>
+        /// 鎵嬬画璐规瘮渚�
+        /// </summary>
+        public decimal PremiumRate { get; set; }
+
     }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 5193fb0..83e9f57 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -400,6 +400,26 @@
             涓嬪崟娓犻亾
             </summary>
         </member>
+        <member name="P:LifePayment.Application.Contracts.CreateLifePayOrderInput.PlatformRate">
+            <summary>
+            骞冲彴鎶樻墸姣斾緥
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateLifePayOrderInput.ChannleRate">
+            <summary>
+            娓犻亾鎶樻墸
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateLifePayOrderInput.ChannlesRakeRate">
+            <summary>
+            娓犻亾浣i噾姣斾緥
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateLifePayOrderInput.PremiumRate">
+            <summary>
+            鎵嬬画璐规瘮渚�
+            </summary>
+        </member>
         <member name="P:LifePayment.Application.Contracts.QueryLifePayOrderListInput.LifePayOrderType">
             <summary>
             璁㈠崟绫诲瀷

--
Gitblit v1.9.1