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>();
|
||||
|
||||
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
|
||||
|
|
|
|||
1601
Migrations/20250915084717_update_table_period_add_authname.Designer.cs
generated
Normal file
1601
Migrations/20250915084717_update_table_period_add_authname.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,62 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Recruit.Service.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class update_table_period_add_authname : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthName",
|
||||
table: "Recruits");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthPosition",
|
||||
table: "Recruits");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthName",
|
||||
table: "RecruitImports",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthPosition",
|
||||
table: "RecruitImports",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthName",
|
||||
table: "RecruitImports");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthPosition",
|
||||
table: "RecruitImports");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthName",
|
||||
table: "Recruits",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthPosition",
|
||||
table: "Recruits",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,12 +65,6 @@ namespace BMA.EHR.Recruit.Service.Migrations
|
|||
b.Property<DateTime>("ApplyDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("AuthName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("AuthPosition")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("CitizenCardExpireDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
|
|
@ -631,6 +625,12 @@ namespace BMA.EHR.Recruit.Service.Migrations
|
|||
.HasColumnOrder(6)
|
||||
.HasComment("วันเริ่มประกาศ");
|
||||
|
||||
b.Property<string>("AuthName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("AuthPosition")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ namespace BMA.EHR.Recruit.Service.Models.Recruits
|
|||
public string? PositionName { get; set; }
|
||||
public string? PositionType { get; set; }
|
||||
public string? PositionLevel { get; set; }
|
||||
public string? AuthName { get; set; }
|
||||
public string? AuthPosition { get; set; }
|
||||
|
||||
[Comment("บัญชีสอบ")]
|
||||
public string? HddPosition { get; set; } = string.Empty;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ namespace BMA.EHR.Recruit.Service.Models.Recruits
|
|||
public List<Recruit> Recruits { get; set; } = new List<Recruit>();
|
||||
|
||||
public ScoreImport ScoreImport { get; set; }
|
||||
public string? AuthName { get; set; }
|
||||
public string? AuthPosition { get; set; }
|
||||
|
||||
public List<RecruitImportHistory> ImportHostories { get; set; } = new List<RecruitImportHistory>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue