using System.ComponentModel.DataAnnotations; using Dlhis.Visitor.Appointment.Request; using Dlhis.Visitor.Appointment.Response; using Dlhis.Visitor.Appointment.Services; using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; using Kurisu.Core.DataAccess.Dto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Dlhis.Visitor.Appointment.Controllers; /// /// 预约 /// [Authorize] [ApiController] [Route("api/[controller]")] public class AppointmentsController : ControllerBase { private readonly IAppointmentService _appointmentService; public AppointmentsController(IAppointmentService appointmentService) { _appointmentService = appointmentService; } /// /// 接受预约写入 /// /// /// [AllowAnonymous] [Transactional] [IgnoreTenant] [HttpPost("receive")] public async Task ReceiveAsync(AppointmentReceiveRequest request) { await _appointmentService.ReceiveAsync(request); } /// /// 预约分页 /// /// /// [HttpGet("page")] public async Task> GetPageAsync([FromQuery] AppointmentPageRequest request) { return await _appointmentService.GetPageAsync(request); } /// /// 确认到达 /// /// /// [HttpPost("confirm")] public async Task ConfirmAsync(AppointmentConfirmRequest request) { await _appointmentService.ConfirmAsync(request); } /// /// 根据身份证获取当天访客预约 /// /// /// [AllowAnonymous] [HttpGet("today")] public async Task GetTodayByIdNoAsync( [FromQuery] [StringLength(18, MinimumLength = 18, ErrorMessage = "身份证错误")] [Required(ErrorMessage = "身份证不可为空")]string idNo) { return await _appointmentService.GetTodayByIdNoAsync(idNo); } [AllowAnonymous] [HttpGet("idno/page")] public async Task> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request) { return await _appointmentService.GetRecordPageByIdNoAsync(request); } }