fix 考勤任务生成处理

This commit is contained in:
2024-02-22 15:00:21 +08:00
parent 1ccacdf04d
commit 9f5c239832
2 changed files with 8 additions and 3 deletions

View File

@@ -24,11 +24,13 @@ public class JobPack : BaseAppPack
TimeZone = TimeZoneInfo.Local
});
//创建设备同步时间任务
RecurringJob.AddOrUpdate<CreateSyncServerDateTimeJob>("SyncServerDateTime", s => s.RunAsync(), "0 0 0/1 * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local
});
//创建设备获取考勤的任务
RecurringJob.AddOrUpdate<CreateGetAttendanceJob>("CreateGetAttendance", s => s.RunAsync(), "0 0/1 * * * ?", new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local

View File

@@ -23,16 +23,19 @@ public class CreateGetAttendanceJob
_dbContext.Client.QueryFilter.ClearAndBackup<ITenantId>();
try
{
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Enable).ToListAsync();
devices = devices.Where(x => x.Funcs.Contains(DeviceFuncEnumType.Attendance)).ToList();
var devices = await _dbContext.Queryable<DeviceEntity>()
.Where(x => x.Enable)
.Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance))
.ToListAsync();
var ds = devices.Select(x => x.UniqueNo).ToList();
var b = await _dbContext.Queryable<DeviceTaskEntity>()
var b = await _dbContext.Queryable<DeviceTaskEntity>()
.Where(x => ds.Contains(x.DeviceUniqueNo))
.Where(x => x.Type == DeviceTaskEnumType.UploadRecord)
.Where(x => x.Status == DeviceTaskStatusEnumType.Process)
.AnyAsync();
if (b)
{
return;