api report ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลาแล้ว #1778
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
Bright 2025-08-25 20:13:31 +07:00
parent 2d9f546023
commit 75ddebba37
5 changed files with 139 additions and 2 deletions

View file

@ -18,6 +18,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Globalization;
using System.Net;
using System.Net.Http.Headers;
@ -1114,6 +1115,60 @@ namespace BMA.EHR.Application.Repositories.Reports
return s_data;
}
public async Task<dynamic> GeInsigniaRequestProfiles(Guid id)
{
var profile = await _dbContext.Set<InsigniaRequestProfile>()
.Where(x => x.Id == id)
.Select(x => new
{
Fullname = $"{x.Prefix}{x.FirstName} {x.LastName}",
Position = x.Position ?? "",
Oc = (x.Child4 == null ? "" : x.Child4 + " ") +
(x.Child3 == null ? "" : x.Child3 + " ") +
(x.Child2 == null ? "" : x.Child2 + " ") +
(x.Child1 == null ? "" : x.Child1 + " ") +
(x.Root == null ? "" : x.Root),
BirthDate = x.BirthDate == null ? "" : x.BirthDate.Value.ToThaiShortDate().ToString().ToThaiNumber(),
DateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate().ToString().ToThaiNumber(),
ProfileId = x.ProfileId
})
.FirstOrDefaultAsync();
if (profile == null)
throw new Exception(GlobalMessages.DataNotFound);
var profileSalarys = await _userProfileRepository.GetProfileSalaryById(profile.ProfileId, AccessToken);
var salarys = profileSalarys.Select(x => new
{
DateAffect = x.DateAffect == null ? "" : x.DateAffect.ToThaiShortDate().ToString().ToThaiNumber(),
Position = x.Position ?? "",
Root = x.Root,
Child1 = x.Child1,
Child2 = x.Child2,
Child3 = x.Child3,
Child4 = x.Child4,
Oc = (x.Child4 == null ? "" : x.Child4 + " ") +
(x.Child3 == null ? "" : x.Child3 + " ") +
(x.Child2 == null ? "" : x.Child2 + " ") +
(x.Child1 == null ? "" : x.Child1 + " ") +
(x.Root == null ? "" : x.Root),
Age = x.Age == null ? "" : x.Age.ToString().ToThaiNumber(),
Amount = x.Amount == null ? "" : x.Amount.ToString("N0", new CultureInfo("th-TH")).ToThaiNumber(),
Remark = x.Remark == null ? "" : x.Remark.ToThaiNumber(),
}).ToList();
var result = new
{
profile.Fullname,
profile.Position,
profile.Oc,
profile.BirthDate,
profile.DateAppoint,
Salarys = salarys
};
return result;
}
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
{