|
|
|
@@ -7,9 +7,11 @@ using Dlhis.Entity.Visitor.Enums;
|
|
|
|
using Dlhis.Visitor.Appointment.Request;
|
|
|
|
using Dlhis.Visitor.Appointment.Request;
|
|
|
|
using Dlhis.Visitor.Appointment.Response;
|
|
|
|
using Dlhis.Visitor.Appointment.Response;
|
|
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
|
|
|
|
|
|
using Kurisu.Core.CustomClass;
|
|
|
|
using Kurisu.Core.DataAccess.Dto;
|
|
|
|
using Kurisu.Core.DataAccess.Dto;
|
|
|
|
using Kurisu.SqlSugar.Extensions;
|
|
|
|
using Kurisu.SqlSugar.Extensions;
|
|
|
|
using Kurisu.SqlSugar.Services;
|
|
|
|
using Kurisu.SqlSugar.Services;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -19,11 +21,13 @@ public class AppointmentService : IAppointmentService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IDbContext _dbContext;
|
|
|
|
private readonly IDbContext _dbContext;
|
|
|
|
private readonly IDeviceGroupApi _deviceGroupApi;
|
|
|
|
private readonly IDeviceGroupApi _deviceGroupApi;
|
|
|
|
|
|
|
|
private readonly IDataProtectionProvider _dataProtectionProvider;
|
|
|
|
|
|
|
|
|
|
|
|
public AppointmentService(IDbContext dbContext, IDeviceGroupApi deviceGroupApi)
|
|
|
|
public AppointmentService(IDbContext dbContext, IDeviceGroupApi deviceGroupApi, IDataProtectionProvider dataProtectionProvider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_dbContext = dbContext;
|
|
|
|
_dbContext = dbContext;
|
|
|
|
_deviceGroupApi = deviceGroupApi;
|
|
|
|
_deviceGroupApi = deviceGroupApi;
|
|
|
|
|
|
|
|
_dataProtectionProvider = dataProtectionProvider;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task ReceiveAsync(AppointmentReceiveRequest request)
|
|
|
|
public async Task ReceiveAsync(AppointmentReceiveRequest request)
|
|
|
|
@@ -131,7 +135,6 @@ public class AppointmentService : IAppointmentService
|
|
|
|
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
|
|
|
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
|
|
|
detail.ThrowIfNull("预约信息不存在");
|
|
|
|
detail.ThrowIfNull("预约信息不存在");
|
|
|
|
|
|
|
|
|
|
|
|
//todo生成下发任务
|
|
|
|
|
|
|
|
var mst = await _dbContext.Queryable<VisitorAppointmentEntity>().Where(x => x.Id == detail.AppointmentId).FirstAsync();
|
|
|
|
var mst = await _dbContext.Queryable<VisitorAppointmentEntity>().Where(x => x.Id == detail.AppointmentId).FirstAsync();
|
|
|
|
var deviceGroup = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
|
|
|
var deviceGroup = await _dbContext.Queryable<AppointmentAreaAssignmentEntity>()
|
|
|
|
.Where(x => x.CustomCode == mst.AreaCustomCode)
|
|
|
|
.Where(x => x.CustomCode == mst.AreaCustomCode)
|
|
|
|
@@ -141,7 +144,7 @@ public class AppointmentService : IAppointmentService
|
|
|
|
var deviceCodesResult = await _deviceGroupApi.GetDevicesByCodeAsync(deviceGroup);
|
|
|
|
var deviceCodesResult = await _deviceGroupApi.GetDevicesByCodeAsync(deviceGroup);
|
|
|
|
var deviceCodes = deviceCodesResult.Data;
|
|
|
|
var deviceCodes = deviceCodesResult.Data;
|
|
|
|
|
|
|
|
|
|
|
|
var userNo = detail.IsExternal
|
|
|
|
var userNo = detail.IsExternal
|
|
|
|
? await _dbContext.Queryable<GainfoExternalEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync()
|
|
|
|
? 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.Queryable<GainfoEntity>().Where(x => x.IdNo == detail.IdNo).Select(x => x.No).FirstAsync();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -166,6 +169,16 @@ public class AppointmentService : IAppointmentService
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<AppointmentDetailResponse> GetTodayByIdNoAsync(string idNo)
|
|
|
|
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>()
|
|
|
|
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
|
|
|
.Where(x => x.IdNo == idNo)
|
|
|
|
.Where(x => x.IdNo == idNo)
|
|
|
|
.Where(x => SqlFunc.DateIsSame(x.Start, DateTime.Today, DateType.Day))
|
|
|
|
.Where(x => SqlFunc.DateIsSame(x.Start, DateTime.Today, DateType.Day))
|
|
|
|
@@ -178,6 +191,16 @@ public class AppointmentService : IAppointmentService
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<Pagination<AppointmentDetailResponse>> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request)
|
|
|
|
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>()
|
|
|
|
var page = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
|
|
|
.Where(x => x.IdNo == request.IdNo)
|
|
|
|
.Where(x => x.IdNo == request.IdNo)
|
|
|
|
.OrderBy(x => x.Start)
|
|
|
|
.OrderBy(x => x.Start)
|
|
|
|
|