From 0ee3e9996050bd0df360367af28738acea9cdfc6 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期三, 11 六月 2025 16:12:48 +0800 Subject: [PATCH] fix:修改统计公式 新增前端日志上传 --- LifePayment/LifePayment.Application/LifePay/StatisticsService.cs | 38 +++++++++++++++++++++++++++++--------- 1 files changed, 29 insertions(+), 9 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs index 17ab4c9..7438b91 100644 --- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs +++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs @@ -205,19 +205,39 @@ public async Task<ChannelDataListOutPut> GetChannelDataList(List<string> channleList) { + var today = DateTime.Now.Date; int maxStatisticsNumber = 5; /// 杩欓噷涓嶅姞鍏�.Where()浼氭姤閿� - var statistics = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false) - .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId)) - .ToListAsync(); + var statistics = await _lifePayChannlesRakeRepository + .Where(x => x.IsDeleted == false && x.CreationTime < today) + .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId)) + .ToListAsync(); + + var lifepayOrderBaseList = await _lifePayOrderRepository + .Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.鏈敮浠�) + .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId)) + .ToListAsync(); + CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "娓犻亾鏀舵缁熻澶辫触"); var groupedStatistics = statistics .GroupBy(x => x.ChannelId) - .Select(g => new + .Select(g => { - ChannelId = g.Key, - ReceivePrice = g.Sum(x => x.PayAmount), - ChannlesRakePrice = g.Sum(x => x.ChannlesRakePrice), + /// 绱鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱 + var accumulatedReceipts = + lifepayOrderBaseList + .Where(x => x.ChannelId == g.Key) + .Sum(x => x.PayAmount) + - + lifepayOrderBaseList + .Where(x => x.ChannelId == g.Key && x.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�) + .Sum(x => (x.RefundPrice ?? 0)); + return new + { + ChannelId = g.Key, + ReceivePrice = accumulatedReceipts ?? 0, + ChannlesRakePrice = g.Sum(x => x.ChannlesRakePrice), + }; }) .OrderByDescending(o => o.ReceivePrice) .ToList(); @@ -239,7 +259,7 @@ } /// 绱鐢ㄦ埛 - var users = await _lifePayUserRepository.Where(x => x.IsDeleted == false).WhereIf(channleList.Count() > 0, x => channleList.Contains(x.CreationChannleNum)) + var users = await _lifePayUserRepository.Where(x => x.IsDeleted == false && x.CreationTime < today).WhereIf(channleList.Count() > 0, x => channleList.Contains(x.CreationChannleNum)) .ToListAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "绱鐢ㄦ埛缁熻澶辫触"); var groupedUsers = users @@ -293,7 +313,7 @@ private async Task<DallyStatistics> TopStatistics(string channleId, DateTime today) { - var lifepayOrderBaseList = await _lifePayOrderRepository.Where(x => x.CreationTime < today) + var lifepayOrderBaseList = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.鏈敮浠�) .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).ToListAsync(); /// 绱鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱 -- Gitblit v1.9.1