no message
This commit is contained in:
parent
5e4394fd33
commit
b0765fa2ca
2 changed files with 277 additions and 251 deletions
|
|
@ -143,259 +143,261 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PlacementAdmin == true)
|
|
||||||
|
var rootId = "";
|
||||||
|
var child1Id = "";
|
||||||
|
var child2Id = "";
|
||||||
|
var child3Id = "";
|
||||||
|
var child4Id = "";
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position-act";
|
||||||
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
var data = await _context.PlacementProfiles.Where(x => x.Placement.Id == examId).Select(x => new
|
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)
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
var org = JsonConvert.DeserializeObject<OrgRequestAct>(_result);
|
||||||
PersonalId = x.Id,
|
if (org.result.isOfficer == false)
|
||||||
x.profileId,
|
|
||||||
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
|
||||||
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
|
|
||||||
Prefix = x.Prefix,
|
|
||||||
Firstname = x.Firstname,
|
|
||||||
Lastname = x.Lastname,
|
|
||||||
IdCard = x.CitizenId,
|
|
||||||
CitizenId = x.CitizenId,
|
|
||||||
ExamNumber = x.ExamNumber,
|
|
||||||
posmasterId = x.posmasterId,
|
|
||||||
root = x.root,
|
|
||||||
rootId = x.rootId,
|
|
||||||
rootShortName = x.rootShortName,
|
|
||||||
child1 = x.child1,
|
|
||||||
child1Id = x.child1Id,
|
|
||||||
child1ShortName = x.child1ShortName,
|
|
||||||
child2 = x.child2,
|
|
||||||
child2Id = x.child2Id,
|
|
||||||
child2ShortName = x.child2ShortName,
|
|
||||||
child3 = x.child3,
|
|
||||||
child3Id = x.child3Id,
|
|
||||||
child3ShortName = x.child3ShortName,
|
|
||||||
child4 = x.child4,
|
|
||||||
child4Id = x.child4Id,
|
|
||||||
child4ShortName = x.child4ShortName,
|
|
||||||
orgRevisionId = x.orgRevisionId,
|
|
||||||
positionId = x.positionId,
|
|
||||||
posMasterNo = x.posMasterNo,
|
|
||||||
positionName = x.positionName,
|
|
||||||
positionField = x.positionField,
|
|
||||||
posTypeId = x.posTypeId,
|
|
||||||
posTypeName = x.posTypeName,
|
|
||||||
posLevelId = x.posLevelId,
|
|
||||||
posLevelName = x.posLevelName,
|
|
||||||
PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
|
|
||||||
PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
|
|
||||||
ReportingDate = x.ReportingDate,
|
|
||||||
StatusId = x.PlacementStatus,
|
|
||||||
Draft = x.Draft,
|
|
||||||
typeCommand = x.typeCommand,
|
|
||||||
IsOfficer = x.IsOfficer,
|
|
||||||
IsRelief = x.IsRelief,
|
|
||||||
posLevelCandidateId = x.posLevelIdOld != null ? Guid.Parse(x.posLevelIdOld) : (x.PositionLevel == null ? (Guid?)null : x.PositionLevel.Id),
|
|
||||||
posTypeCandidateId = x.posTypeIdOld != null ? Guid.Parse(x.posTypeIdOld) : (x.PositionType == null ? (Guid?)null : x.PositionType.Id),
|
|
||||||
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
|
||||||
|
|
||||||
var result = new List<dynamic>();
|
|
||||||
foreach (var p in data)
|
|
||||||
{
|
|
||||||
var _data = new
|
|
||||||
{
|
{
|
||||||
p.Id,
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
p.PersonalId,
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
p.FullName,
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
p.Prefix,
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
p.Firstname,
|
var data1 = await _context.PlacementProfiles
|
||||||
p.Lastname,
|
.Where(x => x.Placement.Id == examId)
|
||||||
p.IdCard,
|
.Where(x => x.Draft == true)
|
||||||
p.CitizenId,
|
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id)))))
|
||||||
p.profileId,
|
.Select(x => new
|
||||||
p.ExamNumber,
|
|
||||||
p.posmasterId,
|
|
||||||
p.root,
|
|
||||||
p.rootId,
|
|
||||||
p.rootShortName,
|
|
||||||
p.child1,
|
|
||||||
p.child1Id,
|
|
||||||
p.child1ShortName,
|
|
||||||
p.child2,
|
|
||||||
p.child2Id,
|
|
||||||
p.child2ShortName,
|
|
||||||
p.child3,
|
|
||||||
p.child3Id,
|
|
||||||
p.child3ShortName,
|
|
||||||
p.child4,
|
|
||||||
p.child4Id,
|
|
||||||
p.child4ShortName,
|
|
||||||
node = p.root == null ? (int?)null : (p.child1 == null ? 0 : (p.child2 == null ? 1 : (p.child3 == null ? 2 : (p.child4 == null ? 3 : 4)))),
|
|
||||||
nodeName = p.root == null ? null : (p.child1 == null ? p.root : (p.child2 == null ? p.child1 : (p.child3 == null ? p.child2 : (p.child4 == null ? p.child3 : p.child4)))),
|
|
||||||
nodeId = p.rootId == null ? null : (p.child1Id == null ? p.rootId : (p.child2Id == null ? p.child1Id : (p.child3Id == null ? p.child2Id : (p.child4Id == null ? p.child3Id : p.child4Id)))),
|
|
||||||
nodeShortName = p.rootShortName == null ? null : (p.child1ShortName == null ? p.rootShortName : (p.child2ShortName == null ? p.child1ShortName : (p.child3ShortName == null ? p.child2ShortName : (p.child4ShortName == null ? p.child3ShortName : p.child4ShortName)))),
|
|
||||||
p.orgRevisionId,
|
|
||||||
p.positionId,
|
|
||||||
p.posMasterNo,
|
|
||||||
p.positionName,
|
|
||||||
p.positionField,
|
|
||||||
p.posTypeId,
|
|
||||||
p.posTypeName,
|
|
||||||
p.posLevelId,
|
|
||||||
p.posLevelName,
|
|
||||||
p.PositionCandidate,
|
|
||||||
p.PositionCandidateId,
|
|
||||||
p.ReportingDate,
|
|
||||||
BmaOfficer = p.IsOfficer == true ? "OFFICER" : null,
|
|
||||||
p.StatusId,
|
|
||||||
p.Draft,
|
|
||||||
p.typeCommand,
|
|
||||||
p.IsRelief,
|
|
||||||
p.posLevelCandidateId,
|
|
||||||
p.posTypeCandidateId,
|
|
||||||
};
|
|
||||||
result.Add(_data);
|
|
||||||
}
|
|
||||||
return Success(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var rootId = "";
|
|
||||||
var child1Id = "";
|
|
||||||
var child2Id = "";
|
|
||||||
var child3Id = "";
|
|
||||||
var child4Id = "";
|
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
|
||||||
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();
|
|
||||||
|
|
||||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
|
||||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
|
||||||
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
|
||||||
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
|
||||||
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
|
||||||
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
|
||||||
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
|
||||||
// return Success(new {rootId=rootId,child1Id=child1Id,child2Id=child2Id,child3Id=child3Id,child4Id=child4Id });
|
|
||||||
var data = await _context.PlacementProfiles
|
|
||||||
.Where(x => x.Placement.Id == examId)
|
|
||||||
.Where(x => x.Draft == true)
|
|
||||||
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id)))))
|
|
||||||
.Select(x => new
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
PersonalId = x.Id,
|
|
||||||
x.profileId,
|
|
||||||
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
|
||||||
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
|
|
||||||
Prefix = x.Prefix,
|
|
||||||
Firstname = x.Firstname,
|
|
||||||
Lastname = x.Lastname,
|
|
||||||
IdCard = x.CitizenId,
|
|
||||||
CitizenId = x.CitizenId,
|
|
||||||
ExamNumber = x.ExamNumber,
|
|
||||||
posmasterId = x.posmasterId,
|
|
||||||
root = x.root,
|
|
||||||
rootId = x.rootId,
|
|
||||||
rootShortName = x.rootShortName,
|
|
||||||
child1 = x.child1,
|
|
||||||
child1Id = x.child1Id,
|
|
||||||
child1ShortName = x.child1ShortName,
|
|
||||||
child2 = x.child2,
|
|
||||||
child2Id = x.child2Id,
|
|
||||||
child2ShortName = x.child2ShortName,
|
|
||||||
child3 = x.child3,
|
|
||||||
child3Id = x.child3Id,
|
|
||||||
child3ShortName = x.child3ShortName,
|
|
||||||
child4 = x.child4,
|
|
||||||
child4Id = x.child4Id,
|
|
||||||
child4ShortName = x.child4ShortName,
|
|
||||||
orgRevisionId = x.orgRevisionId,
|
|
||||||
positionId = x.positionId,
|
|
||||||
posMasterNo = x.posMasterNo,
|
|
||||||
positionName = x.positionName,
|
|
||||||
positionField = x.positionField,
|
|
||||||
posTypeId = x.posTypeId,
|
|
||||||
posTypeName = x.posTypeName,
|
|
||||||
posLevelId = x.posLevelId,
|
|
||||||
posLevelName = x.posLevelName,
|
|
||||||
PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
|
|
||||||
PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
|
|
||||||
ReportingDate = x.ReportingDate,
|
|
||||||
StatusId = x.PlacementStatus,
|
|
||||||
Draft = x.Draft,
|
|
||||||
typeCommand = x.typeCommand,
|
|
||||||
IsOfficer = x.IsOfficer,
|
|
||||||
IsRelief = x.IsRelief,
|
|
||||||
posLevelCandidateId = x.PositionLevel == null ? (Guid?)null : x.PositionLevel.Id,
|
|
||||||
posTypeCandidateId = x.PositionType == null ? (Guid?)null : x.PositionType.Id,
|
|
||||||
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
|
||||||
|
|
||||||
var result = new List<dynamic>();
|
|
||||||
foreach (var p in data)
|
|
||||||
{
|
|
||||||
var _data = new
|
|
||||||
{
|
{
|
||||||
p.Id,
|
Id = x.Id,
|
||||||
p.PersonalId,
|
PersonalId = x.Id,
|
||||||
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
x.profileId,
|
||||||
p.FullName,
|
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
||||||
p.Prefix,
|
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
|
||||||
p.Firstname,
|
Prefix = x.Prefix,
|
||||||
p.Lastname,
|
Firstname = x.Firstname,
|
||||||
p.IdCard,
|
Lastname = x.Lastname,
|
||||||
p.CitizenId,
|
IdCard = x.CitizenId,
|
||||||
p.profileId,
|
CitizenId = x.CitizenId,
|
||||||
p.ExamNumber,
|
ExamNumber = x.ExamNumber,
|
||||||
p.posmasterId,
|
posmasterId = x.posmasterId,
|
||||||
p.root,
|
root = x.root,
|
||||||
p.rootId,
|
rootId = x.rootId,
|
||||||
p.rootShortName,
|
rootShortName = x.rootShortName,
|
||||||
p.child1,
|
child1 = x.child1,
|
||||||
p.child1Id,
|
child1Id = x.child1Id,
|
||||||
p.child1ShortName,
|
child1ShortName = x.child1ShortName,
|
||||||
p.child2,
|
child2 = x.child2,
|
||||||
p.child2Id,
|
child2Id = x.child2Id,
|
||||||
p.child2ShortName,
|
child2ShortName = x.child2ShortName,
|
||||||
p.child3,
|
child3 = x.child3,
|
||||||
p.child3Id,
|
child3Id = x.child3Id,
|
||||||
p.child3ShortName,
|
child3ShortName = x.child3ShortName,
|
||||||
p.child4,
|
child4 = x.child4,
|
||||||
p.child4Id,
|
child4Id = x.child4Id,
|
||||||
p.child4ShortName,
|
child4ShortName = x.child4ShortName,
|
||||||
node = p.root == null ? (int?)null : (p.child1 == null ? 0 : (p.child2 == null ? 1 : (p.child3 == null ? 2 : (p.child4 == null ? 3 : 4)))),
|
orgRevisionId = x.orgRevisionId,
|
||||||
nodeName = p.root == null ? null : (p.child1 == null ? p.root : (p.child2 == null ? p.child1 : (p.child3 == null ? p.child2 : (p.child4 == null ? p.child3 : p.child4)))),
|
positionId = x.positionId,
|
||||||
nodeId = p.rootId == null ? null : (p.child1Id == null ? p.rootId : (p.child2Id == null ? p.child1Id : (p.child3Id == null ? p.child2Id : (p.child4Id == null ? p.child3Id : p.child4Id)))),
|
posMasterNo = x.posMasterNo,
|
||||||
nodeShortName = p.rootShortName == null ? null : (p.child1ShortName == null ? p.rootShortName : (p.child2ShortName == null ? p.child1ShortName : (p.child3ShortName == null ? p.child2ShortName : (p.child4ShortName == null ? p.child3ShortName : p.child4ShortName)))),
|
positionName = x.positionName,
|
||||||
p.orgRevisionId,
|
positionField = x.positionField,
|
||||||
p.positionId,
|
posTypeId = x.posTypeId,
|
||||||
p.posMasterNo,
|
posTypeName = x.posTypeName,
|
||||||
p.positionName,
|
posLevelId = x.posLevelId,
|
||||||
p.positionField,
|
posLevelName = x.posLevelName,
|
||||||
p.posTypeId,
|
PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
|
||||||
p.posTypeName,
|
PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
|
||||||
p.posLevelId,
|
ReportingDate = x.ReportingDate,
|
||||||
p.posLevelName,
|
StatusId = x.PlacementStatus,
|
||||||
p.PositionCandidate,
|
Draft = x.Draft,
|
||||||
p.PositionCandidateId,
|
typeCommand = x.typeCommand,
|
||||||
p.ReportingDate,
|
IsOfficer = x.IsOfficer,
|
||||||
BmaOfficer = p.IsOfficer == true ? "OFFICER" : null,
|
IsRelief = x.IsRelief,
|
||||||
p.StatusId,
|
posLevelCandidateId = x.PositionLevel == null ? (Guid?)null : x.PositionLevel.Id,
|
||||||
p.Draft,
|
posTypeCandidateId = x.PositionType == null ? (Guid?)null : x.PositionType.Id,
|
||||||
p.typeCommand,
|
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
||||||
p.IsRelief,
|
|
||||||
p.posLevelCandidateId,
|
var result1 = new List<dynamic>();
|
||||||
p.posTypeCandidateId,
|
foreach (var p in data1)
|
||||||
};
|
{
|
||||||
result.Add(_data);
|
var _data1 = new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.PersonalId,
|
||||||
|
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
||||||
|
p.FullName,
|
||||||
|
p.Prefix,
|
||||||
|
p.Firstname,
|
||||||
|
p.Lastname,
|
||||||
|
p.IdCard,
|
||||||
|
p.CitizenId,
|
||||||
|
p.profileId,
|
||||||
|
p.ExamNumber,
|
||||||
|
p.posmasterId,
|
||||||
|
p.root,
|
||||||
|
p.rootId,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1Id,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2Id,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3Id,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4Id,
|
||||||
|
p.child4ShortName,
|
||||||
|
node = p.root == null ? (int?)null : (p.child1 == null ? 0 : (p.child2 == null ? 1 : (p.child3 == null ? 2 : (p.child4 == null ? 3 : 4)))),
|
||||||
|
nodeName = p.root == null ? null : (p.child1 == null ? p.root : (p.child2 == null ? p.child1 : (p.child3 == null ? p.child2 : (p.child4 == null ? p.child3 : p.child4)))),
|
||||||
|
nodeId = p.rootId == null ? null : (p.child1Id == null ? p.rootId : (p.child2Id == null ? p.child1Id : (p.child3Id == null ? p.child2Id : (p.child4Id == null ? p.child3Id : p.child4Id)))),
|
||||||
|
nodeShortName = p.rootShortName == null ? null : (p.child1ShortName == null ? p.rootShortName : (p.child2ShortName == null ? p.child1ShortName : (p.child3ShortName == null ? p.child2ShortName : (p.child4ShortName == null ? p.child3ShortName : p.child4ShortName)))),
|
||||||
|
p.orgRevisionId,
|
||||||
|
p.positionId,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.positionField,
|
||||||
|
p.posTypeId,
|
||||||
|
p.posTypeName,
|
||||||
|
p.posLevelId,
|
||||||
|
p.posLevelName,
|
||||||
|
p.PositionCandidate,
|
||||||
|
p.PositionCandidateId,
|
||||||
|
p.ReportingDate,
|
||||||
|
BmaOfficer = p.IsOfficer == true ? "OFFICER" : null,
|
||||||
|
p.StatusId,
|
||||||
|
p.Draft,
|
||||||
|
p.typeCommand,
|
||||||
|
p.IsRelief,
|
||||||
|
p.posLevelCandidateId,
|
||||||
|
p.posTypeCandidateId,
|
||||||
|
};
|
||||||
|
result1.Add(_data1);
|
||||||
|
}
|
||||||
|
return Success(result1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
var data = await _context.PlacementProfiles.Where(x => x.Placement.Id == examId).Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
PersonalId = x.Id,
|
||||||
|
x.profileId,
|
||||||
|
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
||||||
|
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
|
||||||
|
Prefix = x.Prefix,
|
||||||
|
Firstname = x.Firstname,
|
||||||
|
Lastname = x.Lastname,
|
||||||
|
IdCard = x.CitizenId,
|
||||||
|
CitizenId = x.CitizenId,
|
||||||
|
ExamNumber = x.ExamNumber,
|
||||||
|
posmasterId = x.posmasterId,
|
||||||
|
root = x.root,
|
||||||
|
rootId = x.rootId,
|
||||||
|
rootShortName = x.rootShortName,
|
||||||
|
child1 = x.child1,
|
||||||
|
child1Id = x.child1Id,
|
||||||
|
child1ShortName = x.child1ShortName,
|
||||||
|
child2 = x.child2,
|
||||||
|
child2Id = x.child2Id,
|
||||||
|
child2ShortName = x.child2ShortName,
|
||||||
|
child3 = x.child3,
|
||||||
|
child3Id = x.child3Id,
|
||||||
|
child3ShortName = x.child3ShortName,
|
||||||
|
child4 = x.child4,
|
||||||
|
child4Id = x.child4Id,
|
||||||
|
child4ShortName = x.child4ShortName,
|
||||||
|
orgRevisionId = x.orgRevisionId,
|
||||||
|
positionId = x.positionId,
|
||||||
|
posMasterNo = x.posMasterNo,
|
||||||
|
positionName = x.positionName,
|
||||||
|
positionField = x.positionField,
|
||||||
|
posTypeId = x.posTypeId,
|
||||||
|
posTypeName = x.posTypeName,
|
||||||
|
posLevelId = x.posLevelId,
|
||||||
|
posLevelName = x.posLevelName,
|
||||||
|
PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
|
||||||
|
PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
|
||||||
|
ReportingDate = x.ReportingDate,
|
||||||
|
StatusId = x.PlacementStatus,
|
||||||
|
Draft = x.Draft,
|
||||||
|
typeCommand = x.typeCommand,
|
||||||
|
IsOfficer = x.IsOfficer,
|
||||||
|
IsRelief = x.IsRelief,
|
||||||
|
posLevelCandidateId = x.posLevelIdOld != null ? Guid.Parse(x.posLevelIdOld) : (x.PositionLevel == null ? (Guid?)null : x.PositionLevel.Id),
|
||||||
|
posTypeCandidateId = x.posTypeIdOld != null ? Guid.Parse(x.posTypeIdOld) : (x.PositionType == null ? (Guid?)null : x.PositionType.Id),
|
||||||
|
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
||||||
|
|
||||||
|
var result = new List<dynamic>();
|
||||||
|
foreach (var p in data)
|
||||||
|
{
|
||||||
|
var _data = new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.PersonalId,
|
||||||
|
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
||||||
|
p.FullName,
|
||||||
|
p.Prefix,
|
||||||
|
p.Firstname,
|
||||||
|
p.Lastname,
|
||||||
|
p.IdCard,
|
||||||
|
p.CitizenId,
|
||||||
|
p.profileId,
|
||||||
|
p.ExamNumber,
|
||||||
|
p.posmasterId,
|
||||||
|
p.root,
|
||||||
|
p.rootId,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1Id,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2Id,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3Id,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4Id,
|
||||||
|
p.child4ShortName,
|
||||||
|
node = p.root == null ? (int?)null : (p.child1 == null ? 0 : (p.child2 == null ? 1 : (p.child3 == null ? 2 : (p.child4 == null ? 3 : 4)))),
|
||||||
|
nodeName = p.root == null ? null : (p.child1 == null ? p.root : (p.child2 == null ? p.child1 : (p.child3 == null ? p.child2 : (p.child4 == null ? p.child3 : p.child4)))),
|
||||||
|
nodeId = p.rootId == null ? null : (p.child1Id == null ? p.rootId : (p.child2Id == null ? p.child1Id : (p.child3Id == null ? p.child2Id : (p.child4Id == null ? p.child3Id : p.child4Id)))),
|
||||||
|
nodeShortName = p.rootShortName == null ? null : (p.child1ShortName == null ? p.rootShortName : (p.child2ShortName == null ? p.child1ShortName : (p.child3ShortName == null ? p.child2ShortName : (p.child4ShortName == null ? p.child3ShortName : p.child4ShortName)))),
|
||||||
|
p.orgRevisionId,
|
||||||
|
p.positionId,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.positionField,
|
||||||
|
p.posTypeId,
|
||||||
|
p.posTypeName,
|
||||||
|
p.posLevelId,
|
||||||
|
p.posLevelName,
|
||||||
|
p.PositionCandidate,
|
||||||
|
p.PositionCandidateId,
|
||||||
|
p.ReportingDate,
|
||||||
|
BmaOfficer = p.IsOfficer == true ? "OFFICER" : null,
|
||||||
|
p.StatusId,
|
||||||
|
p.Draft,
|
||||||
|
p.typeCommand,
|
||||||
|
p.IsRelief,
|
||||||
|
p.posLevelCandidateId,
|
||||||
|
p.posTypeCandidateId,
|
||||||
|
};
|
||||||
|
result.Add(_data);
|
||||||
|
}
|
||||||
|
return Success(result);
|
||||||
}
|
}
|
||||||
return Success(result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Success(new List<dynamic>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("personal/{personalId:length(36)}")]
|
[HttpGet("personal/{personalId:length(36)}")]
|
||||||
|
|
@ -1606,7 +1608,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
result.Add(r);
|
result.Add(r);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
result.Add(new {
|
result.Add(new
|
||||||
|
{
|
||||||
No = _null,
|
No = _null,
|
||||||
FullName = r.RemarkHorizontal,
|
FullName = r.RemarkHorizontal,
|
||||||
Education = _null,
|
Education = _null,
|
||||||
|
|
@ -1905,7 +1908,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
result.Add(r);
|
result.Add(r);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
result.Add(new {
|
result.Add(new
|
||||||
|
{
|
||||||
No = _null,
|
No = _null,
|
||||||
FullName = r.RemarkHorizontal,
|
FullName = r.RemarkHorizontal,
|
||||||
Education = _null,
|
Education = _null,
|
||||||
|
|
@ -2222,7 +2226,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
result.Add(r);
|
result.Add(r);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
result.Add(new {
|
result.Add(new
|
||||||
|
{
|
||||||
No = _null,
|
No = _null,
|
||||||
FullName = r.RemarkHorizontal,
|
FullName = r.RemarkHorizontal,
|
||||||
Education = _null,
|
Education = _null,
|
||||||
|
|
@ -2444,7 +2449,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
result.Add(r);
|
result.Add(r);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
result.Add(new {
|
result.Add(new
|
||||||
|
{
|
||||||
No = _null,
|
No = _null,
|
||||||
FullName = r.RemarkHorizontal,
|
FullName = r.RemarkHorizontal,
|
||||||
Education = _null,
|
Education = _null,
|
||||||
|
|
@ -2658,7 +2664,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
result.Add(r);
|
result.Add(r);
|
||||||
string? _null = null;
|
string? _null = null;
|
||||||
result.Add(new {
|
result.Add(new
|
||||||
|
{
|
||||||
No = _null,
|
No = _null,
|
||||||
FullName = r.RemarkHorizontal,
|
FullName = r.RemarkHorizontal,
|
||||||
Education = _null,
|
Education = _null,
|
||||||
|
|
|
||||||
19
BMA.EHR.Placement.Service/Requests/OrgRequestAct.cs
Normal file
19
BMA.EHR.Placement.Service/Requests/OrgRequestAct.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Placement.Service.Requests
|
||||||
|
{
|
||||||
|
public class OrgRequestAct
|
||||||
|
{
|
||||||
|
public OrgRequestActData result { get; set; } = new();
|
||||||
|
}
|
||||||
|
public class OrgRequestActData
|
||||||
|
{
|
||||||
|
public bool? isOfficer { get; set; }
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue