fix : เครื่องราชย์ + บันทึกเครื่องราชย์
This commit is contained in:
parent
def2b8f7fe
commit
26ccf67dad
5 changed files with 92 additions and 5 deletions
|
|
@ -5179,10 +5179,9 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(x => x.Document)
|
||||
//.Include(x => x.Organization)
|
||||
//.ThenInclude(x => x.OrganizationOrganization)
|
||||
.Where(x => x.OrganizationId != null)
|
||||
.FirstOrDefaultAsync(x => x.Period.Id == period.Id && x.OrganizationId == ocId);
|
||||
|
||||
var oc = _userProfileRepository.GetOc(request.OrganizationId, 0, AccessToken);
|
||||
var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
|
||||
return new InsigniaResults
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Responses.Insignias;
|
||||
using BMA.EHR.Application.Responses.Organizations;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
|
@ -533,6 +534,25 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task PostProfileInsigniaAsync(PostProfileInsigniaDto body, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/profile/insignia";
|
||||
|
||||
var profiles = new List<SearchProfileDto>();
|
||||
|
||||
var apiResult = await PostExternalAPIBooleanAsync(apiPath, accessToken ?? "", body);
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace BMA.EHR.Application.Requests
|
|||
public string InsigniaName { get; set; }
|
||||
public string InsigniaPage { get; set; }
|
||||
public string InsigniaNo { get; set; }
|
||||
public int? Kp7InsigniaId { get; set; }
|
||||
public Guid Kp7InsigniaId { get; set; }
|
||||
}
|
||||
public class DocReceive
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Application.Responses.Insignias
|
||||
{
|
||||
public class PostProfileInsigniaDto
|
||||
{
|
||||
public Guid ProfileId { get; set; }
|
||||
|
||||
public int Year { get; set; } = 0;
|
||||
|
||||
public string No { get; set; } = string.Empty;
|
||||
|
||||
public string Volume { get; set; } = string.Empty;
|
||||
|
||||
public string Section { get; set; } = string.Empty;
|
||||
|
||||
public string Page { get; set; } = string.Empty;
|
||||
|
||||
public DateTime ReceiveDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
public Guid InsigniaId { get; set; }
|
||||
|
||||
public DateTime DateAnnounce { get; set; } = DateTime.MinValue;
|
||||
|
||||
public string Issue { get; set; } = string.Empty;
|
||||
|
||||
public string VolumeNo { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? RefCommandDate { get; set; }
|
||||
|
||||
public string RefCommandNo { get; set; } = string.Empty;
|
||||
|
||||
public string Note { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Application.Responses.Insignias;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -26,19 +27,25 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
|
||||
public InsigniaReceiveController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
}
|
||||
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
[HttpGet("{type}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsigniaList(string type, Guid id, Guid ocId)
|
||||
{
|
||||
|
|
@ -151,6 +158,28 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
if (items.Profile.Count() != 0)
|
||||
{
|
||||
foreach(var p in items.Profile)
|
||||
{
|
||||
await _userProfileRepository.PostProfileInsigniaAsync(new PostProfileInsigniaDto
|
||||
{
|
||||
ProfileId = Guid.Parse(p.FkProfileId),
|
||||
Year = item.InsigniaDateannounce.Value.Year,
|
||||
No = p.InsigniaNo,
|
||||
Volume = item.InsigniaVolume,
|
||||
Section = item.InsigniaSection,
|
||||
Page = p.InsigniaPage,
|
||||
ReceiveDate = item.InsigniaDatereceive.Value,
|
||||
InsigniaId = p.Kp7InsigniaId,
|
||||
DateAnnounce = item.InsigniaDateannounce.Value,
|
||||
Issue = item.InsigniaIssue,
|
||||
VolumeNo = item.InsigniaVolumeno.Value.ToString(),
|
||||
|
||||
|
||||
}, AccessToken);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// foreach (var i in items.Profile)
|
||||
// {
|
||||
// var profile = _context.Profiles.AsQueryable()
|
||||
|
|
@ -208,7 +237,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// return NotFound("Profile not found!!!");
|
||||
// }
|
||||
}
|
||||
_context.SaveChanges();
|
||||
//_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue