From e08d70b9e610a2c176b88cb092d580754e009de5 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期二, 01 四月 2025 15:41:04 +0800
Subject: [PATCH] 统计

---
 LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs |   85 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 74 insertions(+), 11 deletions(-)

diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
index 96e2a15..606efc1 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -1,6 +1,7 @@
 锘縰sing Alipay.AopSdk.F2FPay.Model;
 using LifePayment.Application.Contracts;
 using LifePayment.Application.LifePay;
+using LifePayment.Domain;
 using LifePayment.Domain.Common;
 using LifePayment.Domain.Shared;
 using Microsoft.AspNetCore.Authorization;
@@ -50,12 +51,32 @@
         /// <summary>
         /// 鑾峰彇椤堕儴缁熻鏁版嵁
         /// </summary>
+        /// <param name="input"></param>
         /// <returns></returns>
-        [HttpGet]
+        [HttpPost]
         [AllowAnonymous]
-        public async Task<TopStatisticsOutput> GetTopStatistics(string channleId = "")
+        public async Task<TopStatisticsOutput> GetTopStatistics(TopStatisticsInput input)
         {
-            return await _statisticsService.GetTopStatistics(channleId);
+            return await _statisticsService.GetTopStatistics(input.ChannleList);
+        }
+
+        /// <summary>
+        /// 鑾峰彇30鏃ユ敹娆剧粺璁�
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [AllowAnonymous]
+        public async Task<ReceiptsListOutPut> GetReceiptsList(TopStatisticsInput input)
+        {
+            return await _statisticsService.GetReceiptsList(input.ChannleList);
+        }
+
+        [HttpPost]
+        [AllowAnonymous]
+        public async Task<ChannelDataListOutPut> GetChannelDataList(TopStatisticsInput input)
+        {
+            return await _statisticsService.GetChannelDataList(input.ChannleList);
         }
 
         /// <summary>
@@ -443,6 +464,33 @@
         }
 
         /// <summary>
+        /// 鑾峰彇娓犻亾鍒嗕剑鍒嗛〉鍒楄〃
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<PageOutput<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakePage(LifePayChannlesRakePageInput input)
+        {
+            return await _lifePayOrderService.GetLifePayChannlesRakePage(input);
+        }
+
+        /// <summary>
+        /// 瀵煎嚭娓犻亾鍒嗕剑Excel
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<ActionResult> GetLifePayChannlesRakePageExport(LifePayChannlesRakePageInput input)
+        {
+            var data = await _lifePayOrderService.GetLifePayChannlesRakePageExport(input);
+            if (data.Any())
+            {
+                var bytes = ExcelHelper.ListToByteForExcel(data, "xlsx");
+                return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "娓犻亾鍒嗕剑" + ".xlsx");
+            }
+            return Json(default);
+        }
+        /// <summary>
         /// 鑾峰彇鏀舵敮娴佹按鍒嗛〉鏁版嵁
         /// </summary>
         /// <param name="input"></param>
@@ -496,15 +544,20 @@
         public async Task<WxPayDomesticRefundsQueryReponse> WxPayDomesticRefundsQuery(string outTradeNo)
         {
             var res = await _lifePayService.WxPayDomesticRefundsQuery(outTradeNo);
-            await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+            if (res.Code == WxpayResultCode.Success)
             {
-                OrderNo = res.OutTradeNo,
-                OutOrderNo = res.TransactionId,
-                LifePayType = LifePayTypeEnum.WxPay,
-                ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
-                Amount = Convert.ToDecimal(res.Amount.Total)
-            });
+                await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+                {
+                    OrderNo = res.OutTradeNo,
+                    OutRefundNo = res.RefundId,
+                    OutOrderNo = res.TransactionId,
+                    LifePayType = LifePayTypeEnum.WxPay,
+                    ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
+                    Amount = Convert.ToDecimal(res.Amount.Total)
+                });
+            }
             return res;
+
         }
 
         /// <summary>
@@ -539,7 +592,17 @@
             await _lifePayOrderService.GetAllLifePayExpensesReceipts();
         }
 
-        
+        /// <summary>
+        /// 鍚屾璁㈠崟
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [AllowAnonymous]
+        public async Task GetAllChannlesRake()
+        {
+            await _lifePayOrderService.GetAllChannlesRake();
+        }
+
 
         #endregion
 

--
Gitblit v1.9.1