fix 注释+设备密码脱敏
This commit is contained in:
@@ -182,25 +182,31 @@ public class AppointmentService : IAppointmentService
|
||||
|
||||
public async Task FocusLeaveAsync(long id, string reason)
|
||||
{
|
||||
// 根据访客预约详情ID获取记录,若不存在则抛出异常
|
||||
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == id).SingleAsync();
|
||||
detail.ThrowIfNull("数据不存在");
|
||||
|
||||
//Wait->obsolete; Arrived->FocusLeave
|
||||
|
||||
// 如果已进入门区且门区状态为“已到达”,则将门区状态更新为“强制离场”
|
||||
if (detail.IsEnterDoorArea && detail.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
detail.DoorStatus = VisitorAppointmentDetailStatusEnumType.FocusLeave;
|
||||
|
||||
|
||||
// 如果已进入门区且门区状态为“待到达”,则将门区状态更新为“作废”
|
||||
if (detail.IsEnterDoorArea && detail.DoorStatus == VisitorAppointmentDetailStatusEnumType.Wait)
|
||||
detail.DoorStatus = VisitorAppointmentDetailStatusEnumType.Obsolete;
|
||||
|
||||
|
||||
// 如果已进入工作区且工作区状态为“已到达”,则将工作区状态更新为“强制离场”
|
||||
if (detail.IsEnterWorkplace && detail.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
detail.WorkplaceStatus = VisitorAppointmentDetailStatusEnumType.FocusLeave;
|
||||
|
||||
|
||||
// 如果已进入工作区且工作区状态为“待到达”,则将工作区状态更新为“作废”
|
||||
if (detail.IsEnterWorkplace && detail.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Wait)
|
||||
detail.WorkplaceStatus = VisitorAppointmentDetailStatusEnumType.Obsolete;
|
||||
|
||||
|
||||
// 记录强制离场时间和原因
|
||||
detail.FocusLeaveDateTime = DateTime.Now;
|
||||
detail.Remark += "强制离场:" + reason;
|
||||
|
||||
|
||||
// 生成设备任务并更新数据库
|
||||
await GenerateDeviceTasksAsync(detail, true, DeviceTaskEnumType.Delete, $"强制离场:{reason}");
|
||||
await _dbContext.UpdateAsync(detail);
|
||||
}
|
||||
@@ -370,12 +376,14 @@ public class AppointmentService : IAppointmentService
|
||||
|
||||
foreach (var ext in exts)
|
||||
{
|
||||
// 查询该外部人员最近一次通行记录的时间
|
||||
DateTime? raiseDateTime = await _dbContext.Queryable<DeviceUploadLogEntity>()
|
||||
.Where(x => x.UserUniqueNo == ext.Code)
|
||||
.GroupBy(x => x.UserUniqueNo)
|
||||
.Select(x => SqlFunc.IsNull(SqlFunc.AggregateMax(x.RaiseDateTime), default(DateTime?)))
|
||||
.SingleAsync();
|
||||
|
||||
// 如果最近通行时间存在且超出未通行天数阈值,则自动归档该外部人员
|
||||
if (raiseDateTime.HasValue && raiseDateTime.Value.AddDays(setting.NoRecordAutoResignExternalDays) < DateTime.Now)
|
||||
{
|
||||
try
|
||||
@@ -389,6 +397,7 @@ public class AppointmentService : IAppointmentService
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// 记录自动归档异常日志
|
||||
_logger.LogError(e, "自动归档外部人员异常:{msg}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user