ถึงแก้กรรม

This commit is contained in:
Bright 2025-03-27 11:02:58 +07:00
parent 9be78c8bdc
commit dd8e87b994
4 changed files with 66 additions and 45 deletions

View file

@ -154,7 +154,7 @@ var app = builder.Build();
app.UseStaticFiles();
app.MapControllers();
app.UseMiddleware<ErrorHandlerMiddleware>();
app.UseMiddleware<RequestLoggingMiddleware>();
//app.UseMiddleware<RequestLoggingMiddleware>();
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{

View file

@ -394,25 +394,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
retirementDeceased.Document = _doc;
}
//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,
//});
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())
@ -427,35 +427,58 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
});
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
var highers = JsonConvert.DeserializeObject<RetirementDeceasedAddNotiHigherRequest>(_result);
if (highers != null && highers.result != null)
{
var highers = JsonConvert.DeserializeObject<RetirementDeceasedAddNotiHigherRequest>(_result);
if (highers != null && highers.status == 200)
foreach (var higher in highers.result)
{
foreach (var higher in highers.result)
if (higher.profileId != null)
{
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
var payload_attach = new List<PayloadAttachment>();
payload_attach.Add(new PayloadAttachment
{
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,
name = "หนังสือเวียนถึงแก่กรรม",
url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}"
});
var payload = new CommandPayload()
{
attachments = payload_attach
};
var payload_str = JsonConvert.SerializeObject(payload);
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(higher.profileId),
$"หนังสือเวียนถึงแก่กรรมของ {higher.prefix}{higher.firstName} {higher.lastName}",
$"แจ้งข่าวการถึงแก่กรรมของ {retirementDeceased.prefix}{retirementDeceased.firstName} {retirementDeceased.lastName}",
//payload_str,
"",
"",
true,
true
);
}
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();

View file

@ -161,7 +161,7 @@ var app = builder.Build();
app.UseStaticFiles();
app.MapControllers();
app.UseMiddleware<ErrorHandlerMiddleware>();
app.UseMiddleware<RequestLoggingMiddleware>();
//app.UseMiddleware<RequestLoggingMiddleware>();
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{

View file

@ -5,8 +5,6 @@ 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