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();