add authname
This commit is contained in:
parent
6a53a7f05e
commit
3727cef238
6 changed files with 1688 additions and 24 deletions
|
|
@ -473,6 +473,23 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = 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);
|
||||
import.AuthName = org.result.name == null ? "" : org.result.name;
|
||||
import.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||
}
|
||||
}
|
||||
|
||||
await _context.RecruitImports.AddAsync(import);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
@ -1401,22 +1418,6 @@ namespace BMA.EHR.Recruit.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>();
|
||||
|
||||
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue