This commit is contained in:
parent
ce5f2e3389
commit
800a9a8f50
1 changed files with 94 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ using System.Net.Http.Headers;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Controllers
|
||||
{
|
||||
|
|
@ -33,6 +34,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly PermissionRepository _permission;
|
||||
private readonly CandidateReportRepository _service;
|
||||
private readonly MinIOExamService _minIOExamService;
|
||||
|
||||
public PlacementController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
|
|
@ -40,7 +43,9 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
PermissionRepository permission)
|
||||
PermissionRepository permission,
|
||||
CandidateReportRepository service,
|
||||
MinIOExamService minIOExamService)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
|
|
@ -49,6 +54,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_permission = permission;
|
||||
_service = service;
|
||||
_minIOExamService = minIOExamService;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -3281,5 +3288,91 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
};
|
||||
return Success(data);
|
||||
}
|
||||
#region ใบสมัคร
|
||||
/// <summary>
|
||||
/// ใบสมัคร
|
||||
/// </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("candidate/{exportType}/{Id}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<ResponseObject>> GetExamCandidate([FromRoute] Guid Id, string exportType = "pdf")
|
||||
{
|
||||
var candidate = await _service.GetExamCandidateAsync(Id);
|
||||
var careers = await _service.GetExamCareerCandidateAsync(Id);
|
||||
var avatar = await _service.GetExamAvatarCandidateAsync(Id);
|
||||
if (candidate != null)
|
||||
{
|
||||
var picContent = avatar == null ? null : await _minIOExamService.ImagesPath(avatar);
|
||||
var mapData = new
|
||||
{
|
||||
Id = candidate.GetType().GetProperty("Id").GetValue(candidate),
|
||||
AvatarId = candidate.GetType().GetProperty("AvatarId").GetValue(candidate),
|
||||
PeriodExamName = candidate.GetType().GetProperty("PeriodExamName").GetValue(candidate),
|
||||
PeriodExamRound = candidate.GetType().GetProperty("PeriodExamRound").GetValue(candidate),
|
||||
PeriodExamYear = candidate.GetType().GetProperty("PeriodExamYear").GetValue(candidate),
|
||||
PositionName = candidate.GetType().GetProperty("PositionName").GetValue(candidate),
|
||||
PositionLevelName = candidate.GetType().GetProperty("PositionLevelName").GetValue(candidate),
|
||||
FullName = candidate.GetType().GetProperty("FullName").GetValue(candidate),
|
||||
Nationality = candidate.GetType().GetProperty("Nationality").GetValue(candidate),
|
||||
Religion = candidate.GetType().GetProperty("Religion").GetValue(candidate),
|
||||
CitizenId = candidate.GetType().GetProperty("CitizenId").GetValue(candidate),
|
||||
DateOfBirth = candidate.GetType().GetProperty("DateOfBirth").GetValue(candidate),
|
||||
Age = candidate.GetType().GetProperty("Age").GetValue(candidate),
|
||||
EducationLevelExamName = candidate.GetType().GetProperty("EducationLevelExamName").GetValue(candidate),
|
||||
EducationName = candidate.GetType().GetProperty("EducationName").GetValue(candidate),
|
||||
EducationMajor = candidate.GetType().GetProperty("EducationMajor").GetValue(candidate),
|
||||
EducationLocation = candidate.GetType().GetProperty("EducationLocation").GetValue(candidate),
|
||||
EducationEndDate = candidate.GetType().GetProperty("EducationEndDate").GetValue(candidate),
|
||||
EducationScores = candidate.GetType().GetProperty("EducationScores").GetValue(candidate),
|
||||
EducationType = candidate.GetType().GetProperty("EducationType").GetValue(candidate),
|
||||
EducationLevelHighName = candidate.GetType().GetProperty("EducationLevelHighName").GetValue(candidate),
|
||||
ExamIdenNumber = candidate.GetType().GetProperty("ExamIdenNumber").GetValue(candidate),
|
||||
OccupationPositionType = candidate.GetType().GetProperty("OccupationPositionType").GetValue(candidate),
|
||||
OccupationPosition = candidate.GetType().GetProperty("OccupationPosition").GetValue(candidate),
|
||||
OccupationSalary = candidate.GetType().GetProperty("OccupationSalary").GetValue(candidate),
|
||||
OccupationGroup = candidate.GetType().GetProperty("OccupationGroup").GetValue(candidate),
|
||||
OccupationPile = candidate.GetType().GetProperty("OccupationPile").GetValue(candidate),
|
||||
OccupationOrg = candidate.GetType().GetProperty("OccupationOrg").GetValue(candidate),
|
||||
OccupationTelephone = candidate.GetType().GetProperty("OccupationTelephone").GetValue(candidate),
|
||||
CareersTotal = candidate.GetType().GetProperty("CareersTotal").GetValue(candidate),
|
||||
RegistAddress = candidate.GetType().GetProperty("RegistAddress").GetValue(candidate),
|
||||
RegistProvinceName = candidate.GetType().GetProperty("RegistProvinceName").GetValue(candidate),
|
||||
RegistDistrictName = candidate.GetType().GetProperty("RegistDistrictName").GetValue(candidate),
|
||||
RegistSubDistrictName = candidate.GetType().GetProperty("RegistSubDistrictName").GetValue(candidate),
|
||||
RegistZipCode = candidate.GetType().GetProperty("RegistZipCode").GetValue(candidate),
|
||||
CurrentAddress = candidate.GetType().GetProperty("CurrentAddress").GetValue(candidate),
|
||||
CurrentProvinceName = candidate.GetType().GetProperty("CurrentProvinceName").GetValue(candidate),
|
||||
CurrentDistrictName = candidate.GetType().GetProperty("CurrentDistrictName").GetValue(candidate),
|
||||
CurrentSubDistrictName = candidate.GetType().GetProperty("CurrentSubDistrictName").GetValue(candidate),
|
||||
CurrentZipCode = candidate.GetType().GetProperty("CurrentZipCode").GetValue(candidate),
|
||||
Telephone = candidate.GetType().GetProperty("Telephone").GetValue(candidate),
|
||||
Email = candidate.GetType().GetProperty("Email").GetValue(candidate),
|
||||
ContactFullName = candidate.GetType().GetProperty("ContactFullName").GetValue(candidate),
|
||||
ContactRelations = candidate.GetType().GetProperty("ContactRelations").GetValue(candidate),
|
||||
ContactTel = candidate.GetType().GetProperty("ContactTel").GetValue(candidate),
|
||||
RegisterDate = candidate.GetType().GetProperty("RegisterDate").GetValue(candidate),
|
||||
Url = picContent ?? "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg",
|
||||
Careers = careers,
|
||||
};
|
||||
|
||||
var data = new
|
||||
{
|
||||
template = "ผลสอบคัดเลือกรายบุคคล",
|
||||
reportName = "docx-report",
|
||||
data = mapData
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue