api report ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลาแล้ว #1778
Some checks failed
release-dev / release-dev (push) Failing after 11s
Some checks failed
release-dev / release-dev (push) Failing after 11s
This commit is contained in:
parent
2d9f546023
commit
75ddebba37
5 changed files with 139 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Globalization;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
|
|
@ -1114,6 +1115,60 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
return s_data;
|
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 ปี
|
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
||||||
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1246,6 +1246,31 @@ namespace BMA.EHR.Application.Repositories
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async Task<List<GetProfileSalaryDto>> GetProfileSalaryById(Guid profileId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/profile/insignia/position";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
var body = new
|
||||||
|
{
|
||||||
|
profileId = profileId.ToString(),
|
||||||
|
};
|
||||||
|
var apiResult = await PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileSalaryResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetProfileSalaryDto
|
||||||
|
{
|
||||||
|
public DateTime DateAffect { get; set; }
|
||||||
|
public string Position { get; set; } = string.Empty;
|
||||||
|
public string Root { get; set; } = string.Empty;
|
||||||
|
public string Child1 { get; set; } = string.Empty;
|
||||||
|
public string Child2 { get; set; } = string.Empty;
|
||||||
|
public string Child3 { get; set; } = string.Empty;
|
||||||
|
public string Child4 { get; set; } = string.Empty;
|
||||||
|
public int Age { get; set; } = 0;
|
||||||
|
public int Amount { get; set; } = 0;
|
||||||
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
{
|
||||||
|
public class GetProfileSalaryResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public List<GetProfileSalaryDto> Result { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -587,7 +587,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region รายงานสถิติการได้รับเครื่องราชอิสริยาภรณ์ข้าราชการ ฯ
|
#region รายงานสถิติการได้รับเครื่องราชอิสริยาภรณ์ข้าราชการ ฯ
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// รายงานสถิติการได้รับเครื่องราชอิสริยาภรณ์ข้าราชการ ฯ
|
/// รายงานสถิติการได้รับเครื่องราชอิสริยาภรณ์ข้าราชการ ฯ
|
||||||
|
|
@ -688,7 +687,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region รายงานผลการจ่ายประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์ แยกรายหน่วยงาน
|
#region รายงานผลการจ่ายประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์ แยกรายหน่วยงาน
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// รายงานผลการจ่ายประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์ แยกรายหน่วยงาน
|
/// รายงานผลการจ่ายประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์ แยกรายหน่วยงาน
|
||||||
|
|
@ -833,5 +831,37 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา
|
||||||
|
/// <summary>
|
||||||
|
/// ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">id </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report8/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetInsigniaReport8Async(Guid id)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _repository.GeInsigniaRequestProfiles(id);
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "reportInsignia8",
|
||||||
|
reportName = "reportInsignia8",
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue