fix defect and add new api
This commit is contained in:
parent
576c43749a
commit
019a400028
7 changed files with 1180 additions and 6 deletions
|
|
@ -151,7 +151,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
|
||||
LeaveSalaryText = req.LeaveSalaryText ?? "",
|
||||
LeaveStatus = "NEW",
|
||||
LeaveStatus = "DRAFT",
|
||||
KeycloakUserId = userId,
|
||||
ApproveStep = APPROVE_STEP_CREATE
|
||||
};
|
||||
|
|
@ -273,6 +273,24 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
break;
|
||||
}
|
||||
|
||||
// add dear and oc_data
|
||||
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty);
|
||||
var approver = string.Empty;
|
||||
if (rootOc != null)
|
||||
{
|
||||
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
||||
if (list.Count > 0)
|
||||
approver = list.First().Name;
|
||||
}
|
||||
|
||||
leaveRequest.LeaveTypeCode = leaveType.Code;
|
||||
leaveRequest.Dear = approver;
|
||||
leaveRequest.PositionName = profile.Position == null ? "" : profile.Position.Name;
|
||||
leaveRequest.PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name;
|
||||
leaveRequest.OrganizationName = profile.Oc ?? "";
|
||||
|
||||
|
||||
|
||||
// save to database
|
||||
await _leaveRequestRepository.AddAsync(leaveRequest);
|
||||
|
||||
|
|
@ -328,11 +346,14 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
DateSendLeave = DateTime.Now.Date,
|
||||
LeaveTypeName = leaveType.Name,
|
||||
Dear = approver,
|
||||
|
||||
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
|
||||
|
||||
Dear = approver,
|
||||
PositionName = profile.Position == null ? "" : profile.Position.Name,
|
||||
PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
|
||||
OrganizationName = profile.Oc ?? "",
|
||||
|
||||
LeaveLimit = leaveType.Limit,
|
||||
LeaveTotal = sumLeave,
|
||||
LeaveRemain = leaveType.Limit - sumLeave,
|
||||
|
|
@ -592,6 +613,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CoupleDayStartDateHistory = rawData.CoupleDayStartDateHistory,
|
||||
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
|
||||
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
|
||||
|
||||
Dear = rawData.Dear ?? "",
|
||||
PositionName = rawData.PositionName ?? "",
|
||||
PositionLevelName = rawData.PositionLevelName ?? "",
|
||||
OrganizationName = rawData.OrganizationName ?? "",
|
||||
LeaveTypeCode = rawData.LeaveTypeCode ?? ""
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -892,6 +919,26 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LV2_021 - ส่งคำขอลา
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// </returns>
|
||||
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("user/send/{id:guid}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> SendLeaveRequestAsync(Guid id,
|
||||
[FromBody] LeaveRequestApproveDto req)
|
||||
{
|
||||
await _leaveRequestRepository.SendToOfficerAsync(id);
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LV2_017 - ผู้มีอำนาจไม่อนุมัติการลา (ADMIN)
|
||||
/// </summary>
|
||||
|
|
@ -971,9 +1018,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
Id = rawData.Id,
|
||||
ReasonCommander = rawData.LeaveComment ?? "",
|
||||
ReasonOligarch = rawData.LeaveDirectorComment ?? "",
|
||||
PositionName = profile.Position == null ? "" : profile.Position.Name,
|
||||
PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
|
||||
OrganizationName = profile.Oc ?? "",
|
||||
|
||||
LeaveTypeName = rawData.Type.Name,
|
||||
LeaveTypeId = rawData.Type.Id,
|
||||
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
|
||||
|
|
@ -1038,7 +1083,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
|
||||
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
|
||||
|
||||
Dear = approver,
|
||||
// Dear = approver,
|
||||
// PositionName = profile.Position == null ? "" : profile.Position.Name,
|
||||
// PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
|
||||
// OrganizationName = profile.Oc ?? "",
|
||||
|
||||
// เปลี่ยนมาอ่านจากฐานข้อมูลแทน read_db
|
||||
Dear = rawData.Dear ?? "",
|
||||
PositionName = rawData.PositionName ?? "",
|
||||
PositionLevelName = rawData.PositionLevelName ?? "",
|
||||
OrganizationName = rawData.OrganizationName ?? "",
|
||||
|
||||
|
||||
ApproveStep = rawData.ApproveStep ?? "-",
|
||||
|
||||
LeaveLimit = rawData.Type.Limit,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue