Merge branch 'develop' of github.com:Frappet/hrms-api-backend into develop
Some checks failed
release-dev / release-dev (push) Has been cancelled

This commit is contained in:
moss 2025-03-27 12:00:48 +07:00
commit 60a46c9232
4 changed files with 68 additions and 47 deletions

View file

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

View file

@ -394,25 +394,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
retirementDeceased.Document = _doc; retirementDeceased.Document = _doc;
} }
//retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
//{ {
// CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId, CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId,
// Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix, Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix,
// FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName, FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName,
// LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName, LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName,
// IsSendMail = true, IsSendMail = true,
// IsSendInbox = true, IsSendInbox = true,
// IsSendNotification = true, IsSendNotification = true,
// // OrganizationName = retirementDeceased.OrganizationName, OrganizationName = retirementDeceased.root == null ? "" : retirementDeceased.root,
// PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position, PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position,
// profileId = req.ProfileId, profileId = req.ProfileId,
// CreatedFullName = FullName ?? "System Administrator", CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
// CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator", LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "", LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
//}); });
var pathUrl = $"{_configuration["API"]}/org/command/find-higher"; var pathUrl = $"{_configuration["API"]}/org/command/find-higher";
using (var client = new HttpClient()) using (var client = new HttpClient())
@ -427,35 +427,58 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
}); });
var _result = await _res.Content.ReadAsStringAsync(); 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); foreach (var higher in highers.result)
if (highers != null && highers.status == 200)
{ {
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, // name = "หนังสือเวียนถึงแก่กรรม",
Prefix = higher.prefix, // url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}"
FirstName = higher.firstName, //});
LastName = higher.lastName,
OrganizationName = higher.organizationName, //var payload = new CommandPayload()
PositionName = higher.positionName, //{
IsSendMail = true, // attachments = payload_attach
IsSendInbox = true, //};
IsSendNotification = true,
CreatedFullName = FullName ?? "System Administrator", //var payload_str = JsonConvert.SerializeObject(payload);
CreatedUserId = UserId ?? "", await _repositoryNoti.PushNotificationAsync(
CreatedAt = DateTime.Now, Guid.Parse(higher.profileId),
LastUpdateFullName = FullName ?? "System Administrator", $"หนังสือเวียนถึงแก่กรรมของ {higher.prefix}{higher.firstName} {higher.lastName}",
LastUpdateUserId = UserId ?? "", $"แจ้งข่าวการถึงแก่กรรมของ {retirementDeceased.prefix}{retirementDeceased.firstName} {retirementDeceased.lastName}",
LastUpdatedAt = DateTime.Now, //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(); await _context.SaveChangesAsync();

View file

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

View file

@ -5,8 +5,6 @@ namespace BMA.EHR.Retirement.Service.Requests
{ {
public class RetirementDeceasedAddNotiHigherRequest 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 List<HigherResponse> result { get; set; } = new List<HigherResponse>();
} }
public class HigherResponse public class HigherResponse