fix 暂时注释
This commit is contained in:
@@ -1,163 +1,163 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Entity;
|
||||
using Dlhis.Entity.Visitor.Enums;
|
||||
using Dlhis.Visitor.Appointment.Request;
|
||||
using Dlhis.Visitor.Appointment.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Visitor.Appointment.Services.Implements;
|
||||
|
||||
public class AppointmentAreaService : IAppointmentAreaService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public AppointmentAreaService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<ApponintmentAreaPageResponse>> GetPageAsync(PageDto request)
|
||||
{
|
||||
return await _dbContext.Queryable<AppointmentAreaEntity>()
|
||||
.Select<ApponintmentAreaPageResponse>()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
|
||||
public async Task SaveAsync(AppointmentAreaSaveRequest request)
|
||||
{
|
||||
await CheckCustomCodeDuplicateAsync(request);
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<AppointmentAreaEntity>();
|
||||
entity.Type = request.Type;
|
||||
entity.CustomCode = request.CustomCode;
|
||||
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<AppointmentAreaEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||
entity.ThrowIfNull("预约区域不存在");
|
||||
|
||||
request.Adapt(entity);
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task DeleteAsync(long id)
|
||||
{
|
||||
var entity = await _dbContext.Queryable<AppointmentAreaEntity>().Where(x => x.Id == id).SingleAsync();
|
||||
await _dbContext.DeleteAsync(entity);
|
||||
}
|
||||
|
||||
|
||||
public async Task AssignAsync(AppointmentAreaAssignRequest request)
|
||||
{
|
||||
var userNos = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.LeftJoin<VisitorAppointmentEntity>((x, y) => x.No == y.No)
|
||||
.Where(x => x.Status == AppointmentDetailEnumType.Arrived)
|
||||
.Where((x, y) => y.AreaCustomCode == request.CustomCode)
|
||||
.Select(x => x.UserNo)
|
||||
.ToListAsync();
|
||||
|
||||
//通过人
|
||||
var deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode).Select(x => x.DeviceCode).ToListAsync();
|
||||
|
||||
var userPermissions = userNos.ToDictionary(x => x, _ => deviceCodes.ToList());
|
||||
|
||||
await _dbContext.Client.Deleteable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
var data = request.DeviceCodes.Select(x => new AppointmentAreaAssignmentEntity
|
||||
{
|
||||
CustomCode = request.CustomCode,
|
||||
DeviceCode = x
|
||||
}).ToList();
|
||||
|
||||
await _dbContext.InsertAsync(data);
|
||||
|
||||
|
||||
deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode).Select(x => x.DeviceCode).ToListAsync();
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).ToListAsync();
|
||||
|
||||
var userCurrentPermissions = userNos.ToDictionary(x => x, _ => deviceCodes.ToList());
|
||||
|
||||
var tasks = new List<DeviceTaskEntity>();
|
||||
foreach (var userNo in userNos)
|
||||
{
|
||||
var before = userPermissions[userNo];
|
||||
var current = userCurrentPermissions[userNo];
|
||||
|
||||
//被删除
|
||||
var deletedItems = before.Where(x => !current.Contains(x)).ToList();
|
||||
//新增
|
||||
var addItems = current.Where(x => !before.Contains(x)).ToList();
|
||||
|
||||
if (!deletedItems.Any() && !addItems.Any())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tasks.AddRange(deletedItems.Select(x => new DeviceTaskEntity
|
||||
{
|
||||
Type = DeviceTaskEnumType.Delete,
|
||||
DeviceType = DeviceTypeEnumType.Door,
|
||||
UserNo = userNo,
|
||||
DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
Version = 0,
|
||||
CancellationId = 0,
|
||||
Source = DeviceTaskSourceEnumType.Appointment,
|
||||
Priority = 99
|
||||
}));
|
||||
|
||||
tasks.AddRange(addItems.Select(x => new DeviceTaskEntity
|
||||
{
|
||||
Type = DeviceTaskEnumType.Add,
|
||||
DeviceType = DeviceTypeEnumType.Door,
|
||||
UserNo = userNo,
|
||||
DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
Version = 0,
|
||||
CancellationId = 0,
|
||||
Source = DeviceTaskSourceEnumType.Appointment,
|
||||
Priority = 99
|
||||
}));
|
||||
}
|
||||
|
||||
await _dbContext.InsertAsync(tasks);
|
||||
}
|
||||
|
||||
|
||||
//********************************************************* help methods ***************************************************************
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查编码重复
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
private async Task CheckCustomCodeDuplicateAsync(AppointmentAreaSaveRequest request)
|
||||
{
|
||||
var exists = await _dbContext.Queryable<AppointmentAreaEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id == request.Id)
|
||||
.AnyAsync();
|
||||
|
||||
exists.ThrowIfTrue("重复区域编码,请检查");
|
||||
}
|
||||
}
|
||||
// using Dlhis.Entity.Basic.Entity;
|
||||
// using Dlhis.Entity.Device.Entities;
|
||||
// using Dlhis.Entity.Device.Enums;
|
||||
// using Dlhis.Entity.Visitor.Entity;
|
||||
// using Dlhis.Entity.Visitor.Enums;
|
||||
// using Dlhis.Visitor.Appointment.Request;
|
||||
// using Dlhis.Visitor.Appointment.Response;
|
||||
// using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
// using Kurisu.AspNetCore.Utils.Extensions;
|
||||
// using Mapster;
|
||||
//
|
||||
// namespace Dlhis.Visitor.Appointment.Services.Implements;
|
||||
//
|
||||
// public class AppointmentAreaService : IAppointmentAreaService
|
||||
// {
|
||||
// private readonly IDbContext _dbContext;
|
||||
//
|
||||
// public AppointmentAreaService(IDbContext dbContext)
|
||||
// {
|
||||
// _dbContext = dbContext;
|
||||
// }
|
||||
//
|
||||
// public async Task<Pagination<ApponintmentAreaPageResponse>> GetPageAsync(PageDto request)
|
||||
// {
|
||||
// return await _dbContext.Queryable<AppointmentAreaEntity>()
|
||||
// .Select<ApponintmentAreaPageResponse>()
|
||||
// .ToPageListAsync(request);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public async Task SaveAsync(AppointmentAreaSaveRequest request)
|
||||
// {
|
||||
// await CheckCustomCodeDuplicateAsync(request);
|
||||
//
|
||||
// if (!request.Id.HasValue)
|
||||
// {
|
||||
// var entity = request.Adapt<AppointmentAreaEntity>();
|
||||
// entity.Type = request.Type;
|
||||
// entity.CustomCode = request.CustomCode;
|
||||
//
|
||||
// await _dbContext.InsertAsync(entity);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var entity = await _dbContext.Queryable<AppointmentAreaEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||
// entity.ThrowIfNull("预约区域不存在");
|
||||
//
|
||||
// request.Adapt(entity);
|
||||
//
|
||||
// await _dbContext.UpdateAsync(entity);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public async Task DeleteAsync(long id)
|
||||
// {
|
||||
// var entity = await _dbContext.Queryable<AppointmentAreaEntity>().Where(x => x.Id == id).SingleAsync();
|
||||
// await _dbContext.DeleteAsync(entity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public async Task AssignAsync(AppointmentAreaAssignRequest request)
|
||||
// {
|
||||
// var userNos = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
// .LeftJoin<VisitorAppointmentEntity>((x, y) => x.No == y.No)
|
||||
// .Where(x => x.Status == AppointmentDetailEnumType.Arrived)
|
||||
// .Where((x, y) => y.AreaCustomCode == request.CustomCode)
|
||||
// .Select(x => x.UserNo)
|
||||
// .ToListAsync();
|
||||
//
|
||||
// //通过人
|
||||
// var deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
// .Where(x => x.CustomCode == request.CustomCode).Select(x => x.DeviceCode).ToListAsync();
|
||||
//
|
||||
// var userPermissions = userNos.ToDictionary(x => x, _ => deviceCodes.ToList());
|
||||
//
|
||||
// await _dbContext.Client.Deleteable<AppointmentAreaAssignmentEntity>()
|
||||
// .Where(x => x.CustomCode == request.CustomCode)
|
||||
// .ExecuteCommandAsync();
|
||||
//
|
||||
// var data = request.DeviceCodes.Select(x => new AppointmentAreaAssignmentEntity
|
||||
// {
|
||||
// CustomCode = request.CustomCode,
|
||||
// DeviceCode = x
|
||||
// }).ToList();
|
||||
//
|
||||
// await _dbContext.InsertAsync(data);
|
||||
//
|
||||
//
|
||||
// deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
// .Where(x => x.CustomCode == request.CustomCode).Select(x => x.DeviceCode).ToListAsync();
|
||||
//
|
||||
// var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).ToListAsync();
|
||||
//
|
||||
// var userCurrentPermissions = userNos.ToDictionary(x => x, _ => deviceCodes.ToList());
|
||||
//
|
||||
// var tasks = new List<DeviceTaskEntity>();
|
||||
// foreach (var userNo in userNos)
|
||||
// {
|
||||
// var before = userPermissions[userNo];
|
||||
// var current = userCurrentPermissions[userNo];
|
||||
//
|
||||
// //被删除
|
||||
// var deletedItems = before.Where(x => !current.Contains(x)).ToList();
|
||||
// //新增
|
||||
// var addItems = current.Where(x => !before.Contains(x)).ToList();
|
||||
//
|
||||
// if (!deletedItems.Any() && !addItems.Any())
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// tasks.AddRange(deletedItems.Select(x => new DeviceTaskEntity
|
||||
// {
|
||||
// Type = DeviceTaskEnumType.Delete,
|
||||
// DeviceType = DeviceTypeEnumType.Door,
|
||||
// UserNo = userNo,
|
||||
// DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo,
|
||||
// Status = DeviceTaskStatusEnumType.Wait,
|
||||
// Version = 0,
|
||||
// CancellationId = 0,
|
||||
// Source = DeviceTaskSourceEnumType.Appointment,
|
||||
// Priority = 99
|
||||
// }));
|
||||
//
|
||||
// tasks.AddRange(addItems.Select(x => new DeviceTaskEntity
|
||||
// {
|
||||
// Type = DeviceTaskEnumType.Add,
|
||||
// DeviceType = DeviceTypeEnumType.Door,
|
||||
// UserNo = userNo,
|
||||
// DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo,
|
||||
// Status = DeviceTaskStatusEnumType.Wait,
|
||||
// Version = 0,
|
||||
// CancellationId = 0,
|
||||
// Source = DeviceTaskSourceEnumType.Appointment,
|
||||
// Priority = 99
|
||||
// }));
|
||||
// }
|
||||
//
|
||||
// await _dbContext.InsertAsync(tasks);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //********************************************************* help methods ***************************************************************
|
||||
//
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 检查编码重复
|
||||
// /// </summary>
|
||||
// /// <param name="request"></param>
|
||||
// /// <returns></returns>
|
||||
// private async Task CheckCustomCodeDuplicateAsync(AppointmentAreaSaveRequest request)
|
||||
// {
|
||||
// var exists = await _dbContext.Queryable<AppointmentAreaEntity>()
|
||||
// .Where(x => x.CustomCode == request.CustomCode)
|
||||
// .WhereIF(request.Id.HasValue, x => x.Id == request.Id)
|
||||
// .AnyAsync();
|
||||
//
|
||||
// exists.ThrowIfTrue("重复区域编码,请检查");
|
||||
// }
|
||||
// }
|
||||
@@ -1,129 +1,129 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Entity;
|
||||
using Dlhis.Entity.Visitor.Enums;
|
||||
using Dlhis.Visitor.Appointment.Request;
|
||||
using Dlhis.Visitor.Appointment.Response;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Visitor.Appointment.Services.Implements;
|
||||
|
||||
public class AppointmentService : IAppointmentService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||
|
||||
public AppointmentService(IDbContext dbContext, IDataProtectionProvider dataProtectionProvider)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_dataProtectionProvider = dataProtectionProvider;
|
||||
}
|
||||
|
||||
public async Task<Pagination<AppointmentPageResponse>> GetPageAsync(AppointmentPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<VisitorAppointmentEntity>()
|
||||
.WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true && request.SearchDateTimePeriod?.End.HasValue == true,
|
||||
x => x.ApplyTime >= request.SearchDateTimePeriod.Start && x.ApplyTime <= request.SearchDateTimePeriod.End)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name == request.Search)
|
||||
.Select<AppointmentPageResponse>()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<List<AppointmentDetailResponse>> GetAppointmentDetailsByIdAsync(long id)
|
||||
{
|
||||
return await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => x.AppointmentId == id)
|
||||
.Select<AppointmentDetailResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task ConfirmAsync(AppointmentConfirmRequest request)
|
||||
{
|
||||
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||
detail.ThrowIfNull("预约信息不存在");
|
||||
|
||||
var mst = await _dbContext.Queryable<VisitorAppointmentEntity>().Where(x => x.Id == detail.AppointmentId).SingleAsync();
|
||||
|
||||
//当前分配的设备codes
|
||||
var deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
.Where(x => x.CustomCode == mst.AreaCustomCode)
|
||||
.Select(x => x.DeviceCode)
|
||||
.ToListAsync();
|
||||
|
||||
var deviceUniqueNos = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).Select(x => x.UniqueNo).ToListAsync();
|
||||
|
||||
var userNo = detail.IsExternal
|
||||
? await _dbContext.Queryable<GainfoExternalEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync()
|
||||
: await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync();
|
||||
|
||||
await _dbContext.InsertAsync(deviceUniqueNos.Select(x => new DeviceTaskEntity
|
||||
{
|
||||
CancellationId = 0,
|
||||
DeviceType = DeviceTypeEnumType.Door,
|
||||
DeviceUniqueNo = x,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
UserNo = userNo,
|
||||
Type = DeviceTaskEnumType.Add,
|
||||
Priority = 100,
|
||||
Source = DeviceTaskSourceEnumType.Appointment,
|
||||
Version = 0
|
||||
}).ToList());
|
||||
|
||||
detail.Status = AppointmentDetailEnumType.Arrived;
|
||||
await _dbContext.UpdateAsync(detail);
|
||||
}
|
||||
|
||||
|
||||
//********************************************************** 用户操作 *******************************************************************
|
||||
|
||||
public async Task<AppointmentDetailResponse> GetTodayByIdNoAsync(string idNo)
|
||||
{
|
||||
var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
|
||||
try
|
||||
{
|
||||
idNo = protector.Unprotect(idNo);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new UserFriendlyException("凭证有误");
|
||||
}
|
||||
|
||||
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => x.IdNo == idNo)
|
||||
.Where(x => SqlFunc.DateIsSame(x.Start, DateTime.Today, DateType.Day))
|
||||
.OrderBy(x => x.Start)
|
||||
.Select<AppointmentDetailResponse>()
|
||||
.FirstAsync();
|
||||
|
||||
return detail;
|
||||
}
|
||||
|
||||
public async Task<Pagination<AppointmentDetailResponse>> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request)
|
||||
{
|
||||
var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
|
||||
try
|
||||
{
|
||||
request.IdNo = protector.Unprotect(request.IdNo);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new UserFriendlyException("凭证有误");
|
||||
}
|
||||
|
||||
var page = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => x.IdNo == request.IdNo)
|
||||
.OrderBy(x => x.Start)
|
||||
.Select<AppointmentDetailResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
// using Dlhis.Entity.Basic.Entity;
|
||||
// using Dlhis.Entity.Device.Entities;
|
||||
// using Dlhis.Entity.Device.Enums;
|
||||
// using Dlhis.Entity.Visitor.Entity;
|
||||
// using Dlhis.Entity.Visitor.Enums;
|
||||
// using Dlhis.Visitor.Appointment.Request;
|
||||
// using Dlhis.Visitor.Appointment.Response;
|
||||
// using Kurisu.AspNetCore.CustomClass;
|
||||
// using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
// using Kurisu.AspNetCore.Utils.Extensions;
|
||||
// using Microsoft.AspNetCore.DataProtection;
|
||||
// using Microsoft.AspNetCore.Mvc;
|
||||
// using SqlSugar;
|
||||
//
|
||||
// namespace Dlhis.Visitor.Appointment.Services.Implements;
|
||||
//
|
||||
// public class AppointmentService : IAppointmentService
|
||||
// {
|
||||
// private readonly IDbContext _dbContext;
|
||||
// private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||
//
|
||||
// public AppointmentService(IDbContext dbContext, IDataProtectionProvider dataProtectionProvider)
|
||||
// {
|
||||
// _dbContext = dbContext;
|
||||
// _dataProtectionProvider = dataProtectionProvider;
|
||||
// }
|
||||
//
|
||||
// public async Task<Pagination<AppointmentPageResponse>> GetPageAsync(AppointmentPageRequest request)
|
||||
// {
|
||||
// return await _dbContext.Queryable<VisitorAppointmentEntity>()
|
||||
// .WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true && request.SearchDateTimePeriod?.End.HasValue == true,
|
||||
// x => x.ApplyTime >= request.SearchDateTimePeriod.Start && x.ApplyTime <= request.SearchDateTimePeriod.End)
|
||||
// .WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name == request.Search)
|
||||
// .Select<AppointmentPageResponse>()
|
||||
// .ToPageListAsync(request);
|
||||
// }
|
||||
//
|
||||
// public async Task<List<AppointmentDetailResponse>> GetAppointmentDetailsByIdAsync(long id)
|
||||
// {
|
||||
// return await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
// .Where(x => x.AppointmentId == id)
|
||||
// .Select<AppointmentDetailResponse>()
|
||||
// .ToListAsync();
|
||||
// }
|
||||
//
|
||||
// public async Task ConfirmAsync(AppointmentConfirmRequest request)
|
||||
// {
|
||||
// var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||
// detail.ThrowIfNull("预约信息不存在");
|
||||
//
|
||||
// var mst = await _dbContext.Queryable<VisitorAppointmentEntity>().Where(x => x.Id == detail.AppointmentId).SingleAsync();
|
||||
//
|
||||
// //当前分配的设备codes
|
||||
// var deviceCodes = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
||||
// .Where(x => x.CustomCode == mst.AreaCustomCode)
|
||||
// .Select(x => x.DeviceCode)
|
||||
// .ToListAsync();
|
||||
//
|
||||
// var deviceUniqueNos = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).Select(x => x.UniqueNo).ToListAsync();
|
||||
//
|
||||
// var userNo = detail.IsExternal
|
||||
// ? await _dbContext.Queryable<GainfoExternalEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync()
|
||||
// : await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync();
|
||||
//
|
||||
// await _dbContext.InsertAsync(deviceUniqueNos.Select(x => new DeviceTaskEntity
|
||||
// {
|
||||
// CancellationId = 0,
|
||||
// DeviceType = DeviceTypeEnumType.Door,
|
||||
// DeviceUniqueNo = x,
|
||||
// Status = DeviceTaskStatusEnumType.Wait,
|
||||
// UserNo = userNo,
|
||||
// Type = DeviceTaskEnumType.Add,
|
||||
// Priority = 100,
|
||||
// Source = DeviceTaskSourceEnumType.Appointment,
|
||||
// Version = 0
|
||||
// }).ToList());
|
||||
//
|
||||
// detail.Status = AppointmentDetailEnumType.Arrived;
|
||||
// await _dbContext.UpdateAsync(detail);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //********************************************************** 用户操作 *******************************************************************
|
||||
//
|
||||
// public async Task<AppointmentDetailResponse> GetTodayByIdNoAsync(string idNo)
|
||||
// {
|
||||
// var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
|
||||
// try
|
||||
// {
|
||||
// idNo = protector.Unprotect(idNo);
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// throw new UserFriendlyException("凭证有误");
|
||||
// }
|
||||
//
|
||||
// var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
// .Where(x => x.IdNo == idNo)
|
||||
// .Where(x => SqlFunc.DateIsSame(x.Start, DateTime.Today, DateType.Day))
|
||||
// .OrderBy(x => x.Start)
|
||||
// .Select<AppointmentDetailResponse>()
|
||||
// .FirstAsync();
|
||||
//
|
||||
// return detail;
|
||||
// }
|
||||
//
|
||||
// public async Task<Pagination<AppointmentDetailResponse>> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request)
|
||||
// {
|
||||
// var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
|
||||
// try
|
||||
// {
|
||||
// request.IdNo = protector.Unprotect(request.IdNo);
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// throw new UserFriendlyException("凭证有误");
|
||||
// }
|
||||
//
|
||||
// var page = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
// .Where(x => x.IdNo == request.IdNo)
|
||||
// .OrderBy(x => x.Start)
|
||||
// .Select<AppointmentDetailResponse>()
|
||||
// .ToPageListAsync(request);
|
||||
//
|
||||
// return page;
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user