This commit is contained in:
2025-12-19 10:34:55 +08:00
parent cefc35030b
commit 8be9468a8b

View File

@@ -347,6 +347,7 @@ public class AppointmentService : IAppointmentService
var gainfoLeaves = await _dbContext.Queryable<GainfoLeaveEntity>()
.Where(x => x.Type == GainfoUserTypeEnumType.External)
.Where(x => SqlFunc.DateIsSame(x.ResignationDate, day))
.Where(x => SqlFunc.Subqueryable<GainfoEntity>().Where(p => p.No == x.No).NotAny())
.ToListAsync();
foreach (var gainfoLeave in gainfoLeaves)
@@ -359,9 +360,17 @@ public class AppointmentService : IAppointmentService
await _dbContext.InsertAsync(gainfo);
await _dbContext.DeleteReallyAsync(gainfoLeave);
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.UserNo == gainfo.No).SingleAsync();
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.UserNo == gainfo.No).OrderByDescending(x => x.Id).FirstAsync();
detail.ThrowIfNull("数据不存在");
if (detail.IsEnterDoorArea)
{
detail.DoorStatus = VisitorAppointmentDetailStatusEnumType.Arrived;
}
if (detail.IsEnterWorkplace)
{
detail.WorkplaceStatus = VisitorAppointmentDetailStatusEnumType.Arrived;
}
await _dbContext.UpdateAsync(detail);
await GenerateDeviceTasksAsync(detail, true, DeviceTaskEnumType.Update, "数据恢复");
await _dbContext.Client.Ado.CommitTranAsync();