fix 数据处理增加条件
This commit is contained in:
@@ -4,6 +4,7 @@ using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Entity;
|
||||
using Dlhis.Entity.Visitor.Enums;
|
||||
using Dlhis.ScheduledTask.Attributes;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
|
||||
@@ -21,14 +22,17 @@ public class AutoRemoveAppointmentJob : BaseJob
|
||||
/// <inheritdoc />
|
||||
protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
var details = await DbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived || x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived) ||
|
||||
(x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived))
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var detail in details)
|
||||
{
|
||||
var areaCodes = GetValidAreaCodes(detail).ToList();
|
||||
if (!areaCodes.Any())
|
||||
if (areaCodes.IsEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -57,12 +61,12 @@ public class AutoRemoveAppointmentJob : BaseJob
|
||||
Version = 0
|
||||
}).ToList());
|
||||
|
||||
if (detail.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
if (detail.IsEnterDoorArea && detail.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived && detail.DoorEnd <= now)
|
||||
{
|
||||
detail.DoorStatus = VisitorAppointmentDetailStatusEnumType.Leave;
|
||||
}
|
||||
|
||||
if (detail.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
if (detail.IsEnterWorkplace && detail.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived && detail.WorkplaceEnd <= now)
|
||||
{
|
||||
detail.WorkplaceStatus = VisitorAppointmentDetailStatusEnumType.Leave;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user