From f70aa1ba523b3e8956a90304d1f48badc193c8c4 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 25 三月 2025 14:51:25 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi

---
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs     |    9 +++-
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml |    5 ++
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs              |   95 ++++++++++++++++++++++++++++-------------------
 LifePayment/LifePayment.Application/LifePay/StatisticsService.cs           |    4 +-
 4 files changed, 70 insertions(+), 43 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
index 428ccdc..f944c9a 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -443,6 +443,13 @@
     [Name("鍏呭�兼笭閬�")]
     public string? ChannelName { get; set; }
 
+
+
+    /// <summary>
+    /// 閫�娆剧敵璇锋椂闂�
+    /// </summary>
+    public DateTime? RefundApplyTime { get; set; }
+
     /// <summary>
     /// 閫�娆剧敵璇锋椂闂�
     /// </summary>
@@ -454,8 +461,6 @@
     /// </summary>
     public DateTime CreationTime { get; set; }
 
-    [Name("涓嬪崟鏃堕棿")]
-    public string? CreationTimeStr { get; set; }
 
     [Name("閫�娆捐鍗曞彿")]
     public string? RefundOrderNo { get; set; }
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 7987669..a142921 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -283,7 +283,7 @@
                                 RefundApplyRemark = a.RefundApplyRemark,
                                 RefundTime = a.RefundTime,
                                 ChannelName = b.ChannlesName,
-                                ActualRechargeAmount = a.ActualRechargeAmount,
+                                ActualRechargeAmount = a.RechargeAmount,
                                 PlatformDeductionAmount = a.PlatformDeductionAmount,
                                 ACOOLYStatus = a.ACOOLYStatus,
                                 LifePayRefundStatus = a.LifePayRefundStatus,
@@ -302,7 +302,7 @@
 
         var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
         .Where(x => x.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆句腑
-        || x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆�)
+        || (x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆� && x.LifePayRefundStatus != LifePayRefundStatusEnum.閫�娆鹃┏鍥�))
                                             .WhereIf(input.BeginRefundTime.HasValue, x => x.RefundTime >= input.BeginRefundTime)
                                             .WhereIf(input.EndRefundTime.HasValue, x => x.RefundTime <= input.EndRefundTime)
                                             .WhereIf(input.BeginRefundApplyTime.HasValue, x => x.RefundApplyTime >= input.BeginRefundApplyTime)
@@ -337,10 +337,11 @@
                                 RefundCheckRemark = a.RefundCheckRemark,
                                 RefundApplyRemark = a.RefundApplyRemark,
                                 RefundApplyTime = a.RefundApplyTime,
+                                RefundOrderNo = a.RefundOrderNo,
                                 RefundTime = a.RefundTime,
                                 RefundPrice = a.RefundPrice,
                                 ChannelName = b.ChannlesName,
-                                ActualRechargeAmount = a.ActualRechargeAmount,
+                                ActualRechargeAmount = a.RechargeAmount,
                                 PlatformDeductionAmount = a.PlatformDeductionAmount,
                                 ACOOLYStatus = a.ACOOLYStatus,
                                 LifePayRefundStatus = a.LifePayRefundStatus,
@@ -365,6 +366,7 @@
             PayAmount = x.PayAmount,
             PhoneNumber = x.PhoneNumber,
             RefundOrderNo = x.RefundOrderNo,
+            RefundApplyTime = x.RefundApplyTime,
             ChannelName = x.ChannelName,
             CreationTime = x.CreationTime,
             ACOOLYStatus = x.ACOOLYStatus,
@@ -380,13 +382,13 @@
             s.SerialNumber = ++i;
             s.ACOOLYStatusStr = s.ACOOLYStatus.GetDescription();
             s.LifePayOrderTypeStr = s.LifePayOrderType.GetDescription();
-            s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
             s.RechargeAmountStr = s.RechargeAmount.ToString("F2");
             s.ActualReceivedAmount = s.ActualReceivedAmount;
             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);
+            s.RefundApplyTimeStr = !s.RefundApplyTime.HasValue? string.Empty:s.RefundApplyTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
         });
         return result;
     }
@@ -427,7 +429,7 @@
             RefundTime = order.RefundTime,
             ACOOLYOrderNo = order.ACOOLYOrderNo,
             LifePayRefundStatus = order.LifePayRefundStatus,
-            ActualRechargeAmount = order.ActualRechargeAmount,
+            ActualRechargeAmount = order.RechargeAmount,
             RefundPrice = order.RefundPrice,
             PlatformRate = order.PlatformRate,
             PlatformPrice = order.PlatformDeductionAmount,
@@ -742,7 +744,7 @@
             ACOOLYStatus = x.ACOOLYStatus,
             //RefundApplyRemark = x.RefundApplyRemark,
             ChannelName = x.ChannelName,
-            PlatformPrice = x.PlatformDeductionAmount.HasValue ? x.PlatformDeductionAmount.Value : 0
+            PlatformPrice = x.PlatformDeductionAmount.HasValue ? x.PlatformDeductionAmount.Value : 0.00m
         }).OrderByDescending(r => r.CreationTime).ToListAsync();
         var i = 0;
         result.ForEach(s =>
@@ -756,7 +758,7 @@
             s.LifePayTypeStr = s.LifePayType.GetDescription();
             s.PayStatusStr = s.PayStatus.GetDescription();
             s.ActualRechargeAmountStr = s.ActualRechargeAmount.ToString("F2");
-            s.LifePayRefundStatusStr = s.LifePayRefundStatusStr.GetDescription();
+            s.LifePayRefundStatusStr = s.LifePayRefundStatus.GetDescription();
             s.ACOOLYStatusStr = s.ACOOLYStatus.GetDescription();
             //s.LifePayOrderStatusStr = s.LifePayOrderStatus.GetDescription();
             s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss);
@@ -1312,6 +1314,11 @@
             order.ACOOLYOrderNo = acoolyOrderNo;
         }
 
+        if (status == LifePayOrderStatusEnum.寰呴��娆�)
+        {
+            order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
+        }
+
         if (refundApplyRemark.IsNotNullOrEmpty())
         {
             order.RefundApplyRemark = refundApplyRemark;
@@ -1383,10 +1390,10 @@
 
                 break;
             case LifePayTypeEnum.AliPay:
-                var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = Convert.ToInt32(input.RefundPrice * 100).ToString() });
+                var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = input.RefundPrice.ToString() });
                 if (aliRefundResult.Code != AlipayResultCode.Success)
                 {
-                    throw new UserFriendlyException("閫�娆惧け璐�");
+                    throw new UserFriendlyException("閫�娆惧け璐�:" + aliRefundResult.SubMsg);
                 }
 
                 order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
@@ -1968,42 +1975,52 @@
 
     private async Task<IQueryable<LifePayOrderListOutput>> GetLifePayOrderListFilter(QueryLifePayOrderListInput input)
     {
-        var result = (from a in _lifePayOrderRepository.Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�)
-                                            .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime)
+        var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWords)).Select(x => x.ChannlesNum).ToListAsync();
+        var result = (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.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)
                                             .WhereIf(input.LifePayOrderStatus.HasValue, x => x.LifePayOrderStatus == input.LifePayOrderStatus.Value)
                                             .WhereIf(input.PayStatus.HasValue, x => x.PayStatus == input.PayStatus.Value)
+                                            .WhereIf(input.ACOOLYStatus.HasValue, x => x.ACOOLYStatus == input.ACOOLYStatus.Value)
                                             .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType.Value)
                                             .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value)
-                                            .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.PhoneNumber.Contains(input.KeyWords) || x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords))
-                      join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp
-                      from b in temp.DefaultIfEmpty()
-                      select new LifePayOrderListOutput
-                      {
-                          DiscountAmount = a.DiscountAmount,
-                          FinishTime = a.FinishTime,
-                          Id = a.Id,
-                          LifePayOrderStatus = a.LifePayOrderStatus,
-                          LifePayOrderType = a.LifePayOrderType,
-                          LifePayType = a.LifePayType,
-                          OrderNo = a.OrderNo,
-                          PayAmount = a.PayAmount,
-                          PhoneNumber = a.PhoneNumber,
-                          RechargeAmount = a.RechargeAmount,
-                          UserId = a.UserId,
-                          OutOrderNo = a.OutOrderNo,
-                          PayStatus = a.PayStatus,
-                          PayTime = a.PayTime,
-                          ACOOLYOrderNo = a.ACOOLYOrderNo,
-                          RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(),
-                          CreationTime = a.CreationTime,
-                          RefundCheckRemark = a.RefundCheckRemark,
-                          RefundApplyRemark = a.RefundApplyRemark,
-                          RefundTime = a.RefundTime,
-                          ChannelName = b.ChannlesName
-                      });
+                                            .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords) || channles.Contains(x.ChannelId))
+                            join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp
+                            from b in temp.DefaultIfEmpty()
+                            select new LifePayOrderListOutput
+                            {
+                                DiscountAmount = a.DiscountAmount,
+                                FinishTime = a.FinishTime,
+                                Id = a.Id,
+                                LifePayOrderStatus = a.LifePayOrderStatus,
+                                LifePayOrderType = a.LifePayOrderType,
+                                LifePayType = a.LifePayType,
+                                OrderNo = a.OrderNo,
+                                PayAmount = a.PayAmount,
+                                PhoneNumber = a.PhoneNumber,
+                                RechargeAmount = a.RechargeAmount,
+                                UserId = a.UserId,
+                                OutOrderNo = a.OutOrderNo,
+                                PayStatus = a.PayStatus,
+                                PayTime = a.PayTime,
+                                ACOOLYOrderNo = a.ACOOLYOrderNo,
+                                RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(),
+                                RefundPrice = a.RefundPrice,
+                                CreationTime = a.CreationTime,
+                                RefundCheckRemark = a.RefundCheckRemark,
+                                RefundApplyRemark = a.RefundApplyRemark,
+                                RefundTime = a.RefundTime,
+                                ChannelName = b.ChannlesName,
+                                ActualRechargeAmount = a.ActualRechargeAmount,
+                                PlatformDeductionAmount = a.PlatformDeductionAmount,
+                                ACOOLYStatus = a.ACOOLYStatus,
+                                LifePayRefundStatus = a.LifePayRefundStatus,
+                            });
+
+        
         return result;
     }
 
@@ -2011,7 +2028,7 @@
     {
         var result = (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
      .Where(x => x.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆句腑
-     || x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆�)
+     || (x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆� && x.LifePayRefundStatus != LifePayRefundStatusEnum.閫�娆鹃┏鍥�))
                                          .WhereIf(input.BeginRefundTime.HasValue, x => x.RefundTime >= input.BeginRefundTime)
                                          .WhereIf(input.EndRefundTime.HasValue, x => x.RefundTime <= input.EndRefundTime)
                                          .WhereIf(input.BeginRefundApplyTime.HasValue, x => x.RefundApplyTime >= input.BeginRefundApplyTime)
diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
index 5bcd101..b13c9ac 100644
--- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
@@ -44,7 +44,7 @@
                 var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.PayAmount);
                 var receiptsYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today).SumAsync(x => x.PayAmount);
                 var accumulatedOrders = await _lifePayOrderRepository.Where(x => x.CreationTime < today).CountAsync();
-                var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.ActualRechargeAmount);
+                var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.RechargeAmount);
                 var ordersNumYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today).CountAsync();
                 var yesterdaySuccess = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�).CountAsync();
                 var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆惧け璐�).CountAsync();
@@ -76,7 +76,7 @@
                     YesterdaySuccess = entity.YesterdaySuccess,
                     YesterdayFail = entity.YesterdayFail,
                     AccumulatedUsers = entity.AccumulatedUsers,
-                    YesterdayActiveUsers = yesterdayActiveUsers
+                    YesterdayActiveUsers = entity.AccumulatedUsers,
                 };
                 return topStatisticsOutput;
             }
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 46b2f78..ae42fc0 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -931,6 +931,11 @@
             瀹屾垚鏃堕棿
             </summary>
         </member>
+        <member name="P:LifePayment.Application.Contracts.LifePayRefundOrderListTemplate.RefundApplyTime">
+            <summary>
+            閫�娆剧敵璇锋椂闂�
+            </summary>
+        </member>
         <member name="P:LifePayment.Application.Contracts.LifePayRefundOrderListTemplate.RefundApplyTimeStr">
             <summary>
             閫�娆剧敵璇锋椂闂�

--
Gitblit v1.9.1