แยกประเภทขรก
This commit is contained in:
parent
54661ffbcb
commit
5751ea57a4
3 changed files with 34 additions and 2 deletions
|
|
@ -246,6 +246,8 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
|
|
||||||
[Comment("หมายเหตุแนวนอน")]
|
[Comment("หมายเหตุแนวนอน")]
|
||||||
public string? RemarkHorizontal { get; set; }
|
public string? RemarkHorizontal { get; set; }
|
||||||
|
[Comment("profileId")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
public virtual List<PlacementCertificate> PlacementCertificates { get; set; } = new List<PlacementCertificate>();
|
public virtual List<PlacementCertificate> PlacementCertificates { get; set; } = new List<PlacementCertificate>();
|
||||||
public virtual List<PlacementEducation> PlacementEducations { get; set; } = new List<PlacementEducation>();
|
public virtual List<PlacementEducation> PlacementEducations { get; set; } = new List<PlacementEducation>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ using BMA.EHR.MetaData.Service.Models;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Recurit.Service.Data;
|
using BMA.EHR.Recurit.Service.Data;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BMA.EHR.Recruit.Service.Services
|
namespace BMA.EHR.Recruit.Service.Services
|
||||||
{
|
{
|
||||||
|
|
@ -19,16 +21,19 @@ namespace BMA.EHR.Recruit.Service.Services
|
||||||
private readonly MetadataDbContext _contextMetadata;
|
private readonly MetadataDbContext _contextMetadata;
|
||||||
private readonly MinIOService _minIOService;
|
private readonly MinIOService _minIOService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public RecruitService(ApplicationDbContext context,
|
public RecruitService(ApplicationDbContext context,
|
||||||
MetadataDbContext contextMetadata,
|
MetadataDbContext contextMetadata,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
MinIOService minIOService)
|
MinIOService minIOService,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_contextMetadata = contextMetadata;
|
_contextMetadata = contextMetadata;
|
||||||
_minIOService = minIOService;
|
_minIOService = minIOService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -36,6 +41,7 @@ namespace BMA.EHR.Recruit.Service.Services
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -204,6 +210,27 @@ namespace BMA.EHR.Recruit.Service.Services
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
foreach (var candidate in candidates)
|
foreach (var candidate in candidates)
|
||||||
{
|
{
|
||||||
|
var IsOfficer = false;
|
||||||
|
dynamic org = null;
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/citizenid/position/{candidate.CitizenId}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
{
|
||||||
|
IsOfficer = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsOfficer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
var Address = candidate.Addresses.FirstOrDefault() == null ? null : $"{candidate.Addresses.FirstOrDefault().Address}";
|
var Address = candidate.Addresses.FirstOrDefault() == null ? null : $"{candidate.Addresses.FirstOrDefault().Address}";
|
||||||
var Moo = candidate.Addresses.FirstOrDefault() == null ? null : $" หมู่ {candidate.Addresses.FirstOrDefault().Moo}";
|
var Moo = candidate.Addresses.FirstOrDefault() == null ? null : $" หมู่ {candidate.Addresses.FirstOrDefault().Moo}";
|
||||||
var Soi = candidate.Addresses.FirstOrDefault() == null ? null : $" ซอย {candidate.Addresses.FirstOrDefault().Soi}";
|
var Soi = candidate.Addresses.FirstOrDefault() == null ? null : $" ซอย {candidate.Addresses.FirstOrDefault().Soi}";
|
||||||
|
|
@ -308,6 +335,8 @@ namespace BMA.EHR.Recruit.Service.Services
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdateFullName = FullName ?? "",
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
IsOfficer = IsOfficer,
|
||||||
|
profileId = org == null || org.result == null ? null : org.result.profileId,
|
||||||
};
|
};
|
||||||
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
|
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,5 +31,6 @@
|
||||||
"AccessKey": "ZQOGEjHxDesiVIHR",
|
"AccessKey": "ZQOGEjHxDesiVIHR",
|
||||||
"SecretKey": "vKTpcxY0Wjjp775aDwNn1q6VWJu8EFb6",
|
"SecretKey": "vKTpcxY0Wjjp775aDwNn1q6VWJu8EFb6",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
},
|
||||||
|
"API": "https://bma-ehr.frappet.synology.me/api/v1/"
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue