zhengyuxuan
2025-03-27 ff1462c4d0c4c88b1ef801608284f01ac1e37761
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,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()
@@ -44,15 +41,22 @@
                    OrderNo = x.OrderNo,
                    RechargeAmount = x.RechargeAmount,
                    Remark = x.Remark,
                    Voucher = x.Voucher,
                    Voucher = x.Voucher.GetOssPath(),
                    CreationTime = x.CreationTime,
                })
                .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 +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();