หา dna บรรจุ
This commit is contained in:
parent
b1ad88c37b
commit
1ef8544833
20 changed files with 1425 additions and 303 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
|
|
@ -31,6 +32,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly PermissionRepository _permission;
|
||||
|
||||
public PlacementAppointmentController(PlacementRepository repository,
|
||||
|
|
@ -39,6 +41,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permiss)
|
||||
{
|
||||
_repository = repository;
|
||||
|
|
@ -47,6 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_permission = permiss;
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +60,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -76,11 +81,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// string?[] rootId = jsonData?.result?.rootId ?? null;
|
||||
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
|
||||
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
|
||||
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
|
||||
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
|
||||
string role = jsonData["result"];
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child4DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
var node = profileAdmin?.Node;
|
||||
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
|
||||
.Where(x => x.type == "OFFICER")
|
||||
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
|
||||
|
|
@ -173,10 +197,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.positionAreaOld,
|
||||
p.CreatedAt,
|
||||
p.typeCommand,
|
||||
p.rootDnaId,
|
||||
p.child1DnaId,
|
||||
p.child2DnaId,
|
||||
p.child3DnaId,
|
||||
p.child4DnaId,
|
||||
})
|
||||
.ToListAsync();
|
||||
if (status != null && status.Trim().ToUpper() != "ALL")
|
||||
placementAppointments = placementAppointments.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
placementAppointments = placementAppointments
|
||||
.Where(x => node == 4 ? x.child4DnaId == nodeId : (node == 3 ? x.child3DnaId == nodeId : (node == 2 ? x.child2DnaId == nodeId : (node == 1 ? x.child1DnaId == nodeId : (node == 0 ? x.rootDnaId == nodeId : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
placementAppointments = placementAppointments
|
||||
.Where(x => x.rootDnaId == nodeId).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
placementAppointments = placementAppointments
|
||||
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
|
||||
}
|
||||
return Success(placementAppointments);
|
||||
}
|
||||
|
||||
|
|
@ -477,8 +526,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
|
||||
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
|
||||
(org.result.root == null ? "" : org.result.root);
|
||||
placementAppointment.OrganizationPositionOld = org.result.position + "\n" +
|
||||
(placementAppointment.PositionExecutiveOld == null ? "" : (placementAppointment.positionExecutiveField == null ? placementAppointment.PositionExecutiveOld + "\n": placementAppointment.PositionExecutiveOld + "(" + placementAppointment.positionExecutiveField + ")" + "\n"))
|
||||
placementAppointment.OrganizationPositionOld = org.result.position + "\n" +
|
||||
(placementAppointment.PositionExecutiveOld == null ? "" : (placementAppointment.positionExecutiveField == null ? placementAppointment.PositionExecutiveOld + "\n" : placementAppointment.PositionExecutiveOld + "(" + placementAppointment.positionExecutiveField + ")" + "\n"))
|
||||
+ placementAppointment.OrganizationOld;
|
||||
placementAppointment.AmountOld = org.result.salary;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -30,6 +31,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly PermissionRepository _permission;
|
||||
|
||||
public PlacementAppointmentEmployeeController(PlacementRepository repository,
|
||||
|
|
@ -38,6 +40,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
_repository = repository;
|
||||
|
|
@ -46,6 +49,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_permission = permission;
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +59,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -75,11 +80,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// string?[] rootId = jsonData?.result?.rootId ?? null;
|
||||
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
|
||||
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
|
||||
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
|
||||
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
|
||||
string role = jsonData["result"];
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child4DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
var node = profileAdmin?.Node;
|
||||
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
|
||||
.Where(x => x.type == "EMPLOYEE")
|
||||
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
|
||||
|
|
@ -167,32 +191,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.positionOld,
|
||||
p.CreatedAt,
|
||||
p.typeCommand,
|
||||
p.rootDnaId,
|
||||
p.child1DnaId,
|
||||
p.child2DnaId,
|
||||
p.child3DnaId,
|
||||
p.child4DnaId,
|
||||
})
|
||||
.ToListAsync();
|
||||
// if (keyword != "")
|
||||
// {
|
||||
// var data = placementAppointments.Where(x =>
|
||||
// (x.citizenId != null && x.citizenId.Contains(keyword)) ||
|
||||
// (x.prefix != null && x.prefix.Contains(keyword)) ||
|
||||
// (x.firstName != null && x.firstName.Contains(keyword)) ||
|
||||
// (x.lastName != null && x.lastName.Contains(keyword)) ||
|
||||
// (x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
|
||||
// (x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
|
||||
// (x.OrganizationOld != null && x.OrganizationOld.Contains(keyword)) ||
|
||||
// (x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
|
||||
// (x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
|
||||
// (x.OrganizationPositionOld != null && x.OrganizationPositionOld.Contains(keyword)) ||
|
||||
// (x.Reason != null && x.Reason.Contains(keyword)) ||
|
||||
// (x.nodeName != null && x.nodeName.Contains(keyword)))
|
||||
// .OrderByDescending(x => x.CreatedAt)
|
||||
// .Skip((page - 1) * pageSize)
|
||||
// .Take(pageSize)
|
||||
// .ToList();
|
||||
|
||||
// placementAppointments = data;
|
||||
// }
|
||||
if (status != null && status.Trim().ToUpper() != "ALL")
|
||||
placementAppointments = placementAppointments.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
placementAppointments = placementAppointments
|
||||
.Where(x => node == 4 ? x.child4DnaId == nodeId : (node == 3 ? x.child3DnaId == nodeId : (node == 2 ? x.child2DnaId == nodeId : (node == 1 ? x.child1DnaId == nodeId : (node == 0 ? x.rootDnaId == nodeId : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
placementAppointments = placementAppointments
|
||||
.Where(x => x.rootDnaId == nodeId).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
placementAppointments = placementAppointments
|
||||
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
|
||||
}
|
||||
return Success(placementAppointments);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
|
|
@ -31,6 +32,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly PermissionRepository _permission;
|
||||
|
||||
public PlacementOfficerController(PlacementRepository repository,
|
||||
|
|
@ -39,6 +41,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
_repository = repository;
|
||||
|
|
@ -47,6 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_permission = permission;
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +60,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -76,11 +81,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// string?[] rootId = jsonData?.result?.rootId ?? null;
|
||||
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
|
||||
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
|
||||
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
|
||||
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
|
||||
string role = jsonData["result"];
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child4DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
var node = profileAdmin?.Node;
|
||||
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
|
||||
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
|
||||
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
|
||||
|
|
@ -128,10 +152,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.Organization,
|
||||
p.OrganizationPositionOld,
|
||||
p.IsActive,
|
||||
p.rootDnaOldId,
|
||||
p.child1DnaOldId,
|
||||
p.child2DnaOldId,
|
||||
p.child3DnaOldId,
|
||||
p.child4DnaOldId,
|
||||
})
|
||||
.ToListAsync();
|
||||
if (status != null && status.Trim().ToUpper() != "ALL")
|
||||
placementOfficers = placementOfficers.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
placementOfficers = placementOfficers
|
||||
.Where(x => node == 4 ? x.child4DnaOldId == nodeId : (node == 3 ? x.child3DnaOldId == nodeId : (node == 2 ? x.child2DnaOldId == nodeId : (node == 1 ? x.child1DnaOldId == nodeId : (node == 0 ? x.rootDnaOldId == nodeId : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
placementOfficers = placementOfficers
|
||||
.Where(x => x.rootDnaOldId == nodeId).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
placementOfficers = placementOfficers
|
||||
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
|
||||
}
|
||||
return Success(placementOfficers);
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +470,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
|
||||
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
|
||||
(org.result.root == null ? "" : org.result.root);
|
||||
placementOfficer.OrganizationPositionOld = org.result.position + "\n" +
|
||||
placementOfficer.OrganizationPositionOld = org.result.position + "\n" +
|
||||
(placementOfficer.PositionExecutiveOld == null ? "" : (placementOfficer.positionExecutiveField == null ? placementOfficer.PositionExecutiveOld + "\n" : placementOfficer.PositionExecutiveOld + "(" + placementOfficer.positionExecutiveField + ")" + "\n"))
|
||||
+ placementOfficer.OrganizationOld;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Swashbuckle.AspNetCore.Annotations;
|
|||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using System.Reflection;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Controllers
|
||||
{
|
||||
|
|
@ -32,6 +33,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly PermissionRepository _permission;
|
||||
|
||||
public PlacementReceiveController(PlacementRepository repository,
|
||||
|
|
@ -40,6 +42,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permiss)
|
||||
{
|
||||
_repository = repository;
|
||||
|
|
@ -48,6 +51,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_permission = permiss;
|
||||
}
|
||||
|
||||
|
|
@ -57,6 +61,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -77,11 +82,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// string?[] rootId = jsonData?.result?.rootId ?? null;
|
||||
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
|
||||
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
|
||||
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
|
||||
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
|
||||
string role = jsonData["result"];
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child4DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
var node = profileAdmin?.Node;
|
||||
var placementReceives = await _context.PlacementReceives.AsQueryable()
|
||||
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
|
||||
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
|
||||
|
|
@ -165,10 +189,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.posLevelNameOld,
|
||||
p.CreatedAt,
|
||||
p.profileId,
|
||||
p.rootDnaId,
|
||||
p.child1DnaId,
|
||||
p.child2DnaId,
|
||||
p.child3DnaId,
|
||||
p.child4DnaId,
|
||||
})
|
||||
.ToListAsync();
|
||||
if (status != null && status.Trim().ToUpper() != "ALL")
|
||||
placementReceives = placementReceives.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
placementReceives = placementReceives
|
||||
.Where(x => node == 4 ? x.child4DnaId == nodeId : (node == 3 ? x.child3DnaId == nodeId : (node == 2 ? x.child2DnaId == nodeId : (node == 1 ? x.child1DnaId == nodeId : (node == 0 ? x.rootDnaId == nodeId : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
placementReceives = placementReceives
|
||||
.Where(x => x.rootDnaId == nodeId).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
placementReceives = placementReceives
|
||||
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
|
||||
}
|
||||
return Success(placementReceives);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
|
|
@ -32,6 +33,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly PermissionRepository _permission;
|
||||
|
||||
public PlacementRepatriationController(PlacementRepository repository,
|
||||
|
|
@ -40,6 +42,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
PermissionRepository permiss)
|
||||
{
|
||||
_repository = repository;
|
||||
|
|
@ -48,6 +51,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_permission = permiss;
|
||||
}
|
||||
|
||||
|
|
@ -57,6 +61,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -77,11 +82,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// string?[] rootId = jsonData?.result?.rootId ?? null;
|
||||
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
|
||||
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
|
||||
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
|
||||
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
|
||||
string role = jsonData["result"];
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child4DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
var node = profileAdmin?.Node;
|
||||
var placementRepatriations = await _context.PlacementRepatriations.AsQueryable()
|
||||
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
|
||||
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
|
||||
|
|
@ -133,10 +157,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.OrganizationPositionOld,
|
||||
p.IsActive,
|
||||
p.DateRepatriation,
|
||||
p.rootDnaOldId,
|
||||
p.child1DnaOldId,
|
||||
p.child2DnaOldId,
|
||||
p.child3DnaOldId,
|
||||
p.child4DnaOldId,
|
||||
})
|
||||
.ToListAsync();
|
||||
if (status != null && status.Trim().ToUpper() != "ALL")
|
||||
placementRepatriations = placementRepatriations.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
placementRepatriations = placementRepatriations
|
||||
.Where(x => node == 4 ? x.child4DnaOldId == nodeId : (node == 3 ? x.child3DnaOldId == nodeId : (node == 2 ? x.child2DnaOldId == nodeId : (node == 1 ? x.child1DnaOldId == nodeId : (node == 0 ? x.rootDnaOldId == nodeId : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
placementRepatriations = placementRepatriations
|
||||
.Where(x => x.rootDnaOldId == nodeId).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
placementRepatriations = placementRepatriations
|
||||
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
|
||||
}
|
||||
return Success(placementRepatriations);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using System.Net.Http.Headers;
|
|||
using System.Security.Claims;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Controllers
|
||||
{
|
||||
|
|
@ -33,6 +34,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly PermissionRepository _permission;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly TransferReportRepository _service;
|
||||
|
||||
public PlacementTransferController(PlacementRepository repository,
|
||||
|
|
@ -42,6 +44,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
PermissionRepository permission,
|
||||
UserProfileRepository userProfileRepository,
|
||||
TransferReportRepository service)
|
||||
{
|
||||
_repository = repository;
|
||||
|
|
@ -51,6 +54,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
_permission = permission;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_service = service;
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +64,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -169,18 +174,31 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// var data = JsonConvert.DeserializeObject<OrgPermissionRequest>(getPermission);
|
||||
// string?[]? root = data?.Result?.Root ?? null;
|
||||
// string?[]? child1 = data?.Result?.Child1 ?? null;
|
||||
// string?[]? child2 = data?.Result?.Child2 ?? null;
|
||||
// string?[]? child3 = data?.Result?.Child3 ?? null;
|
||||
// string?[]? child4 = data?.Result?.Child4 ?? null;
|
||||
string role = jsonData["result"];
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child4DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
var node = profileAdmin?.Node;
|
||||
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
|
||||
// .Where(x => root == null ? true : root.Contains(x.rootOldId))
|
||||
// .Where(x => child1 == null ? true : child1.Contains(x.child1OldId))
|
||||
// .Where(x => child2 == null ? true : child2.Contains(x.child2OldId))
|
||||
// .Where(x => child3 == null ? true : child3.Contains(x.child3OldId))
|
||||
// .Where(x => child4 == null ? true : child4.Contains(x.child4OldId))
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -225,10 +243,36 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.IsActive,
|
||||
p.rootDnaOldId,
|
||||
p.child1DnaOldId,
|
||||
p.child2DnaOldId,
|
||||
p.child3DnaOldId,
|
||||
p.child4DnaOldId,
|
||||
})
|
||||
.ToListAsync();
|
||||
if (status != null && status.Trim().ToUpper() != "ALL")
|
||||
placementTransfers = placementTransfers.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
placementTransfers = placementTransfers
|
||||
.Where(x => node == 4 ? x.child4DnaOldId == nodeId : (node == 3 ? x.child3DnaOldId == nodeId : (node == 2 ? x.child2DnaOldId == nodeId : (node == 1 ? x.child1DnaOldId == nodeId : (node == 0 ? x.rootDnaOldId == nodeId : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
placementTransfers = placementTransfers
|
||||
.Where(x => x.rootDnaOldId == nodeId).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
placementTransfers = placementTransfers
|
||||
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
|
||||
}
|
||||
|
||||
return Success(placementTransfers);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue