Files
jinko.yikatong/Src/Dlhis.ScheduledTask/Packs/JobPack.cs

52 lines
1.7 KiB
C#

using Dlhis.ScheduledTask.CommonJobs;
using Dlhis.ScheduledTask.SyncSapInfo.Job;
using Dlhis.ScheduledTask.TaskAssignment.Job;
using Hangfire;
using Kurisu.AspNetCore.Startup;
namespace Dlhis.ScheduledTask.Packs;
public class JobPack : BaseAppPack
{
public override int Order => 999;
public override bool IsBeforeUseRouting { get; }
public override void Invoke(IServiceProvider serviceProvider)
{
RecurringJob.AddOrUpdate<SyncOrganizationJob>("SyncSap", s => s.SyncOrgInfo(), "0 0 2 * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
RecurringJob.AddOrUpdate<SyncPersonJob>("SyncPerson", s => s.RunAsync(), "0 0 3 * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
//创建设备同步时间任务
RecurringJob.AddOrUpdate<CreateSyncServerDateTimeJob>("SyncServerDateTime", s => s.RunAsync(), "0 0 0/1 * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
//创建设备获取的任务
RecurringJob.AddOrUpdate<CreateGetUploadRecordJob>("CreateGetUploadRecord", s => s.RunAsync(), "0 0/1 * * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
//创建系统默认分组
RecurringJob.AddOrUpdate<CreateDefinitelyGroupJob>("CreateDefinitelyGroup", s => s.RunAsync(), "0 0 5 * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
//心跳
RecurringJob.AddOrUpdate<HeartbeatJob>("Heartbeat", s => s.RunAsync(), "0/10 * * * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
}
}