using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.AppDictionaries;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.PunchRecordServices;
using ATS.NonCustodial.Shared.Helpers;
using Quartz;
namespace ATS.NonCustodial.Admin.QuartzJobs.Jobs
{
///
/// 定时检查谁没有打卡
///
/// Author:mxg
/// CreatedTimed:2022-06-29 05:04 PM
[PersistJobDataAfterExecution] //下一次执行可以本次的结果
[DisallowConcurrentExecution] //不让任务在同一段时间内执行,5s,但是5s没有执行完,然后等执行完,在来执行
public class PunchRecordJob : BaseJobs.BaseJobs, IJob
{
#region Private
private readonly IAppPunchRecordService _appPunchRecordService;
private readonly IAppDictionaryService _appDictionaryService;
///
///
///
///
///
public PunchRecordJob(IAppPunchRecordService appPunchRecordService, IAppDictionaryService appDictionaryService)
{
_appPunchRecordService = appPunchRecordService;
_appDictionaryService = appDictionaryService;
}
#endregion Private
///
/// 执行打卡情况job
///
///
///
///
/// 2、未打卡,新增字典自动计划检查打卡时间的执行时间间隔,以分钟为单位,设置1分钟表明计划1分钟一次执行
/// 检查应打卡时间范围内,被监管人距离上一次打卡时间是否大于案件设置的打卡间隔时间,如果是则触发未打卡预警
///
public async Task Execute(IJobExecutionContext context)
{
ConsoleHelper.WriteWarningLine("job start……");
await _appPunchRecordService.CheckPunchRecordForJob();
ConsoleHelper.WriteWarningLine("job end……");
}
}
}