diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs index 385240394..21d16c2f7 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs @@ -113,7 +113,7 @@ public class UserSiteSurveySubmitedEventConsumer( var scenario = _trialSiteSurveyRepository.Any(t => t.Id != trialSiteSurveyId && t.TrialId == siteSurveyInfo.TrialId && t.TrialSiteId == siteSurveyInfo.TrialSiteId) ? EmailBusinessScenario.Approval_UpdateSiteSurvey : EmailBusinessScenario.Approval_SubmitSiteSurvey; - await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, EmailBusinessScenario.Approval_SubmitSiteSurvey, messageToSend, emailConfigFunc); + await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, scenario, messageToSend, emailConfigFunc); await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig); @@ -174,7 +174,7 @@ public class SiteSurveySPMSubmitedEventConsumer( Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => { - var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo); + var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo); var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr), toUserName, siteInfo.TrialSiteCode, @@ -274,7 +274,7 @@ public class SiteSurverRejectedEventConsumer( Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => { - var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo); + var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo); var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr), toUserName, trialInfo.TrialCode, diff --git a/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs index 0af514bd5..c36c3cbac 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs @@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Contracts public UserTypeEnum? CopyUserType { get; set; } - + public BusinessLevel? BusinessLevelEnum { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs index 49eda1a85..af8653df5 100644 --- a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs @@ -25,13 +25,14 @@ namespace IRaCIS.Core.Application.Contracts .WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) .WhereIf(inQuery.SystemLevel != null, t => t.SystemLevel == inQuery.SystemLevel) .WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria) + .WhereIf(inQuery.BusinessLevelEnum != null, t => t.BusinessLevelEnum == inQuery.BusinessLevelEnum) .WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum) .WhereIf(inQuery.BusinessModuleEnum != null, t => t.BusinessModuleEnum == inQuery.BusinessModuleEnum) .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) .WhereIf(inQuery.EmailUrgentEnum != null, t => t.EmailUrgentEnum == inQuery.EmailUrgentEnum) - .WhereIf(inQuery.ToUserType != null, t => t.EmailNoticeUserTypeList.Any(t=>t.UserType==inQuery.ToUserType && t.EmailUserType==EmailUserType.To) ) + .WhereIf(inQuery.ToUserType != null, t => t.EmailNoticeUserTypeList.Any(t => t.UserType == inQuery.ToUserType && t.EmailUserType == EmailUserType.To)) .WhereIf(inQuery.CopyUserType != null, t => t.EmailNoticeUserTypeList.Any(t => t.UserType == inQuery.CopyUserType && t.EmailUserType == EmailUserType.Copy)) .ProjectTo(_mapper.ConfigurationProvider); @@ -43,9 +44,10 @@ namespace IRaCIS.Core.Application.Contracts { var verifyExp1 = new EntityVerifyExp() { - VerifyExp = t => t.BusinessScenarioEnum == addOrEditEmailNoticeConfig.BusinessScenarioEnum, + VerifyExp = t => t.BusinessScenarioEnum == addOrEditEmailNoticeConfig.BusinessScenarioEnum && t.CriterionTypeEnum== addOrEditEmailNoticeConfig.CriterionTypeEnum, VerifyMsg = _localizer["EmailNoticeConfig_RepeatEmailScenario"] + }; // 匹配所有占位符的正则表达式,允许包含空格的占位符 diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index d55d78cb9..fca2fa4da 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -76,6 +76,9 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); + CreateMap(); + + CreateMap().ReverseMap(); CreateMap(); diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 3c85f29a0..c5c0c92d2 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -1244,8 +1244,7 @@ namespace IRaCIS.Core.Application.Service { var trialConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First(); - var emailNoticeConfigQueryable = _emailNoticeConfigRepository - .WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) + var emailNoticeConfigQueryable = _emailNoticeConfigRepository.Where(t=>t.BusinessLevelEnum==BusinessLevel.Trial) .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) diff --git a/IRaCIS.Core.Domain/Common/EmailNoticeConfig.cs b/IRaCIS.Core.Domain/Common/EmailNoticeConfig.cs index eb7bbe6e4..a11ad0756 100644 --- a/IRaCIS.Core.Domain/Common/EmailNoticeConfig.cs +++ b/IRaCIS.Core.Domain/Common/EmailNoticeConfig.cs @@ -23,7 +23,7 @@ public class EmailNoticeConfig : BaseFullDeleteAuditEntity public string AttachPath { get; set; } = null!; [Comment("业务级别")] - public int BusinessLevelEnum { get; set; } + public BusinessLevel BusinessLevelEnum { get; set; } [Comment("业务模块")] public BusinessModule BusinessModuleEnum { get; set; } @@ -83,6 +83,21 @@ public class EmailNoticeUserType : Entity public EmailUserType EmailUserType { get; set; } } +public enum BusinessLevel +{ + Default=0, + + + System=1, + + //需要手动添加到项目的邮件 + Trial=2, + + //项目默认发送的邮件,不需要手动添加到项目 + TrialDefault=3 +} + + public enum BusinessModule { ///