retirement report
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
kittapath 2025-02-03 17:09:43 +07:00
parent 8a27795586
commit 6d44f6e9c3
2 changed files with 133 additions and 7 deletions

View file

@ -1,5 +1,7 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Application.Repositories.Reports;
using BMA.EHR.Application.Repositories.Reports;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Retirement;
@ -32,6 +34,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IConfiguration _configuration;
private readonly PermissionRepository _permission;
private readonly RetireReportRepository _service;
public RetirementResignController(RetirementRepository repository,
NotificationRepository repositoryNoti,
@ -39,7 +42,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
MinIOService documentService,
IHttpContextAccessor httpContextAccessor,
IConfiguration configuration,
PermissionRepository permission)
PermissionRepository permission,
RetireReportRepository service)
{
_repository = repository;
_repositoryNoti = repositoryNoti;
@ -48,6 +52,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
_httpContextAccessor = httpContextAccessor;
_configuration = configuration;
_permission = permission;
_service = service;
}
#region " Properties "
@ -2642,5 +2647,46 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
return Success();
}
#region 33-
/// <summary>
/// 33-แบบฟอร์มหนังสือขอลาออกจากราชการ
/// </summary>
/// <param name="id">id </param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("33/{exportType}/{id}")]
public async Task<ActionResult<ResponseObject>> GetResign33ConvertReportAsync(Guid id, string exportType = "pdf")
{
try
{
var resign = await _service.GetResignByUser(id);
if (resign == null)
return NotFound();
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
}
var data = new
{
template = "resign",
reportName = "docx-report",
data = resign
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
}
}