api คำสั่งแต่งตั้ง เลื่อน ย้ายจากราชกิจจาฯ
Some checks failed
release-dev / release-dev (push) Failing after 11s
Some checks failed
release-dev / release-dev (push) Failing after 11s
This commit is contained in:
parent
0b9d3b16ac
commit
ac6e4f5c1f
1 changed files with 115 additions and 0 deletions
|
|
@ -1908,5 +1908,120 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-47
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("gazette/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostGazetteReportAppoint([FromBody] ReportPersonRequest req)
|
||||
{
|
||||
var placementProfiles = await _context.PlacementAppointments
|
||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
placementProfiles.ForEach(profile =>
|
||||
{
|
||||
profile.Status = req.status.Trim().ToUpper();
|
||||
//profile.typeCommand = "APPOINT";
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบรายชื่อออกคำสั่ง C-PM-47
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("gazette/report/delete")]
|
||||
public async Task<ActionResult<ResponseObject>> PostGazetteReportDeleteAppoint([FromBody] ReportPersonRequest req)
|
||||
{
|
||||
var placementProfiles = await _context.PlacementAppointments
|
||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
placementProfiles.ForEach(profile => profile.Status = "PENDING");
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-47
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("gazette/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostGazetteReportExecuteAppoint([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
var data = await _context.PlacementAppointments
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
amount = r.amount,
|
||||
amountSpecial = r.amountSpecial,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
positionExecutive = p.PositionExecutive,
|
||||
positionExecutiveField = p.positionExecutiveField,
|
||||
positionArea = p.positionArea,
|
||||
positionType = p.posTypeName,
|
||||
positionLevel = p.posLevelName,
|
||||
posmasterId = p.posmasterId,
|
||||
positionId = p.positionId,
|
||||
commandId = r.commandId,
|
||||
orgRoot = p.root,
|
||||
orgChild1 = p.child1,
|
||||
orgChild2 = p.child2,
|
||||
orgChild3 = p.child3,
|
||||
orgChild4 = p.child4,
|
||||
commandNo = r.commandNo,
|
||||
commandYear = r.commandYear,
|
||||
posNo = p.posMasterNo?.ToString(),
|
||||
posNoAbb = p.node == 4 ? $"{p.child4ShortName}" :
|
||||
p.node == 3 ? $"{p.child3ShortName}" :
|
||||
p.node == 2 ? $"{p.child2ShortName}" :
|
||||
p.node == 1 ? $"{p.child1ShortName}" :
|
||||
p.node == 0 ? $"{p.rootShortName}" : "",
|
||||
commandDateAffect = r.commandDateAffect,
|
||||
commandDateSign = r.commandDateSign,
|
||||
positionName = p.position,
|
||||
commandCode = r.commandCode,
|
||||
commandName = r.commandName,
|
||||
remark = r.remark,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-current";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue