test
This commit is contained in:
parent
2b0151fd67
commit
52f3d6e786
2 changed files with 27 additions and 11 deletions
|
|
@ -2,15 +2,15 @@
|
||||||
{
|
{
|
||||||
public class RecruitPosRequest
|
public class RecruitPosRequest
|
||||||
{
|
{
|
||||||
public RecruitPosTypeRequest result { get; set; } = new();
|
public List<RecruitPosLevelRequest> result { get; set; } = new();
|
||||||
}
|
|
||||||
public class RecruitPosTypeRequest
|
|
||||||
{
|
|
||||||
public string posTypeName { get; set; }
|
|
||||||
public List<RecruitPosLevelRequest> posLevels { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
public class RecruitPosLevelRequest
|
public class RecruitPosLevelRequest
|
||||||
{
|
{
|
||||||
public string posLevelName { get; set; }
|
public string posLevelName { get; set; }
|
||||||
|
public RecruitPosLevelRequest posTypes { get; set; } = new();
|
||||||
|
}
|
||||||
|
public class RecruitPosTypeRequest
|
||||||
|
{
|
||||||
|
public string posTypeName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -184,9 +184,9 @@ namespace BMA.EHR.Recruit.Service.Services
|
||||||
var httpClient1 = new HttpClient();
|
var httpClient1 = new HttpClient();
|
||||||
httpClient1.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token?.Replace("Bearer ", ""));
|
httpClient1.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token?.Replace("Bearer ", ""));
|
||||||
httpClient1.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
httpClient1.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
var apiUrl1 = $"{_configuration["API"]}/api/v1/org/pos/type";
|
var apiUrl1 = $"{_configuration["API"]}/api/v1/org/pos/level";
|
||||||
var response1 = await httpClient1.GetStringAsync(apiUrl1);
|
var response1 = await httpClient1.GetStringAsync(apiUrl1);
|
||||||
var posType = JsonConvert.DeserializeObject<RecruitPosTypeRequest>(response1);
|
var posOptions = JsonConvert.DeserializeObject<RecruitPosRequest>(response1);
|
||||||
|
|
||||||
var recruitImport = await _context.RecruitImports.AsQueryable()
|
var recruitImport = await _context.RecruitImports.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == examId);
|
.FirstOrDefaultAsync(x => x.Id == examId);
|
||||||
|
|
@ -294,12 +294,28 @@ namespace BMA.EHR.Recruit.Service.Services
|
||||||
var registAddress = BuildAddress(firstAddress?.Address, firstAddress?.Moo, firstAddress?.Soi, firstAddress?.Road);
|
var registAddress = BuildAddress(firstAddress?.Address, firstAddress?.Moo, firstAddress?.Soi, firstAddress?.Road);
|
||||||
var currentAddress = BuildAddress(firstAddress?.Address1, firstAddress?.Moo1, firstAddress?.Soi1, firstAddress?.Road1);
|
var currentAddress = BuildAddress(firstAddress?.Address1, firstAddress?.Moo1, firstAddress?.Soi1, firstAddress?.Road1);
|
||||||
|
|
||||||
|
// หาค่า posLevelName หลังสุด
|
||||||
|
var posLevelObject = posOptions?.result?.FirstOrDefault(x =>
|
||||||
|
!string.IsNullOrWhiteSpace(x.posLevelName) &&
|
||||||
|
!string.IsNullOrWhiteSpace(candidate.PositionName) &&
|
||||||
|
candidate.PositionName.Contains(x.posLevelName));
|
||||||
|
|
||||||
|
// เก็บเฉพาะค่า posLevelName
|
||||||
|
var posLevelName = posLevelObject?.posLevelName;
|
||||||
|
|
||||||
|
// สร้างตัวแปร PositionName ที่ตัดค่า posLevelName ออก
|
||||||
|
var positionNameWithoutLevel = candidate.PositionName ?? "";
|
||||||
|
if (!string.IsNullOrWhiteSpace(posLevelName))
|
||||||
|
{
|
||||||
|
positionNameWithoutLevel = positionNameWithoutLevel.Replace(posLevelName, "").Trim();
|
||||||
|
}
|
||||||
|
|
||||||
var placementProfile = new PlacementProfile
|
var placementProfile = new PlacementProfile
|
||||||
{
|
{
|
||||||
Placement = placement,
|
Placement = placement,
|
||||||
PositionCandidate = candidate.PositionName ?? "",
|
PositionCandidate = positionNameWithoutLevel,
|
||||||
PositionType = candidate.PositionType ?? "",
|
PositionType = posLevelObject?.posTypes?.posLevelName ?? "",
|
||||||
PositionLevel = candidate.PositionLevel ?? "",
|
PositionLevel = posLevelName ?? "",
|
||||||
Prefix = candidate.Prefix ?? "",
|
Prefix = candidate.Prefix ?? "",
|
||||||
Firstname = candidate.FirstName ?? "",
|
Firstname = candidate.FirstName ?? "",
|
||||||
Lastname = candidate.LastName ?? "",
|
Lastname = candidate.LastName ?? "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue