From 01962d7f7d9bb4963546eb0c79b921995e6fe271 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 13:24:38 +0800 Subject: [PATCH] 提交 --- LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs | 28 ++++ LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml | 60 ++++++++++ LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs | 90 +++++++++++++++ LifePayment/LifePayment.Domain/LifePay/LifePayRechargeReceipts.cs | 37 ++++++ LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs | 30 ++++ LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs | 15 ++ LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs | 2 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs | 42 +++++++ LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml | 14 ++ LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 8 LifePayment/LifePayment.Domain/Common/ChannelFilter.cs | 1 11 files changed, 320 insertions(+), 7 deletions(-) diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs new file mode 100644 index 0000000..7c812c5 --- /dev/null +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayOrderService.cs @@ -0,0 +1,15 @@ +锘縰sing LifePayment.Domain.Shared; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Services; +using ZeroD.Util; + +namespace LifePayment.Application.Contracts; + +public interface ILifePayOrderService : IApplicationService +{ + Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input); + Task AddUpdatePayRechargeReceipts(AddUpdatePayRechargeReceiptsInput input); +} \ No newline at end of file diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs index b392da3..2d84ee7 100644 --- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs @@ -586,4 +586,46 @@ public decimal Profit { get; set; } +} + +public class LifePayRechargeReceiptsPageInput : ChannelsBaseInput +{ + public string? OrderNo { get; set; } + + /// <summary> + /// 璁拌处寮�濮嬫椂闂� + /// </summary> + public DateTime? CreationTimeBegin { get; set; } + + /// <summary> + /// 璁拌处缁撴潫鏃堕棿 + /// </summary> + public DateTime? CreationTimeEnd { get; set; } +} +public class AddUpdatePayRechargeReceiptsInput +{ + /// <summary> + /// 缂栧彿 + /// </summary> + public Guid? Id { get; set; } + + /// <summary> + /// 涓氬姟璁㈠崟鍙� + /// </summary> + public string OrderNo { get; set; } + + /// <summary> + /// 鍏呭�奸噾棰� + /// </summary> + public decimal RechargeAmount { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + public string? Remark { get; set; } + + /// <summary> + /// 鍏呭�煎嚟璇� + /// </summary> + public string Voucher { get; set; } } \ 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 16a9684..3afce11 100644 --- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs @@ -1108,4 +1108,32 @@ /// 鍦ㄧ嚎瀹㈡湇閾炬帴 /// </summary> public string Link { get; set; } +} + +public class LifePayRechargeReceiptsListOutput +{ + /// <summary> + /// 缂栧彿 + /// </summary> + public Guid Id { get; set; } + + /// <summary> + /// 涓氬姟璁㈠崟鍙� + /// </summary> + public string OrderNo { get; set; } + + /// <summary> + /// 鍏呭�奸噾棰� + /// </summary> + public decimal RechargeAmount { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + public string Remark { get; set; } + + /// <summary> + /// 鍑瘉 + /// </summary> + public string Voucher { get; set; } } \ No newline at end of file diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs new file mode 100644 index 0000000..87d9e46 --- /dev/null +++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs @@ -0,0 +1,90 @@ +锘縰sing LifePayment.Application.Contracts; +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; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; +using Microsoft.EntityFrameworkCore; +using ZeroD.Util; + +namespace LifePayment.Application.LifePay +{ + public class LifePayOrderService : ApplicationService, ILifePayOrderService + { + private readonly IRepository<LifePayRechargeReceipts, Guid> _lifePayRechargeReceiptsRepository; + + public LifePayOrderService( + IRepository<LifePayRechargeReceipts, Guid> lifePayRechargeReceiptsRepository) + { + _lifePayRechargeReceiptsRepository = lifePayRechargeReceiptsRepository; + } + + /// <summary> + /// 鑾峰彇鍏呭�兼祦姘� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + public async Task<PageOutput<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.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin) + .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd) + .Select(x => new LifePayRechargeReceiptsListOutput() + { + Id = x.Id, + OrderNo = x.OrderNo, + RechargeAmount = x.RechargeAmount, + Remark = x.Remark, + Voucher = x.Voucher, + }) + .GetPageResult(input.PageModel); + return list; + } + + //public async Task GetTotalLifePayRechargeReceipts() + //{ + + //} + + /// <summary> + /// 缂栬緫鍏呭�兼祦姘� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + public async Task AddUpdatePayRechargeReceipts(AddUpdatePayRechargeReceiptsInput input) + { + CheckExtensions.IfTrueThrowUserFriendlyException(input.OrderNo == null, "璇疯緭鍏ヤ笟鍔¤鍗曞彿"); + CheckExtensions.IfTrueThrowUserFriendlyException(input.RechargeAmount <= 0, "鍏呭�奸噾棰濆簲澶т簬0"); + CheckExtensions.IfTrueThrowUserFriendlyException(input.Voucher == null, "璇锋彁浜ゅ厖鍊煎嚟璇�"); + if (input.Id.HasValue) + { + var payRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false && x.Id == input.Id.Value).FirstOrDefaultAsync(); + payRechargeReceipts.OrderNo = input.OrderNo; + payRechargeReceipts.RechargeAmount = input.RechargeAmount; + payRechargeReceipts.Remark = input.Remark; + payRechargeReceipts.Voucher = input.Voucher; + } + else + { + LifePayRechargeReceipts payRechargeReceipts = new LifePayRechargeReceipts() + { + Id = Guid.NewGuid(), + OrderNo = input.OrderNo, + RechargeAmount = input.RechargeAmount, + Remark = input.Remark, + Voucher = input.Voucher, + }; + await _lifePayRechargeReceiptsRepository.InsertAsync(payRechargeReceipts); + } + } + } +} diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index c6b0d54..6887672 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -837,10 +837,10 @@ var channle = await GetLifePayChannlesDtoByNum(input.ChannelId); CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�"); - var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.璇濊垂璁㈠崟 + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.璇濊垂璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.IspCode) && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).ToListAsync(); - CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); + CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); @@ -898,7 +898,7 @@ //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); - var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐢佃垂璁㈠崟 + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐢佃垂璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricType) && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricAccount)).ToListAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); @@ -953,7 +953,7 @@ //var rate = await GetRate(); //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�"); - var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐕冩皵璁㈠崟 + var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐕冩皵璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasOrgType) && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasAccount)).ToListAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); diff --git a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs index 0a2bc21..3f0984f 100644 --- a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs +++ b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs @@ -40,7 +40,6 @@ var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList(); if (queryUser.Count() > 0) { - var queryResult = query.Where(s => (!string.IsNullOrEmpty(s.CreationChannleNum) && queryUser.Contains(s.CreationChannleNum)) || string.IsNullOrEmpty(s.CreationChannleNum)); return queryResult; } diff --git a/LifePayment/LifePayment.Domain/LifePay/LifePayRechargeReceipts.cs b/LifePayment/LifePayment.Domain/LifePay/LifePayRechargeReceipts.cs new file mode 100644 index 0000000..5953b75 --- /dev/null +++ b/LifePayment/LifePayment.Domain/LifePay/LifePayRechargeReceipts.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp; + +namespace LifePayment.Domain.LifePay +{ + public class LifePayRechargeReceipts : FullAuditedEntity<Guid>, IDataUserFilter + { + public LifePayRechargeReceipts() + { + } + + /// <summary> + /// 涓氬姟璁㈠崟鍙� + /// </summary> + public string OrderNo { get; set; } + + /// <summary> + /// 鍏呭�奸噾棰� + /// </summary> + public decimal RechargeAmount { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + public string Remark { get; set; } + + /// <summary> + /// 鍑瘉 + /// </summary> + public string Voucher { get; set; } + } +} diff --git a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs index e232ed4..7ca62cf 100644 --- a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs +++ b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs @@ -25,6 +25,8 @@ public virtual DbSet<LifePayPremium> LifePayPremium { get; set; } + public virtual DbSet<LifePayRechargeReceipts> LifePayRechargeReceipts { get; set; } + public virtual DbSet<Area> Area { get; set; } public virtual DbSet<User> Users { get; set; } diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml index 1ee0e60..50f010d 100644 --- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml +++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml @@ -253,6 +253,13 @@ <param name="input"></param> <returns></returns> </member> + <member name="M:LifePayment.HttpApi.LifePayController.GetLifePayRechargeReceiptsPage(LifePayment.Application.Contracts.LifePayRechargeReceiptsPageInput)"> + <summary> + 鑾峰彇鍏呭�兼祦姘村垎椤垫暟鎹� + </summary> + <param name="input"></param> + <returns></returns> + </member> <member name="M:LifePayment.HttpApi.LifePayController.CreateLifePayPhoneOrder(LifePayment.Application.Contracts.CreateLifePayOrderInput{LifePayment.Application.Contracts.LifePhoneData})"> <summary> 鍒涘缓鐢熸椿缂磋垂璇濊垂璁㈠崟 @@ -361,6 +368,13 @@ <param name="input"></param> <returns></returns> </member> + <member name="M:LifePayment.HttpApi.LifePayController.AddUpdatePayRechargeReceipts(LifePayment.Application.Contracts.AddUpdatePayRechargeReceiptsInput)"> + <summary> + 涓婁紶鍏呭�兼祦姘� + </summary> + <param name="input"></param> + <returns></returns> + </member> <member name="M:LifePayment.HttpApi.LifePayController.SetLifePayOrderPayType(LifePayment.Domain.Shared.SetLifePayOrderPayTypeInput)"> <summary> 璁剧疆鐢熸椿缂磋垂鏀粯绫诲瀷 diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml index dac2ea7..ebefdb8 100644 --- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml +++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml @@ -683,6 +683,41 @@ 鍒╂鼎 </summary> </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsPageInput.CreationTimeBegin"> + <summary> + 璁拌处寮�濮嬫椂闂� + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsPageInput.CreationTimeEnd"> + <summary> + 璁拌处缁撴潫鏃堕棿 + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.AddUpdatePayRechargeReceiptsInput.Id"> + <summary> + 缂栧彿 + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.AddUpdatePayRechargeReceiptsInput.OrderNo"> + <summary> + 涓氬姟璁㈠崟鍙� + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.AddUpdatePayRechargeReceiptsInput.RechargeAmount"> + <summary> + 鍏呭�奸噾棰� + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.AddUpdatePayRechargeReceiptsInput.Remark"> + <summary> + 澶囨敞 + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.AddUpdatePayRechargeReceiptsInput.Voucher"> + <summary> + 鍏呭�煎嚟璇� + </summary> + </member> <member name="P:LifePayment.Application.Contracts.LifePayIntroInfoInput.LifePayType"> <summary> 鐢熸椿缂磋垂绫诲瀷 @@ -1528,6 +1563,31 @@ 鍦ㄧ嚎瀹㈡湇閾炬帴 </summary> </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsListOutput.Id"> + <summary> + 缂栧彿 + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsListOutput.OrderNo"> + <summary> + 涓氬姟璁㈠崟鍙� + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsListOutput.RechargeAmount"> + <summary> + 鍏呭�奸噾棰� + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsListOutput.Remark"> + <summary> + 澶囨敞 + </summary> + </member> + <member name="P:LifePayment.Application.Contracts.LifePayRechargeReceiptsListOutput.Voucher"> + <summary> + 鍑瘉 + </summary> + </member> <member name="P:LifePayment.Application.Contracts.RecordOperateHistoryEto.RelationId"> <summary> 鍏宠仈鍏崇郴ID diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs index 08f7441..ad13e15 100644 --- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs +++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs @@ -1,4 +1,5 @@ 锘縰sing LifePayment.Application.Contracts; +using LifePayment.Application.LifePay; using LifePayment.Domain.Common; using LifePayment.Domain.Shared; using Microsoft.AspNetCore.Authorization; @@ -24,19 +25,22 @@ private readonly IStatisticsService _statisticsService; private readonly IWebClientInfoProvider _webClientInfoProvider; private readonly ICommonService _commonService; + private readonly ILifePayOrderService _lifePayOrderService; private readonly ILogger<LifePayController> _logger; public LifePayController( ILifePayService lifePayService, IStatisticsService statisticsService, IWebClientInfoProvider webClientInfoProvider, - ICommonService commonService - , ILogger<LifePayController> logger + ICommonService commonService, + ILifePayOrderService lifePayOrderService, + ILogger<LifePayController> logger ) { _lifePayService = lifePayService; _statisticsService = statisticsService; _webClientInfoProvider = webClientInfoProvider; _commonService = commonService; + _lifePayOrderService = lifePayOrderService; _logger = logger; } @@ -426,6 +430,17 @@ return data; } + /// <summary> + /// 鑾峰彇鍏呭�兼祦姘村垎椤垫暟鎹� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + public async Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input) + { + return await _lifePayOrderService.GetLifePayRechargeReceiptsPage(input); + } + #endregion @@ -621,6 +636,17 @@ return Constant.SUCCESS; } + /// <summary> + /// 涓婁紶鍏呭�兼祦姘� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + public async Task<int> AddUpdatePayRechargeReceipts(AddUpdatePayRechargeReceiptsInput input) + { + await _lifePayOrderService.AddUpdatePayRechargeReceipts(input); + return Constant.SUCCESS; + } /// <summary> /// 璁剧疆鐢熸椿缂磋垂鏀粯绫诲瀷 -- Gitblit v1.9.1