From f291f615859f129265f740526cba144415d7b49e Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期一, 07 四月 2025 10:32:47 +0800 Subject: [PATCH] fix:bug修复 --- LifePayment/LifePayment.Application/LifePay/StatisticsService.cs | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs index fb39436..4c748a6 100644 --- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs +++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs @@ -186,12 +186,16 @@ ChannlesRakeListOutPut channlesRakeListOutPut = new ChannlesRakeListOutPut(); - foreach (var item in groupedStatistics) + var dateList = Enumerable.Range(1, 31) + .Select(i => today.AddDays(-i)) + .ToList(); + foreach (var date in dateList) { + var stat = groupedStatistics.FirstOrDefault(g => g.FinishTime == date.ToString("yyyy-MM-dd")); ReceiptsDetail receive = new ReceiptsDetail() { - CreationTime = item.FinishTime, - Amount = item.ChannlesRakePrice + CreationTime = date.ToString("yyyy-MM-dd"), + Amount = stat?.ChannlesRakePrice ?? 0 }; channlesRakeListOutPut.ChannlesRakeList.Add(receive); } @@ -202,8 +206,9 @@ public async Task<ChannelDataListOutPut> GetChannelDataList(List<string> channleList) { int maxStatisticsNumber = 5; - var statistics = await _lifePayChannlesRakeRepository - .WhereIf(channleList != null && channleList.Count() > 0, x => channleList.Contains(x.ChannelId)) + /// 杩欓噷涓嶅姞鍏�.Where()浼氭姤閿� + var statistics = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false) + .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId)) .ToListAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "娓犻亾鏀舵缁熻澶辫触"); var groupedStatistics = statistics @@ -234,7 +239,7 @@ } /// 绱鐢ㄦ埛 - var users = await _lifePayUserRepository.WhereIf(channleList.Count() > 0, x => channleList.Contains(x.CreationChannleNum)) + var users = await _lifePayUserRepository.Where(x => x.IsDeleted == false).WhereIf(channleList.Count() > 0, x => channleList.Contains(x.CreationChannleNum)) .ToListAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "绱鐢ㄦ埛缁熻澶辫触"); var groupedUsers = users -- Gitblit v1.9.1