Merge branch 'develop' into adiDev
This commit is contained in:
commit
e0ed1fc240
9 changed files with 20870 additions and 63 deletions
|
|
@ -297,7 +297,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}/{isDeputy}/{type}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkkByTypeAsync(Guid insigniaPeriodId, Guid ocId, string role, string status, bool isDeputy, string type = "officer")
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId);
|
||||
var result = await _repository.GetInsigniaRequestByTypeAsync(insigniaPeriodId, ocId, type);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
|
|
@ -647,7 +647,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
continue;
|
||||
|
||||
|
||||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, organization.Id);
|
||||
var result = await _repository.GetInsigniaRequestByTypeAsync(insigniaPeriodId, organization.Id, type);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
|
|
@ -657,12 +657,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repository.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate);
|
||||
await _repository.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
// update รายชื่อ
|
||||
await _repository.UpdateCandidateAsync(period, organization.Id, organization.OrgRootName, candidate);
|
||||
await _repository.UpdateCandidateAsync(period, organization.Id, organization.OrgRootName, candidate, type);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -750,11 +750,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("officer/approve/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId)
|
||||
[HttpGet("officer/approve/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId, string type)
|
||||
{
|
||||
await _repository.SaveAprove(id, ocId);
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
await _repository.SaveApproveByTypeAsync(id, ocId, type);
|
||||
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||
var requestNew = await _context.InsigniaRequests
|
||||
.Include(x => x.Period)
|
||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
|
|
@ -785,11 +785,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("officer/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
[HttpPut("officer/reject/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId, string type)
|
||||
{
|
||||
await _repository.SaveAprove(id, ocId);
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
await _repository.SaveApproveByTypeAsync(id, ocId, type);
|
||||
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
if (requestNew != null)
|
||||
{
|
||||
|
|
@ -810,10 +810,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("director/approve/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt6(Guid id, Guid ocId)
|
||||
[HttpGet("director/approve/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt6(Guid id, Guid ocId, string type)
|
||||
{
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||
var requestNew = await _context.InsigniaRequests
|
||||
.Include(x => x.Period)
|
||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
|
|
@ -852,10 +852,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("director/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt4([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
[HttpPut("director/reject/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt4([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId, string type)
|
||||
{
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||
var requestNew = await _context.InsigniaRequests
|
||||
.Include(x => x.Period)
|
||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
|
|
@ -886,10 +886,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("head/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt5([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
[HttpPut("head/reject/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt5([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId, string type)
|
||||
{
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||
var requestNew = await _context.InsigniaRequests
|
||||
.Include(x => x.Period)
|
||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
|
|
@ -1015,18 +1015,20 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("dashboard/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> DashboardInsigniaPeriod(Guid insigniaPeriodId)
|
||||
[HttpGet("dashboard/{type}/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> DashboardInsigniaPeriod(Guid insigniaPeriodId, string type)
|
||||
{
|
||||
var insigniaPeriod = await _context.InsigniaPeriods.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
||||
if (insigniaPeriod == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var orgAllCount = await _context.InsigniaRequests
|
||||
.Where(x => x.Period == insigniaPeriod)
|
||||
.Where(x => x.ProfileType!.ToLower() == type.ToLower())
|
||||
.ToListAsync();
|
||||
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE");
|
||||
var allUserUser = await _context.InsigniaRequests
|
||||
.Where(x => x.Period == insigniaPeriod)
|
||||
.Where(x => x.ProfileType!.ToLower() == type.ToLower())
|
||||
.Where(x => RoleInsignia.isOfficer == true ? x.RequestStatus == "st6" : (RoleInsignia.isDirector == true ? (x.RequestStatus != "st1" && x.RequestStatus != "st2") : x.Id != null))
|
||||
.Select(x => x.RequestProfiles.Count(x => x.Status != "DELETE" && x.Status != "REJECT"))
|
||||
.SumAsync();
|
||||
|
|
@ -1043,8 +1045,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("org/no-send/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ListOrgDontSentUser(Guid insigniaPeriodId)
|
||||
[HttpGet("org/no-send/{type}/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ListOrgDontSentUser(Guid insigniaPeriodId, string type)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_MANAGE");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -1057,6 +1059,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var orgIdSend = await _context.InsigniaRequests
|
||||
.Where(x => x.Period == insigniaPeriod)
|
||||
.Where(x => x.ProfileType!.ToLower() == type.ToLower())
|
||||
.Where(x => x.RequestStatus == "st6")
|
||||
.Select(x => x.OrganizationId)
|
||||
.ToListAsync();
|
||||
|
|
@ -1514,6 +1517,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
||||
.Select(x => new
|
||||
{
|
||||
x.ProfileId,
|
||||
Id = x.Id,
|
||||
x.Prefix,
|
||||
x.FirstName,
|
||||
|
|
@ -1555,6 +1559,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
ProfileId = x.ProfileId,
|
||||
Prefix = x.Prefix ?? "",
|
||||
Position = x.Position ?? "",
|
||||
ProfileType = x.ProfileType ?? "",
|
||||
|
|
@ -1597,6 +1602,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
new
|
||||
{
|
||||
insigniaNoteProfile.Id,
|
||||
insigniaNoteProfile.ProfileId,
|
||||
insigniaNoteProfile.Prefix,
|
||||
insigniaNoteProfile.Position,
|
||||
insigniaNoteProfile.CitizenId,
|
||||
|
|
@ -2938,7 +2944,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
requestProfiles = requestProfiles.Where(x => x.ProfileId != null)
|
||||
.ToList();
|
||||
if (req.InsigniaId != null)
|
||||
requestProfiles = requestProfiles.Where(x => x.RequestInsignia.Id == req.InsigniaId).ToList();
|
||||
requestProfiles = requestProfiles
|
||||
.Where(x => x.ProfileType.ToLower() == req.ProfileType.ToLower())
|
||||
.Where(x => x.RequestInsignia.Id == req.InsigniaId)
|
||||
.ToList();
|
||||
var row = 2;
|
||||
foreach (var item in requestProfiles)
|
||||
{
|
||||
|
|
@ -3139,58 +3148,35 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <summary>
|
||||
/// อัพเดทสถานะ Mark (โทษทางวินัย, ไม่ได้เลื่อนเงินเดือน/ไม่ได้เลื่อนขั้น (เนื่องจากลาเกิน), ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี, ข้อมูลเครื่องราชฯ)
|
||||
/// </summary>
|
||||
/// <param name="insigniaPeriodId">Id รอบเครื่องราช</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("update/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> InsigniaRequestUpdateMark(Guid insigniaPeriodId)
|
||||
[HttpPut("update")]
|
||||
public async Task<ActionResult<ResponseObject>> InsigniaRequestUpdateMark([FromBody] UpdateInsigniaRequestProfile req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var insigniaPeriod = await _context.InsigniaPeriods
|
||||
.Include(x => x.InsigniaRequests)
|
||||
.Include(x => x.InsigniaEmployees)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
||||
.Include(x => x.InsigniaRequests.Where(r => r.OrganizationId == req.agencyId))
|
||||
.FirstOrDefaultAsync(x => x.Id == req.insigniaPeriodId);
|
||||
if (insigniaPeriod == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
|
||||
if (insigniaPeriod.InsigniaRequests.Count > 0)
|
||||
{
|
||||
//var allProfileIds = new List<string>();
|
||||
//var allProfileEmpIds = new List<string>();
|
||||
|
||||
foreach (var InsigniaRequest in insigniaPeriod.InsigniaRequests)
|
||||
{
|
||||
var profiles = await _context.Set<InsigniaRequestProfile>()
|
||||
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType.Trim().ToUpper() == "OFFICER").Select(x => x.ProfileId.ToString()).ToListAsync();
|
||||
|
||||
var profileEmps = await _context.Set<InsigniaRequestProfile>()
|
||||
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType.Trim().ToUpper() == "EMPLOYEE").Select(x => x.ProfileId.ToString()).ToListAsync();
|
||||
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType == req.type.Trim().ToUpper()).Select(x => x.ProfileId.ToString()).ToListAsync();
|
||||
|
||||
if (profiles.Count > 0)
|
||||
{
|
||||
//allProfileIds.AddRange(profiles);
|
||||
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profiles.ToArray(), "OFFICER");
|
||||
}
|
||||
|
||||
if (profileEmps.Count > 0)
|
||||
{
|
||||
//allProfileEmpIds.AddRange(profileEmps);
|
||||
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profileEmps.ToArray(), "EMPLOYEE");
|
||||
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profiles.ToArray(), req.type.Trim().ToUpper());
|
||||
}
|
||||
}
|
||||
|
||||
//if (allProfileIds.Count > 0)
|
||||
//{
|
||||
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileIds.ToArray(), "OFFICER");
|
||||
//}
|
||||
|
||||
//if (allProfileEmpIds.Count > 0)
|
||||
//{
|
||||
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileEmpIds.ToArray(), "EMPLOYEE");
|
||||
//}
|
||||
}
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue