From a3bfd6cd7ee9580db08aa03a8656ad5572089756 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 31 三月 2025 16:19:36 +0800
Subject: [PATCH] Merge branch 'dev-lifepay-v1.3' of http://120.26.58.240:8888/r/LifePaymentApi into dev-lifepay-v1.3

---
 LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs            |   11 ++
 LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs                     |   35 ++++++++
 LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs          |    2 
 LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs                |    7 +
 LifePayment/LifePayment.Application.Contracts/LifePay/IStatisticsService.cs |    2 
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs       |    6 +
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                 |    3 
 LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs           |    1 
 LifePayment/LifePayment.Application/LifePay/StatisticsService.cs            |  162 +++++++++++++++++++++++-----------------
 9 files changed, 153 insertions(+), 76 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/IStatisticsService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/IStatisticsService.cs
index 3aaec90..14477ef 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/IStatisticsService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/IStatisticsService.cs
@@ -10,6 +10,6 @@
 
 public interface IStatisticsService : IApplicationService
 {
-    Task<TopStatisticsOutput> GetTopStatistics(string channleId = "");
+    Task<TopStatisticsOutput> GetTopStatistics(List<string>? channleList = null);
 
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
index 545f42d..11f4cf1 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
@@ -2,6 +2,7 @@
 using Newtonsoft.Json;
 using System;
 using System.ComponentModel.DataAnnotations;
+using System.Collections.Generic;
 using static LifePayment.Domain.Shared.LifePaymentConstant;
 
 namespace LifePayment.Application.Contracts;
@@ -771,3 +772,8 @@
     public DateTime? FinishTimeEnd { get; set; }
 
 }
+
+public class TopStatisticsInput
+{
+    public List<string>? ChannleList { get; set; }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
index 6e9e7e5..73f75c5 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -163,7 +163,7 @@
                 s.SerialNumber = ++i;
                 s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss);
                 s.PayAmountStr = s.PayAmount.ToString("F2");
-                s.ChannlesRakeRateStr = s.ChannlesRakeRate.ToString("F2");
+                s.ChannlesRakeRateStr = s.ChannlesRakeRate.ToString("F0") + "%";
                 s.ChannlesRakePriceStr = s.ChannlesRakePrice.ToString("F2");
                 s.FinishTimeStr = s.FinishTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss);
             });
diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
index 7547c44..0ff2fb3 100644
--- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
@@ -16,6 +16,8 @@
 using Volo.Abp.EventBus.Distributed;
 using static Nest.FileSystemStats;
 using Microsoft.EntityFrameworkCore;
+using System.Threading.Channels;
+using ZeroD.Util;
 
 namespace LifePayment.Application.LifePay
 {
@@ -24,15 +26,18 @@
         private readonly IRepository<LifePayOrder, Guid> _lifePayOrderRepository;
         private readonly IRepository<LifePayUser, Guid> _lifePayUserRepository;
         private readonly IRepository<DallyStatistics, Guid> _dallyStatisticsRepository;
+        private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep;
 
         public StatisticsService(
                               IRepository<LifePayOrder, Guid> lifePayOrderRepository,
                               IRepository<LifePayUser, Guid> lifePayUserRepository,
-                            IRepository<DallyStatistics, Guid> dallyStatisticsRepository)
+                            IRepository<DallyStatistics, Guid> dallyStatisticsRepository,
+                            IRepository<LifePayChannles, Guid> lifePayChannlesRep)
         {
             _lifePayOrderRepository = lifePayOrderRepository;
             _lifePayUserRepository = lifePayUserRepository;
             _dallyStatisticsRepository = dallyStatisticsRepository;
+            _lifePayChannlesRep = lifePayChannlesRep;
         }
 
         /// <summary>
@@ -40,95 +45,112 @@
         /// </summary>
         /// <param name="channleId"></param>
         /// <returns></returns>
