noti พ้นราชการ บรรจุ
This commit is contained in:
parent
e5af4a3513
commit
d34f04ffee
25 changed files with 16558 additions and 130 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -26,15 +27,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public InsigniaManageController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
@ -412,12 +416,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.AsQueryable()
|
||||
.Include(x => x.RequestInsignia)
|
||||
.Include(x => x.InsigniaNote)
|
||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
|
||||
if (insigniaNoteProfile == null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
||||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Year == DateTime.Now.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||
if (insigniaManage == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -24,15 +25,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public InsigniaPeriodController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -23,15 +24,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public InsigniaReceiveController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
|
|
@ -30,18 +31,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly string Royal_Type = "Royal";
|
||||
|
||||
public InsigniaRequestController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostingEnvironment,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
|
|
@ -865,7 +869,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.Select(x => x.RequestProfiles.Count(x => x.Status != "DELETE" && x.Status != "REJECT"))
|
||||
.SumAsync();
|
||||
|
||||
return Success(new { OrgAllCount = orgAllCount.Count(), OrgSendCount = orgAllCount.Where(x => x.RequestStatus != "st1" && x.RequestStatus != "st2").Count(), OrgNoSendCount = orgAllCount.Where(x => x.RequestStatus == "st1" && x.RequestStatus == "st2").Count(), AllUserUser = allUserUser });
|
||||
return Success(new { OrgAllCount = orgAllCount.Count(), OrgSendCount = orgAllCount.Where(x => x.RequestStatus != "st1" && x.RequestStatus != "st2").Count(), OrgNoSendCount = orgAllCount.Where(x => x.RequestStatus == "st1" || x.RequestStatus == "st2").Count(), AllUserUser = allUserUser });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1093,6 +1097,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
foreach (var profileOld in profileOlds)
|
||||
{
|
||||
if (profileOld.Status == "DELETE" || profileOld.Status == "REJECT")
|
||||
continue;
|
||||
var noreProfileOld = insigniaNote.InsigniaNoteProfiles
|
||||
.Where(x => x.Profile == profileOld.Profile)
|
||||
.FirstOrDefault();
|
||||
|
|
@ -1397,11 +1403,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var profileInsignia = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == req.CitizanId);
|
||||
if (profileInsignia == null)
|
||||
{
|
||||
await _context.InsigniaNoteProfiles.AddAsync(new InsigniaNoteProfile
|
||||
var insigniaNoteProfile = new InsigniaNoteProfile
|
||||
{
|
||||
Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
IsApprove = true,
|
||||
Status = "DONE",
|
||||
Status = "PENDING",
|
||||
Profile = profile,
|
||||
Issue = req.Issue,
|
||||
Number = req.Number,
|
||||
|
|
@ -1424,48 +1430,83 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
};
|
||||
if (req.DateReceive != null && req.Date != null)
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
// Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.DateReceive,
|
||||
ReceiveDate = req.Date,
|
||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
Insignia = insignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
insigniaNoteProfile.Status = "DONE";
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
// Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.Date,
|
||||
ReceiveDate = req.DateReceive,
|
||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
Insignia = insignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
await _context.InsigniaNoteProfiles.AddAsync(insigniaNoteProfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
profileInsignia.Issue = req.Issue;
|
||||
profileInsignia.Number = req.Number;
|
||||
profileInsignia.DateReceive = req.DateReceive;
|
||||
profileInsignia.Date = req.Date;
|
||||
profileInsignia.VolumeNo = req.VolumeNo;
|
||||
profileInsignia.Section = req.Section;
|
||||
profileInsignia.Page = req.Page;
|
||||
profileInsignia.No = req.No;
|
||||
profileInsignia.DatePayment = req.DatePayment;
|
||||
profileInsignia.TypePayment = req.TypePayment;
|
||||
profileInsignia.Address = req.Address;
|
||||
profileInsignia.RequestInsignia = insignia;
|
||||
profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profileInsignia.LastUpdateUserId = UserId ?? "";
|
||||
profileInsignia.LastUpdatedAt = DateTime.Now;
|
||||
if (profileInsignia.Status != "DONE")
|
||||
{
|
||||
profileInsignia.Issue = req.Issue;
|
||||
profileInsignia.Number = req.Number;
|
||||
profileInsignia.DateReceive = req.DateReceive;
|
||||
profileInsignia.Date = req.Date;
|
||||
profileInsignia.VolumeNo = req.VolumeNo;
|
||||
profileInsignia.Section = req.Section;
|
||||
profileInsignia.Page = req.Page;
|
||||
profileInsignia.No = req.No;
|
||||
profileInsignia.DatePayment = req.DatePayment;
|
||||
profileInsignia.TypePayment = req.TypePayment;
|
||||
profileInsignia.Address = req.Address;
|
||||
profileInsignia.RequestInsignia = insignia;
|
||||
profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profileInsignia.LastUpdateUserId = UserId ?? "";
|
||||
profileInsignia.LastUpdatedAt = DateTime.Now;
|
||||
if (req.DateReceive != null && req.Date != null)
|
||||
{
|
||||
profileInsignia.Status = "DONE";
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
// Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.Date,
|
||||
ReceiveDate = req.DateReceive,
|
||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
Insignia = insignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
|
|
@ -1587,6 +1628,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var items = await ReadExcelImportReceive(file);
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.DateReceive == null || item.Date == null)
|
||||
continue;
|
||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||
if (profile == null)
|
||||
{
|
||||
|
|
@ -1603,7 +1646,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
RequestDate = DateTime.Now,
|
||||
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
IsApprove = true,
|
||||
Status = "DONE",
|
||||
Status = "PENDIND",
|
||||
Number = item.Number,
|
||||
RequestInsignia = _insignia,
|
||||
DateReceive = item.DateReceive,
|
||||
|
|
@ -1622,42 +1665,50 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.Number = item.Number;
|
||||
profile.RequestInsignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia) == null ? profile.RequestInsignia : await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||
profile.DateReceive = item.DateReceive;
|
||||
profile.Date = item.Date;
|
||||
profile.VolumeNo = item.VolumeNo;
|
||||
profile.Section = item.Section;
|
||||
profile.Page = item.Page;
|
||||
profile.No = item.No;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
if (profile.Status != "DONE")
|
||||
{
|
||||
profile.Number = item.Number;
|
||||
profile.RequestInsignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia) == null ? profile.RequestInsignia : await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||
profile.DateReceive = item.DateReceive;
|
||||
profile.Date = item.Date;
|
||||
profile.VolumeNo = item.VolumeNo;
|
||||
profile.Section = item.Section;
|
||||
profile.Page = item.Page;
|
||||
profile.No = item.No;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
}
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
// if (profile.DateReceive == null || profile.Date == null)
|
||||
// continue;
|
||||
if (profile.Status != "DONE")
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = profile.No,
|
||||
Issue = profile.VolumeNo,
|
||||
VolumeNo = profile.VolumeNo,
|
||||
// Volume = profile.Volume,
|
||||
Section = profile.Section,
|
||||
Page = profile.Page,
|
||||
DateAnnounce = profile.DateReceive,
|
||||
ReceiveDate = profile.Date,
|
||||
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
||||
Insignia = profile.RequestInsignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile.Profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
profile.Status = "DONE";
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = profile.No,
|
||||
Issue = profile.VolumeNo,
|
||||
VolumeNo = profile.VolumeNo,
|
||||
// Volume = profile.Volume,
|
||||
Section = profile.Section,
|
||||
Page = profile.Page,
|
||||
DateAnnounce = profile.Date,
|
||||
ReceiveDate = profile.DateReceive,
|
||||
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
||||
Insignia = profile.RequestInsignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile.Profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue