Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2023-09-08 11:53:58 +07:00
commit 388517aed0
6 changed files with 73 additions and 55 deletions

View file

@ -59,58 +59,58 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
try try
{ {
var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId); var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId);
if (profile == null) if (profile != null)
throw new Exception(GlobalMessages.DataNotFound);
if (IsSendNotification == true)
{ {
_dbContext.Set<Notification>().Add(new Notification if (IsSendNotification == true)
{ {
Body = Body, _dbContext.Set<Notification>().Add(new Notification
ReceiverUserId = ReceiverUserId, {
Type = "", Body = Body,
Payload = "", ReceiverUserId = ReceiverUserId,
CreatedUserId = FullName ?? "", Type = "",
CreatedFullName = UserId ?? "System Administrator", Payload = "",
CreatedAt = DateTime.Now, CreatedUserId = FullName ?? "",
LastUpdateFullName = FullName ?? "System Administrator", CreatedFullName = UserId ?? "System Administrator",
LastUpdateUserId = UserId ?? "", CreatedAt = DateTime.Now,
LastUpdatedAt = DateTime.Now, LastUpdateFullName = FullName ?? "System Administrator",
}); LastUpdateUserId = UserId ?? "",
} LastUpdatedAt = DateTime.Now,
if (IsSendInbox == true) });
{ }
_dbContext.Set<Inbox>().Add(new Inbox if (IsSendInbox == true)
{ {
Subject = Subject, _dbContext.Set<Inbox>().Add(new Inbox
Body = Body, {
ReceiverUserId = ReceiverUserId, Subject = Subject,
Payload = "", Body = Body,
CreatedUserId = FullName ?? "", ReceiverUserId = ReceiverUserId,
CreatedFullName = UserId ?? "System Administrator", Payload = "",
CreatedAt = DateTime.Now, CreatedUserId = FullName ?? "",
LastUpdateFullName = FullName ?? "System Administrator", CreatedFullName = UserId ?? "System Administrator",
LastUpdateUserId = UserId ?? "", CreatedAt = DateTime.Now,
LastUpdatedAt = DateTime.Now, LastUpdateFullName = FullName ?? "System Administrator",
}); LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
if (IsSendMail == true)
{
// _context.Notifications.Add(new Notification
// {
// Body = req.Body,
// ReceiverUserId = req.ReceiverUserId,
// Type = "",
// Payload = "",
// CreatedUserId = FullName ?? "",
// CreatedFullName = UserId ?? "System Administrator",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
}
await _dbContext.SaveChangesAsync();
} }
if (IsSendMail == true)
{
// _context.Notifications.Add(new Notification
// {
// Body = req.Body,
// ReceiverUserId = req.ReceiverUserId,
// Type = "",
// Payload = "",
// CreatedUserId = FullName ?? "",
// CreatedFullName = UserId ?? "System Administrator",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
}
await _dbContext.SaveChangesAsync();
} }
catch catch
{ {

View file

@ -732,6 +732,7 @@ namespace BMA.EHR.Application.Repositories.Reports
Age = r.Date == null ? "-" : r.Date.Value.CalculateBetweenDateV2(DateTime.Now).ToThaiNumber(), Age = r.Date == null ? "-" : r.Date.Value.CalculateBetweenDateV2(DateTime.Now).ToThaiNumber(),
Amount = r.Amount == null ? null : r.Amount.Value.ToNumericText().ToThaiNumber(), Amount = r.Amount == null ? null : r.Amount.Value.ToNumericText().ToThaiNumber(),
Date = r.Date, Date = r.Date,
Remark = "",
}) })
.Distinct() .Distinct()
.OrderBy(x => x.Date) .OrderBy(x => x.Date)

View file

@ -373,7 +373,7 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
} }
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"), Guid.Parse("08db721d-ade4-480e-8d84-0853946a0ea5"),
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอน", $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอน",
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}" $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}"
); );

View file

@ -352,7 +352,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
} }
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"), Guid.Parse("08db721d-ae2f-4f5d-836a-02d2413df33d"),
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก", $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก",
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก" $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก"
); );
@ -507,6 +507,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator"; updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา"
);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
@ -537,6 +542,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator"; updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา"
);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
@ -567,9 +577,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"), updated.Profile.Id,
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ", $"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ" $"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ"
); );
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
@ -589,6 +599,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
public async Task<ActionResult<ResponseObject>> OligarchReject([FromBody] RetirementReasonDateRequest req, Guid id) public async Task<ActionResult<ResponseObject>> OligarchReject([FromBody] RetirementReasonDateRequest req, Guid id)
{ {
var updated = await _context.RetirementResigns var updated = await _context.RetirementResigns
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
if (updated == null) if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404); return Error(GlobalMessages.RetirementResignNotFound, 404);
@ -601,6 +613,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator"; updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
updated.Profile.Id,
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ"
);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();

View file

@ -19,7 +19,7 @@
}, },
"Jwt": { "Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://identity.frappet.com/realms/bma-ehr" "Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
}, },
"EPPlus": { "EPPlus": {
"ExcelPackage": { "ExcelPackage": {

View file

@ -1,6 +1,6 @@
{ {
"realm": "bma-ehr", "realm": "bma-ehr",
"auth-server-url": "https://identity.frappet.com", "auth-server-url": "https://id.frappet.synology.me",
"ssl-required": "external", "ssl-required": "external",
"resource": "bma-ehr", "resource": "bma-ehr",
"public-client": true "public-client": true