fix #1357 ปรับ API
This commit is contained in:
parent
7b55e16e7d
commit
88270a230f
6 changed files with 20839 additions and 27 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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue