diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index ce8be47c4..1396841fe 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -34,10 +34,11 @@ namespace IRaCIS.Core.Application.Service IRepository _trialDictionaryRepository, IRepository _trialBodyPartRepository, IOptionsMonitor _verifyConfig, + IOptionsMonitor systemEmailConfig, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, ITrialService { - + private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue; public bool TrialExpeditedChange { get; set; } = false; @@ -113,9 +114,9 @@ namespace IRaCIS.Core.Application.Service List pm = new List() { (int)UserTypeEnum.ProjectManager }; // QA EA - List qAEq= new List() { (int)UserTypeEnum.QA, (int)UserTypeEnum.EA }; + List qAEq = new List() { (int)UserTypeEnum.QA, (int)UserTypeEnum.EA }; - List other = new List() { }; + List other = new List() { }; other.AddRange(sap); other.AddRange(pm); @@ -125,24 +126,24 @@ namespace IRaCIS.Core.Application.Service return await _trialRepository.AsQueryable() //SuperAdmin Admin OP - .WhereIf(sap.Contains(_userInfo.UserTypeEnumInt),x=> trialState.Contains(x.TrialStatusStr)) - + .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 + .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 + // 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 + .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) + && t.IsDeleted == false && t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } @@ -330,6 +331,14 @@ namespace IRaCIS.Core.Application.Service trial.UpdateTime = DateTime.Now; + #region 邮件默认值 + trial.EmailAuthorizationCode = _systemEmailConfig.AuthorizationCode; + trial.EmailFromEmail = _systemEmailConfig.FromEmail; + trial.EmailFromName = $"{_systemEmailConfig.FromName}-{trial.TrialCode}"; + trial.EmailSMTPServerAddress = _systemEmailConfig.Host; + trial.EmailSMTPServerPort = _systemEmailConfig.Port; + #endregion + var success = await _trialRepository.SaveChangesAsync(); //维护CRO Sponsor @@ -479,7 +488,7 @@ namespace IRaCIS.Core.Application.Service public async Task DeleteOSSFolder() { List trialids = await _trialRepository.Select(x => x.Id).ToListAsync(); - List path= _oSSService.GetRootFolderNames(); + List path = _oSSService.GetRootFolderNames(); foreach (var item in path) { if (Guid.TryParse(item, out Guid folderId) && !trialids.Contains(folderId))