From 5c3f745cc2a9104e831115a4949e8543373f6105 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期二, 25 三月 2025 18:23:13 +0800 Subject: [PATCH] merge --- LifePayment/LifePayment.Application/LifePay/StatisticsService.cs | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs index b13c9ac..02d873c 100644 --- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs +++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs @@ -41,21 +41,32 @@ var statistics = await _dallyStatisticsRepository.Where(x => x.CreationTime.Date == today).FirstOrDefaultAsync(); if (statistics == null) { - 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 accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus == LifePayStatusEnum.宸叉敮浠�).SumAsync(x => x.PayAmount) - await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�).SumAsync(x => x.RefundPrice); + /// 鏄ㄦ棩鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╂敹鍒扮殑銆愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱 + var receiptsYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.PayStatus == LifePayStatusEnum.宸叉敮浠�).SumAsync(x => x.PayAmount) - await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�).SumAsync(x => x.PayAmount); + /// 绱鏀跺叆锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鐘舵�佷负鈥滃凡瀹屾垚鈥濅笖璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴峰疄浠橀噾棰�-骞冲彴鎵f閲戦-閮ㄥ垎閫�娆鹃噾棰濄�戯紱 + var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�).SumAsync(x => x.PayAmount - x.PlatformDeductionAmount - x.RefundPrice); + /// 绱涓嬪崟锛氱粺璁″钩鍙颁腑璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏃堕棿鐨勮鍗曡褰曪紱 var accumulatedOrders = await _lifePayOrderRepository.Where(x => x.CreationTime < today).CountAsync(); - 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(); + /// 鏄ㄦ棩澶辫触锛氱粺璁″钩鍙颁腑璁㈠崟鐘舵�佷负鈥滃厖鍊煎け璐�/宸查��娆锯�濅笖璁㈠崟涓嬪崟鏃堕棿鍦ㄦ槰澶╃殑璁㈠崟璁板綍锛� + var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆�).CountAsync(); + /// 绱鐢ㄦ埛 var accumulatedUsers = await _lifePayUserRepository.CountAsync(); + /// 鏄ㄦ棩娲昏穬鐢ㄦ埛 var yesterdayActiveUsers = await _lifePayUserRepository.Where(x => x.LastLoginTime >= today.AddDays(-1)).CountAsync(); + var entity = new DallyStatistics() { Id = GuidGenerator.Create(), CreationTime = DateTime.Now, Amount = 0, - AccumulatedReceipts = accumulatedReceipts, + AccumulatedReceipts = accumulatedReceipts.HasValue? accumulatedReceipts.Value:0, + AccumulatedIncome = accumulatedIncome.HasValue ? accumulatedIncome.Value : 0, ReceiptsYesterday = receiptsYesterday, AccumulatedOrders = accumulatedOrders, OrdersNumYesterday = ordersNumYesterday, @@ -70,13 +81,14 @@ { 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.AccumulatedUsers, + YesterdayActiveUsers = entity.YesterdayActiveUsers, }; return topStatisticsOutput; } @@ -86,12 +98,14 @@ { 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, }; return topStatisticsOutput; } -- Gitblit v1.9.1