diff --git a/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs b/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs index c886d0555..ef5e78eed 100644 --- a/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs +++ b/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs @@ -89,6 +89,9 @@ namespace IRaCIS.Core.Application.Helper { case EmailBusinessScenario.GeneralTraining_ExpirationNotification: + + HangfireJobHelper.RemoveCronJob(jobId + "System"); + HangfireJobHelper.RemoveCronJob(jobId + "Trial"); Console.WriteLine("添加发邮件过期提醒任务"); HangfireJobHelper.AddOrUpdateCronJob(jobId+"System", t => t.Send(new SystemDocumentErverDayEvent() { }, default), emailCron); HangfireJobHelper.AddOrUpdateCronJob(jobId+"Trial", t => t.Send(new TrialDocumentErverDayEvent() { }, default), emailCron); diff --git a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs index 28fab14b8..4bdc0d7b6 100644 --- a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs @@ -168,14 +168,6 @@ namespace IRaCIS.Core.Application.Contracts var jobId = $"{entity.Id}_({entity.BusinessScenarioEnum})"; //有的job 可能编辑控制直接不发,需要移除已存在的 - HangfireJobHelper.RemoveCronJob(jobId); - if (entity.BusinessScenarioEnum == EmailBusinessScenario.GeneralTraining_ExpirationNotification) - { - - HangfireJobHelper.RemoveCronJob(jobId + "System"); - HangfireJobHelper.RemoveCronJob(jobId + "Trial"); - } - if (entity.IsAutoSend && entity.IsEnable) { HangfireJobHelper.AddOrUpdateSystemCronJob(jobId, entity.BusinessScenarioEnum, entity.EmailCron);