add 获取访客门禁设备权限
This commit is contained in:
@@ -140,8 +140,8 @@ public class AppointmentsController : ControllerBase
|
||||
end = start.Date.AddDays(1).AddMilliseconds(-1);
|
||||
return await _appointmentService.GetSummaryAsync(factory, start, end);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动离职处理
|
||||
/// </summary>
|
||||
@@ -152,4 +152,13 @@ public class AppointmentsController : ControllerBase
|
||||
{
|
||||
await _appointmentService.AutoResignAsync();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[IgnoreTenant]
|
||||
[HttpGet("visitor-devices")]
|
||||
public async Task<List<string>> GetVisitorDevicesAsync(long detailId)
|
||||
{
|
||||
return await _appointmentService.GetVisitorDevicesAsync(detailId);
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -72,4 +72,6 @@ public interface IAppointmentService : IScopeDependency
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task AutoResignAsync();
|
||||
|
||||
Task<List<string>> GetVisitorDevicesAsync(long detailId);
|
||||
}
|
||||
@@ -318,6 +318,28 @@ public class AppointmentService : IAppointmentService
|
||||
await GenerateDeviceTasksAsync(detail, true, DeviceTaskEnumType.Update, "访客手动上传照片");
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetVisitorDevicesAsync(long detailId)
|
||||
{
|
||||
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == detailId).SingleAsync();
|
||||
detail.ThrowIfNull("数据不存在");
|
||||
|
||||
var areaCodes = GetValidAreaCodes(detail, false).ToList();
|
||||
if (areaCodes.IsEmpty()) return new List<string>();
|
||||
|
||||
var existsAreaCodes = await _dbContext.Queryable<AppointmentAreaEntity>().Where(x => areaCodes.Contains(x.CustomCode)).Select(x => x.CustomCode).ToListAsync();
|
||||
|
||||
//当前分配的设备组code
|
||||
var deviceGroupCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => existsAreaCodes.Contains(x.CustomCode))
|
||||
.Select(x => x.DeviceGroupCode)
|
||||
.ToListAsync();
|
||||
|
||||
var deviceCodes = await _dbContext.Queryable<DeviceGroupRelationshipEntity>().Where(x => deviceGroupCodes.Contains(x.GroupCode)).Select(x => x.DeviceCode).ToListAsync();
|
||||
var deviceUniqueNos = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).Select(x => x.UniqueNo).ToListAsync();
|
||||
|
||||
return deviceUniqueNos;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task AutoResignAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user