From 977adf3153febe8926212a44b01fc9ff69f884d4 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 1 Apr 2025 13:10:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/TrialService.cs | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index be3859b66..e5e3f45fa 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -13,6 +13,7 @@ using Microsoft.Extensions.Options; using NPOI.SS.Formula.Functions; using Panda.DynamicWebApi.Attributes; using ZiggyCreatures.Caching.Fusion; +using static IRaCIS.Core.Domain.Share.StaticData; namespace IRaCIS.Core.Application.Service { @@ -105,21 +106,41 @@ namespace IRaCIS.Core.Application.Service //过滤废除的项目 public async Task> GetTrialSelect() { - + // SuperAdmin Admin OP List sap = new List() { (int)UserTypeEnum.SuperAdmin, (int)UserTypeEnum.Admin, (int)UserTypeEnum.OP }; - List sapp = new List() { (int)UserTypeEnum.SuperAdmin, (int)UserTypeEnum.Admin, (int)UserTypeEnum.OP, (int)UserTypeEnum.ProjectManager }; + // pm + List pm = new List() { (int)UserTypeEnum.ProjectManager }; + // QA EA + List qAEq= new List() { (int)UserTypeEnum.QA, (int)UserTypeEnum.EA }; + + List other = new List() { }; + + other.AddRange(sap); + other.AddRange(pm); + other.AddRange(qAEq); + + List trialState = new List() { StaticData.TrialState.TrialOngoing, StaticData.TrialState.TrialCompleted, StaticData.TrialState.TrialStopped }; return await _trialRepository.AsQueryable() + //SuperAdmin Admin OP - .WhereIf(sap.Contains(_userInfo.UserTypeEnumInt),x=> x.TrialStatusStr == StaticData.TrialState.TrialOngoing) + .WhereIf(sap.Contains(_userInfo.UserTypeEnumInt),x=> trialState.Contains(x.TrialStatusStr)) // pm - .WhereIf(_userInfo.UserTypeEnumInt== (int)UserTypeEnum.ProjectManager,t=> t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false + .WhereIf(pm.Contains(_userInfo.UserTypeEnumInt),t=> t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false && t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false)) && t.IsDeleted == false) + + + // QA EA + .WhereIf(qAEq.Contains(_userInfo.UserTypeEnumInt), t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false + && t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false)) + && t.IsDeleted == false && trialState.Contains(t.TrialStatusStr)) + + // other - .WhereIf(!sapp.Contains(_userInfo.UserTypeEnumInt), t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false + .WhereIf(!other.Contains(_userInfo.UserTypeEnumInt), t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false && t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false)) && t.IsDeleted == false&& t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync();