From a8833caf55053b94c4b2c1c01d10181d49eac822 Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 19 三月 2025 16:50:22 +0800
Subject: [PATCH] 添加过滤
---
LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs | 2 +-
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 35 ++++++++++++-----------------------
LifePayment/LifePayment.Domain/Common/IChannelFilter.cs | 2 ++
LifePayment/LifePayment.Domain/Common/ChannelFilter.cs | 14 +++++++++++++-
4 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index ad5178a..e3fc6ef 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1,36 +1,25 @@
-锘縰sing DynamicQuery.Net.Dto.Input;
-using LifePayment.Application.Contracts;
+锘縰sing LifePayment.Application.Contracts;
using LifePayment.Domain;
+using LifePayment.Domain.LifePay;
using LifePayment.Domain.Models;
using LifePayment.Domain.Shared;
-using MailKit.Search;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-using Nest;
using Newtonsoft.Json;
-using NPOI.OpenXmlFormats.Dml.Chart;
-using NPOI.SS.Formula.Functions;
-using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Security.Cryptography;
+using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
-using Volo.Abp.Domain.Entities;
+using Volo.Abp.Data;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus.Distributed;
-using ZeroD.Util;
-using ZeroD.Util.Fadd;
-using static LifePayment.Domain.Shared.LifePaymentConstant;
-using Volo.Abp.Data;
using Z.EntityFramework.Plus;
-using LifePayment.Domain.LifePay;
-using pingan.openbank.api.sdk.enums;
-using System.Linq.Dynamic.Core;
-using static Volo.Abp.Identity.Settings.IdentitySettingNames;
+using ZeroD.Util;
+using static LifePayment.Domain.Shared.LifePaymentConstant;
namespace LifePayment.Application;
@@ -164,7 +153,7 @@
public async Task<List<LifePayIntroInfoOutput>> GetIntroInfo(LifePayOrderTypeEnum lifePayType)
{
return await _lifePayIntroInfoRepository.Where(x => x.IsDeleted == false && x.LifePayType == lifePayType).OrderBy(x => x.Sequence)
- .Select(x => new LifePayIntroInfoOutput() { Type = x.Type, ContentSummary = x.ContentSummary, Content = x.Content, LifePayType = x.LifePayType,Path = x.Path,Sequence = x.Sequence })
+ .Select(x => new LifePayIntroInfoOutput() { Type = x.Type, ContentSummary = x.ContentSummary, Content = x.Content, LifePayType = x.LifePayType, Path = x.Path, Sequence = x.Sequence })
.ToListAsync();
}
@@ -175,7 +164,7 @@
/// <returns></returns>
public async Task<PageOutput<UserListOutput>> GetUserPage(QueryUserPageInput input)
{
- return await _lifePayUserRepository.Where(x => x.IsDeleted == false)
+ return await _channelFilter.GetChannelLifePayUserFilter(_lifePayUserRepository).Where(x => x.IsDeleted == false)
.WhereIf(!string.IsNullOrEmpty(input.QueryCondition), x => x.PhoneNumber.Contains(input.QueryCondition) || x.Name.Contains(input.QueryCondition))
.WhereIf(input.CreationTime.HasValue, x => x.CreationTime.ToString("yyyy-MM-dd") == input.CreationTime.Value.ToString("yyyy-MM-dd"))
.Select(x =>
@@ -284,7 +273,7 @@
return new PageOutput<UserLifePayOrderOutput>();
}
- return await _lifePayOrderRepository.Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�)
+ return await _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository).Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�)
.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)
@@ -406,7 +395,7 @@
public async Task<UserLifePayOrderRefundOutput> GetUserLifePayOrderRefund(Guid id)
{
- var order = await _lifePayOrderRepository.Where(x => x.Id == id).Select(x =>
+ var order = await _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository).Where(x => x.Id == id).Select(x =>
new UserLifePayOrderRefundOutput
{
Id = x.Id,
@@ -1630,5 +1619,5 @@
});
}
- #endregion
- }
+ #endregion
+}
diff --git a/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs
index 2b44105..01758a1 100644
--- a/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs
+++ b/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs
@@ -16,7 +16,7 @@
{
public abstract IQueryable<LifePayOrder> GetChannelLifePayOrderFilter(IQueryable<LifePayOrder> query);
-
+ public abstract IQueryable<LifePayUser> GetChannelLifePayUserFilter(IQueryable<LifePayUser> query);
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService<ICurrentUser>();
diff --git a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
index 11cde80..521da7e 100644
--- a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
+++ b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
@@ -23,7 +23,19 @@
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);
+ var queryResult = query.Where(s => (!string.IsNullOrEmpty(s.ChannelId) && queryUser.Contains(s.ChannelId)) || string.IsNullOrEmpty(s.ChannelId));
+ return queryResult;
+ }
+
+ return query;
+ }
+
+ public override IQueryable<LifePayUser> GetChannelLifePayUserFilter(IQueryable<LifePayUser> query)
+ {
+ 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 => (!string.IsNullOrEmpty(s.CreationChannleNum) && queryUser.Contains(s.CreationChannleNum)) || string.IsNullOrEmpty(s.CreationChannleNum));
return queryResult;
}
diff --git a/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs
index d56f0eb..44235d7 100644
--- a/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs
+++ b/LifePayment/LifePayment.Domain/Common/IChannelFilter.cs
@@ -11,6 +11,8 @@
public IQueryable<LifePayOrder> GetChannelLifePayOrderFilter(IQueryable<LifePayOrder> query);
+ public IQueryable<LifePayUser> GetChannelLifePayUserFilter(IQueryable<LifePayUser> query);
+
//public static IQueryable<T> GetChannleQuery<T>(this IQueryable<T> query, ChannelFilterInput input) where T : class, IChannelData
//{
// if (query == null)
--
Gitblit v1.9.1