Merge branch 'develop' into work
This commit is contained in:
commit
088748ef20
3 changed files with 146 additions and 0 deletions
|
|
@ -39,6 +39,19 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public string? RejectReason { get; set; }
|
||||
[Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
[Comment("สถานะยับยั้งผู้ดูแล")]
|
||||
public bool? OligarchReject { get; set; }
|
||||
[Comment("เหตุผลยับยั้งผู้ดูแล")]
|
||||
public string? OligarchRejectReason { get; set; }
|
||||
[Comment("วันที่ยับยั้งผู้ดูแล")]
|
||||
public DateTime? OligarchRejectDate { get; set; }
|
||||
[Comment("สถานะยับยั้งผู้บังคับบัญชา")]
|
||||
public bool? CommanderReject { get; set; }
|
||||
[Comment("เหตุผลยับยั้งผู้บังคับบัญชา")]
|
||||
public string? CommanderRejectReason { get; set; }
|
||||
[Comment("วันที่ยับยั้งผู้บังคับบัญชา")]
|
||||
public DateTime? CommanderRejectDate { get; set; }
|
||||
|
||||
public virtual List<RetirementResignDoc> RetirementResignDocs { get; set; } = new List<RetirementResignDoc>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,6 +214,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.PositionLevelOld,
|
||||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.OligarchReject,
|
||||
p.OligarchRejectReason,
|
||||
p.OligarchRejectDate,
|
||||
p.CommanderReject,
|
||||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
@ -252,6 +258,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.RejectReason,
|
||||
data.IsActive,
|
||||
data.CreatedAt,
|
||||
data.OligarchReject,
|
||||
data.OligarchRejectReason,
|
||||
data.OligarchRejectDate,
|
||||
data.CommanderReject,
|
||||
data.CommanderRejectReason,
|
||||
data.CommanderRejectDate,
|
||||
Docs = retirementResignDocs,
|
||||
};
|
||||
|
||||
|
|
@ -453,6 +465,116 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
|
||||
return Success();
|
||||
}
|
||||
/// <summary>
|
||||
/// ผู้บังคับบัญชา อนุมัติคำลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("commander/confirm/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonDateRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
// updated.Status = "APPROVE";
|
||||
updated.CommanderReject = false;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ผู้บังคับบัญชา ไม่อนุมัติคำลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("commander/reject/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonDateRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
// updated.Status = "REJECT";
|
||||
updated.CommanderReject = true;
|
||||
updated.CommanderRejectReason = req.Reason;
|
||||
updated.CommanderRejectDate = req.Date;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
/// <summary>
|
||||
/// ผู้มีอำนาจ อนุมัติคำลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("oligarch/confirm/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonDateRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
// updated.Status = "APPROVE";
|
||||
updated.OligarchReject = false;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ผู้มีอำนาจ ไม่อนุมัติคำลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("oligarch/reject/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonDateRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
// updated.Status = "REJECT";
|
||||
updated.OligarchReject = true;
|
||||
updated.OligarchRejectReason = req.Reason;
|
||||
updated.OligarchRejectDate = req.Date;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สั่งรายชื่อไปออกคำสั่ง
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Retirement.Service.Requests
|
||||
{
|
||||
public class RetirementReasonDateRequest
|
||||
{
|
||||
public string Reason { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue