From 8d1d296a9a2f1e1fb6b20a9b49ae190bf57650da Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 14:19:40 +0800 Subject: [PATCH] fix:充值流水功能开发 --- LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs index 87d9e46..35b36c8 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs @@ -2,9 +2,6 @@ using LifePayment.Domain.LifePay; using LifePayment.Domain.Models; using LifePayment.Domain.Shared; -using LifePayment.Domain; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; @@ -32,7 +29,7 @@ /// </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)) @@ -44,15 +41,21 @@ OrderNo = x.OrderNo, RechargeAmount = x.RechargeAmount, Remark = x.Remark, - Voucher = x.Voucher, + Voucher = x.Voucher.GetOssPath(), }) .GetPageResult(input.PageModel); - return list; + + 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 GetTotalLifePayRechargeReceipts() + //public async Task<decimal> GetTotalLifePayRechargeReceipts() //{ - + // var result = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount); + // return result; //} /// <summary> @@ -65,6 +68,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