Merge branch 'develop' into adiDev
This commit is contained in:
commit
252fe0ff9a
12 changed files with 1022 additions and 111 deletions
|
|
@ -27,7 +27,7 @@ namespace BMA.EHR.Application
|
||||||
services.AddTransient<OrganizationCommonRepository>();
|
services.AddTransient<OrganizationCommonRepository>();
|
||||||
services.AddTransient<InboxRepository>();
|
services.AddTransient<InboxRepository>();
|
||||||
services.AddTransient<NotificationRepository>();
|
services.AddTransient<NotificationRepository>();
|
||||||
services.AddTransient<RetirementRepository>();
|
//services.AddTransient<RetirementRepository>();
|
||||||
services.AddTransient<RetireReportRepository>();
|
services.AddTransient<RetireReportRepository>();
|
||||||
services.AddTransient<InsigniaReportRepository>();
|
services.AddTransient<InsigniaReportRepository>();
|
||||||
services.AddTransient<CommandReportRepository>();
|
services.AddTransient<CommandReportRepository>();
|
||||||
|
|
|
||||||
|
|
@ -909,7 +909,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
var developComplete2 = evaluate_assign.result.evaluate.develop_complete == 0
|
var developComplete2 = evaluate_assign.result.evaluate.develop_complete == 0
|
||||||
? "🗹"
|
? "🗹"
|
||||||
: "☐";
|
: "☐";
|
||||||
var passResult1 = evaluate_assign.result.evaluate.pass_result == 1
|
var passResult1 = evaluate_assign.result.evaluate.pass_result == 1 || evaluate_assign.result.evaluate.pass_result == 4
|
||||||
? no == 1 ? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป"
|
? no == 1 ? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป"
|
||||||
: no == 1 ? "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป";
|
: no == 1 ? "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป";
|
||||||
var passResult2 = evaluate_assign.result.evaluate.pass_result == 2
|
var passResult2 = evaluate_assign.result.evaluate.pass_result == 2
|
||||||
|
|
@ -919,7 +919,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน"
|
? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน"
|
||||||
: "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน";
|
: "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน";
|
||||||
|
|
||||||
var passResult = evaluate_assign.result.evaluate.pass_result == 1
|
var passResult = evaluate_assign.result.evaluate.pass_result == 1 || evaluate_assign.result.evaluate.pass_result == 4
|
||||||
? no == 1 ? "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "เห็นควรให้รับราชการต่อไป"
|
? no == 1 ? "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "เห็นควรให้รับราชการต่อไป"
|
||||||
: evaluate_assign.result.evaluate.pass_result == 2
|
: evaluate_assign.result.evaluate.pass_result == 2
|
||||||
? "เห็นควรให้ออกจากราชการ"
|
? "เห็นควรให้ออกจากราชการ"
|
||||||
|
|
@ -937,7 +937,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||||
|
|
@ -949,8 +949,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
ChairmanPosition = string.IsNullOrEmpty(evaluate_assign.result.chairman.Position) ? string.Empty : evaluate_assign.result.chairman.Position,
|
ChairmanPosition = string.IsNullOrEmpty(evaluate_assign.result.chairman.Position) ? string.Empty : evaluate_assign.result.chairman.Position,
|
||||||
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.result.evaluate?.chairman_dated?.ToThaiFullDate().ToString().ToThaiNumber(),
|
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.result.evaluate?.chairman_dated?.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
CommanderName = string.IsNullOrEmpty(evaluate_assign.result.commander.name) ? string.Empty : evaluate_assign.result.commander.name,
|
CommanderName = string.IsNullOrEmpty(evaluate_assign.result.commander.name) ? string.Empty : evaluate_assign.result.commander.name,
|
||||||
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.Position) ? string.Empty : evaluate_assign.result.commander.Position,
|
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.position) ? string.Empty : evaluate_assign.result.commander.position,
|
||||||
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.result.evaluate?.director1_dated?.ToThaiFullDate().ToString().ToThaiNumber(),
|
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.commander.dated.ToString()) ? "-" : evaluate_assign.result.commander.dated?.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
Name = evaluate_assign.result.experimentee.name,
|
Name = evaluate_assign.result.experimentee.name,
|
||||||
RoundNo = no.ToString().ToThaiNumber(),
|
RoundNo = no.ToString().ToThaiNumber(),
|
||||||
DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-",
|
DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-",
|
||||||
|
|
|
||||||
|
|
@ -105,42 +105,53 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
|
|
||||||
//เกษียณอายุราชการ
|
//เกษียณอายุราชการ
|
||||||
public async Task ExecuteRetirement()
|
//public async Task ExecuteRetirement()
|
||||||
{
|
//{
|
||||||
var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
// var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||||
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||||
.Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
// .Where(x => x.Year == DateTime.Now.Year)
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
|
|
||||||
var body = retirePeriodOfficer.RetirementProfiles
|
// if (retirePeriodOfficer == null)
|
||||||
.Select(x => new {
|
// return;
|
||||||
profileId = x.profileId,
|
|
||||||
//lastUpdateUserId = UserId,
|
|
||||||
//lastUpdateFullName = FullName,
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
//ข้าราชการ
|
// var body = new
|
||||||
//var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
// {
|
||||||
var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
// data = retirePeriodOfficer.RetirementRawProfiles
|
||||||
using (var client = new HttpClient())
|
// .Select(x => new
|
||||||
{
|
// {
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
// profileId = x.profileId
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
// })
|
||||||
var jsonBody = JsonConvert.SerializeObject(body);
|
// .ToList()
|
||||||
var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
// };
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
|
||||||
{
|
|
||||||
Content = content
|
|
||||||
};
|
|
||||||
var response = await client.SendAsync(_req);
|
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
|
||||||
if (!response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
// //ข้าราชการ
|
||||||
}
|
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||||
|
// using (var client = new HttpClient())
|
||||||
|
// {
|
||||||
|
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
|
||||||
|
// var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
|
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||||
|
// {
|
||||||
|
// Content = content
|
||||||
|
// };
|
||||||
|
// var response = await client.SendAsync(_req);
|
||||||
|
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
// if (!response.IsSuccessStatusCode)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
public void TestMethod()
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,19 @@ namespace BMA.EHR.Application.Responses
|
||||||
|
|
||||||
public class Commander
|
public class Commander
|
||||||
{
|
{
|
||||||
public string personal_id { get; set; }
|
// public string personal_id { get; set; }
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
public string PositionId { get; set; }
|
// public string PositionId { get; set; }
|
||||||
public string PositionLevelId { get; set; }
|
// public string PositionLevelId { get; set; }
|
||||||
public string PositionLineId { get; set; }
|
// public string PositionLineId { get; set; }
|
||||||
public string Position { get; set; }
|
public string position { get; set; }
|
||||||
public string Department { get; set; }
|
// public string Department { get; set; }
|
||||||
public string OrganizationOrganization { get; set; }
|
// public string OrganizationOrganization { get; set; }
|
||||||
public string Oc { get; set; }
|
// public string Oc { get; set; }
|
||||||
|
public DateTime? dated { get; set; }
|
||||||
|
public string posLevel { get; set; }
|
||||||
|
public string posType { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Chairman
|
public class Chairman
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ using Newtonsoft.Json.Linq;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Security.Policy;
|
||||||
|
|
||||||
namespace BMA.EHR.Leave.Service.Controllers
|
namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -1827,15 +1828,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
//var sumHoliday = await _holidayRepository.GetHolidayCountAsync(rawData.LeaveStartDate, rawData.LeaveEndDate, category);
|
//var sumHoliday = await _holidayRepository.GetHolidayCountAsync(rawData.LeaveStartDate, rawData.LeaveEndDate, category);
|
||||||
//var sumWeekend = _holidayRepository.GetWeekEndCount(rawData.LeaveStartDate, rawData.LeaveEndDate, category);
|
//var sumWeekend = _holidayRepository.GetWeekEndCount(rawData.LeaveStartDate, rawData.LeaveEndDate, category);
|
||||||
|
|
||||||
|
// fix issue : ระบบการลา>>สังกัด ฝ่าย (เอา / ออก เปลี่ยนเป็นว่าง) #1131
|
||||||
|
|
||||||
|
|
||||||
var orgName = rawData.Root ?? "";
|
var orgName = rawData.Root ?? "";
|
||||||
if (rawData.Child1 != null && rawData.Child1 != "")
|
if (rawData.Child1 != null && rawData.Child1 != "")
|
||||||
orgName += $"/{rawData.Child1}";
|
orgName += $" {rawData.Child1}";
|
||||||
if (rawData.Child2 != null && rawData.Child2 != "")
|
if (rawData.Child2 != null && rawData.Child2 != "")
|
||||||
orgName += $"/{rawData.Child2}";
|
orgName += $" {rawData.Child2}";
|
||||||
if (rawData.Child3 != null && rawData.Child3 != "")
|
if (rawData.Child3 != null && rawData.Child3 != "")
|
||||||
orgName += $"/{rawData.Child3}";
|
orgName += $" {rawData.Child3}";
|
||||||
if (rawData.Child4 != null && rawData.Child4 != "")
|
if (rawData.Child4 != null && rawData.Child4 != "")
|
||||||
orgName += $"/{rawData.Child4}";
|
orgName += $" {rawData.Child4}";
|
||||||
|
|
||||||
var result = new GetLeaveRequestForAdminByIdDto
|
var result = new GetLeaveRequestForAdminByIdDto
|
||||||
{
|
{
|
||||||
|
|
@ -1972,6 +1976,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var rejectList = await _leaveRequestRepository.GetSumRejectLeaveAsync(thisYear);
|
var rejectList = await _leaveRequestRepository.GetSumRejectLeaveAsync(thisYear);
|
||||||
var deleteList = await _leaveRequestRepository.GetSumDeleteLeaveAsync(thisYear);
|
var deleteList = await _leaveRequestRepository.GetSumDeleteLeaveAsync(thisYear);
|
||||||
|
|
||||||
|
var approvePrevYear = await _leaveRequestRepository.GetSumApproveLeaveAsync(thisYear - 1);
|
||||||
|
|
||||||
var result = new List<dynamic>();
|
var result = new List<dynamic>();
|
||||||
foreach (var leaveType in leaveTypes)
|
foreach (var leaveType in leaveTypes)
|
||||||
{
|
{
|
||||||
|
|
@ -1987,12 +1993,43 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var deleteData = deleteList.FirstOrDefault(x => x.KeycloakUserId == userId && x.LeaveTypeId == leaveType.Id);
|
var deleteData = deleteList.FirstOrDefault(x => x.KeycloakUserId == userId && x.LeaveTypeId == leaveType.Id);
|
||||||
var delete = deleteData == null ? 0 : deleteData.SumLeaveDay;
|
var delete = deleteData == null ? 0 : deleteData.SumLeaveDay;
|
||||||
|
|
||||||
|
// fix issue : SIT ระบบบันทึกการลา>> สิทธิ์การลา(โอนสิทธิ์การลา) #974
|
||||||
|
|
||||||
|
var extendLeave = 0.0;
|
||||||
|
var leaveLimit = leaveType.Limit;
|
||||||
|
|
||||||
|
if (leaveType.Code == "LV-005")
|
||||||
|
{
|
||||||
|
var apprvPrevData = approvePrevYear.FirstOrDefault(x => x.KeycloakUserId == userId && x.LeaveTypeId == leaveType.Id);
|
||||||
|
var apprvPrev = apprvPrevData == null ? 0 : approveData.SumLeaveDay;
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||||
|
var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||||
|
|
||||||
|
if (govAge >= 180)
|
||||||
|
{
|
||||||
|
if (govAge >= 3650)
|
||||||
|
{
|
||||||
|
// ถ้าอายุราชการเกิน 10 ปี ได้บวกเพิ่มอีก 10 วัน
|
||||||
|
extendLeave = 30 - apprvPrev; // หายอดวันลาที่เหลือของปีก่อน
|
||||||
|
if (extendLeave >= 20) extendLeave = 20;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extendLeave = 20 - apprvPrev; // หายอดวันลาที่เหลือของปีก่อน
|
||||||
|
if (extendLeave >= 10) extendLeave = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
leaveLimit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
Id = leaveType.Id,
|
Id = leaveType.Id,
|
||||||
LeaveTypeName = leaveType.Name,
|
LeaveTypeName = leaveType.Name,
|
||||||
LeaveLimit = leaveType.Limit,
|
LeaveLimit = leaveLimit,
|
||||||
LeaveExtend = 0,
|
LeaveExtend = extendLeave,
|
||||||
leavePercent = Math.Round((approve * 100.0) / leaveType.Limit, 2),
|
leavePercent = Math.Round((approve * 100.0) / leaveType.Limit, 2),
|
||||||
LeaveCountSend = send,
|
LeaveCountSend = send,
|
||||||
LeaveCountApprove = approve,
|
LeaveCountApprove = approve,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ using System.Net.Http.Headers;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||||
|
using BMA.EHR.Application.Repositories.Reports;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -33,6 +34,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly CandidateReportRepository _service;
|
||||||
|
private readonly MinIOExamService _minIOExamService;
|
||||||
|
|
||||||
public PlacementController(PlacementRepository repository,
|
public PlacementController(PlacementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
|
|
@ -40,7 +43,9 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
CandidateReportRepository service,
|
||||||
|
MinIOExamService minIOExamService)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
|
|
@ -49,6 +54,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
_service = service;
|
||||||
|
_minIOExamService = minIOExamService;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -3281,5 +3288,91 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
};
|
};
|
||||||
return Success(data);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,404 @@
|
||||||
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
|
using BMA.EHR.Application.Repositories.Reports;
|
||||||
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
using BMA.EHR.Placement.Service.Requests;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/placement/probation")]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
[ApiController]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Authorize]
|
||||||
|
[SwaggerTag("report ทดลองงาน")]
|
||||||
|
public class PlacementProbationController : BaseController
|
||||||
|
{
|
||||||
|
private readonly ApplicationDBContext _context;
|
||||||
|
private readonly MinIOService _documentService;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly ProbationReportRepository _repository;
|
||||||
|
|
||||||
|
public PlacementProbationController(
|
||||||
|
ApplicationDBContext context,
|
||||||
|
MinIOService documentService,
|
||||||
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration,
|
||||||
|
PermissionRepository permiss,
|
||||||
|
ProbationReportRepository repository)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_documentService = documentService;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
|
_permission = permiss;
|
||||||
|
_repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
|
||||||
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ
|
||||||
|
/// <summary>
|
||||||
|
/// 13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">assign 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("13/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProbationReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
string authorizationHeader = Request.Headers["Authorization"];
|
||||||
|
string token = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
|
||||||
|
{
|
||||||
|
token = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
var probation = await _repository.GetProbationAssignAsync(id, token);
|
||||||
|
|
||||||
|
if (probation != null)
|
||||||
|
{
|
||||||
|
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 = "probation-13",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = probation
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล
|
||||||
|
/// <summary>
|
||||||
|
/// 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">evaluate 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("14/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProbation14ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string authorizationHeader = Request.Headers["Authorization"];
|
||||||
|
string token = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
|
||||||
|
{
|
||||||
|
token = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
var evaluateRecord = await _repository.GetEvaluateRecord14_15Async(id, token);
|
||||||
|
|
||||||
|
if (evaluateRecord != null)
|
||||||
|
{
|
||||||
|
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 = "probation-14",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = evaluateRecord
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
|
||||||
|
/// <summary>
|
||||||
|
/// 15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">evaluate 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("15/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProbation15ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string authorizationHeader = Request.Headers["Authorization"];
|
||||||
|
string token = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
|
||||||
|
{
|
||||||
|
token = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
var evaluateRecord = await _repository.GetEvaluateRecord14_15Async(id, token);
|
||||||
|
|
||||||
|
if (evaluateRecord != null)
|
||||||
|
{
|
||||||
|
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 = "probation-15",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = evaluateRecord
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
|
||||||
|
/// <summary>
|
||||||
|
/// 16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">evaluate 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("16/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProbation16ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string authorizationHeader = Request.Headers["Authorization"];
|
||||||
|
string token = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
|
||||||
|
{
|
||||||
|
token = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
var evaluateAssign = await _repository.GetEvaluateAssignAsync(id, token);
|
||||||
|
|
||||||
|
if (evaluateAssign != null)
|
||||||
|
{
|
||||||
|
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 = "probation-16",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = evaluateAssign
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ
|
||||||
|
/// <summary>
|
||||||
|
/// 17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">evaluate 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("17/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProbation17ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string authorizationHeader = Request.Headers["Authorization"];
|
||||||
|
string token = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
|
||||||
|
{
|
||||||
|
token = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
var evaluateAssign = await _repository.GetEvaluateChairmanAssignAsync(id, token);
|
||||||
|
|
||||||
|
if (evaluateAssign != null)
|
||||||
|
{
|
||||||
|
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 = "probation-17",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = evaluateAssign
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา
|
||||||
|
/// <summary>
|
||||||
|
/// 18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">assign 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("18/{exportType}/{id}/{no}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProbation19ConvertReportAsync(Guid id, int no, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string authorizationHeader = Request.Headers["Authorization"];
|
||||||
|
string token = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
|
||||||
|
{
|
||||||
|
token = authorizationHeader.Substring("Bearer ".Length).Trim();
|
||||||
|
var evaluateAssign = await _repository.GetEvaluateResultAssignAsync(id, no, token);
|
||||||
|
|
||||||
|
if (evaluateAssign != null)
|
||||||
|
{
|
||||||
|
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 = no == 1 ? "probation-18-1" : "probation-18-2",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = evaluateAssign
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using BMA.EHR.Application.Repositories.Reports;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -32,6 +33,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly TransferReportRepository _service;
|
||||||
|
|
||||||
public PlacementTransferController(PlacementRepository repository,
|
public PlacementTransferController(PlacementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
|
|
@ -39,7 +41,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
TransferReportRepository service)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
|
|
@ -48,6 +51,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
_service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -927,5 +931,192 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#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("21/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetTransfer1ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _service.GetData1Transfer(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "transfer1",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#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("22/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetTransfer2ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _service.GetData2Transfer(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "transfer2",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#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("23/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetTransfer3ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _service.GetData3Transfer(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "transfer3",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#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("24/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetTransfer4ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _service.GetData4Transfer(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "transfer4",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#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("25/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetTransfer5ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _service.GetData5Transfer(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "transfer5",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#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("26/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetTransfer6ConvertReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _service.GetData6Transfer(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "transfer6",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
|
using BMA.EHR.Application.Repositories.Reports;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
|
|
@ -35,6 +36,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
private readonly DisciplineDbContext _contextDiscipline;
|
private readonly DisciplineDbContext _contextDiscipline;
|
||||||
|
private readonly RetireReportRepository _service;
|
||||||
public RetirementController(RetirementRepository repository,
|
public RetirementController(RetirementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
|
|
@ -43,7 +45,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
OrganizationCommonRepository organizationCommonRepository,
|
OrganizationCommonRepository organizationCommonRepository,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
PermissionRepository permission,
|
PermissionRepository permission,
|
||||||
DisciplineDbContext contextDiscipline)
|
DisciplineDbContext contextDiscipline,
|
||||||
|
RetireReportRepository service)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
|
|
@ -54,6 +57,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
_contextDiscipline = contextDiscipline;
|
_contextDiscipline = contextDiscipline;
|
||||||
|
_service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -1999,44 +2003,110 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//เกษียณอายุราชการ
|
/// <summary>
|
||||||
//public async Task ExecuteRetirement()
|
/// เกษียณอายุราชการ
|
||||||
//{
|
/// </summary>
|
||||||
// var retirePeriodOfficer = await _context.RetirementPeriods
|
/// <param name="type">ประเภทUser(officer,employee)(ตัวใหญ่หรือเล็กก็ได้)</param>
|
||||||
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
/// <param name="year">ปีงบประมาณ(ค.ศ.)</param>
|
||||||
// .Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
/// <returns></returns>
|
||||||
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
/// <response code="200"></response>
|
||||||
// .FirstOrDefaultAsync();
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("update-status/{type}/{year}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdateStatusRetirement(string type, int year)
|
||||||
|
{
|
||||||
|
var retirePeriodOfficer = await _context.RetirementPeriods
|
||||||
|
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||||
|
.Where(x => x.Year == year && x.Type.Trim().ToUpper().Contains(type))
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
// var body = retirePeriodOfficer.RetirementProfiles
|
if (retirePeriodOfficer == null)
|
||||||
// .Select(x => new
|
return Error("ไม่พบรอบประกาศเกษียณอายุราชการ");
|
||||||
// {
|
|
||||||
// profileId = x.profileId,
|
|
||||||
// //lastUpdateUserId = UserId,
|
|
||||||
// //lastUpdateFullName = FullName,
|
|
||||||
// })
|
|
||||||
// .ToList();
|
|
||||||
|
|
||||||
// //ข้าราชการ
|
var data = retirePeriodOfficer.RetirementRawProfiles
|
||||||
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
.Select(x => new
|
||||||
// var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
{
|
||||||
// using (var client = new HttpClient())
|
profileId = x.profileId
|
||||||
// {
|
})
|
||||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
.ToList();
|
||||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
|
||||||
// var jsonBody = JsonConvert.SerializeObject(body);
|
|
||||||
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
|
||||||
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
|
||||||
// {
|
|
||||||
// Content = content
|
|
||||||
// };
|
|
||||||
// var response = await client.SendAsync(_req);
|
|
||||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
|
||||||
// if (!response.IsSuccessStatusCode)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
return Success(data);
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
|
#region 31-ประกาศเกษียณข้าราชการ & 32-ประกาศเกษียณลูกจ้างประจำ
|
||||||
|
/// <summary>
|
||||||
|
/// 31-ประกาศเกษียณข้าราชการ & 32-ประกาศเกษียณลูกจ้างประจำ
|
||||||
|
/// </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("31/{exportType}/{Id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
var retire = await _service.GetProfileRetirementdAsync(Id);
|
||||||
|
if (retire != null)
|
||||||
|
{
|
||||||
|
var reportfile = string.Empty;
|
||||||
|
exportType = exportType.Trim();
|
||||||
|
switch (retire.GetType().GetProperty("Type").GetValue(retire))
|
||||||
|
{
|
||||||
|
case "OFFICER":
|
||||||
|
if (string.IsNullOrEmpty(retire.GetType().GetProperty("TypeReport").GetValue(retire)))
|
||||||
|
{
|
||||||
|
reportfile = $"retire-1";
|
||||||
|
}
|
||||||
|
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "ADD" || retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT")
|
||||||
|
{
|
||||||
|
reportfile = $"retire-2";
|
||||||
|
}
|
||||||
|
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "REMOVE")
|
||||||
|
{
|
||||||
|
reportfile = $"retire-3";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Error(retire.GetType().GetProperty("TypeReport").GetValue(retire));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "EMPLOYEE":
|
||||||
|
if (string.IsNullOrEmpty(retire.GetType().GetProperty("TypeReport").GetValue(retire)))
|
||||||
|
{
|
||||||
|
reportfile = $"retire-emp-1";
|
||||||
|
}
|
||||||
|
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "ADD" || retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT")
|
||||||
|
{
|
||||||
|
reportfile = $"retire-emp-2";
|
||||||
|
}
|
||||||
|
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "REMOVE")
|
||||||
|
{
|
||||||
|
reportfile = $"retire-emp-3";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Error(retire.GetType().GetProperty("TypeReport").GetValue(retire));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return Error(retire.GetType().GetProperty("Type").GetValue(retire));
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = new
|
||||||
|
{
|
||||||
|
template = reportfile,
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = retire
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,6 @@ using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Application.Repositories.Reports;
|
using BMA.EHR.Application.Repositories.Reports;
|
||||||
using BMA.EHR.Application.Responses;
|
using BMA.EHR.Application.Responses;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
|
||||||
using BMA.EHR.Domain.Models.HR;
|
|
||||||
using BMA.EHR.Domain.Models.MetaData;
|
|
||||||
using BMA.EHR.Domain.Models.Notifications;
|
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -18,10 +14,7 @@ using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
|
||||||
|
|
||||||
namespace BMA.EHR.Retirement.Service.Controllers
|
namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -747,5 +740,63 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 36-บันทึกเวียนแจ้งการถึงแก่กรรม
|
||||||
|
/// </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("36/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetDeceasedReportAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var head = await _repositoryRetireReport.GetHeadRetirementDeceasedAsync(id);
|
||||||
|
var detail = await _repositoryRetireReport.GetRetirementDeceasedAsync(id);
|
||||||
|
if (detail != null && head != null)
|
||||||
|
{
|
||||||
|
var mergeData = new
|
||||||
|
{
|
||||||
|
Oc = head.GetType().GetProperty("Oc").GetValue(head),
|
||||||
|
Number = head.GetType().GetProperty("Number").GetValue(head),
|
||||||
|
Date = head.GetType().GetProperty("Date").GetValue(head),
|
||||||
|
Subject = head.GetType().GetProperty("Subject").GetValue(head),
|
||||||
|
Send = head.GetType().GetProperty("Send").GetValue(head),
|
||||||
|
FullName = detail.GetType().GetProperty("FullName").GetValue(detail),
|
||||||
|
Position = detail.GetType().GetProperty("Position").GetValue(detail),
|
||||||
|
Reason = detail.GetType().GetProperty("Reason").GetValue(detail),
|
||||||
|
DeceasedDate = detail.GetType().GetProperty("Date").GetValue(detail),
|
||||||
|
CurrentDate = detail.GetType().GetProperty("CurrentDate").GetValue(detail),
|
||||||
|
DeceasedNumber = detail.GetType().GetProperty("Number").GetValue(detail),
|
||||||
|
Location = detail.GetType().GetProperty("Location").GetValue(detail),
|
||||||
|
};
|
||||||
|
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 = "deceased",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = mergeData
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
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.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
|
|
@ -32,6 +34,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly RetireReportRepository _service;
|
||||||
|
|
||||||
public RetirementResignController(RetirementRepository repository,
|
public RetirementResignController(RetirementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
|
|
@ -39,7 +42,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
RetireReportRepository service)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
|
|
@ -48,6 +52,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
_service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -2642,5 +2647,46 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
return Success();
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,13 +82,14 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
.SetIsOriginAllowedToAllowWildcardSubdomains();
|
.SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddApplication();
|
builder.Services.AddApplication();
|
||||||
builder.Services.AddPersistence(builder.Configuration);
|
|
||||||
builder.Services.AddLeaveApplication();
|
builder.Services.AddLeaveApplication();
|
||||||
|
builder.Services.AddPersistence(builder.Configuration);
|
||||||
builder.Services.AddLeavePersistence(builder.Configuration);
|
builder.Services.AddLeavePersistence(builder.Configuration);
|
||||||
|
|
||||||
|
builder.Services.AddHttpClient();
|
||||||
|
|
||||||
builder.Services.AddControllers(options =>
|
builder.Services.AddControllers(options =>
|
||||||
{
|
{
|
||||||
options.SuppressAsyncSuffixInActionNames = false;
|
options.SuppressAsyncSuffixInActionNames = false;
|
||||||
|
|
@ -108,6 +109,7 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
options.UseMySql(disciplineConnection, ServerVersion.AutoDetect(disciplineConnection)));
|
options.UseMySql(disciplineConnection, ServerVersion.AutoDetect(disciplineConnection)));
|
||||||
|
|
||||||
builder.Services.AddHealthChecks();
|
builder.Services.AddHealthChecks();
|
||||||
|
|
||||||
// Add Hangfire services.
|
// Add Hangfire services.
|
||||||
builder.Services.AddHangfire(configuration => configuration
|
builder.Services.AddHangfire(configuration => configuration
|
||||||
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
||||||
|
|
@ -159,18 +161,20 @@ var app = builder.Build();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||||
|
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||||
{
|
{
|
||||||
Authorization = new[] { new CustomAuthorizeFilter() }
|
Authorization = new[] { new CustomAuthorizeFilter() }
|
||||||
});
|
});
|
||||||
|
|
||||||
var manager = new RecurringJobManager();
|
var manager = new RecurringJobManager();
|
||||||
if (manager != null)
|
if (manager != null)
|
||||||
{
|
{
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementRepository>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementRepository>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("Test อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementController>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
manager.AddOrUpdate("ทดสอบ", Job.FromExpression<RetirementRepository>(x => x.TestMethod()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply migrations
|
// apply migrations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue