From 2b6e63ae8a4af6f612e431c57d2f2f08fb9b9135 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期三, 02 四月 2025 11:30:51 +0800 Subject: [PATCH] fix:加入CreateACOOLYElectricOrder报错日志 --- LifePayment/LifePayment.Application/LifePay/StatisticsService.cs | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs index b69b5b6..477b532 100644 --- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs +++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs @@ -19,6 +19,7 @@ using System.Threading.Channels; using ZeroD.Util; using NPOI.SS.Formula.Functions; +using System.Security.Principal; namespace LifePayment.Application.LifePay { @@ -28,19 +29,22 @@ private readonly IRepository<LifePayUser, Guid> _lifePayUserRepository; private readonly IRepository<DallyStatistics, Guid> _dallyStatisticsRepository; private readonly IRepository<LifePayChannlesRake, Guid> _lifePayChannlesRakeRepository; + private readonly IRepository<LifePayRechargeReceipts, Guid> _lifePayRechargeReceiptsRepository; private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep; public StatisticsService( IRepository<LifePayOrder, Guid> lifePayOrderRepository, IRepository<LifePayUser, Guid> lifePayUserRepository, - IRepository<DallyStatistics, Guid> dallyStatisticsRepository, - IRepository<LifePayChannlesRake, Guid> lifePayChannlesRakeRepository, - IRepository<LifePayChannles, Guid> lifePayChannlesRep) + IRepository<DallyStatistics, Guid> dallyStatisticsRepository, + IRepository<LifePayChannlesRake, Guid> lifePayChannlesRakeRepository, + IRepository<LifePayRechargeReceipts, Guid> lifePayRechargeReceiptsRepository, + IRepository<LifePayChannles, Guid> lifePayChannlesRep) { _lifePayOrderRepository = lifePayOrderRepository; _lifePayUserRepository = lifePayUserRepository; _dallyStatisticsRepository = dallyStatisticsRepository; _lifePayChannlesRakeRepository = lifePayChannlesRakeRepository; + _lifePayRechargeReceiptsRepository = lifePayRechargeReceiptsRepository; _lifePayChannlesRep = lifePayChannlesRep; } @@ -240,6 +244,10 @@ private async Task<DallyStatistics> TopStatistics(string channleId, DateTime today) { + var totalRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false && x.CreationTime < today).SumAsync(x => x.RechargeAmount); + var accountBalance = totalRechargeReceipts - await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus == LifePayStatusEnum.宸叉敮浠� + && (x.ACOOLYStatus == ACOOLYStatusEnum.鍏呭�兼垚鍔� || x.ACOOLYStatus == ACOOLYStatusEnum.宸插畬鎴� || x.ACOOLYStatus == ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�)) + .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount); /// 绱鏀舵锛氱粺璁″钩鍙拌处鎴蜂笅璁㈠崟鍒涘缓鏃堕棿鍦ㄦ槰澶╁強涔嬪墠鏀跺埌鐨勩�愮敤鎴锋敮浠樻垚鍔熺殑閲戦-閫�娆剧粰鐢ㄦ埛鐨勯噾棰濄�戯紱 var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today && x.PayStatus != LifePayStatusEnum.鏈敮浠�) .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).SumAsync(x => x.PayAmount) - @@ -277,7 +285,7 @@ { Id = GuidGenerator.Create(), CreationTime = today, - Amount = 0, + Amount = accountBalance ?? 0, AccumulatedReceipts = accumulatedReceipts ?? 0, AccumulatedIncome = accumulatedIncome ?? 0, IncomeYesterday = yesterdayIncome ?? 0, -- Gitblit v1.9.1