From 721826e346b2b7ff930348b422701fff4b153212 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 20 Aug 2025 11:18:10 +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 | 43 ++++++++++++++++++- IRaCIS.Core.Domain/Trial/Trial.cs | 5 +++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index e45d2bfcf..e7218afef 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -101,9 +101,48 @@ namespace IRaCIS.Core.Application.Service //过滤废除的项目 public async Task> GetTrialSelect() { - return await _trialRepository.AsQueryable() - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId) && t.IsDeleted == false) + // SuperAdmin Admin OP OA + List sap = new List() { (int)UserTypeEnum.SuperAdmin, (int)UserTypeEnum.Admin, (int)UserTypeEnum.OP, (int)UserTypeEnum.OA }; + // pm + List pm = new List() { (int)UserTypeEnum.ProjectManager }; + + // QA EA + List qAEq = new List() { (int)UserTypeEnum.QA, (int)UserTypeEnum.EA }; + + // GA + List ga = new List() { (int)UserTypeEnum.GA }; + + 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 => trialState.Contains(x.TrialStatusStr)) + + // pm + .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(!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(); } diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 20664a6fb..9cd1a1f7d 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -19,6 +19,11 @@ public partial class Trial : BaseFullDeleteAuditEntity public List TrialBodyPartList { get; set; } [JsonIgnore] public List TaskMedicalReviewList { get; set; } + + + [JsonIgnore] + public List TrialIdentityUserList { get; set; } + [JsonIgnore] public List TaskConsistentRuleList { get; set; } [JsonIgnore]