-        public async Task<TopStatisticsOutput> GetTopStatistics(string channleId = "")
+        public async Task<TopStatisticsOutput> GetTopStatistics(List<string> channleList)
         {
             var today = DateTime.Now.Date;
             var statistics = await _dallyStatisticsRepository.Where(x => x.CreationTime.Date == today)
-                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId)
-                .FirstOrDefaultAsync();
-            if (statistics == null)
+                .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
+                .ToListAsync();
+            if (statistics == null || statistics.Count() == 0)
             {
-                /// 绱鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱
-                var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.鏈敮浠�)
-                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount) - await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�).SumAsync(x => (x.RefundPrice ?? 0));
-                /// 鏄ㄦ棩鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╂敹鍒扮殑銆愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱
-                var receiptsYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.PayStatus == LifePayStatusEnum.宸叉敮浠�)
-                    .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount) - await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�).SumAsync(x => (x.RefundPrice ?? 0));
-                /// 绱鏀跺叆锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鐘舵�佷负鈥滃凡瀹屾垚鈥濅笖璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴峰疄浠橀噾棰�-骞冲彴鎵f閲戦-閮ㄥ垎閫�娆鹃噾棰濄�戯紱
-                var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�)
-                    .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount - (x.PlatformDeductionAmount ?? 0) - (x.RefundPrice ?? 0));
-                /// 绱涓嬪崟锛氱粺璁″钩鍙颁腑璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏃堕棿鐨勮鍗曡褰曪紱
-                var accumulatedOrders = await _lifePayOrderRepository.Where(x => x.CreationTime < today).WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
-                /// 鏄ㄦ棩涓嬪崟锛氱粺璁″钩鍙颁腑璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛�
-                var ordersNumYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today)
-                    .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
-                /// 鏄ㄦ棩鎴愬姛锛氱粺璁″钩鍙颁腑璁㈠崟鐘舵�佷负鈥滃凡瀹屾垚/閮ㄥ垎鍏呭�兼垚鍔熲�濅笖璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛�
-                var yesterdaySuccess = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�)
-                    .WhereIf(string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
-                /// 鏄ㄦ棩澶辫触锛氱粺璁″钩鍙颁腑璁㈠崟鐘舵�佷负鈥滃厖鍊煎け璐�/宸查��娆锯�濅笖璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛�
-                var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆�)
-                    .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
-                /// 绱鐢ㄦ埛
-                var accumulatedUsers = await _lifePayUserRepository.WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.CreationChannleNum == channleId).CountAsync();
-                /// 鏄ㄦ棩娲昏穬鐢ㄦ埛
-                var yesterdayActiveUsers = await _lifePayUserRepository.WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.CreationChannleNum == channleId).Where(x => x.LastLoginTime >= today.AddDays(-1)).CountAsync();
-
-                var entity = new DallyStatistics()
+                TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput() { };
+                var allChannle = await _lifePayChannlesRep.Where(x => x.IsDeleted == false).ToListAsync();
+                foreach (var item in allChannle)
                 {
-                    Id = GuidGenerator.Create(),
-                    CreationTime = DateTime.Now,
-                    Amount = 0,
-                    AccumulatedReceipts = accumulatedReceipts??0,
-                    AccumulatedIncome = accumulatedIncome ?? 0,
-                    ReceiptsYesterday = receiptsYesterday ?? 0,
-                    AccumulatedOrders = accumulatedOrders,
-                    OrdersNumYesterday = ordersNumYesterday,
-                    YesterdaySuccess = yesterdaySuccess,
-                    YesterdayFail = yesterdayFail,
-                    AccumulatedUsers = accumulatedUsers,
-                    YesterdayActiveUsers = yesterdayActiveUsers,
-                    ChannelId = channleId
-                };
-                await _dallyStatisticsRepository.InsertAsync(entity);
+                    var entity = await TopStatistics(item.ChannlesNum, today);
+                    if (channleList.Count() == 0 || channleList.Contains(item.ChannlesNum))
+                    {
+                        topStatisticsOutput.Amount += entity.Amount;
+                        topStatisticsOutput.AccumulatedReceipts += entity.AccumulatedReceipts;
+                        topStatisticsOutput.AccumulatedIncome += entity.AccumulatedIncome;
+                        topStatisticsOutput.ReceiptsYesterday += entity.ReceiptsYesterday;
+                        topStatisticsOutput.AccumulatedOrders += entity.AccumulatedOrders;
+                        topStatisticsOutput.OrdersNumYesterday += entity.OrdersNumYesterday;
+                        topStatisticsOutput.YesterdaySuccess += entity.YesterdaySuccess;
+                        topStatisticsOutput.YesterdayFail += entity.YesterdayFail;
+                        topStatisticsOutput.AccumulatedUsers += entity.AccumulatedUsers;
+                        topStatisticsOutput.YesterdayActiveUsers += entity.YesterdayActiveUsers;
+                    }
+                }
 
-                TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput()
-                {
-                    Amount = entity.Amount,
-                    AccumulatedReceipts = entity.AccumulatedReceipts,
-                    AccumulatedIncome = entity.AccumulatedIncome,
-                    ReceiptsYesterday = entity.ReceiptsYesterday,
-                    AccumulatedOrders = entity.AccumulatedOrders,
-                    OrdersNumYesterday = entity.OrdersNumYesterday,
-                    YesterdaySuccess = entity.YesterdaySuccess,
-                    YesterdayFail = entity.YesterdayFail,
-                    AccumulatedUsers = entity.AccumulatedUsers,
-                    YesterdayActiveUsers = entity.YesterdayActiveUsers,
-                };
+               
                 return topStatisticsOutput;
             }
             else
             {
                 TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput()
                 {
-                    Amount = statistics.Amount,
-                    AccumulatedReceipts = statistics.AccumulatedReceipts,
-                    AccumulatedIncome = statistics.AccumulatedIncome,
-                    ReceiptsYesterday = statistics.ReceiptsYesterday,
-                    AccumulatedOrders = statistics.AccumulatedOrders,
-                    OrdersNumYesterday = statistics.OrdersNumYesterday,
-                    YesterdaySuccess = statistics.YesterdaySuccess,
-                    YesterdayFail = statistics.YesterdayFail,
-                    AccumulatedUsers = statistics.AccumulatedUsers,
-                    YesterdayActiveUsers = statistics.YesterdayActiveUsers,
+                    Amount = statistics.Sum(s => s.Amount),
+                    AccumulatedReceipts = statistics.Sum(s => s.AccumulatedReceipts),
+                    AccumulatedIncome = statistics.Sum(s => s.AccumulatedIncome),
+                    ReceiptsYesterday = statistics.Sum(s => s.ReceiptsYesterday),
+                    AccumulatedOrders = statistics.Sum(s => s.AccumulatedOrders),
+                    OrdersNumYesterday = statistics.Sum(s => s.OrdersNumYesterday),
+                    YesterdaySuccess = statistics.Sum(s => s.YesterdaySuccess),
+                    YesterdayFail = statistics.Sum(s => s.YesterdayFail),
+                    AccumulatedUsers = statistics.Sum(s => s.AccumulatedUsers),
+                    YesterdayActiveUsers = statistics.Sum(s => s.YesterdayActiveUsers),
                 };
                 return topStatisticsOutput;
             }
         }
 
-        //public async Task<ReceiptsListOutPut> GetReceiptsList(string channleId = "")
+        //public async Task<ReceiptsListOutPut> GetReceiptsList(List<string> channleList)
         //{
         //    var today = DateTime.Now.Date;
 
         //}
+
+        private async Task<DallyStatistics> TopStatistics(string channleId, DateTime today)
+        {
+            /// 绱鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱
+            var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.鏈敮浠�)
+            .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount) - 
+            await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
+            .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => (x.RefundPrice ?? 0));
+            /// 鏄ㄦ棩鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╂敹鍒扮殑銆愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱
+            var receiptsYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.PayStatus == LifePayStatusEnum.宸叉敮浠�)
+                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount) -
+                await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
+                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => (x.RefundPrice ?? 0));
+            /// 绱鏀跺叆锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鐘舵�佷负鈥滃凡瀹屾垚鈥濅笖璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴峰疄浠橀噾棰�-骞冲彴鎵f閲戦-閮ㄥ垎閫�娆鹃噾棰濄�戯紱
+            var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�)
+                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount - (x.PlatformDeductionAmount ?? 0) - (x.RefundPrice ?? 0));
+            /// 绱涓嬪崟锛氱粺璁″钩鍙颁腑璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏃堕棿鐨勮鍗曡褰曪紱
+            var accumulatedOrders = await _lifePayOrderRepository.Where(x => x.CreationTime < today).WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
+            /// 鏄ㄦ棩涓嬪崟锛氱粺璁″钩鍙颁腑璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛�
+            var ordersNumYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today)
+                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
+            /// 鏄ㄦ棩鎴愬姛锛氱粺璁″钩鍙颁腑璁㈠崟鐘舵�佷负鈥滃凡瀹屾垚/閮ㄥ垎鍏呭�兼垚鍔熲�濅笖璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛�
+            var yesterdaySuccess = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�)
+                .WhereIf(string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
+            /// 鏄ㄦ棩澶辫触锛氱粺璁″钩鍙颁腑璁㈠崟鐘舵�佷负鈥滃厖鍊煎け璐�/宸查��娆锯�濅笖璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛�
+            var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆�)
+                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
+            /// 绱鐢ㄦ埛
+            var accumulatedUsers = await _lifePayUserRepository.WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.CreationChannleNum == channleId).CountAsync();
+            /// 鏄ㄦ棩娲昏穬鐢ㄦ埛
+            var yesterdayActiveUsers = await _lifePayUserRepository.WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.CreationChannleNum == channleId).Where(x => x.LastLoginTime >= today.AddDays(-1)).CountAsync();
+
+
+            var entity = new DallyStatistics()
+            {
+                Id = GuidGenerator.Create(),
+                CreationTime = DateTime.Now,
+                Amount = 0,
+                AccumulatedReceipts = accumulatedReceipts ?? 0,
+                AccumulatedIncome = accumulatedIncome ?? 0,
+                ReceiptsYesterday = receiptsYesterday ?? 0,
+                AccumulatedOrders = accumulatedOrders,
+                OrdersNumYesterday = ordersNumYesterday,
+                YesterdaySuccess = yesterdaySuccess,
+                YesterdayFail = yesterdayFail,
+                AccumulatedUsers = accumulatedUsers,
+                YesterdayActiveUsers = yesterdayActiveUsers,
+                ChannelId = channleId
+            };
+            await _dallyStatisticsRepository.InsertAsync(entity);
+            return entity;
+        }
     }
 }
