141 lines
4.3 KiB
C#
141 lines
4.3 KiB
C#
using Dlhis.Basic.Appointment.Request;
|
|
using Dlhis.Basic.Appointment.Response;
|
|
using Dlhis.Basic.Appointment.Services;
|
|
using Dlhis.Entity.Device.Enums;
|
|
using Dlhis.Entity.Visitor.Enums;
|
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Basic.Appointment.Controllers;
|
|
|
|
/// <summary>
|
|
/// 预约
|
|
/// </summary>
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class AppointmentsController : ControllerBase
|
|
{
|
|
private readonly IAppointmentService _appointmentService;
|
|
|
|
public AppointmentsController(IAppointmentService appointmentService)
|
|
{
|
|
_appointmentService = appointmentService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 预约申请分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<AppointmentPageResponse>> GetPageAsync([FromQuery] AppointmentPageRequest request)
|
|
{
|
|
return await _appointmentService.GetPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取预约明细
|
|
/// </summary>
|
|
/// <param name="no"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("details")]
|
|
public async Task<List<AppointmentDetailResponse>> GetAppointmentDetailsByIdAsync(string no)
|
|
{
|
|
return await _appointmentService.GetAppointmentDetailsByIdAsync(no);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 确认到达
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpPost("confirm")]
|
|
[Transactional]
|
|
[IgnoreTenant]
|
|
public async Task ConfirmAsync(AppointmentConfirmRequest request)
|
|
{
|
|
await _appointmentService.ConfirmAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 强制离场
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
[HttpPost("focusleave")]
|
|
[Transactional]
|
|
public async Task FocusLeaveAsync(AppointmentFocusLeaveRequest request)
|
|
{
|
|
await _appointmentService.FocusLeaveAsync(request.Id, request.Reason);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 人脸更新
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
[HttpPost("face/update")]
|
|
[Transactional]
|
|
public async Task UpdateFaceAsync(AppointmentConfirmRequest request)
|
|
{
|
|
await _appointmentService.UpdateFaceAsync(request.Id, request.Base64Image);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据身份证获取当天预约信息
|
|
/// </summary>
|
|
/// <param name="idNo"></param>
|
|
/// <param name="factory"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("today")]
|
|
public async Task<AppointmentDetailResponse> GetTodayByIdNoAsync(string idNo, string factory)
|
|
{
|
|
return await _appointmentService.GetTodayByIdNoAsync(idNo, factory);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 门禁预约
|
|
/// </summary>
|
|
/// <param name="factory"></param>
|
|
/// <param name="search"></param>
|
|
/// <param name="status"></param>
|
|
/// <param name="start"></param>
|
|
/// <param name="end"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("door/list")]
|
|
public async Task<List<AppointmentDetailResponse>> GetRecordListAsync(string factory, string search, VisitorAppointmentDetailStatusEnumType? status, DateTime start, DateTime end)
|
|
{
|
|
return await _appointmentService.GetRecordListAsync(factory, search, status, start, end);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据身份证获取预约信息分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("idno/page")]
|
|
public async Task<Pagination<AppointmentDetailResponse>> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request)
|
|
{
|
|
return await _appointmentService.GetRecordPageByIdNoAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 数据明细
|
|
/// </summary>
|
|
/// <param name="factory"></param>
|
|
/// <param name="start"></param>
|
|
/// <param name="end"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("summary")]
|
|
public async Task<AppointmentSummaryResponse> GetSummaryAsync(string factory, DateTime start, DateTime end)
|
|
{
|
|
end = start.Date.AddDays(1).AddMilliseconds(-1);
|
|
return await _appointmentService.GetSummaryAsync(factory, start, end);
|
|
}
|
|
} |