no message
This commit is contained in:
parent
1374757bf2
commit
9567181117
5 changed files with 528 additions and 6 deletions
|
|
@ -1699,5 +1699,50 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-23
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("employee/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteEmployee([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
{
|
||||
var data = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/org/profile-employee/salary/{data.profileId}";
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Put, apiUrl);
|
||||
var _res = await client.PutAsJsonAsync(apiUrl, new
|
||||
{
|
||||
isLeave = true,
|
||||
leaveReason = "ลาออกจากราชการ",
|
||||
dateLeave = recv.commandAffectDate,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue