fix : Leave and Insignia (Not Complete)

This commit is contained in:
Suphonchai Phoonsawat 2024-06-24 12:24:57 +07:00
parent 89b4c71dbd
commit c85bece782
14 changed files with 18266 additions and 88 deletions

View file

@ -147,6 +147,8 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetProfileInsignia(Guid id)
{
var profile = (from r in await _dbContext.Set<Profile>()
.Include(x => x.Prefix)
.Include(x => x.Position)

View file

@ -1,4 +1,5 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses.Organizations;
using BMA.EHR.Application.Responses.Profiles;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.MetaData;
@ -266,7 +267,7 @@ namespace BMA.EHR.Application.Repositories
{
try
{
var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak";
var apiPath = $"{_configuration["API"]}/org/dotnet/user-fullname/{keycloakId}";
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "");
if (apiResult.Result != null)
@ -349,6 +350,36 @@ namespace BMA.EHR.Application.Repositories
}
}
public GetOrganizationResponseDTO? GetOc(Guid ocId, int level, string? accessToken)
{
try
{
var apiPath = $"{_configuration["API"]}/org/find/all";
var body = new
{
nodeId = ocId,
node = level
};
var apiResult = PostExternalAPIAsync(apiPath, accessToken ?? "", body).Result;
if (apiResult != null)
{
var raw = JsonConvert.DeserializeObject<GetOrganizationResponseResultDTO>(apiResult);
if (raw != null && raw.Result != null)
{
return raw.Result;
}
}
return null;
}
catch
{
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMA.EHR.Application.Responses.Organizations
{
public class GetOrganizationResponseDTO
{
public Guid? RootId { get; set; }
public string? Root { get; set; }
public string? RootShortName { get; set; }
public Guid? Child1Id { get; set; }
public string? Child1 { get; set; }
public string? Child1ShortName { get; set; }
public Guid? Child2Id { get; set; }
public string? Child2 { get; set; }
public string? Child2ShortName { get; set; }
public Guid? Child3Id { get; set; }
public string? Child3 { get; set; }
public string? Child3ShortName { get; set; }
public Guid? Child4Id { get; set; }
public string? Child4 { get; set; }
public string? Child4ShortName { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace BMA.EHR.Application.Responses.Organizations
{
public class GetOrganizationResponseResultDTO
{
public string Message { get; set; } = string.Empty;
public int Status { get; set; } = -1;
public GetOrganizationResponseDTO? Result { get; set; }
}
}

View file

@ -27,7 +27,7 @@ namespace BMA.EHR.Application.Responses.Profiles
public string? Oc { get; set; }
public List<ProfileSalary> Salaries { get; set; } = new();
public ProfileSalaryResult? ProfileSalary { get; set; } = new();
public Guid? Keycloak { get; set; }
@ -61,4 +61,22 @@ namespace BMA.EHR.Application.Responses.Profiles
public string LastUpdateFullName { get; set; }
public string PosTypeName { get; set; }
}
public class ProfileSalaryResult
{
public Guid? Id { get; set; }
public DateTime? CreatedAt { get; set; }
public Guid? CreatedUserId { get; set; }
public DateTime? LastUpdatedAt { get; set; }
public Guid? LastUpdateUserId { get; set; }
public string? CreatedFullName { get; set; }
public string? LastUpdateFullName { get; set; }
public string PosNo { get; set; } = string.Empty;
public double? Amount { get; set; }
public double? PositionSalaryAmount { get; set; }
public double? MouthSalaryAmount { get; set; }
}
}