From 4aad201a4468477a2353b1999b1af77971b432ee Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期三, 19 三月 2025 16:28:21 +0800 Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi --- /dev/null | 47 ----------------------- LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs | 4 +- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 9 +++- LifePayment/LifePayment.Domain/Common/IChannelFilter.cs | 41 ++++++++++++++++++++ LifePayment/LifePayment.Domain/Common/ChannelFilter.cs | 14 +++++-- 5 files changed, 59 insertions(+), 56 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index ab35a81..0e4a39c 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -47,7 +47,7 @@ private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRep; private readonly IRepository<LifePayAccount, Guid> _lifePayAccount; private readonly IDataFilter dataFilter; - + private readonly IChannelFilter _channelFilter; private readonly IAliPayApi _aliPayApi; private readonly IWxPayApi _wxPayApi; private readonly WxPayOption _wxPayOptions; @@ -67,7 +67,8 @@ IOptions<WxPayOption> wxPayOptions, IRepository<LifePayChannles, Guid> lifePayChannlesRep, IRepository<LifePayAccount, Guid> lifePayAccount, - IDataFilter dataFilter) + IDataFilter dataFilter, + IChannelFilter channelFilter) { _logger = logger; _aCOOLYManager = aCOOLYManager; @@ -83,6 +84,7 @@ _lifePayChannlesRep = lifePayChannlesRep; _lifePayAccount = lifePayAccount; this.dataFilter = dataFilter; + _channelFilter = channelFilter; } #region 鏌ヨ @@ -228,7 +230,8 @@ /// <returns></returns> public async Task<PageOutput<LifePayOrderListOutput>> GetLifePayOrderPage(QueryLifePayOrderListInput input) { - var result = await (from a in _lifePayOrderRepository.Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�) + + var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository) .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime) .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime) .WhereIf(input.BeginPayTime.HasValue, x => x.PayTime >= input.BeginPayTime) diff --git a/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs index 4c7efd3..2b44105 100644 --- a/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs +++ b/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs @@ -12,9 +12,9 @@ namespace LifePayment.Domain.Common { - public abstract class AbstractChannelFilter + public abstract class AbstractChannelFilter : IChannelFilter, ISingletonDependency { - public abstract Task<IQueryable<ChannelsBase>> GetChannelFilter(IQueryable<ChannelsBase> query); + public abstract IQueryable<LifePayOrder> GetChannelLifePayOrderFilter(IQueryable<LifePayOrder> query); public IAbpLazyServiceProvider LazyServiceProvider { get; set; } diff --git a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs index f4d0a5e..11cde80 100644 --- a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs +++ b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Channels; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Services; @@ -17,11 +18,16 @@ { public class ChannelFilter : AbstractChannelFilter { - public async override Task<IQueryable<ChannelsBase>> GetChannelFilter(IQueryable<ChannelsBase> query) + public override IQueryable<LifePayOrder> GetChannelLifePayOrderFilter(IQueryable<LifePayOrder> query) { - var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList(); - var queryResult = query.Where(s => queryUser.Contains(s.ChannleId)); - return queryResult; + if (CurrentUser.ClientId == Constant.ClientType.Back) + { + var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList(); + var queryResult = query.Where(s => (s.ChannelId.HasValue && queryUser.Contains(s.ChannelId.Value)) || !s.ChannelId.HasValue); + return queryResult; + } + + return query; } } diff --git a/LifePayment/LifePayment.Domain/Common/ChannelHelper.cs b/LifePayment/LifePayment.Domain/Common/ChannelHelper.cs deleted file mode 100644 index cff865d..0000000 --- a/LifePayment/LifePayment.Domain/Common/ChannelHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -锘縰sing DynamicQuery.Net.Dto.Input; -using DynamicQuery.Net; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ZeroD.Application.Services.Dto; -using Volo.Abp.Users; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace LifePayment.Domain -{ - public interface IChannelFilter - { - - public Task<IQueryable<TEntity>> GetChannelFilter<TEntity, TKey>(IQueryable<TEntity> query) - where TEntity : class, IChannelData, IMayHaveCreator, IEntity<TKey>; - //public static IQueryable<T> GetChannleQuery<T>(this IQueryable<T> query, ChannelFilterInput input) where T : class, IChannelData - //{ - // if (query == null) - // { - // return query; - // } - // if (input.Channels != null && input.Channels.Any()) - // { - // query = query.Where(r => input.Channels.Contains(r.ChannelId)); - // } - // return query; - //} - - } - - - - public interface IChannelData - { - public Guid ChannleId { get; set; } - } - - public class ChannelFilterInput - { - public List<Guid> Channels { get; set; } = new List<Guid>(); - } - -} diff --git a/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs new file mode 100644 index 0000000..d56f0eb --- /dev/null +++ b/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs @@ -0,0 +1,41 @@ +锘縰sing LifePayment.Domain.Models; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace LifePayment.Domain +{ + public interface IChannelFilter + { + + + public IQueryable<LifePayOrder> GetChannelLifePayOrderFilter(IQueryable<LifePayOrder> query); + + //public static IQueryable<T> GetChannleQuery<T>(this IQueryable<T> query, ChannelFilterInput input) where T : class, IChannelData + //{ + // if (query == null) + // { + // return query; + // } + // if (input.Channels != null && input.Channels.Any()) + // { + // query = query.Where(r => input.Channels.Contains(r.ChannelId)); + // } + // return query; + //} + + } + + + + //public interface IChannelData + //{ + // public Guid ChannleId { get; set; } + //} + + //public class ChannelFilterInput + //{ + // public List<Guid> Channels { get; set; } = new List<Guid>(); + //} + +} -- Gitblit v1.9.1