add ข้อมูลเพิ่มจาก api leave-profile #1476
Some checks failed
release-dev / release-dev (push) Failing after 12s
Some checks failed
release-dev / release-dev (push) Failing after 12s
This commit is contained in:
parent
505df8e8b1
commit
2240c383c7
2 changed files with 125 additions and 25 deletions
|
|
@ -8,6 +8,8 @@ using BMA.EHR.Domain.Common;
|
|||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Leave.Commons;
|
||||
using BMA.EHR.Domain.Models.Leave.Requests;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.ModelsExam.Candidate;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Leave.Service.DTOs.Reports;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
|
@ -20,8 +22,10 @@ using Org.BouncyCastle.Ocsp;
|
|||
using Sentry;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Globalization;
|
||||
using System.Security.Claims;
|
||||
using static Nest.JoinField;
|
||||
|
||||
namespace BMA.EHR.Leave.Service.Controllers
|
||||
{
|
||||
|
|
@ -319,14 +323,14 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
|
||||
|
||||
leaveAddress = data.LeaveAddress.ToThaiNumber(),
|
||||
leaveNumber = data.LeaveNumber.ToThaiNumber(),
|
||||
LeaveRemain = (leaveLimit - sumLeave).ToString().ToThaiNumber(),
|
||||
|
||||
leaveTotal = data.LeaveTotal.ToString().ToThaiNumber(), // วันลาปัจจุบัน
|
||||
LeaveSummary = sumLeave.ToString().ToThaiNumber(), // วันลาครั้งก่อน
|
||||
|
||||
|
||||
LeaveAll = (data.LeaveTotal + sumLeave).ToString().ToThaiNumber(), // ลาครั้งนี้ + ครั้งก่อน
|
||||
LeaveLimit = leaveLimit.ToString().ToThaiNumber() // สิทธิ์การลา
|
||||
}
|
||||
|
|
@ -531,6 +535,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var profileLeave = await _userProfileRepository.GetProfileLeaveByKeycloakIdAsync(data.KeycloakUserId, AccessToken);
|
||||
if (profileLeave == null)
|
||||
{
|
||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
|
||||
|
||||
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
||||
|
|
@ -562,6 +572,49 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
|
||||
profileType = profile.ProfileType,
|
||||
|
||||
birthDate = profileLeave.BirthDate.ToThaiShortDate().ToThaiNumber(),
|
||||
retireDate = profileLeave.RetireDate.ToThaiShortDate().ToThaiNumber(),
|
||||
govAge = profileLeave.GovAge.ToThaiNumber(),
|
||||
age = profileLeave.Age.ToThaiNumber(),
|
||||
dateAppoint = profileLeave.DateAppoint.ToThaiShortDate().ToThaiNumber(),
|
||||
amount = ((double)profileLeave.Amount).ToNumericText().ToThaiNumber(),
|
||||
telephoneNumber = profileLeave.TelephoneNumber == null ? "" : profileLeave.TelephoneNumber.ToThaiNumber(),
|
||||
|
||||
posLevel = profileLeave.PosLevel.ToThaiNumber(),
|
||||
posType = profileLeave.PosType.ToThaiNumber(),
|
||||
currentAddress = profileLeave.CurrentAddress.ToThaiNumber(),
|
||||
oc = profileLeave.Oc.ToThaiNumber(),
|
||||
root = profileLeave.Root.ToThaiNumber(),
|
||||
child1 = profileLeave.Child1 == null ? "" : profileLeave.Child1!.ToThaiNumber(),
|
||||
child2 = profileLeave.Child2 == null ? "" : profileLeave.Child2!.ToThaiNumber(),
|
||||
child3 = profileLeave.Child3 == null ? "" : profileLeave.Child3!.ToThaiNumber(),
|
||||
child4 = profileLeave.Child4 == null ? "" : profileLeave.Child4!.ToThaiNumber(),
|
||||
|
||||
positions = profileLeave.Positions.Select(x => new
|
||||
{
|
||||
positionName = x.PositionName == null ? "" : x.PositionName.ToThaiNumber(),
|
||||
date = x.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
positionType = x.PositionType == null ? "" : x.PositionType.ToThaiNumber(),
|
||||
positionLevel = x.PositionLevel == null ? "" : x.PositionLevel.ToThaiNumber(),
|
||||
orgRoot = x.OrgRoot == null ? "" : x.OrgRoot.ToThaiNumber(),
|
||||
orgChild1 = x.OrgChild1 == null ? "" : x.OrgChild1.ToThaiNumber(),
|
||||
orgChild2 = x.OrgChild2 == null ? "" : x.OrgChild2.ToThaiNumber(),
|
||||
orgChild3 = x.OrgChild3 == null ? "" : x.OrgChild3.ToThaiNumber(),
|
||||
orgChild4 = x.OrgChild4 == null ? "" : x.OrgChild4.ToThaiNumber(),
|
||||
}).ToList(),
|
||||
educations = profileLeave.Educations.Select(x => new
|
||||
{
|
||||
educationLevel = x.EducationLevel == null ? "" : x.EducationLevel.ToThaiNumber(),
|
||||
institute = x.Institute == null ? "" : x.Institute.ToThaiNumber(),
|
||||
country = x.Country == null ? "" : x.Country.ToThaiNumber(),
|
||||
finishDate = x.FinishDate == null ? "" : x.FinishDate.Value.ToThaiShortDate().ToThaiNumber()
|
||||
}).ToList()
|
||||
|
||||
//positionName = profileLeave.PositionName,
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -630,6 +683,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var profileLeave = await _userProfileRepository.GetProfileLeaveByKeycloakIdAsync(data.KeycloakUserId, AccessToken);
|
||||
if (profileLeave == null)
|
||||
{
|
||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
|
||||
|
||||
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
||||
|
|
@ -662,6 +721,47 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
|
||||
|
||||
profileType = profile.ProfileType,
|
||||
|
||||
birthDate = profileLeave.BirthDate.ToThaiShortDate().ToThaiNumber(),
|
||||
retireDate = profileLeave.RetireDate.ToThaiShortDate().ToThaiNumber(),
|
||||
govAge = profileLeave.GovAge.ToThaiNumber(),
|
||||
age = profileLeave.Age.ToThaiNumber(),
|
||||
dateAppoint = profileLeave.DateAppoint.ToThaiShortDate().ToThaiNumber(),
|
||||
amount = ((double)profileLeave.Amount).ToNumericText().ToThaiNumber(),
|
||||
telephoneNumber = profileLeave.TelephoneNumber == null ? "" : profileLeave.TelephoneNumber.ToThaiNumber(),
|
||||
|
||||
posLevel = profileLeave.PosLevel.ToThaiNumber(),
|
||||
posType = profileLeave.PosType.ToThaiNumber(),
|
||||
currentAddress = profileLeave.CurrentAddress.ToThaiNumber(),
|
||||
oc = profileLeave.Oc.ToThaiNumber(),
|
||||
root = profileLeave.Root.ToThaiNumber(),
|
||||
child1 = profileLeave.Child1 == null ? "" : profileLeave.Child1!.ToThaiNumber(),
|
||||
child2 = profileLeave.Child2 == null ? "" : profileLeave.Child2!.ToThaiNumber(),
|
||||
child3 = profileLeave.Child3 == null ? "" : profileLeave.Child3!.ToThaiNumber(),
|
||||
child4 = profileLeave.Child4 == null ? "" : profileLeave.Child4!.ToThaiNumber(),
|
||||
|
||||
positions = profileLeave.Positions.Select(x => new
|
||||
{
|
||||
positionName = x.PositionName == null ? "" : x.PositionName.ToThaiNumber(),
|
||||
date = x.Date.ToThaiShortDate().ToThaiNumber(),
|
||||
positionType = x.PositionType == null ? "" : x.PositionType.ToThaiNumber(),
|
||||
positionLevel = x.PositionLevel == null ? "" : x.PositionLevel.ToThaiNumber(),
|
||||
orgRoot = x.OrgRoot == null ? "" : x.OrgRoot.ToThaiNumber(),
|
||||
orgChild1 = x.OrgChild1 == null ? "" : x.OrgChild1.ToThaiNumber(),
|
||||
orgChild2 = x.OrgChild2 == null ? "" : x.OrgChild2.ToThaiNumber(),
|
||||
orgChild3 = x.OrgChild3 == null ? "" : x.OrgChild3.ToThaiNumber(),
|
||||
orgChild4 = x.OrgChild4 == null ? "" : x.OrgChild4.ToThaiNumber(),
|
||||
}).ToList(),
|
||||
educations = profileLeave.Educations.Select(x => new
|
||||
{
|
||||
educationLevel = x.EducationLevel == null ? "" : x.EducationLevel.ToThaiNumber(),
|
||||
institute = x.Institute == null ? "" : x.Institute.ToThaiNumber(),
|
||||
country = x.Country == null ? "" : x.Country.ToThaiNumber(),
|
||||
finishDate = x.FinishDate == null ? "" : x.FinishDate.Value.ToThaiShortDate().ToThaiNumber()
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue