ปรับ api ตามที่คุยใหม่
This commit is contained in:
parent
7b038f0131
commit
1a7be19e33
2 changed files with 174 additions and 20 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using Amazon.S3.Model.Internal.MarshallTransformations;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.Commands;
|
||||
using BMA.EHR.Application.Requests.Commands;
|
||||
using BMA.EHR.Command.Service.Requests;
|
||||
|
|
@ -493,7 +494,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-26 : ข้อมูลเลือกรายชื่อออกคำสั่ง
|
||||
/// PM7-26 : ข้อมูลเลือกรายชื่อออกคำสั่ง ** ยังไม่ได้กรองหน่วยงาน ** ** แสดงรายการจากระบบบรรจุ **
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -509,8 +510,57 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
try
|
||||
{
|
||||
// TODO : หาค่า Education มาแสดง
|
||||
var receivers = (await _repository.GetReceiverByCommmandIdAsync(orderId))
|
||||
var existed = await _repository.GetReceiverByCommmandIdAsync(orderId);
|
||||
|
||||
var receivers = (await _repository.GetReceiverForCommandAsync(orderId))
|
||||
.OrderBy(x => x.Sequence)
|
||||
.Select(r => new CommandReceiverResponse
|
||||
{
|
||||
RefRecordId = r.RefPlacementProfileId!.Value,
|
||||
PersonalId = r.Id,
|
||||
Sequence = r.Sequence,
|
||||
IdCard = r.CitizenId,
|
||||
Name = $"{r.Prefix!}{r.FirstName!} {r.LastName!}",
|
||||
SelectStatus = existed.FirstOrDefault(x => x.RefPlacementProfileId!.Value == r.RefPlacementProfileId!.Value) != null,
|
||||
Education = "" // ยังหาไม่เจอว่าอยุ่ field ไหน
|
||||
}).ToList();
|
||||
|
||||
foreach (var r in receivers)
|
||||
{
|
||||
var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
|
||||
|
||||
r.SalaryAmount = salary.SalaryAmount;
|
||||
r.PositionSalaryAmount = salary.PositionSalaryAmount;
|
||||
r.MonthSalaryAmount = salary.MonthSalaryAmount;
|
||||
}
|
||||
|
||||
return Success(receivers);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูลเลือกรายชื่อออกคำสั่ง ** ที่ได้เลือกเอาไว้แล้ว **
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("persons-selected/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandSelectReceiverAsync(Guid orderId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var receivers = (await _repository.GetReceiverByCommmandIdAsync(orderId))
|
||||
.OrderBy(x => x.Sequence)
|
||||
.Select(r => new CommandReceiverResponse
|
||||
{
|
||||
RefRecordId = r.RefPlacementProfileId!.Value,
|
||||
|
|
@ -540,7 +590,33 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-27 : ข้อมูลเลือกรายชื่อออกคำสั่ง ** ยังไม่ได้กรองหน่วยงาน **
|
||||
/// บันทึกข้อมูลเลือกรายชื่อออกคำสั่ง ** ที่ได้เลือกเอาไว้แล้ว **
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("persons/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> SaveCommandSelectReceiverAsync(Guid orderId,[FromBody] List<Guid> selected)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _repository.SaveSelectedReceiverAsync(orderId, selected);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-27 : ลบข้อมูลเลือกรายชื่อออกคำสั่ง
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ** ยังไม่ได้กรองหน่วยงาน **
|
||||
|
|
@ -935,8 +1011,8 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var record = await _repository.GetCommandReceiverAsync(personalId);
|
||||
|
||||
var record = await _repository.GetCommandReceiverAsync(personalId);
|
||||
|
||||
var data = await _repository.GetPlacementSalaryAsync(record!.RefPlacementProfileId!.Value);
|
||||
|
||||
return Success(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue