เพิ่มกวาดรายชื่อตอนส่งหนังสือเวียนถึงแก่กรรม (issue #1281 & #1287)
Some checks failed
release-dev / release-dev (push) Failing after 11s
Some checks failed
release-dev / release-dev (push) Failing after 11s
This commit is contained in:
parent
3779128e6c
commit
44cd46effc
2 changed files with 85 additions and 18 deletions
|
|
@ -394,25 +394,70 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
retirementDeceased.Document = _doc;
|
||||
}
|
||||
|
||||
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
|
||||
//retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
|
||||
//{
|
||||
// CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId,
|
||||
// Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix,
|
||||
// FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName,
|
||||
// LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName,
|
||||
// IsSendMail = true,
|
||||
// IsSendInbox = true,
|
||||
// IsSendNotification = true,
|
||||
// // OrganizationName = retirementDeceased.OrganizationName,
|
||||
// PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position,
|
||||
// profileId = req.ProfileId,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
//});
|
||||
|
||||
var pathUrl = $"{_configuration["API"]}/org/command/find-higher";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId,
|
||||
Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix,
|
||||
FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName,
|
||||
LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName,
|
||||
IsSendMail = true,
|
||||
IsSendInbox = true,
|
||||
IsSendNotification = true,
|
||||
// OrganizationName = retirementDeceased.OrganizationName,
|
||||
PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position,
|
||||
profileId = req.ProfileId,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(pathUrl, new
|
||||
{
|
||||
persons = new List<object>
|
||||
{
|
||||
new { profileId = req.ProfileId }
|
||||
}
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var highers = JsonConvert.DeserializeObject<RetirementDeceasedAddNotiHigherRequest>(_result);
|
||||
if (highers != null && highers.status == 200)
|
||||
{
|
||||
foreach (var higher in highers.result)
|
||||
{
|
||||
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
|
||||
{
|
||||
profileId = higher.profileId,
|
||||
CitizenId = higher.citizenId,
|
||||
Prefix = higher.prefix,
|
||||
FirstName = higher.firstName,
|
||||
LastName = higher.lastName,
|
||||
OrganizationName = higher.organizationName,
|
||||
PositionName = higher.positionName,
|
||||
IsSendMail = true,
|
||||
IsSendInbox = true,
|
||||
IsSendNotification = true,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Retirement.Service.Requests
|
||||
{
|
||||
public class RetirementDeceasedAddNotiHigherRequest
|
||||
{
|
||||
public int status { get; set; }
|
||||
public string message { get; set; } = string.Empty;
|
||||
public List<HigherResponse> result { get; set; } = new List<HigherResponse>();
|
||||
}
|
||||
public class HigherResponse
|
||||
{
|
||||
public string citizenId { get; set; } = string.Empty;
|
||||
public string prefix { get; set; } = string.Empty;
|
||||
public string firstName { get; set; } = string.Empty;
|
||||
public string lastName { get; set; } = string.Empty;
|
||||
public string organizationName { get; set; } = string.Empty;
|
||||
public string positionName { get; set; } = string.Empty;
|
||||
public string profileId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue