This commit is contained in:
parent
3880ce6985
commit
8ce58201e9
1 changed files with 109 additions and 2 deletions
|
|
@ -1,10 +1,12 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Elasticsearch.Net;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -595,6 +597,30 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaType == null)
|
||||
return Error(GlobalMessages.InsigniaTypeNotFound);
|
||||
|
||||
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 rawData = await _context.InsigniaReclaimProfiles.AsQueryable()
|
||||
.Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
||||
|
|
@ -635,8 +661,36 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
p.InsigniaNoteProfile.Address,
|
||||
p.InsigniaNoteProfile.Number,
|
||||
p.InsigniaNoteProfile.Salary,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
RootDnaId = p.InsigniaNoteProfile.RootDnaId,
|
||||
Child1DnaId = p.InsigniaNoteProfile.Child1DnaId,
|
||||
Child2DnaId = p.InsigniaNoteProfile.Child2DnaId,
|
||||
Child3DnaId = p.InsigniaNoteProfile.Child3DnaId,
|
||||
Child4DnaId = p.InsigniaNoteProfile.Child4DnaId,
|
||||
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))).ToList();
|
||||
}
|
||||
|
||||
var data = rawData
|
||||
.Select(p => new
|
||||
|
|
@ -810,6 +864,31 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaType == null)
|
||||
return Error(GlobalMessages.InsigniaTypeNotFound);
|
||||
|
||||
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 rawData = await _context.InsigniaManageProfiles.AsQueryable()
|
||||
.Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
||||
|
|
@ -856,9 +935,37 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
p.InsigniaNoteProfile.Address,
|
||||
p.InsigniaNoteProfile.Number,
|
||||
p.InsigniaNoteProfile.Salary,
|
||||
|
||||
|
||||
RootDnaId = p.InsigniaNoteProfile.RootDnaId,
|
||||
Child1DnaId = p.InsigniaNoteProfile.Child1DnaId,
|
||||
Child2DnaId = p.InsigniaNoteProfile.Child2DnaId,
|
||||
Child3DnaId = p.InsigniaNoteProfile.Child3DnaId,
|
||||
Child4DnaId = p.InsigniaNoteProfile.Child4DnaId,
|
||||
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
if(role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))).ToList();
|
||||
}
|
||||
|
||||
var data = rawData
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue