From ff1462c4d0c4c88b1ef801608284f01ac1e37761 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 14:35:37 +0800 Subject: [PATCH] fix;获取充值流水接口查询条件优化 --- LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs index 6b78d5e..3f02652 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs @@ -29,10 +29,10 @@ /// </summary> /// <param name="input"></param> /// <returns></returns> - public async Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input) + public async Task<LifePayRechargeReceiptsPageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input) { var list = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false) - .WhereIf(input.OrderNo.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.OrderNo)) + .WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord)) .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin) .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd) .Select(x => new LifePayRechargeReceiptsListOutput() @@ -42,16 +42,22 @@ RechargeAmount = x.RechargeAmount, Remark = x.Remark, Voucher = x.Voucher.GetOssPath(), + CreationTime = x.CreationTime, }) .GetPageResult(input.PageModel); - return list; - } - public async Task<decimal> GetTotalLifePayRechargeReceipts() - { - var result = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount); + var total = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount); + LifePayRechargeReceiptsPageOutput<LifePayRechargeReceiptsListOutput> result = new LifePayRechargeReceiptsPageOutput<LifePayRechargeReceiptsListOutput>(); + result.Data = list.Data; + result.TotalRechargeAmount = total; return result; } + + //public async Task<decimal> GetTotalLifePayRechargeReceipts() + //{ + // var result = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount); + // return result; + //} /// <summary> /// 缂栬緫鍏呭�兼祦姘� @@ -63,6 +69,8 @@ CheckExtensions.IfTrueThrowUserFriendlyException(input.OrderNo == null, "璇疯緭鍏ヤ笟鍔¤鍗曞彿"); CheckExtensions.IfTrueThrowUserFriendlyException(input.RechargeAmount <= 0, "鍏呭�奸噾棰濆簲澶т簬0"); CheckExtensions.IfTrueThrowUserFriendlyException(input.Voucher == null, "璇锋彁浜ゅ厖鍊煎嚟璇�"); + var repeat = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false && x.OrderNo == input.OrderNo).FirstOrDefaultAsync(); + CheckExtensions.IfTrueThrowUserFriendlyException(repeat != null && repeat.Id != input.Id, "涓氬姟璁㈠崟鍙烽噸澶�"); if (input.Id.HasValue) { var payRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false && x.Id == input.Id.Value).FirstOrDefaultAsync(); -- Gitblit v1.9.1