diff --git a/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs b/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs
index 31035da..b6b6144 100644
--- a/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs
+++ b/LifePayment/LifePayment.Domain/WeChat/WxRechargeInfo.cs
@@ -241,7 +241,42 @@
         /// </summary>
         [JsonProperty("refund_status")]
         public string RefundStatus { get; set; }
+
+        [JsonProperty("amount")]
+        public RefundAmount Amount { get; set; }
     }
+
+    public class RefundAmount
+    {
+        /// <summary>
+        /// 鎬婚噾棰�
+        /// </summary>
+        [JsonProperty("total", NullValueHandling = NullValueHandling.Ignore)]
+        [Required]
+        public int Total { get; set; }
+
+        /// <summary>
+        /// 閫�娆鹃噾棰�
+        /// </summary>
+        [JsonProperty("refund", NullValueHandling = NullValueHandling.Ignore)]
+        [Required]
+        public int Refund { get; set; }
+
+        /// <summary>
+        /// 鐢ㄦ埛瀹為檯鏀粯閲戦
+        /// </summary>
+        [JsonProperty("payer_total", NullValueHandling = NullValueHandling.Ignore)]
+        [Required]
+        public string PayerTotal { get; set; }
+
+        /// <summary>
+        /// 鐢ㄦ埛閫�娆鹃噾棰�
+        /// </summary>
+        [JsonProperty("payer_refund", NullValueHandling = NullValueHandling.Ignore)]
+        [Required]
+        public string PayerRefund { get; set; }
+    }
+
     public class WxRechargeNotifyResult
     {
         /// <summary>
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index 6f48d5e..a6d4b04 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -63,10 +63,11 @@
             </summary>
             <returns></returns>
         </member>
-        <member name="M:LifePayment.HttpApi.LifePayController.GetTopStatistics(System.String)">
+        <member name="M:LifePayment.HttpApi.LifePayController.GetTopStatistics(LifePayment.Application.Contracts.TopStatisticsInput)">
             <summary>
             鑾峰彇椤堕儴缁熻鏁版嵁
             </summary>
+            <param name="input"></param>
             <returns></returns>
         </member>
         <member name="M:LifePayment.HttpApi.LifePayController.GetElectricParValue(LifePayment.Domain.Shared.ChannelsBaseInput)">
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
index 37a922e..e2cbb0a 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
@@ -60,6 +60,7 @@
                 if (input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛)
                 {
                     await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo);
+                    // 鎻掑叆鏀舵敮娴佹按
                     await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() { OrderNo = input.OutTradeNo, 
                         OutOrderNo = input.TradeNo ,LifePayType = LifePayTypeEnum.AliPay,ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
                         Amount = input.ReceiptAmount.Value });
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
index b25cbc7..e3060bb 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -50,12 +50,13 @@
         /// <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>
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
index 5411b49..970139a 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
@@ -56,6 +56,8 @@
                     if (wxPayNotice.TradeState == LifePaymentConstant.WxPayStatus.鏀粯鎴愬姛)
                     {
                         await _lifePayService.LifePaySuccessHandler(wxPayNotice.OutTradeNo, wxPayNotice.TransactionId);
+
+                        // 鎻掑叆鏀舵敮娴佹按
                         await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
                         {
                             OrderNo = wxPayNotice.OutTradeNo,
@@ -109,6 +111,15 @@
                         case LifePaymentConstant.WxPayRefundStatus.閫�娆炬垚鍔�:
                         case LifePaymentConstant.WxPayRefundStatus.閫�娆惧叧闂�:
                             await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
+                            // 鎻掑叆鏀舵敮娴佹按
+                            await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+                            {
+                                OrderNo = wxPayNotice.OutTradeNo,
+                                OutOrderNo = wxPayNotice.TransactionId,
+                                LifePayType = LifePayTypeEnum.WxPay,
+                                ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts,
+                                Amount = wxPayNotice.Amount.Total
+                            });
                             break;
                         case LifePaymentConstant.WxPayRefundStatus.閫�娆惧鐞嗕腑:
                             await _lifePayService.WxPayDomesticRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑);

--
Gitblit v1.9.1