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
|
|
@ -4,43 +4,43 @@
|
||||||
{
|
{
|
||||||
public DateTime BirthDate { get; set; }
|
public DateTime BirthDate { get; set; }
|
||||||
public DateTime RetireDate { get; set; }
|
public DateTime RetireDate { get; set; }
|
||||||
public string GovAge { get; set; }
|
public string GovAge { get; set; } = string.Empty;
|
||||||
public string Age { get; set; }
|
public string Age { get; set; } = string.Empty;
|
||||||
public DateTime DateAppoint { get; set; }
|
public DateTime DateAppoint { get; set; }
|
||||||
public int Amount { get; set; }
|
public int Amount { get; set; }
|
||||||
public string? TelephoneNumber { get; set; }
|
public string? TelephoneNumber { get; set; } = string.Empty;
|
||||||
public string PositionName { get; set; }
|
public string PositionName { get; set; } = string.Empty;
|
||||||
public string PosLevel { get; set; }
|
public string PosLevel { get; set; } = string.Empty;
|
||||||
public string PosType { get; set; }
|
public string PosType { get; set; } = string.Empty;
|
||||||
public string CurrentAddress { get; set; }
|
public string CurrentAddress { get; set; } = string.Empty;
|
||||||
public string Oc { get; set; }
|
public string Oc { get; set; } = string.Empty;
|
||||||
public string Root { get; set; }
|
public string Root { get; set; } = string.Empty;
|
||||||
public string Child1 { get; set; }
|
public string? Child1 { get; set; }
|
||||||
public string? Child2 { get; set; }
|
public string? Child2 { get; set; }
|
||||||
public string? Child3 { get; set; }
|
public string? Child3 { get; set; }
|
||||||
public string? Child4 { get; set; }
|
public string? Child4 { get; set; }
|
||||||
public List<ProfileLeavePosition> Positions { get; set; }
|
public List<ProfileLeavePosition> Positions { get; set; } = new();
|
||||||
public List<ProfileLeaveEducation> Educations { get; set; }
|
public List<ProfileLeaveEducation> Educations { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfileLeavePosition
|
public class ProfileLeavePosition
|
||||||
{
|
{
|
||||||
public string? PositionName { get; set; }
|
public string? PositionName { get; set; } = string.Empty;
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public string? PositionType { get; set; }
|
public string? PositionType { get; set; } = string.Empty;
|
||||||
public string? PositionLevel { get; set; }
|
public string? PositionLevel { get; set; } = string.Empty;
|
||||||
public string? OrgRoot { get; set; }
|
public string? OrgRoot { get; set; } = string.Empty;
|
||||||
public string? OrgChild1 { get; set; }
|
public string? OrgChild1 { get; set; } = string.Empty;
|
||||||
public string? OrgChild2 { get; set; }
|
public string? OrgChild2 { get; set; } = string.Empty;
|
||||||
public string? OrgChild3 { get; set; }
|
public string? OrgChild3 { get; set; } = string.Empty;
|
||||||
public string? OrgChild4 { get; set; }
|
public string? OrgChild4 { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfileLeaveEducation
|
public class ProfileLeaveEducation
|
||||||
{
|
{
|
||||||
public string EducationLevel { get; set; }
|
public string EducationLevel { get; set; } = string.Empty;
|
||||||
public string Institute { get; set; }
|
public string Institute { get; set; } = string.Empty;
|
||||||
public string? Country { get; set; }
|
public string? Country { get; set; } = string.Empty;
|
||||||
public DateTime? FinishDate { get; set; }
|
public DateTime? FinishDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Leave.Commons;
|
using BMA.EHR.Domain.Models.Leave.Commons;
|
||||||
using BMA.EHR.Domain.Models.Leave.Requests;
|
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.Domain.Shared;
|
||||||
using BMA.EHR.Leave.Service.DTOs.Reports;
|
using BMA.EHR.Leave.Service.DTOs.Reports;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
@ -20,8 +22,10 @@ using Org.BouncyCastle.Ocsp;
|
||||||
using Sentry;
|
using Sentry;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Diagnostics.Eventing.Reader;
|
using System.Diagnostics.Eventing.Reader;
|
||||||
|
using System.Diagnostics.Metrics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using static Nest.JoinField;
|
||||||
|
|
||||||
namespace BMA.EHR.Leave.Service.Controllers
|
namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -319,14 +323,14 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||||
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate().ToThaiNumber(),
|
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||||
|
|
||||||
leaveAddress = data.LeaveAddress.ToThaiNumber(),
|
leaveAddress = data.LeaveAddress.ToThaiNumber(),
|
||||||
leaveNumber = data.LeaveNumber.ToThaiNumber(),
|
leaveNumber = data.LeaveNumber.ToThaiNumber(),
|
||||||
LeaveRemain = (leaveLimit - sumLeave).ToString().ToThaiNumber(),
|
LeaveRemain = (leaveLimit - sumLeave).ToString().ToThaiNumber(),
|
||||||
|
|
||||||
leaveTotal = data.LeaveTotal.ToString().ToThaiNumber(), // วันลาปัจจุบัน
|
leaveTotal = data.LeaveTotal.ToString().ToThaiNumber(), // วันลาปัจจุบัน
|
||||||
LeaveSummary = sumLeave.ToString().ToThaiNumber(), // วันลาครั้งก่อน
|
LeaveSummary = sumLeave.ToString().ToThaiNumber(), // วันลาครั้งก่อน
|
||||||
|
|
||||||
LeaveAll = (data.LeaveTotal + sumLeave).ToString().ToThaiNumber(), // ลาครั้งนี้ + ครั้งก่อน
|
LeaveAll = (data.LeaveTotal + sumLeave).ToString().ToThaiNumber(), // ลาครั้งนี้ + ครั้งก่อน
|
||||||
LeaveLimit = leaveLimit.ToString().ToThaiNumber() // สิทธิ์การลา
|
LeaveLimit = leaveLimit.ToString().ToThaiNumber() // สิทธิ์การลา
|
||||||
}
|
}
|
||||||
|
|
@ -531,6 +535,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
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 fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
|
||||||
|
|
||||||
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
//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(),
|
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||||
leaveDateEnd = data.LeaveEndDate.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);
|
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 fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
|
||||||
|
|
||||||
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
//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(),
|
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate().ToThaiNumber(),
|
||||||
leaveDateEnd = data.LeaveEndDate.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