zhengyuxuan
2025-04-03 d47921dc014dfaee234ce50cb4c296d342e09085
LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -14,9 +14,6 @@
using LifePayment.Domain;
using static LifePayment.Domain.Shared.LifePaymentConstant;
using Newtonsoft.Json;
using LifePayment.Domain.Common;
using Spire.Pdf.Exporting.XPS.Schema;
using Nest;
namespace LifePayment.Application.LifePay
{
@@ -61,7 +58,7 @@
        public async Task<PageOutput<LifePayConsumptionListOutput>> GetLifePayConsumptionPage(LifePayConsumptionPageInput input)
        {
            var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWord)).Select(x => x.ChannlesNum).ToListAsync();
            var list = await _lifePayConsumption.Where(x => x.IsDeleted == false)
            var list = await _lifePayConsumption
                .WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord) || x.AcoolyOrderNo.Contains(input.KeyWord) || channles.Contains(x.ChannelId))
                .WhereIf(input.Flow.HasValue, x => x.Flow == input.Flow)
                .WhereIf(input.TimeBegin.HasValue, x => x.FinishTime >= input.TimeBegin)
@@ -81,8 +78,8 @@
                })
                .GetPageResult(input.PageModel);
            var totalDeductionAmount = await _lifePayConsumption.Where(x => x.IsDeleted == false).SumAsync(x => x.DeductionAmount);
            var totalFrozenAmount = await _lifePayConsumption.Where(x => x.IsDeleted == false).SumAsync(x => x.FrozenAmount);
            var totalDeductionAmount = await _lifePayConsumption.SumAsync(x => x.DeductionAmount);
            var totalFrozenAmount = await _lifePayConsumption.SumAsync(x => x.FrozenAmount);
            LifePayConsumptionStatistics objectData = new LifePayConsumptionStatistics();
            objectData.TotalDeductionAmount = totalDeductionAmount;
            objectData.TotalFrozenAmount = totalFrozenAmount.Value;
@@ -97,7 +94,7 @@
        /// <returns></returns>
        public async Task<PageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input)
        {
            var list = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false)
            var list = await _lifePayRechargeReceiptsRepository
                .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)
@@ -112,7 +109,7 @@
                })
                .GetPageResult(input.PageModel);
            var total = await _lifePayRechargeReceiptsRepository.Where(x => x.IsDeleted == false).SumAsync(x => x.RechargeAmount);
            var total = await _lifePayRechargeReceiptsRepository.SumAsync(x => x.RechargeAmount);
            LifePayRechargeReceiptsStatistics objectData = new LifePayRechargeReceiptsStatistics();
            objectData.TotalRechargeAmount = total;
            list.ObjectData = objectData;
@@ -126,7 +123,7 @@
        /// <returns></returns>
        public async Task<PageOutput<LifePayExpensesReceiptsListOutput>> GetLifePayExpensesReceiptsPage(LifePayExpensesReceiptsPageInput input)
        {
            var list = await _lifePayExpensesReceiptsRepository.Where(x => x.IsDeleted == false)
            var list = await _lifePayExpensesReceiptsRepository
                .WhereIf(input.KeyWord.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWord) || x.OutOrderNo.Contains(input.KeyWord))
                .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType)
                .WhereIf(input.ExpensesReceiptsType.HasValue, x => x.ExpensesReceiptsType == input.ExpensesReceiptsType)
@@ -145,8 +142,8 @@
                })
                .GetPageResult(input.PageModel);
            var totalIncome = await _lifePayExpensesReceiptsRepository.Where(x => x.IsDeleted == false && x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Expenses).SumAsync(x => x.Amount);
            var totalRefund = await _lifePayExpensesReceiptsRepository.Where(x => x.IsDeleted == false && x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Receipts).SumAsync(x => x.Amount);
            var totalIncome = await _lifePayExpensesReceiptsRepository.Where(x => x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Expenses).SumAsync(x => x.Amount);
            var totalRefund = await _lifePayExpensesReceiptsRepository.Where(x => x.ExpensesReceiptsType == ExpensesReceiptsTypeEnum.Receipts).SumAsync(x => x.Amount);
            LifePayExpensesReceiptsStatistics objectData = new LifePayExpensesReceiptsStatistics();
            objectData.TotalIncome = totalIncome;
@@ -163,7 +160,7 @@
        /// <returns></returns>
        public async Task<PageOutput<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakePage(LifePayChannlesRakePageInput input)
        {
            var list = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
            var list = await _lifePayChannlesRakeRepository
                .WhereIf(input.ChannelId.IsNotNullOrEmpty(), x => x.ChannelId == input.ChannelId)
                .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
                .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
@@ -183,7 +180,7 @@
                })
                .GetPageResult(input.PageModel);
            var totalRakePrice = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
            var totalRakePrice = await _lifePayChannlesRakeRepository
                .WhereIf(input.ChannelId.IsNotNullOrEmpty(), x => x.ChannelId == input.ChannelId)
                .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
                .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
@@ -235,11 +232,11 @@
            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();
            var repeat = await _lifePayRechargeReceiptsRepository.Where(x => 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();
                var payRechargeReceipts = await _lifePayRechargeReceiptsRepository.Where(x => x.Id == input.Id.Value).FirstOrDefaultAsync();
                payRechargeReceipts.OrderNo = input.OrderNo;
                payRechargeReceipts.RechargeAmount = input.RechargeAmount;
                payRechargeReceipts.Remark = input.Remark;
@@ -438,7 +435,7 @@
        /// <returns></returns>
        public async Task GetAllChannlesRake()
        {
            var orderlist = await _lifePayOrderRepository.Where(x => x.IsDeleted == false && x.PayStatus == LifePayStatusEnum.已支付 && x.LifePayOrderStatus == LifePayOrderStatusEnum.已完成).ToListAsync();
            var orderlist = await _lifePayOrderRepository.Where(x => x.PayStatus == LifePayStatusEnum.已支付 && x.LifePayOrderStatus == LifePayOrderStatusEnum.已完成).ToListAsync();
            foreach (var item in orderlist)
            {
                /// 毛利
@@ -568,7 +565,7 @@
        private async Task<IQueryable<LifePayChannlesRakeListOutput>> GetLifePayChannlesRakeListFilter(LifePayChannlesRakePageInput input)
        {
            var list = _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
            var list = _lifePayChannlesRakeRepository
                .WhereIf(input.ChannelId.IsNotNullOrEmpty(), x => x.ChannelId == input.ChannelId)
                .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
                .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)