เครื่องราชเช็คตามรายการ
This commit is contained in:
parent
2efc1910f6
commit
a951378b1f
21 changed files with 57711 additions and 61 deletions
|
|
@ -7476,7 +7476,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
//.ThenInclude(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Period.Id == period.Id && x.OrganizationId == ocId);
|
||||
|
||||
var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
//var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
|
||||
return new InsigniaResults
|
||||
{
|
||||
|
|
@ -7488,7 +7488,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
RequestId = request == null ? null : request.Id,
|
||||
RequestNote = request == null ? "" : request.RequestNote,
|
||||
RequestStatus = request == null ? null : request.RequestStatus,
|
||||
OrganizationName = request == null ? "" : oc.Root,
|
||||
OrganizationName = request == null ? "" : request.Organization,
|
||||
Document = request == null
|
||||
? null
|
||||
: (request.Document == null
|
||||
|
|
@ -7759,7 +7759,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
// }
|
||||
|
||||
// insert candidate list
|
||||
public async Task InsertCandidate(Guid periodId, Guid ocId, List<InsigniaResultSet> items)
|
||||
public async Task InsertCandidate(Guid periodId, Guid ocId, string oc, List<InsigniaResultSet> items)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -7782,7 +7782,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
|
||||
//var oc = await _dbContext.Set<OrganizationEntity>().FirstOrDefaultAsync(x => x.Id == ocId);
|
||||
var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
//var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
|
||||
//if (oc == null)
|
||||
// throw new Exception(GlobalMessages.OCNotFound);
|
||||
|
|
@ -7790,7 +7790,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
var req = new InsigniaRequest
|
||||
{
|
||||
Period = period,
|
||||
OrganizationId = oc!.RootId!.Value,
|
||||
OrganizationId = ocId,
|
||||
Organization = oc,
|
||||
RequestStatus = "st1",
|
||||
RequestNote = "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Metadata;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -1104,10 +1105,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
{
|
||||
if (insigniaPeriod.StartDate == DateTime.Now.Date)
|
||||
continue;
|
||||
var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
if (organizationType == null)
|
||||
continue;
|
||||
var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
//if (organizationType == null)
|
||||
// continue;
|
||||
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||
Console.WriteLine(JsonConvert.SerializeObject(organizations));
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
|
|
@ -1123,7 +1126,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repositoryInsignia.InsertCandidate(period, organization.Id, candidate);
|
||||
await _repositoryInsignia.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -601,7 +601,28 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<GetActiveRootDto>> GetActiveRootLatestAsync(string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/active/root/all";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetActiveRootResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task PostProfileInsigniaAsync(PostProfileInsigniaDto body, string? accessToken)
|
||||
{
|
||||
|
|
@ -622,6 +643,28 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
}
|
||||
|
||||
public async Task<GetIsOfficerDto> GetIsOfficerRootAsync(string? accessToken, string sys)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/workflow/keycloak/isofficer-root/{sys}";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetIsOfficerResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
return new GetIsOfficerDto { isOfficer = false, isStaff = false, isDirector = false };
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue