From 738ac7f47b594f5bf4cf060084d533fd0abc5a44 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 24 三月 2025 10:07:33 +0800
Subject: [PATCH] fix:新增退款订单导出接口

---
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml      |    5 +
 LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs                    |   18 ++++++
 LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs |    4 +
 LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs        |    3 +
 LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs            |    1 
 LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs               |    4 
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                     |    7 ++
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs                   |   95 +++++++++++++++++++++++++++++++
 8 files changed, 134 insertions(+), 3 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
index ab6c296..e72264b 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
@@ -250,6 +250,9 @@
 
     Task<List<LifePayOrderListTemplate>> GetLifePayOrderPageExport(QueryLifePayOrderListInput input);
 
+
+    Task<List<LifePayOrderListTemplate>> GetLifePayRefudOrderPageExport(QueryLifePayRefundOrderListInput input);
+
     Task<string> GetBillErceiptExport(string orderNo);
 
     /// <summary>
diff --git a/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs b/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
index 2dbdc47..6fa5292 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
@@ -15,6 +15,10 @@
         /// 鎵嬫満鍙�
         /// </summary>
         public string PhoneNumber { get; set; }
+
+        /// <summary>
+        /// 瀵嗙爜
+        /// </summary>
         public string Password { get; set; }
 
         /// <summary>
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index f7d0078..e14b2a2 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -338,6 +338,52 @@
         return result;
     }
 
+    /// <summary>
+    /// 閫�娆捐鍗曞垎椤�
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<List<LifePayOrderListTemplate>> GetLifePayRefudOrderPageExport(QueryLifePayRefundOrderListInput input)
+    {
+
+     
+        var result = await (await GetLifePayRefundOrderListFilter(input)).Select(x => new LifePayOrderListTemplate
+        {
+            DiscountAmount = x.DiscountAmount,
+            FinishTime = x.FinishTime,
+            LifePayOrderStatus = x.LifePayOrderStatus,
+            LifePayOrderType = x.LifePayOrderType,
+            LifePayType = x.LifePayType,
+            OrderNo = x.OrderNo,
+            PayAmount = x.PayAmount,
+            PhoneNumber = x.PhoneNumber,
+            RechargeAmount = x.RechargeAmount,
+            OutOrderNo = x.OutOrderNo,
+            PayStatus = x.PayStatus,
+            PayTime = x.PayTime,
+            ACOOLYOrderNo = x.ACOOLYOrderNo,
+            CreationTime = x.CreationTime,
+            RefundApplyRemark = x.RefundApplyRemark,
+            ChannelName = x.ChannelName
+        }).OrderByDescending(r => r.CreationTime).ToListAsync();
+        var i = 0;
+        result.ForEach(s =>
+        {
+            s.SerialNumber = ++i;
+            s.LifePayOrderTypeStr = s.LifePayOrderType.GetDescription();
+            s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
+            s.RechargeAmountStr = s.RechargeAmount.ToString("F2");
+            s.PayAmountStr = s.PayAmount.ToString("F2");
+            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.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
+        });
+        return result;
+    }
+
+
     public async Task<LifePayOrderOutput> GetLifePayOrderDetail(string orderNo)
     {
         var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
@@ -1904,6 +1950,55 @@
         return result;
     }
 
+    private async Task<IQueryable<LifePayOrderListOutput>> GetLifePayRefundOrderListFilter(QueryLifePayRefundOrderListInput input)
+    {
+        var result = (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
+     .Where(x => x.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆句腑
+     || x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆�)
+                                         .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime)
+                                         .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime)
+                                         .WhereIf(input.BeginRefundApplyTime.HasValue, x => x.RefundApplyTime >= input.BeginRefundApplyTime)
+                                         .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType)
+                                         .WhereIf(input.EndRefundApplyTime.HasValue, x => x.RefundApplyTime <= input.EndRefundApplyTime)
+                                         .WhereIf(input.LifePayOrderStatus.HasValue, x => x.LifePayOrderStatus == input.LifePayOrderStatus.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,
+                                RefundApplyTime = a.RefundApplyTime,
+                                RefundTime = a.RefundTime,
+                                RefundPrice = a.RefundPrice,
+                                ChannelName = b.ChannlesName,
+                                ActualRechargeAmount = a.ActualRechargeAmount,
+                                PlatformDeductionAmount = a.PlatformDeductionAmount,
+                                ACOOLYStatus = a.ACOOLYStatus,
+                                LifePayRefundStatus = a.LifePayRefundStatus,
+                            });
+        return result;
+    }
     private IQueryable<CreateEditPayChannelsInput> GetLifePayChannlesListFilter()
     {
         return _lifePayChannlesRep.Select(x =>
diff --git a/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs b/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
index b64e9cf..b1185f6 100644
--- a/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
+++ b/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
@@ -48,7 +48,6 @@
                 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);
diff --git a/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs b/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs
index 5963033..3acbb10 100644
--- a/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs
+++ b/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs
@@ -71,8 +71,8 @@
     [Description("鍏呭�间腑")]
     鍏呭�间腑 = 10,
 
-    //[Description("宸插け璐�")]
-    //宸插け璐� = 20,
+    [Description("宸插け璐�")]
+    宸插け璐� = 20,
 
     [Description("宸插畬鎴�")]
     宸插畬鎴� = 30,
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index dc1a9ed..83aca4a 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -234,6 +234,13 @@
             <param name="input"></param>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.LifePayController.GetLifePayRefudOrderPageExport(LifePayment.Application.Contracts.QueryLifePayRefundOrderListInput)">
+            <summary>
+            瀵煎嚭璁㈠崟Excel
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.HttpApi.LifePayController.CreateLifePayPhoneOrder(LifePayment.Application.Contracts.CreateLifePayOrderInput{LifePayment.Application.Contracts.LifePhoneData})">
             <summary>
             鍒涘缓鐢熸椿缂磋垂璇濊垂璁㈠崟
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 020653b..1fa69a8 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -1990,6 +1990,11 @@
             鎵嬫満鍙�
             </summary>
         </member>
+        <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.Password">
+            <summary>
+            瀵嗙爜
+            </summary>
+        </member>
         <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.UserName">
             <summary>
             璐︽埛
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
index a7d2889..ed87e63 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -376,6 +376,24 @@
             return Json(default);
         }
 
+        /// <summary>
+        /// 瀵煎嚭閫�娆捐鍗旹xcel
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<ActionResult> GetLifePayRefudOrderPageExport(QueryLifePayRefundOrderListInput input)
+        {
+            var data = await _lifePayService.GetLifePayRefudOrderPageExport(input);
+            if (data.Any())
+            {
+                var bytes = ExcelHelper.ListToByteForExcel(data, "xlsx");
+                return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "閫�娆剧鐞�" + ".xlsx");
+            }
+            return Json(default);
+        }
+
+
         [HttpGet]
         public async Task<string> GetBillErceiptExport(string orderNo)
         {

--
Gitblit v1.9.1