add position
This commit is contained in:
parent
5fe786fe7b
commit
37dfac7cff
5 changed files with 1619 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ using Sentry;
|
|||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.WebSockets;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
|
@ -50,6 +51,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
private readonly PermissionRepository _permission;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly ILogger<RecruitController> _logger;
|
||||
private readonly IConfiguration _configuration;
|
||||
//private readonly DateTimeExtension;
|
||||
|
||||
#endregion
|
||||
|
|
@ -63,6 +65,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
RecruitService recruitService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
ILogger<RecruitController> logger,
|
||||
IConfiguration configuration,
|
||||
PermissionRepository permission
|
||||
//DateTimeExtension extensions
|
||||
)
|
||||
|
|
@ -73,6 +76,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
_webHostEnvironment = webHostEnvironment;
|
||||
_recruitService = recruitService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
_permission = permission;
|
||||
//_extensions = extensions;
|
||||
|
|
@ -85,6 +89,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -1308,6 +1313,26 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
|
||||
imported.Scores.Add(r);
|
||||
row++;
|
||||
var recruit = await _context.Recruits.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.RecruitImport == rec_import && x.ExamId == r.ExamId);
|
||||
if (recruit != null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1546
Migrations/20250218054142_update table Recruit add AuthName.Designer.cs
generated
Normal file
1546
Migrations/20250218054142_update table Recruit add AuthName.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,40 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Recruit.Service.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableRecruitaddAuthName : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthName",
|
||||
table: "Recruits");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthPosition",
|
||||
table: "Recruits");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,6 +65,12 @@ 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)");
|
||||
|
||||
|
|
|
|||
|
|
@ -79,5 +79,7 @@ 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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue