From 339de6132efadb4802fb8227badaf20ac8fc4ef5 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Wed, 29 Jan 2025 20:25:19 +0700 Subject: [PATCH 01/12] TEST Retirement Hangfire --- BMA.EHR.Application/ApplicationServicesRegistration.cs | 2 +- BMA.EHR.Application/Repositories/RetirementRepository.cs | 5 +++++ BMA.EHR.Retirement.Service/Program.cs | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/BMA.EHR.Application/ApplicationServicesRegistration.cs b/BMA.EHR.Application/ApplicationServicesRegistration.cs index aa47f71f..312a2597 100644 --- a/BMA.EHR.Application/ApplicationServicesRegistration.cs +++ b/BMA.EHR.Application/ApplicationServicesRegistration.cs @@ -27,7 +27,7 @@ namespace BMA.EHR.Application services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + //services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/BMA.EHR.Application/Repositories/RetirementRepository.cs b/BMA.EHR.Application/Repositories/RetirementRepository.cs index 20d96b3b..ac0b27a0 100644 --- a/BMA.EHR.Application/Repositories/RetirementRepository.cs +++ b/BMA.EHR.Application/Repositories/RetirementRepository.cs @@ -142,5 +142,10 @@ namespace BMA.EHR.Application.Repositories } } } + + public void TestMethod() + { + return; + } } } diff --git a/BMA.EHR.Retirement.Service/Program.cs b/BMA.EHR.Retirement.Service/Program.cs index eb586a04..817b710a 100644 --- a/BMA.EHR.Retirement.Service/Program.cs +++ b/BMA.EHR.Retirement.Service/Program.cs @@ -82,6 +82,8 @@ var builder = WebApplication.CreateBuilder(args); .SetIsOriginAllowedToAllowWildcardSubdomains(); })); + builder.Services.AddHttpClient(); + // Add services to the container. builder.Services.AddApplication(); @@ -170,6 +172,7 @@ var app = builder.Build(); //manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local); //manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local); manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); + manager.AddOrUpdate("ทดสอบ", Job.FromExpression(x => x.TestMethod()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); //manager.AddOrUpdate("Test อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); } From a0cc5b62ff0cba3f95dcd7953441124dee1586aa Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 30 Jan 2025 11:33:00 +0700 Subject: [PATCH 02/12] fixing field --- .../Reports/ProbationReportRepository.cs | 4 ++-- .../Responses/EvaluateResultAssignResponse.cs | 20 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs index 57dd6284..8d55c8f5 100644 --- a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs @@ -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, 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, - 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(), + CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.position) ? string.Empty : evaluate_assign.result.commander.position, + CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.commander.dated.ToString()) ? "-" : evaluate_assign.result.commander.dated?.ToThaiFullDate().ToString().ToThaiNumber(), Name = evaluate_assign.result.experimentee.name, RoundNo = no.ToString().ToThaiNumber(), DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-", diff --git a/BMA.EHR.Application/Responses/EvaluateResultAssignResponse.cs b/BMA.EHR.Application/Responses/EvaluateResultAssignResponse.cs index ae940ec5..412e6bfc 100644 --- a/BMA.EHR.Application/Responses/EvaluateResultAssignResponse.cs +++ b/BMA.EHR.Application/Responses/EvaluateResultAssignResponse.cs @@ -19,15 +19,19 @@ namespace BMA.EHR.Application.Responses public class Commander { - public string personal_id { get; set; } + // public string personal_id { get; set; } public string name { get; set; } - public string PositionId { get; set; } - public string PositionLevelId { get; set; } - public string PositionLineId { get; set; } - public string Position { get; set; } - public string Department { get; set; } - public string OrganizationOrganization { get; set; } - public string Oc { get; set; } + // public string PositionId { get; set; } + // public string PositionLevelId { get; set; } + // public string PositionLineId { get; set; } + public string position { get; set; } + // public string Department { get; set; } + // public string OrganizationOrganization { 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 From 177cefccccd0b4c3ba89ba8fb434ec791ae7775e Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 30 Jan 2025 11:43:36 +0700 Subject: [PATCH 03/12] =?UTF-8?q?fix=20issue=20:=20=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=9A=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5=E0=B8=B2?= =?UTF-8?q?>>=E0=B8=AA=E0=B8=B1=E0=B8=87=E0=B8=81=E0=B8=B1=E0=B8=94=20?= =?UTF-8?q?=E0=B8=9D=E0=B9=88=E0=B8=B2=E0=B8=A2=20(=E0=B9=80=E0=B8=AD?= =?UTF-8?q?=E0=B8=B2=20/=20=E0=B8=AD=E0=B8=AD=E0=B8=81=20=E0=B9=80?= =?UTF-8?q?=E0=B8=9B=E0=B8=A5=E0=B8=B5=E0=B9=88=E0=B8=A2=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=9B=E0=B9=87=E0=B8=99=E0=B8=A7=E0=B9=88=E0=B8=B2=E0=B8=87?= =?UTF-8?q?)=20#1131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BMA.EHR.Leave/Controllers/LeaveRequestController.cs | 11 +++++++---- BMA.EHR.Retirement.Service/Program.cs | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index a4fc6fde..dc581c20 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -1827,15 +1827,18 @@ namespace BMA.EHR.Leave.Service.Controllers //var sumHoliday = await _holidayRepository.GetHolidayCountAsync(rawData.LeaveStartDate, rawData.LeaveEndDate, category); //var sumWeekend = _holidayRepository.GetWeekEndCount(rawData.LeaveStartDate, rawData.LeaveEndDate, category); + // fix issue : ระบบการลา>>สังกัด ฝ่าย (เอา / ออก เปลี่ยนเป็นว่าง) #1131 + + var orgName = rawData.Root ?? ""; if (rawData.Child1 != null && rawData.Child1 != "") - orgName += $"/{rawData.Child1}"; + orgName += $" {rawData.Child1}"; if (rawData.Child2 != null && rawData.Child2 != "") - orgName += $"/{rawData.Child2}"; + orgName += $" {rawData.Child2}"; if (rawData.Child3 != null && rawData.Child3 != "") - orgName += $"/{rawData.Child3}"; + orgName += $" {rawData.Child3}"; if (rawData.Child4 != null && rawData.Child4 != "") - orgName += $"/{rawData.Child4}"; + orgName += $" {rawData.Child4}"; var result = new GetLeaveRequestForAdminByIdDto { diff --git a/BMA.EHR.Retirement.Service/Program.cs b/BMA.EHR.Retirement.Service/Program.cs index 817b710a..31c7ad92 100644 --- a/BMA.EHR.Retirement.Service/Program.cs +++ b/BMA.EHR.Retirement.Service/Program.cs @@ -82,15 +82,14 @@ var builder = WebApplication.CreateBuilder(args); .SetIsOriginAllowedToAllowWildcardSubdomains(); })); - builder.Services.AddHttpClient(); - - // Add services to the container. builder.Services.AddApplication(); - builder.Services.AddPersistence(builder.Configuration); builder.Services.AddLeaveApplication(); + builder.Services.AddPersistence(builder.Configuration); builder.Services.AddLeavePersistence(builder.Configuration); + builder.Services.AddHttpClient(); + builder.Services.AddControllers(options => { options.SuppressAsyncSuffixInActionNames = false; @@ -110,6 +109,7 @@ var builder = WebApplication.CreateBuilder(args); options.UseMySql(disciplineConnection, ServerVersion.AutoDetect(disciplineConnection))); builder.Services.AddHealthChecks(); + // Add Hangfire services. builder.Services.AddHangfire(configuration => configuration .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) @@ -161,10 +161,12 @@ var app = builder.Build(); app.UseStaticFiles(); app.MapControllers(); app.UseMiddleware(); + app.UseHangfireDashboard("/hangfire", new DashboardOptions() { Authorization = new[] { new CustomAuthorizeFilter() } }); + var manager = new RecurringJobManager(); if (manager != null) { From e6a73f1d199f09e015b68ea157c9879d86e66793 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 30 Jan 2025 12:03:14 +0700 Subject: [PATCH 04/12] =?UTF-8?q?fix=20issue=20:=20SIT=20=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=9A=E0=B8=9A=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97?= =?UTF-8?q?=E0=B8=B6=E0=B8=81=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5=E0=B8=B2?= =?UTF-8?q?>>=20=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5=E0=B8=B2(=E0=B9=82?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4?= =?UTF-8?q?=E0=B9=8C=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5=E0=B8=B2)=20#974?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LeaveRequestController.cs | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index dc581c20..f7f322f3 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -18,6 +18,7 @@ using Newtonsoft.Json.Linq; using Swashbuckle.AspNetCore.Annotations; using System.Net.Http.Headers; using System.Security.Claims; +using System.Security.Policy; namespace BMA.EHR.Leave.Service.Controllers { @@ -883,7 +884,7 @@ namespace BMA.EHR.Leave.Service.Controllers break; case "LV-005": // fix issue : ระบบลา (ขรก.) >> ลาพักผ่อน (กรณีรับราชการไม่ถึง 6 เดือน) #838 - var leavePrevYear = (await _leaveRequestRepository.GetSumApproveLeaveAsync(thisYear -1)).Where(x => x.LeaveTypeCode == "LV-005" && x.KeycloakUserId == userId).FirstOrDefault(); + var leavePrevYear = (await _leaveRequestRepository.GetSumApproveLeaveAsync(thisYear - 1)).Where(x => x.LeaveTypeCode == "LV-005" && x.KeycloakUserId == userId).FirstOrDefault(); //var leavePrevYearRemain = 10 - (leavePrevYear == null ? 0 : leavePrevYear.SumLeaveDay); // หายอดวันลาที่เหลือของปีก่อน if (govAge >= 180) @@ -1975,6 +1976,8 @@ namespace BMA.EHR.Leave.Service.Controllers var rejectList = await _leaveRequestRepository.GetSumRejectLeaveAsync(thisYear); var deleteList = await _leaveRequestRepository.GetSumDeleteLeaveAsync(thisYear); + var approvePrevYear = await _leaveRequestRepository.GetSumApproveLeaveAsync(thisYear - 1); + var result = new List(); foreach (var leaveType in leaveTypes) { @@ -1990,12 +1993,43 @@ namespace BMA.EHR.Leave.Service.Controllers var deleteData = deleteList.FirstOrDefault(x => x.KeycloakUserId == userId && x.LeaveTypeId == leaveType.Id); 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 { Id = leaveType.Id, LeaveTypeName = leaveType.Name, - LeaveLimit = leaveType.Limit, - LeaveExtend = 0, + LeaveLimit = leaveLimit, + LeaveExtend = extendLeave, leavePercent = Math.Round((approve * 100.0) / leaveType.Limit, 2), LeaveCountSend = send, LeaveCountApprove = approve, From f81806f59f5652d080f2696208b6b807c46ca1e4 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 30 Jan 2025 14:55:04 +0700 Subject: [PATCH 05/12] fixing date & status report probation --- .../Repositories/Reports/ProbationReportRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs index 8d55c8f5..9323788f 100644 --- a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs @@ -919,7 +919,7 @@ namespace BMA.EHR.Application.Repositories.Reports ? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน" : "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน"; - var passResult = evaluate_assign.result.evaluate.pass_result == 1 + var passResult = evaluate_assign.result.evaluate.pass_result == 4 ? no == 1 ? "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "เห็นควรให้รับราชการต่อไป" : evaluate_assign.result.evaluate.pass_result == 2 ? "เห็นควรให้ออกจากราชการ" @@ -937,7 +937,7 @@ namespace BMA.EHR.Application.Repositories.Reports return new { 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, 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, From 59edf6a716dccc9a705afa698a210da37a6daa4d Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 30 Jan 2025 15:07:46 +0700 Subject: [PATCH 06/12] =?UTF-8?q?api=20get=20=E0=B8=A3=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=9C=E0=B8=B9=E0=B9=89?= =?UTF-8?q?=E0=B9=80=E0=B8=81=E0=B8=A9=E0=B8=B5=E0=B8=A2=E0=B8=93=E0=B8=AD?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=B8=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/RetirementRepository.cs | 74 ++++++++++--------- .../Controllers/RetirementController.cs | 62 +++++++--------- BMA.EHR.Retirement.Service/Program.cs | 3 +- 3 files changed, 67 insertions(+), 72 deletions(-) diff --git a/BMA.EHR.Application/Repositories/RetirementRepository.cs b/BMA.EHR.Application/Repositories/RetirementRepository.cs index ac0b27a0..a771b89e 100644 --- a/BMA.EHR.Application/Repositories/RetirementRepository.cs +++ b/BMA.EHR.Application/Repositories/RetirementRepository.cs @@ -105,43 +105,49 @@ namespace BMA.EHR.Application.Repositories } //เกษียณอายุราชการ - public async Task ExecuteRetirement() - { - var retirePeriodOfficer = await _dbContext.Set() - .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE")) - .Where(x => x.Year == /*DateTime.Now.Year*/2026) - .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER")) - .FirstOrDefaultAsync(); + //public async Task ExecuteRetirement() + //{ + // var retirePeriodOfficer = await _dbContext.Set() + // .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE")) + // .Where(x => x.Year == DateTime.Now.Year) + // .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER")) + // .FirstOrDefaultAsync(); - var body = retirePeriodOfficer.RetirementProfiles - .Select(x => new { - profileId = x.profileId, - //lastUpdateUserId = UserId, - //lastUpdateFullName = FullName, - }) - .ToList(); + // if (retirePeriodOfficer == null) + // return; - //ข้าราชการ - //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement"; - var apiUrl = $"http://localhost:13001/api/v1/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) - { + // var body = new + // { + // data = retirePeriodOfficer.RetirementRawProfiles + // .Select(x => new + // { + // profileId = x.profileId + // }) + // .ToList() + // }; - } - } - } + // //ข้าราชการ + // //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() { diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index 5d5b5306..4336ee79 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -1999,44 +1999,34 @@ namespace BMA.EHR.Retirement.Service.Controllers return Success(data); } - //เกษียณอายุราชการ - //public async Task ExecuteRetirement() - //{ - // var retirePeriodOfficer = await _context.RetirementPeriods - // .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE")) - // .Where(x => x.Year == /*DateTime.Now.Year*/2026) - // .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER")) - // .FirstOrDefaultAsync(); + /// + /// เกษียณอายุราชการ + /// + /// ประเภทUser(officer,employee)(ตัวใหญ่หรือเล็กก็ได้) + /// ปีงบประมาณ(ค.ศ.) + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("update-status/{type}/{year}")] + public async Task> 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 - // .Select(x => new - // { - // profileId = x.profileId, - // //lastUpdateUserId = UserId, - // //lastUpdateFullName = FullName, - // }) - // .ToList(); + if (retirePeriodOfficer == null) + return Error("ไม่พบรอบประกาศเกษียณอายุราชการ"); - // //ข้าราชการ - // //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement"; - // var apiUrl = $"http://localhost:13001/api/v1/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) - // { + var data = retirePeriodOfficer.RetirementRawProfiles + .Select(x => new { + profileId = x.profileId + }) + .ToList(); - // } - // } - //} + return Success(data); + } } } diff --git a/BMA.EHR.Retirement.Service/Program.cs b/BMA.EHR.Retirement.Service/Program.cs index 31c7ad92..fc121e82 100644 --- a/BMA.EHR.Retirement.Service/Program.cs +++ b/BMA.EHR.Retirement.Service/Program.cs @@ -173,9 +173,8 @@ var app = builder.Build(); //manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local); //manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local); //manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local); - manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); + //manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); manager.AddOrUpdate("ทดสอบ", Job.FromExpression(x => x.TestMethod()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); - //manager.AddOrUpdate("Test อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local); } // apply migrations From 780eebea4de264a9dcb2b2d4842d3ee8a975dc8b Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 30 Jan 2025 15:35:16 +0700 Subject: [PATCH 07/12] updated --- .../Repositories/Reports/ProbationReportRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs index 9323788f..1092385f 100644 --- a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs @@ -909,7 +909,7 @@ namespace BMA.EHR.Application.Repositories.Reports 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 ? "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป"; var passResult2 = evaluate_assign.result.evaluate.pass_result == 2 @@ -919,7 +919,7 @@ namespace BMA.EHR.Application.Repositories.Reports ? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน" : "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน"; - var passResult = evaluate_assign.result.evaluate.pass_result == 4 + var passResult = evaluate_assign.result.evaluate.pass_result == 1 || evaluate_assign.result.evaluate.pass_result == 4 ? no == 1 ? "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "เห็นควรให้รับราชการต่อไป" : evaluate_assign.result.evaluate.pass_result == 2 ? "เห็นควรให้ออกจากราชการ" From 8a27795586da42af30684e218c2d5e61ec91631b Mon Sep 17 00:00:00 2001 From: kittapath Date: Mon, 3 Feb 2025 17:01:41 +0700 Subject: [PATCH 08/12] report placement --- .../PlacementTransferController.cs | 193 +++++++++++++++++- 1 file changed, 192 insertions(+), 1 deletion(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs index b9adcb9a..cc4e4d06 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs @@ -14,6 +14,7 @@ using Swashbuckle.AspNetCore.Annotations; using System.Net.Http.Headers; using System.Security.Claims; using Newtonsoft.Json.Linq; +using BMA.EHR.Application.Repositories.Reports; namespace BMA.EHR.Placement.Service.Controllers { @@ -32,6 +33,7 @@ namespace BMA.EHR.Placement.Service.Controllers private readonly IHttpContextAccessor _httpContextAccessor; private readonly IConfiguration _configuration; private readonly PermissionRepository _permission; + private readonly TransferReportRepository _service; public PlacementTransferController(PlacementRepository repository, NotificationRepository repositoryNoti, @@ -39,7 +41,8 @@ namespace BMA.EHR.Placement.Service.Controllers MinIOService documentService, IHttpContextAccessor httpContextAccessor, IConfiguration configuration, - PermissionRepository permission) + PermissionRepository permission, + TransferReportRepository service) { _repository = repository; _repositoryNoti = repositoryNoti; @@ -48,6 +51,7 @@ namespace BMA.EHR.Placement.Service.Controllers _httpContextAccessor = httpContextAccessor; _configuration = configuration; _permission = permission; + _service = service; } #region " Properties " @@ -927,5 +931,192 @@ namespace BMA.EHR.Placement.Service.Controllers } return Success(); } + + + #region คําร้องขอโอนไปถึงส่วนราชการอื่นนอก กรุงเทพมหานครที่ข้าราชการประสงค์ขอโอน + /// + /// คําร้องขอโอนไปถึงส่วนราชการอื่นนอก กรุงเทพมหานครที่ข้าราชการประสงค์ขอโอน + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("21/{exportType}/{id}")] + public async Task> 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 หนังสือแจ้งสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานคร ให้ทราบตําแหน่งและตําแหน่งเลขที่ที่ดําเนินการให้โอน + /// + /// หนังสือแจ้งสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานคร ให้ทราบตําแหน่งและตําแหน่งเลขที่ที่ดําเนินการให้โอน + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("22/{exportType}/{id}")] + public async Task> 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 หนังสือยินยอมให้โอนและวันที่พร้อมจะให้โอนไปยัง หน่วยงานที่รับโอน + /// + /// หนังสือยินยอมให้โอนและวันที่พร้อมจะให้โอนไปยัง หน่วยงานที่รับโอน + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("23/{exportType}/{id}")] + public async Task> 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 หนังสือแจ้งสหกรณ์ออมทรัพย์กรุงเทพมหานครเพื่อขอ ตรวจสอบภาระหนี้สินสหกรณ์ออมทรัพย์ + /// + /// หนังสือแจ้งสหกรณ์ออมทรัพย์กรุงเทพมหานครเพื่อขอ ตรวจสอบภาระหนี้สินสหกรณ์ออมทรัพย์ + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("24/{exportType}/{id}")] + public async Task> 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 หนังสือถึงสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานครเพื่อขอตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สินสวัสดิการ + /// + /// หนังสือถึงสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานครเพื่อขอตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สินสวัสดิการ + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("25/{exportType}/{id}")] + public async Task> 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 หนังสือถึงสถาบันพัฒนาข้าราชการกรุงเทพมหานครเพื่อขอตรวจสอบเรื่องภาระผูกพันการรับทุนและการลา ศึกษาต่อกับทางกรุงเทพมหานคร + /// + /// หนังสือถึงสถาบันพัฒนาข้าราชการกรุงเทพมหานครเพื่อขอตรวจสอบเรื่องภาระผูกพันการรับทุนและการลา ศึกษาต่อกับทางกรุงเทพมหานคร + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("26/{exportType}/{id}")] + public async Task> 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 } } From 6d44f6e9c33c034025b92e5ea6d255bc86f06b98 Mon Sep 17 00:00:00 2001 From: kittapath Date: Mon, 3 Feb 2025 17:09:43 +0700 Subject: [PATCH 09/12] retirement report --- .../Controllers/RetirementController.cs | 92 +++++++++++++++++-- .../Controllers/RetirementResignController.cs | 48 +++++++++- 2 files changed, 133 insertions(+), 7 deletions(-) diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index 4336ee79..2927a3da 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -1,5 +1,6 @@ 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.Models.Retirement; @@ -35,15 +36,17 @@ namespace BMA.EHR.Retirement.Service.Controllers private readonly IConfiguration _configuration; private readonly PermissionRepository _permission; private readonly DisciplineDbContext _contextDiscipline; + private readonly RetireReportRepository _service; public RetirementController(RetirementRepository repository, NotificationRepository repositoryNoti, ApplicationDBContext context, MinIOService documentService, IConfiguration configuration, - OrganizationCommonRepository organizationCommonRepository, + OrganizationCommonRepository organizationCommonRepository, IHttpContextAccessor httpContextAccessor, PermissionRepository permission, - DisciplineDbContext contextDiscipline) + DisciplineDbContext contextDiscipline, + RetireReportRepository service) { _repository = repository; _repositoryNoti = repositoryNoti; @@ -54,6 +57,7 @@ namespace BMA.EHR.Retirement.Service.Controllers _configuration = configuration; _permission = permission; _contextDiscipline = contextDiscipline; + _service = service; } #region " Properties " @@ -991,7 +995,7 @@ namespace BMA.EHR.Retirement.Service.Controllers }; var dataRaw = new RetirementRawProfile { - Order = profileRawCount+1, + Order = profileRawCount + 1, Remove = "ADD", RetirementPeriod = retire, CreatedFullName = FullName ?? "System Administrator", @@ -1042,7 +1046,7 @@ namespace BMA.EHR.Retirement.Service.Controllers data.posExecutiveId = org.result.posExecutiveId; data.posExecutiveName = org.result.posExecutiveName; data.posNo = org.result.posNo; - + dataRaw.profileId = org.result.profileId; dataRaw.prefix = org.result.prefix; dataRaw.firstName = org.result.firstName; @@ -1104,7 +1108,7 @@ namespace BMA.EHR.Retirement.Service.Controllers }; var dataRaw = new RetirementRawProfile { - Order = profileRawCount+1, + Order = profileRawCount + 1, Remove = "ADD", RetirementPeriod = retire, CreatedFullName = FullName ?? "System Administrator", @@ -2021,12 +2025,88 @@ namespace BMA.EHR.Retirement.Service.Controllers return Error("ไม่พบรอบประกาศเกษียณอายุราชการ"); var data = retirePeriodOfficer.RetirementRawProfiles - .Select(x => new { + .Select(x => new + { profileId = x.profileId }) .ToList(); return Success(data); } + + #region 31-ประกาศเกษียณข้าราชการ & 32-ประกาศเกษียณลูกจ้างประจำ + /// + /// 31-ประกาศเกษียณข้าราชการ & 32-ประกาศเกษียณลูกจ้างประจำ + /// + /// Id ของรอบเกษียณ + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("31/{exportType}/{Id}")] + public async Task> 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 } } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index 10a83322..5216110c 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -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-แบบฟอร์มหนังสือขอลาออกจากราชการ + /// + /// 33-แบบฟอร์มหนังสือขอลาออกจากราชการ + /// + /// id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("33/{exportType}/{id}")] + public async Task> 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 } } From 056a768ac933ffc0596c7681b56f12135a4806cb Mon Sep 17 00:00:00 2001 From: kittapath Date: Mon, 3 Feb 2025 17:18:50 +0700 Subject: [PATCH 10/12] report probation --- .../PlacementProbationController.cs | 404 ++++++++++++++++++ 1 file changed, 404 insertions(+) create mode 100644 BMA.EHR.Placement.Service/Controllers/PlacementProbationController.cs diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementProbationController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementProbationController.cs new file mode 100644 index 00000000..e88b302b --- /dev/null +++ b/BMA.EHR.Placement.Service/Controllers/PlacementProbationController.cs @@ -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-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ + /// + /// 13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ + /// + /// assign id แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("13/{exportType}/{id}")] + public async Task> 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-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล + /// + /// 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล + /// + /// evaluate id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("14/{exportType}/{id}")] + public async Task> 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-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา + /// + /// 15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา + /// + /// evaluate id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("15/{exportType}/{id}")] + public async Task> 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-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา + /// + /// 16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา + /// + /// evaluate id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("16/{exportType}/{id}")] + public async Task> 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-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ + /// + /// 17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ + /// + /// evaluate id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("17/{exportType}/{id}")] + public async Task> 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-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา + /// + /// 18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา + /// + /// assign id แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("18/{exportType}/{id}/{no}")] + public async Task> 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 + } +} From ce5f2e338928f261079ffe4a707eb609cd70a362 Mon Sep 17 00:00:00 2001 From: kittapath Date: Mon, 3 Feb 2025 17:22:27 +0700 Subject: [PATCH 11/12] report de retire --- .../RetirementDeceasedController.cs | 65 +++++++++++++++++-- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs index 9ebcf854..7f47b570 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs @@ -3,10 +3,6 @@ using BMA.EHR.Application.Repositories.MessageQueue; using BMA.EHR.Application.Repositories.Reports; using BMA.EHR.Application.Responses; 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.Shared; using BMA.EHR.Infrastructure.Persistence; @@ -18,10 +14,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Swashbuckle.AspNetCore.Annotations; using System.Net.Http.Headers; -using System.Reflection.Metadata; using System.Security.Claims; -using System.Security.Cryptography; -using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace BMA.EHR.Retirement.Service.Controllers { @@ -747,5 +740,63 @@ namespace BMA.EHR.Retirement.Service.Controllers return Success(); } + /// + /// 36-บันทึกเวียนแจ้งการถึงแก่กรรม + /// + /// Id รายการบันทึกเวียนแจ้งการถึงแก่กรรม + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("36/{exportType}/{id}")] + public async Task> 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; + } + } } } From 800a9a8f509a1b118811e33f7eb0adb656e0e3ee Mon Sep 17 00:00:00 2001 From: kittapath Date: Mon, 3 Feb 2025 17:30:53 +0700 Subject: [PATCH 12/12] candidate report --- .../Controllers/PlacementController.cs | 95 ++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 817aaa7d..9b2b3b88 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -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 ใบสมัคร + /// + /// ใบสมัคร + /// + /// Id ผู้สมัคร + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("candidate/{exportType}/{Id}")] + [AllowAnonymous] + public async Task> 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 } }