add PositionLeaveName ในรายงาน
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
Suphonchai Phoonsawat 2025-03-31 12:17:10 +07:00
parent 9e9b3316e9
commit 9136cb8d8a
2 changed files with 88 additions and 108 deletions

View file

@ -79,6 +79,8 @@ namespace BMA.EHR.Application.Responses.Profiles
public string? CurrentZipCode { get; set; }
public string? PositionLeaveName { get; set; }
}
public class PosLevel

View file

@ -146,18 +146,6 @@ namespace BMA.EHR.Leave.Service.Controllers
// approver = list.First().Name;
//}
var orgName = "";
if (profile.Child1 != null && profile.Child1 != "")
orgName += $" {profile.Child1}";
if (profile.Child2 != null && profile.Child2 != "")
orgName += $" {profile.Child2}";
if (profile.Child3 != null && profile.Child3 != "")
orgName += $" {profile.Child3}";
if (profile.Child4 != null && profile.Child4 != "")
orgName += $" {profile.Child4}";
if (profile.Root != null && profile.Root != "")
orgName += $" {profile.Root}";
var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(data.KeycloakUserId, data.Type.Id, data.LeaveStartDate.Year);
return new
@ -172,8 +160,8 @@ namespace BMA.EHR.Leave.Service.Controllers
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PosLevel == null ? "-" : profile!.PosLevel,
organizationName = orgName,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile.Oc,
leaveDetail = data.LeaveDetail,
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(),
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate(),
@ -209,17 +197,7 @@ namespace BMA.EHR.Leave.Service.Controllers
// approver = list.First().Name;
//}
var orgName = "";
if (profile.Child1 != null && profile.Child1 != "")
orgName += $" {profile.Child1}";
if (profile.Child2 != null && profile.Child2 != "")
orgName += $" {profile.Child2}";
if (profile.Child3 != null && profile.Child3 != "")
orgName += $" {profile.Child3}";
if (profile.Child4 != null && profile.Child4 != "")
orgName += $" {profile.Child4}";
if (profile.Root != null && profile.Root != "")
orgName += $" {profile.Root}";
return new
{
@ -233,7 +211,7 @@ namespace BMA.EHR.Leave.Service.Controllers
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
wifeDayName = data.WifeDayName ?? "",
wifeDayDateBorn = data.WifeDayDateBorn ?? "",
@ -256,14 +234,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(data.KeycloakUserId, data.Type.Id, data.LeaveStartDate.Year);
@ -276,10 +254,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
restDayOldTotal = data.RestDayOldTotal,
@ -307,14 +285,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
if (data.HajjDayStatus == true)
{
@ -327,10 +305,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
@ -355,10 +333,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
leavebirthDate = data.LeaveBirthDate == null ? "" : data.LeaveBirthDate.Value.Date.ToThaiShortDate(),
@ -390,14 +368,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
return new
{
@ -408,10 +386,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
absentDaySummon = data.AbsentDaySummon,
@ -438,14 +416,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
return new
{
@ -456,10 +434,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
leavebirthDate = data.LeaveBirthDate == null ? "" : data.LeaveBirthDate.Value.Date.ToThaiShortDate(),
@ -493,14 +471,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
return new
{
@ -511,11 +489,11 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
fullnameEng = "",
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(),
@ -535,14 +513,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
return new
{
@ -553,10 +531,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
leaveSalary = data.LeaveSalary,
@ -590,14 +568,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
return new
{
@ -608,10 +586,10 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveWrote = data.LeaveWrote ?? "",
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
leaveTypeName = data.Type.Name,
dear = approver,
dear = data.Dear,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
@ -740,14 +718,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
//var approver = string.Empty;
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
var result = new
{
@ -760,11 +738,11 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveTypeName = data.Type.Name,
fullname = fullName,
positionName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName,
organizationName = profile!.Oc ?? "",
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(),
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate(),
dear = approver,
dear = data.Dear,
leaveTotal = data.LeaveTotal
}
};