From 848fd84f84c9c5a624c6c7ea07206d03bb0a8575 Mon Sep 17 00:00:00 2001 From: wangping <995664179@qq.com> Date: Wed, 17 Sep 2025 09:38:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=83=A8=E5=88=86BUG=E5=A4=84=E7=90=86,?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BF=A1=E6=81=AF=E6=98=AF=E5=90=A6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=EF=BC=8C=E6=B6=89=E6=A1=88=E4=BA=BA=E5=91=98?= =?UTF-8?q?=EF=BC=8C=E6=B6=89=E6=A1=88=E4=BA=BA=E5=91=98=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Impl/Admins/AuthService.cs | 2 ++ .../Impl/Business/AppEarlyWarningService.cs | 8 +++++++- .../Admins/Auth/Output/AuthLoginOutput.cs | 5 +++++ .../Common/Auth/ClaimAttributes.cs | 5 +++++ .../Common/Auth/IUser.cs | 5 +++++ .../Common/Auth/User.cs | 18 ++++++++++++++++++ 6 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs index 8ef8466..7f1df81 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs @@ -416,6 +416,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins new Claim(ClaimAttributes.phone,user?.Phone??""), new Claim(ClaimAttributes.logtime,timeLogin), new Claim(ClaimAttributes.limits,limits), + new Claim(ClaimAttributes.IsAdmin,user.IsAdmin?"true":"false"), new Claim(ClaimAttributes.personType,user?.ChatPersonType.ToString()!) }); @@ -484,6 +485,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins await _appUserRepository.UpdateAsync(user); } var authLoginOutput = Mapper.Map(user); + authLoginOutput.IsAdmin = isAdmin.IsAdmin; var token = await GetToken(authLoginOutput); diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs index d3cbd97..7046f50 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs @@ -412,7 +412,13 @@ namespace ATS.NonCustodial.Application.Impl.Business /// private async Task> GetExpression(AppEarlyWarningGetPageInput pageInput, IQueryable query) { - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); + var limits = User.limits; + var IsAdmin = User.IsAdmin; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .WhereIf((!IsAdmin),w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + //var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); query = query.Where(w => caseIds.Contains(w.CaseId)) .WhereIf(pageInput.KeyWord.NotNull(), w => w.Title.Contains(pageInput.KeyWord) || w.CaseName.Contains(pageInput.KeyWord)) diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs index 4a48de3..625637d 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Auth/Output/AuthLoginOutput.cs @@ -80,5 +80,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Auth.Output /// 查询界限 /// public string? limits { get; set; } + + /// + /// 是否是Admin + /// + public bool IsAdmin { get; set; } } } \ No newline at end of file diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs index 17d3654..4b42b87 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs @@ -91,5 +91,10 @@ namespace ATS.NonCustodial.Shared.Common.Auth /// 查询界限 /// public const string limits = "limits"; + + /// + /// 是否是Admin + /// + public const string IsAdmin = "false"; } } \ No newline at end of file diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs index 65d1d02..16cfb2b 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs @@ -57,6 +57,11 @@ namespace ATS.NonCustodial.Shared.Common.Auth /// string limits { get; } + /// + /// 是否管理员 + /// + bool IsAdmin { get; } + /// /// 租户Id /// diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs index 17ca193..05b2b91 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs @@ -176,6 +176,24 @@ namespace ATS.NonCustodial.Shared.Common.Auth } } + /// + /// 是否管理员 + /// + public bool IsAdmin + { + get + { + var name = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.IsAdmin); + + if (name != null && name.Value.NotNull()) + { + return name.Value=="true"; + } + + return false; + } + } + /// /// 租户Id /// From f5472e4feadc47653c205634c4f59824413782c5 Mon Sep 17 00:00:00 2001 From: wangping <995664179@qq.com> Date: Wed, 17 Sep 2025 09:52:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseManagements/AppCaseManagementService.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs index 0c14b6c..273da7f 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs @@ -1831,14 +1831,22 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements /// public async Task Getexport(AppCaseManagementGetPageInput input) { + input.PageIndex = 1; + input.PageSize = 999999; + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + input.CaseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var express = await GetExpression(input, _appCaseManagementRepository.AsQueryable(false, true)); var rtn = await base.GetPageAsync(input, express); - var caseIds = rtn.Data.Select(w => w.Id).ToList(); + //var caseIds = rtn.Data.Select(w => w.Id).ToList(); var caseSupervisor = await _appCaseSupervisorRepository.AsQueryable(false, true) - .Where(w => caseIds.Contains(w.CaseId)) + .Where(w => input.CaseIds.Contains(w.CaseId)) .ToListAsync(); foreach (var listDto in rtn.Data)