เพิ่มรายการรักษาการ #2431
This commit is contained in:
parent
34ec9bb77c
commit
7bafbf5001
4 changed files with 398 additions and 23 deletions
|
|
@ -3,8 +3,10 @@ using BMA.EHR.Application.Repositories.Commands;
|
|||
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
|
||||
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses.Leaves;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||
using BMA.EHR.Domain.Models.Notifications;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -3162,13 +3164,14 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetAdditionalCheckRequestAsync([Required] int year, [Required] int month, [Required] int page = 1, [Required] int pageSize = 10, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_CHECKIN_SPECIAL");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
var jsonData = await _permission.GetPermissionWithActingAPIAsync("LIST", "SYS_CHECKIN_SPECIAL");
|
||||
//var jsonData = JsonConvert.DeserializeObject<GetPermissionWithActingResultDto>(getPermission);
|
||||
if (jsonData!.status != 200)
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
return Error(jsonData.message, StatusCodes.Status403Forbidden);
|
||||
}
|
||||
string role = jsonData["result"]?.ToString();
|
||||
//string role = jsonData["result"]?.ToString();
|
||||
string role = jsonData.result.privilege;
|
||||
var nodeId = string.Empty;
|
||||
var profileAdmin = new GetUserOCAllDto();
|
||||
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
|
||||
|
|
@ -3206,6 +3209,80 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
//var rawData = await _additionalCheckRequestRepository.GetAdditionalCheckRequests(year, month);
|
||||
var rawData = await _additionalCheckRequestRepository.GetAdditionalCheckRequestsByAdminRole(year, month, role, nodeId, profileAdmin?.Node, keyword);
|
||||
|
||||
// ถ้ามีการรักษาการ
|
||||
if (jsonData.result.isAct)
|
||||
{
|
||||
var posActs = jsonData.result.posMasterActs;
|
||||
foreach(var act in posActs)
|
||||
{
|
||||
var actRole = act.privilege;
|
||||
string actNodeId = string.Empty;
|
||||
int? actNode;
|
||||
|
||||
if (role == "NORMAL" || role == "CHILD")
|
||||
{
|
||||
actNodeId = act.child4DnaId != null ?
|
||||
act.child4DnaId.Value.ToString("D") :
|
||||
act.child3DnaId != null ?
|
||||
act.child3DnaId.Value.ToString("D") :
|
||||
act.child2DnaId != null ?
|
||||
act.child2DnaId.Value.ToString("D") :
|
||||
act.child1DnaId != null ?
|
||||
act.child1DnaId.Value.ToString("D") :
|
||||
act.rootDnaId != null ?
|
||||
act.rootDnaId.Value.ToString("D") :
|
||||
"";
|
||||
actNode = act.child4DnaId != null ?
|
||||
4 :
|
||||
act.child3DnaId != null ?
|
||||
3 :
|
||||
act.child2DnaId != null ?
|
||||
2 :
|
||||
act.child1DnaId != null ?
|
||||
1 :
|
||||
act.rootDnaId != null ?
|
||||
0 :
|
||||
null;
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
actNodeId = act.child3DnaId != null ?
|
||||
act.child3DnaId.Value.ToString("D") :
|
||||
act.child2DnaId != null ?
|
||||
act.child2DnaId.Value.ToString("D") :
|
||||
act.child1DnaId != null ?
|
||||
act.rootDnaId!.Value.ToString("D") :
|
||||
act.rootDnaId != null ?
|
||||
act.rootDnaId.Value.ToString("D") :
|
||||
"";
|
||||
actNode = act.child4DnaId != null ?
|
||||
4 :
|
||||
act.child3DnaId != null ?
|
||||
4 :
|
||||
act.child2DnaId != null ?
|
||||
3 :
|
||||
act.child1DnaId != null ?
|
||||
2 :
|
||||
act.rootDnaId != null ?
|
||||
0 :
|
||||
null;
|
||||
}
|
||||
else if (role == "ROOT" /*|| role == "PARENT"*/)
|
||||
{
|
||||
actNodeId = act.rootDnaId!.Value.ToString("D");
|
||||
actNode = 0;
|
||||
}
|
||||
|
||||
var rawDataAct = await _additionalCheckRequestRepository.GetAdditionalCheckRequestsByAdminRole(year, month, actRole, actNodeId, profileAdmin?.Node, keyword);
|
||||
if (rawDataAct != null)
|
||||
{
|
||||
if (rawData != null)
|
||||
rawData = rawData.Union(rawDataAct).ToList();
|
||||
else
|
||||
rawData = rawDataAct;
|
||||
}
|
||||
}
|
||||
}
|
||||
var total = rawData.Count;
|
||||
|
||||
var getDefaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue