邮件修改
parent
ea836d9349
commit
0dd73991f0
|
@ -67,7 +67,7 @@ public class HangfireHostService(IRecurringMessageScheduler _recurringMessageSch
|
||||||
//利用主键作为任务Id
|
//利用主键作为任务Id
|
||||||
var jobId = $"{task.Id}_({task.BusinessScenarioEnum})";
|
var jobId = $"{task.Id}_({task.BusinessScenarioEnum})";
|
||||||
|
|
||||||
HangfireJobHelper.AddOrUpdateSystemCronJob(jobId, task.BusinessScenarioEnum, task.EmailCron);
|
HangfireJobHelper.AddOrUpdateTimingCronJob(jobId, task.BusinessScenarioEnum, task.EmailCron);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,18 +83,20 @@ namespace IRaCIS.Core.Application.Helper
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddOrUpdateSystemCronJob(string jobId, EmailBusinessScenario businessScenario, string emailCron)
|
public static void AddOrUpdateTimingCronJob(string jobId, EmailBusinessScenario businessScenario, string emailCron)
|
||||||
{
|
{
|
||||||
switch (businessScenario)
|
switch (businessScenario)
|
||||||
{
|
{
|
||||||
|
|
||||||
case EmailBusinessScenario.GeneralTraining_ExpirationNotification:
|
case EmailBusinessScenario.GeneralTraining_ExpirationNotification:
|
||||||
|
|
||||||
HangfireJobHelper.RemoveCronJob(jobId + "System");
|
|
||||||
HangfireJobHelper.RemoveCronJob(jobId + "Trial");
|
HangfireJobHelper.AddOrUpdateCronJob<IMediator>(jobId, t => t.Send(new SystemDocumentErverDayEvent() { }, default), emailCron);
|
||||||
Console.WriteLine("添加发邮件过期提醒任务");
|
break;
|
||||||
HangfireJobHelper.AddOrUpdateCronJob<IMediator>(jobId+"System", t => t.Send(new SystemDocumentErverDayEvent() { }, default), emailCron);
|
case EmailBusinessScenario.TrialTraining_ExpirationNotification:
|
||||||
HangfireJobHelper.AddOrUpdateCronJob<IMediator>(jobId+"Trial", t => t.Send(new TrialDocumentErverDayEvent() { }, default), emailCron);
|
|
||||||
|
|
||||||
|
HangfireJobHelper.AddOrUpdateCronJob<IMediator>(jobId, t => t.Send(new TrialDocumentErverDayEvent() { }, default), emailCron);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -267,7 +267,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
return (topicStr, htmlBodyStr);
|
return (topicStr, htmlBodyStr);
|
||||||
};
|
};
|
||||||
|
|
||||||
var scenario = EmailBusinessScenario.GeneralTraining_EffectiveNotification;
|
var scenario = EmailBusinessScenario.TrialTraining_EffectiveNotification;
|
||||||
|
|
||||||
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
|
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
|
||||||
|
|
||||||
|
|
|
@ -167,10 +167,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
var jobId = $"{entity.Id}_({entity.BusinessScenarioEnum})";
|
var jobId = $"{entity.Id}_({entity.BusinessScenarioEnum})";
|
||||||
|
|
||||||
|
HangfireJobHelper.RemoveCronJob(jobId);
|
||||||
|
|
||||||
//有的job 可能编辑控制直接不发,需要移除已存在的
|
//有的job 可能编辑控制直接不发,需要移除已存在的
|
||||||
if (entity.IsAutoSend && entity.IsEnable)
|
if (entity.IsAutoSend && entity.IsEnable)
|
||||||
{
|
{
|
||||||
HangfireJobHelper.AddOrUpdateSystemCronJob(jobId, entity.BusinessScenarioEnum, entity.EmailCron);
|
HangfireJobHelper.AddOrUpdateTimingCronJob(jobId, entity.BusinessScenarioEnum, entity.EmailCron);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,8 +312,15 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ReviewerSelection_SPMCPMApproval = 70,
|
ReviewerSelection_SPMCPMApproval = 70,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 项目培训 - 生效通知
|
||||||
|
/// </summary>
|
||||||
|
TrialTraining_EffectiveNotification = 71,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 项目培训 - 到期通知
|
||||||
|
/// </summary>
|
||||||
|
TrialTraining_ExpirationNotification = 72,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue