add authname
This commit is contained in:
parent
579d82a9df
commit
c1fcb04421
7 changed files with 3225 additions and 26 deletions
|
|
@ -493,6 +493,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
};
|
||||
|
||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||
periodExam.AuthName = org.result.name == null ? "" : org.result.name;
|
||||
periodExam.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||
}
|
||||
}
|
||||
|
||||
await _context.PeriodExams.AddAsync(periodExam);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
@ -1594,22 +1611,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
// ใช้ dictionary lookup แทน query DB ทีละรอบ
|
||||
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
|
||||
{
|
||||
// var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
// var _res = await client.SendAsync(_req);
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
// var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||
// recruit.AuthName = org.result.name == null ? "" : org.result.name;
|
||||
// recruit.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||
// }
|
||||
// }
|
||||
|
||||
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>();
|
||||
|
||||
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
ExamResult = sr == null ? "" : sr.ExamStatus,
|
||||
EndDate = p.PeriodExam.RegisterEndDate == null ? null : p.PeriodExam.RegisterEndDate.Value.ToThaiFullDate3(),
|
||||
AuthName = "นายณัฐพงศ์ ดิษยบุตร",
|
||||
AuthPosition = "หัวหน้าสำนักงาน ก.ก."
|
||||
AuthName = p.PeriodExam.AuthName,
|
||||
AuthPosition = p.PeriodExam.AuthPosition,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue