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.Contracts/LifePay/LifePayOutput.cs | 11 +++++++++++ LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml | 5 +++++ LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs | 19 +++++++++++++------ LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs | 13 ++----------- LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs | 3 +-- LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml | 6 ------ 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs index 2676cac..e465c85 100644 --- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs @@ -10,9 +10,8 @@ public interface ILifePayOrderService : IApplicationService { - Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input); + Task<LifePayRechargeReceiptsPageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input); - Task<decimal> GetTotalLifePayRechargeReceipts(); Task AddUpdatePayRechargeReceipts(AddUpdatePayRechargeReceiptsInput input); } \ No newline at end of file diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs index 3afce11..6059095 100644 --- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using ZeroD.Base.Web.Models; +using ZeroD.Util; namespace LifePayment.Application.Contracts; @@ -1109,6 +1110,16 @@ /// </summary> public string Link { get; set; } } +public class LifePayRechargeReceiptsPageOutput<T> : PageOutputBase +{ + + public List<T> Data { get; set; } = new List<T>(); + + /// <summary> + /// 绱鍏呭�� + /// </summary> + public decimal TotalRechargeAmount { get; set; } +} public class LifePayRechargeReceiptsListOutput { diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs index 6b78d5e..35b36c8 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs @@ -29,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,14 +44,19 @@ Voucher = x.Voucher.GetOssPath(), }) .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 +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(); diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml index 0f50933..50f010d 100644 --- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml +++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml @@ -260,12 +260,6 @@ <param name="input"></param> <returns></returns> </member> - <member name="M:LifePayment.HttpApi.LifePayController.GetLifePayRechargeReceiptsPage"> - <summary> - 鑾峰彇绱鍏呭�兼祦姘� - </summary> - <returns></returns> - </member> <member name="M:LifePayment.HttpApi.LifePayController.CreateLifePayPhoneOrder(LifePayment.Application.Contracts.CreateLifePayOrderInput{LifePayment.Application.Contracts.LifePhoneData})"> <summary> 鍒涘缓鐢熸椿缂磋垂璇濊垂璁㈠崟 diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml index ebefdb8..98ee957 100644 --- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml +++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml @@ -1563,6 +1563,11 @@ 鍦ㄧ嚎瀹㈡湇閾炬帴 </summary> </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsPageOutput`1.TotalRechargeAmount"> + <summary> + 绱鍏呭�� + </summary> + </member> <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsListOutput.Id"> <summary> 缂栧彿 diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs index e863fd0..08b9b62 100644 --- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs +++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs @@ -436,21 +436,12 @@ /// <param name="input"></param> /// <returns></returns> [HttpPost] - public async Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input) + public async Task<LifePayRechargeReceiptsPageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input) { return await _lifePayOrderService.GetLifePayRechargeReceiptsPage(input); } - /// <summary> - /// 鑾峰彇绱鍏呭�兼祦姘� - /// </summary> - /// <returns></returns> - [HttpGet] - public async Task<decimal> GetLifePayRechargeReceiptsPage() - { - return await _lifePayOrderService.GetTotalLifePayRechargeReceipts(); - } - + #endregion #region 鎿嶄綔 -- Gitblit v1.9.1