เพิ่มคุณวุฒื
This commit is contained in:
parent
4168b178c9
commit
b88727a0ee
2 changed files with 359 additions and 356 deletions
|
|
@ -65,12 +65,15 @@ namespace BMA.EHR.Organization.Service.Models
|
||||||
[Column(Order = 14), Comment("IsDirector")]
|
[Column(Order = 14), Comment("IsDirector")]
|
||||||
public bool? IsDirector { get; set; }
|
public bool? IsDirector { get; set; }
|
||||||
|
|
||||||
|
[Column(Order = 15), Comment("คุณวุฒิ")]
|
||||||
|
public string? Qualification { get; set; }
|
||||||
|
|
||||||
public string? PositionPathSideObject { get; set; }
|
public string? PositionPathSideObject { get; set; }
|
||||||
|
|
||||||
public string? PositionExecutiveSideObject { get; set; }
|
public string? PositionExecutiveSideObject { get; set; }
|
||||||
|
|
||||||
//public List<AvailablePositionLevelEntity> AvailablePositionLevels { get; } = new();
|
//public List<AvailablePositionLevelEntity> AvailablePositionLevels { get; } = new();
|
||||||
//public List<PositionMasterHistoryEntity> PositionMasterHistorys { get; } = new();
|
//public List<PositionMasterHistoryEntity> PositionMasterHistorys { get; } = new();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,423 +7,423 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace BMA.EHR.Report.Service.Services
|
namespace BMA.EHR.Report.Service.Services
|
||||||
{
|
{
|
||||||
public class OrganizationReportService
|
public class OrganizationReportService
|
||||||
{
|
{
|
||||||
#region " Fields "
|
#region " Fields "
|
||||||
|
|
||||||
private readonly EHRDbContext _context;
|
private readonly EHRDbContext _context;
|
||||||
private readonly EHRDbContext _applicationDbContext;
|
private readonly EHRDbContext _applicationDbContext;
|
||||||
private readonly ProfileService _profileService;
|
private readonly ProfileService _profileService;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " Constructor and Destructor "
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
public OrganizationReportService(EHRDbContext context,
|
public OrganizationReportService(EHRDbContext context,
|
||||||
EHRDbContext applicationDbContext,
|
EHRDbContext applicationDbContext,
|
||||||
ProfileService profileService)
|
ProfileService profileService)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_applicationDbContext = applicationDbContext;
|
_applicationDbContext = applicationDbContext;
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " Methods "
|
#region " Methods "
|
||||||
|
|
||||||
#region " Report Query "
|
#region " Report Query "
|
||||||
|
|
||||||
public async Task<IEnumerable<dynamic>?> GetOrganizationTypes(string type)
|
public async Task<IEnumerable<dynamic>?> GetOrganizationTypes(string type)
|
||||||
{
|
{
|
||||||
var Organizations = await _context.Organizations.ToListAsync();
|
var Organizations = await _context.Organizations.ToListAsync();
|
||||||
|
|
||||||
var OrganizationOrganizations = await _context.OrganizationOrganizations.ToListAsync();
|
var OrganizationOrganizations = await _context.OrganizationOrganizations.ToListAsync();
|
||||||
var OrganizationTypes = await _context.OrganizationTypes.FirstOrDefaultAsync(x => x.Name == type);
|
var OrganizationTypes = await _context.OrganizationTypes.FirstOrDefaultAsync(x => x.Name == type);
|
||||||
|
|
||||||
if (OrganizationTypes == null)
|
if (OrganizationTypes == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Invalid Organization type.");
|
throw new Exception("Invalid Organization type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var dataType = (from o in Organizations
|
var dataType = (from o in Organizations
|
||||||
join os in OrganizationOrganizations on o.OrganizationOrganizationId equals os.Id into os1
|
join os in OrganizationOrganizations on o.OrganizationOrganizationId equals os.Id into os1
|
||||||
from os in os1.DefaultIfEmpty()
|
from os in os1.DefaultIfEmpty()
|
||||||
where o.OrganizationTypeId == OrganizationTypes.Id && os != null
|
where o.OrganizationTypeId == OrganizationTypes.Id && os != null
|
||||||
orderby o.OrganizationOrder
|
orderby o.OrganizationOrder
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
organizationId = o.Id,
|
organizationId = o.Id,
|
||||||
organizationName = os.Name
|
organizationName = os.Name
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
return dataType;
|
return dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<Account1ResultItem>> GetReport1Query(Guid ocId)
|
public async Task<List<Account1ResultItem>> GetReport1Query(Guid ocId)
|
||||||
{
|
{
|
||||||
var ocIdList = _profileService.GetAllIdByRoot(ocId);
|
var ocIdList = _profileService.GetAllIdByRoot(ocId);
|
||||||
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
||||||
|
|
||||||
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
||||||
var positionMasters = await _context.PositionMasters.ToListAsync();
|
var positionMasters = await _context.PositionMasters.ToListAsync();
|
||||||
var organizations = await _context.Organizations.ToListAsync();
|
var organizations = await _context.Organizations.ToListAsync();
|
||||||
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
||||||
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
||||||
var positionNumbers = await _context.PositionNumbers.ToListAsync();
|
var positionNumbers = await _context.PositionNumbers.ToListAsync();
|
||||||
var executivePositions = await _applicationDbContext.PositionExecutives.ToListAsync();
|
var executivePositions = await _applicationDbContext.PositionExecutives.ToListAsync();
|
||||||
var executivePositionSide = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
var executivePositionSide = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
||||||
var positionPaths = await _applicationDbContext.PositionPaths.ToListAsync();
|
var positionPaths = await _applicationDbContext.PositionPaths.ToListAsync();
|
||||||
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
||||||
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
||||||
|
|
||||||
var data = (from op in organizationPositions
|
var data = (from op in organizationPositions
|
||||||
join pm in positionMasters on op.PositionMasterId equals pm.Id
|
join pm in positionMasters on op.PositionMasterId equals pm.Id
|
||||||
join oc in organizations on op.OrganizationId equals oc.Id
|
join oc in organizations on op.OrganizationId equals oc.Id
|
||||||
join oc_n in organizationOrganizations on oc.OrganizationOrganizationId equals oc_n.Id
|
join oc_n in organizationOrganizations on oc.OrganizationOrganizationId equals oc_n.Id
|
||||||
join sn in organizationShortNames on oc.OrganizationShortNameId equals sn.Id
|
join sn in organizationShortNames on oc.OrganizationShortNameId equals sn.Id
|
||||||
join pn in positionNumbers on op.PositionNumberId equals pn.Id
|
join pn in positionNumbers on op.PositionNumberId equals pn.Id
|
||||||
join pp in positionPaths on pm.PositionPathId equals pp.Id
|
join pp in positionPaths on pm.PositionPathId equals pp.Id
|
||||||
join pps in positionPathSides on pm.PositionPathSideId equals pps.Id into pp_pps_join
|
join pps in positionPathSides on pm.PositionPathSideId equals pps.Id into pp_pps_join
|
||||||
from pp_pps in pp_pps_join.DefaultIfEmpty()
|
from pp_pps in pp_pps_join.DefaultIfEmpty()
|
||||||
join ex_p in executivePositions on pm.PositionExecutiveId equals ex_p.Id into pm_exp_join
|
join ex_p in executivePositions on pm.PositionExecutiveId equals ex_p.Id into pm_exp_join
|
||||||
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
||||||
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
||||||
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
||||||
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
||||||
where ocIdList.Contains((Guid)op.OrganizationId)
|
where ocIdList.Contains((Guid)op.OrganizationId)
|
||||||
select new Account1ResultItem
|
select new Account1ResultItem
|
||||||
{
|
{
|
||||||
Id = op.Id,
|
Id = op.Id,
|
||||||
RootOcId = ocId,
|
RootOcId = ocId,
|
||||||
RootOcName = RootOcName,
|
RootOcName = RootOcName,
|
||||||
OcId = op.OrganizationId.Value,
|
OcId = op.OrganizationId.Value,
|
||||||
OcFullName = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
OcFullName = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
||||||
OcName = _profileService.GetOrganizationName(op.OrganizationId.Value),
|
OcName = _profileService.GetOrganizationName(op.OrganizationId.Value),
|
||||||
ShortName = sn.Name,
|
ShortName = sn.Name,
|
||||||
PositionNumber = pn.Name,
|
PositionNumber = pn.Name,
|
||||||
PositionLevel = _profileService.GetPositionLevel(pm.Id),
|
PositionLevel = _profileService.GetPositionLevel(pm.Id),
|
||||||
PositionName = $"{pp.Name}\r\n",
|
PositionName = $"{pp.Name}\r\n",
|
||||||
PositionSide = pm.PositionPathSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionPathSideObject>>(pm.PositionPathSideObject).GetNameList(),
|
PositionSide = pm.PositionPathSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionPathSideObject>>(pm.PositionPathSideObject).GetNameList(),
|
||||||
PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n",
|
PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n",
|
||||||
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
||||||
Remark = op.PositionUserNote,
|
Remark = op.PositionUserNote,
|
||||||
OcOrder = oc.OrganizationOrder.Value,
|
OcOrder = oc.OrganizationOrder.Value,
|
||||||
PositionType = pt.Name
|
PositionType = pt.Name
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<Account2ResultItem>> GetReport2Query(Guid ocId)
|
public async Task<List<Account2ResultItem>> GetReport2Query(Guid ocId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var ocIdList = _profileService.GetAllIdByRoot(ocId);
|
var ocIdList = _profileService.GetAllIdByRoot(ocId);
|
||||||
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
||||||
|
|
||||||
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
||||||
var positionMasters = await _context.PositionMasters.ToListAsync();
|
var positionMasters = await _context.PositionMasters.ToListAsync();
|
||||||
var organizations = await _context.Organizations.ToListAsync();
|
var organizations = await _context.Organizations.ToListAsync();
|
||||||
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
||||||
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
||||||
var positionNumbers = await _context.PositionNumbers.ToListAsync();
|
var positionNumbers = await _context.PositionNumbers.ToListAsync();
|
||||||
var executivePositions = await _applicationDbContext.PositionExecutives.ToListAsync();
|
var executivePositions = await _applicationDbContext.PositionExecutives.ToListAsync();
|
||||||
var executivePositionSide = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
var executivePositionSide = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
||||||
var positionPaths = await _applicationDbContext.PositionPaths.ToListAsync();
|
var positionPaths = await _applicationDbContext.PositionPaths.ToListAsync();
|
||||||
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
||||||
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
||||||
var profilePositions = await _context.ProfilePositions.ToListAsync();
|
var profilePositions = await _context.ProfilePositions.ToListAsync();
|
||||||
var prefixes = await _context.Prefixes.ToListAsync();
|
var prefixes = await _context.Prefixes.ToListAsync();
|
||||||
var profiles = await _context.Profiles.ToListAsync();
|
var profiles = await _context.Profiles.ToListAsync();
|
||||||
var report2 = await _context.Report2s.ToListAsync();
|
var report2 = await _context.Report2s.ToListAsync();
|
||||||
|
|
||||||
var profile_data = (from p in _context.Profiles
|
var profile_data = (from p in _context.Profiles
|
||||||
join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
p.CitizenId,
|
p.CitizenId,
|
||||||
Prefix = pf.Name,
|
Prefix = pf.Name,
|
||||||
p.FirstName,
|
p.FirstName,
|
||||||
p.LastName,
|
p.LastName,
|
||||||
p.PositionLine,
|
p.PositionLine,
|
||||||
p.Position,
|
p.Position,
|
||||||
p.PositionPathSide,
|
p.PositionPathSide,
|
||||||
p.PositionType,
|
p.PositionType,
|
||||||
p.PositionLevel,
|
p.PositionLevel,
|
||||||
p.PositionExecutive,
|
p.PositionExecutive,
|
||||||
p.PositionExecutiveSide,
|
p.PositionExecutiveSide,
|
||||||
p.PosNo,
|
p.PosNo,
|
||||||
p.OrganizationShortName,
|
p.OrganizationShortName,
|
||||||
Degree = p.Educations == null || p.Educations.Count == 0 ? "" : $"{p.Educations.OrderBy(x => x.StartDate).Last().Degree}\r\n({p.Educations.OrderBy(x => x.StartDate).Last().Field})",
|
Degree = p.Educations == null || p.Educations.Count == 0 ? "" : $"{p.Educations.OrderBy(x => x.StartDate).Last().Degree}\r\n({p.Educations.OrderBy(x => x.StartDate).Last().Field})",
|
||||||
Salary = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().Amount,
|
Salary = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().Amount,
|
||||||
SalaryPosition = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().PositionSalaryAmount,
|
SalaryPosition = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().PositionSalaryAmount,
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
var report2_data = (from org_pos in _context.OrganizationPositions.ToList()
|
var report2_data = (from org_pos in _context.OrganizationPositions.ToList()
|
||||||
join ppos in _context.ProfilePositions.ToList() on org_pos.Id equals ppos.OrganizationPositionId
|
join ppos in _context.ProfilePositions.ToList() on org_pos.Id equals ppos.OrganizationPositionId
|
||||||
join pf in profile_data.ToList() on ppos.ProfileId equals pf.Id
|
join pf in profile_data.ToList() on ppos.ProfileId equals pf.Id
|
||||||
join r_raw in _context.Report2s.ToList() on ppos.Id equals r_raw.ProfilePositionId into r_join
|
join r_raw in _context.Report2s.ToList() on ppos.Id equals r_raw.ProfilePositionId into r_join
|
||||||
from r in r_join.DefaultIfEmpty()
|
from r in r_join.DefaultIfEmpty()
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
//Id = r.Id,
|
//Id = r.Id,
|
||||||
ProfilePositionId = ppos.Id,
|
ProfilePositionId = ppos.Id,
|
||||||
CitizenId = pf.CitizenId,
|
CitizenId = pf.CitizenId,
|
||||||
Prefix = pf.Prefix,
|
Prefix = pf.Prefix,
|
||||||
FirstName = pf.FirstName,
|
FirstName = pf.FirstName,
|
||||||
LastName = pf.LastName,
|
LastName = pf.LastName,
|
||||||
OrganizationName = r == null ? "" : r.OrganizationOrganization,
|
OrganizationName = r == null ? "" : r.OrganizationOrganization,
|
||||||
ShortName = r == null ? pf.OrganizationShortName : r.OrganizationShortName,
|
ShortName = r == null ? pf.OrganizationShortName : r.OrganizationShortName,
|
||||||
PositionNumber = r == null ? pf.PosNo : r.PositionNum,
|
PositionNumber = r == null ? pf.PosNo : r.PositionNum,
|
||||||
PositionPath = r == null ? pf.Position : r.PositionPath,
|
PositionPath = r == null ? pf.Position : r.PositionPath,
|
||||||
PositionPathSide = r == null ? pf.PositionPathSide : r.PositionPathSide,
|
PositionPathSide = r == null ? pf.PositionPathSide : r.PositionPathSide,
|
||||||
PositionType = r == null ? pf.PositionType : r.PositionType,
|
PositionType = r == null ? pf.PositionType : r.PositionType,
|
||||||
PositionLevel = r == null ? pf.PositionLevel : r.PositionLevel,
|
PositionLevel = r == null ? pf.PositionLevel : r.PositionLevel,
|
||||||
PositionExecutive = r == null ? pf.PositionExecutive : r.PositionExecutive,
|
PositionExecutive = r == null ? pf.PositionExecutive : r.PositionExecutive,
|
||||||
PositionExecutiveSide = r == null ? pf.PositionExecutiveSide : r.PositionExecutiveSide,
|
PositionExecutiveSide = r == null ? pf.PositionExecutiveSide : r.PositionExecutiveSide,
|
||||||
OcId = org_pos.Id,
|
OcId = org_pos.Id,
|
||||||
OrganizationPositionId = ppos.OrganizationPositionId,
|
OrganizationPositionId = ppos.OrganizationPositionId,
|
||||||
Degree = pf.Degree,
|
Degree = pf.Degree,
|
||||||
Salary = pf.Salary,
|
Salary = pf.Salary,
|
||||||
SalaryPosition = pf.SalaryPosition,
|
SalaryPosition = pf.SalaryPosition,
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
//var report2_data = (from r in _context.Report2s.ToList()
|
//var report2_data = (from r in _context.Report2s.ToList()
|
||||||
// join ppos in _context.ProfilePositions.ToList() on r.ProfilePositionId equals ppos.Id
|
// join ppos in _context.ProfilePositions.ToList() on r.ProfilePositionId equals ppos.Id
|
||||||
// join org_pos in _context.OrganizationPositions.ToList() on ppos.OrganizationPositionId equals org_pos.Id
|
// join org_pos in _context.OrganizationPositions.ToList() on ppos.OrganizationPositionId equals org_pos.Id
|
||||||
// join pf in profile_data.ToList() on ppos.ProfileId equals pf.Id
|
// join pf in profile_data.ToList() on ppos.ProfileId equals pf.Id
|
||||||
// select new
|
// select new
|
||||||
// {
|
// {
|
||||||
// Id = r.Id,
|
// Id = r.Id,
|
||||||
// ProfilePositionId = r.ProfilePositionId,
|
// ProfilePositionId = r.ProfilePositionId,
|
||||||
// CitizenId = pf.CitizenId,
|
// CitizenId = pf.CitizenId,
|
||||||
// Prefix = pf.Prefix,
|
// Prefix = pf.Prefix,
|
||||||
// FirstName = pf.FirstName,
|
// FirstName = pf.FirstName,
|
||||||
// LastName = pf.LastName,
|
// LastName = pf.LastName,
|
||||||
// OrganizationName = r.OrganizationOrganization,
|
// OrganizationName = r.OrganizationOrganization,
|
||||||
// ShortName = r.OrganizationShortName,
|
// ShortName = r.OrganizationShortName,
|
||||||
// PositionNumber = r.PositionNum,
|
// PositionNumber = r.PositionNum,
|
||||||
// PositionPath = r.PositionPath,
|
// PositionPath = r.PositionPath,
|
||||||
// PositionPathSide = r.PositionPathSide,
|
// PositionPathSide = r.PositionPathSide,
|
||||||
// PositionType = r.PositionType,
|
// PositionType = r.PositionType,
|
||||||
// PositionLevel = r.PositionLevel,
|
// PositionLevel = r.PositionLevel,
|
||||||
// PositionExecutive = r.PositionExecutive,
|
// PositionExecutive = r.PositionExecutive,
|
||||||
// PositionExecutiveSide = r.PositionExecutiveSide,
|
// PositionExecutiveSide = r.PositionExecutiveSide,
|
||||||
// OcId = org_pos.Id,
|
// OcId = org_pos.Id,
|
||||||
// OrganizationPositionId = ppos.OrganizationPositionId,
|
// OrganizationPositionId = ppos.OrganizationPositionId,
|
||||||
// Degree = pf.Degree,
|
// Degree = pf.Degree,
|
||||||
// Salary = pf.Salary,
|
// Salary = pf.Salary,
|
||||||
// SalaryPosition = pf.SalaryPosition,
|
// SalaryPosition = pf.SalaryPosition,
|
||||||
// }).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var data = (from op in organizationPositions
|
var data = (from op in organizationPositions
|
||||||
join pm in positionMasters on op.PositionMasterId equals pm.Id
|
join pm in positionMasters on op.PositionMasterId equals pm.Id
|
||||||
join oc in organizations on op.OrganizationId equals oc.Id
|
join oc in organizations on op.OrganizationId equals oc.Id
|
||||||
join oc_n in organizationOrganizations on oc.OrganizationOrganizationId equals oc_n.Id
|
join oc_n in organizationOrganizations on oc.OrganizationOrganizationId equals oc_n.Id
|
||||||
join sn in organizationShortNames on oc.OrganizationShortNameId equals sn.Id
|
join sn in organizationShortNames on oc.OrganizationShortNameId equals sn.Id
|
||||||
join pn in positionNumbers on op.PositionNumberId equals pn.Id
|
join pn in positionNumbers on op.PositionNumberId equals pn.Id
|
||||||
join pp in positionPaths on pm.PositionPathId equals pp.Id
|
join pp in positionPaths on pm.PositionPathId equals pp.Id
|
||||||
join pps in positionPathSides on pm.PositionPathSideId equals pps.Id into pp_pps_join
|
join pps in positionPathSides on pm.PositionPathSideId equals pps.Id into pp_pps_join
|
||||||
from pp_pps in pp_pps_join.DefaultIfEmpty()
|
from pp_pps in pp_pps_join.DefaultIfEmpty()
|
||||||
join ex_p in executivePositions on pm.PositionExecutiveId equals ex_p.Id into pm_exp_join
|
join ex_p in executivePositions on pm.PositionExecutiveId equals ex_p.Id into pm_exp_join
|
||||||
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
||||||
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
||||||
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
||||||
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
||||||
join rp2 in report2_data.ToList() on op.Id equals rp2.OrganizationPositionId into rp2_join
|
join rp2 in report2_data.ToList() on op.Id equals rp2.OrganizationPositionId into rp2_join
|
||||||
from rp2_dt in rp2_join.DefaultIfEmpty()
|
from rp2_dt in rp2_join.DefaultIfEmpty()
|
||||||
|
|
||||||
where ocIdList.Contains((Guid)op.OrganizationId)
|
where ocIdList.Contains((Guid)op.OrganizationId)
|
||||||
select new Account2ResultItem
|
select new Account2ResultItem
|
||||||
{
|
{
|
||||||
Id = op.Id,
|
Id = op.Id,
|
||||||
RootOcId = ocId,
|
RootOcId = ocId,
|
||||||
RootOcName = RootOcName,
|
RootOcName = RootOcName,
|
||||||
OcId = op.OrganizationId.Value,
|
OcId = op.OrganizationId.Value,
|
||||||
OcFullName = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
OcFullName = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
||||||
OcName = _profileService.GetOrganizationName(op.OrganizationId.Value),
|
OcName = _profileService.GetOrganizationName(op.OrganizationId.Value),
|
||||||
ShortName = sn.Name,
|
ShortName = sn.Name,
|
||||||
PositionNumber = pn.Name,
|
PositionNumber = pn.Name,
|
||||||
PositionLevel = rp2_dt == null ? _profileService.GetPositionLevel(pm.Id) : rp2_dt.PositionLevel,
|
PositionLevel = rp2_dt == null ? _profileService.GetPositionLevel(pm.Id) : rp2_dt.PositionLevel,
|
||||||
|
|
||||||
PositionName = $"{pp.Name}\r\n",
|
PositionName = $"{pp.Name}\r\n",
|
||||||
PositionSide = pm.PositionPathSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionPathSideObject>>(pm.PositionPathSideObject).GetNameList(),
|
PositionSide = pm.PositionPathSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionPathSideObject>>(pm.PositionPathSideObject).GetNameList(),
|
||||||
PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n",
|
PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n",
|
||||||
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
||||||
Remark = op.PositionUserNote,
|
Remark = op.PositionUserNote,
|
||||||
OcOrder = oc.OrganizationOrder.Value,
|
OcOrder = oc.OrganizationOrder.Value,
|
||||||
PositionType = pt.Name,
|
PositionType = pt.Name,
|
||||||
|
|
||||||
|
|
||||||
OcIdNew = rp2_dt == null ? op.OrganizationId.Value : rp2_dt.OcId,
|
OcIdNew = rp2_dt == null ? op.OrganizationId.Value : rp2_dt.OcId,
|
||||||
OcFullNameNew = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
OcFullNameNew = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
||||||
OcNameNew = rp2_dt == null ? _profileService.GetOrganizationName(op.OrganizationId.Value) : _profileService.GetOrganizationName(rp2_dt.OcId),
|
OcNameNew = rp2_dt == null ? _profileService.GetOrganizationName(op.OrganizationId.Value) : _profileService.GetOrganizationName(rp2_dt.OcId),
|
||||||
ShortNameNew = rp2_dt == null ? "" : rp2_dt.ShortName,
|
ShortNameNew = rp2_dt == null ? "" : rp2_dt.ShortName,
|
||||||
PositionNumberNew = rp2_dt == null ? "" : rp2_dt.PositionNumber,
|
PositionNumberNew = rp2_dt == null ? "" : rp2_dt.PositionNumber,
|
||||||
PositionLevelNew = rp2_dt == null ? "" : rp2_dt.PositionLevel,
|
PositionLevelNew = rp2_dt == null ? "" : rp2_dt.PositionLevel,
|
||||||
PositionNameNew = rp2_dt == null ? "" : rp2_dt.PositionPath,
|
PositionNameNew = rp2_dt == null ? "" : rp2_dt.PositionPath,
|
||||||
PositionSideNew = rp2_dt == null ? "" : rp2_dt.PositionPathSide,
|
PositionSideNew = rp2_dt == null ? "" : rp2_dt.PositionPathSide,
|
||||||
PositionExecutiveNew = rp2_dt == null ? "" : rp2_dt.PositionExecutive,
|
PositionExecutiveNew = rp2_dt == null ? "" : rp2_dt.PositionExecutive,
|
||||||
PositionExecutiveSideNew = rp2_dt == null ? "" : rp2_dt.PositionExecutiveSide,
|
PositionExecutiveSideNew = rp2_dt == null ? "" : rp2_dt.PositionExecutiveSide,
|
||||||
PositionTypeNew = rp2_dt == null ? "" : rp2_dt.PositionType,
|
PositionTypeNew = rp2_dt == null ? "" : rp2_dt.PositionType,
|
||||||
|
|
||||||
Prefix = rp2_dt == null ? "" : rp2_dt.Prefix,
|
Prefix = rp2_dt == null ? "" : rp2_dt.Prefix,
|
||||||
FirstName = rp2_dt == null ? "" : rp2_dt.FirstName,
|
FirstName = rp2_dt == null ? "" : rp2_dt.FirstName,
|
||||||
LastName = rp2_dt == null ? "" : rp2_dt.LastName,
|
LastName = rp2_dt == null ? "" : rp2_dt.LastName,
|
||||||
Degree = rp2_dt == null ? "" : rp2_dt.Degree,
|
Degree = rp2_dt == null ? (pm == null ? "" : pm.Qualification) : rp2_dt.Degree,
|
||||||
|
|
||||||
Salary = rp2_dt == null ? 0 : (int)rp2_dt.Salary.Value,
|
Salary = rp2_dt == null ? 0 : (int)rp2_dt.Salary.Value,
|
||||||
SalaryPosition = rp2_dt == null ? 0 : (int)rp2_dt.SalaryPosition.Value,
|
SalaryPosition = rp2_dt == null ? 0 : (int)rp2_dt.SalaryPosition.Value,
|
||||||
|
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Account1ResultItem
|
public class Account1ResultItem
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public Guid RootOcId { get; set; }
|
public Guid RootOcId { get; set; }
|
||||||
|
|
||||||
public string RootOcName { get; set; } = string.Empty;
|
public string RootOcName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Guid OcId { get; set; }
|
public Guid OcId { get; set; }
|
||||||
|
|
||||||
public string OcFullName { get; set; } = string.Empty;
|
public string OcFullName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OcName { get; set; } = string.Empty;
|
public string OcName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string ShortName { get; set; } = string.Empty;
|
public string ShortName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionNumber { get; set; } = string.Empty;
|
public string PositionNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionName { get; set; } = string.Empty;
|
public string PositionName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionSide { get; set; } = string.Empty;
|
public string PositionSide { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionLevel { get; set; } = string.Empty;
|
public string PositionLevel { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionExecutive { get; set; } = string.Empty;
|
public string PositionExecutive { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionExecutiveSide { get; set; } = string.Empty;
|
public string PositionExecutiveSide { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Remark { get; set; } = string.Empty;
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int OcOrder { get; set; } = 0;
|
public int OcOrder { get; set; } = 0;
|
||||||
|
|
||||||
public int PositionNumberInt { get; set; } = 0;
|
public int PositionNumberInt { get; set; } = 0;
|
||||||
|
|
||||||
public string PositionType { get; set; } = string.Empty;
|
public string PositionType { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Account2ResultItem
|
public class Account2ResultItem
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public Guid RootOcId { get; set; }
|
public Guid RootOcId { get; set; }
|
||||||
|
|
||||||
public string RootOcName { get; set; } = string.Empty;
|
public string RootOcName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Guid OcId { get; set; }
|
public Guid OcId { get; set; }
|
||||||
|
|
||||||
public string OcFullName { get; set; } = string.Empty;
|
public string OcFullName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OcName { get; set; } = string.Empty;
|
public string OcName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string ShortName { get; set; } = string.Empty;
|
public string ShortName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionNumber { get; set; } = string.Empty;
|
public string PositionNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionName { get; set; } = string.Empty;
|
public string PositionName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionSide { get; set; } = string.Empty;
|
public string PositionSide { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionLevel { get; set; } = string.Empty;
|
public string PositionLevel { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionExecutive { get; set; } = string.Empty;
|
public string PositionExecutive { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionExecutiveSide { get; set; } = string.Empty;
|
public string PositionExecutiveSide { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Remark { get; set; } = string.Empty;
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int OcOrder { get; set; } = 0;
|
public int OcOrder { get; set; } = 0;
|
||||||
|
|
||||||
public int PositionNumberInt { get; set; } = 0;
|
public int PositionNumberInt { get; set; } = 0;
|
||||||
|
|
||||||
public string PositionType { get; set; } = string.Empty;
|
public string PositionType { get; set; } = string.Empty;
|
||||||
|
|
||||||
// new
|
// new
|
||||||
public Guid RootOcIdNew { get; set; }
|
public Guid RootOcIdNew { get; set; }
|
||||||
|
|
||||||
public string RootOcNameNew { get; set; } = string.Empty;
|
public string RootOcNameNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Guid OcIdNew { get; set; }
|
public Guid OcIdNew { get; set; }
|
||||||
|
|
||||||
public string OcFullNameNew { get; set; } = string.Empty;
|
public string OcFullNameNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OcNameNew { get; set; } = string.Empty;
|
public string OcNameNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string ShortNameNew { get; set; } = string.Empty;
|
public string ShortNameNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionNumberNew { get; set; } = string.Empty;
|
public string PositionNumberNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionNameNew { get; set; } = string.Empty;
|
public string PositionNameNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionSideNew { get; set; } = string.Empty;
|
public string PositionSideNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionLevelNew { get; set; } = string.Empty;
|
public string PositionLevelNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionExecutiveNew { get; set; } = string.Empty;
|
public string PositionExecutiveNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionExecutiveSideNew { get; set; } = string.Empty;
|
public string PositionExecutiveSideNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int PositionNumberIntNew { get; set; } = 0;
|
public int PositionNumberIntNew { get; set; } = 0;
|
||||||
|
|
||||||
public string PositionTypeNew { get; set; } = string.Empty;
|
public string PositionTypeNew { get; set; } = string.Empty;
|
||||||
|
|
||||||
// name
|
// name
|
||||||
public string Prefix { get; set; } = string.Empty;
|
public string Prefix { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string FirstName { get; set; } = string.Empty;
|
public string FirstName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string LastName { get; set; } = string.Empty;
|
public string LastName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Degree { get; set; } = string.Empty;
|
public string Degree { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Salary { get; set; } = 0;
|
public int Salary { get; set; } = 0;
|
||||||
|
|
||||||
public int SalaryPosition { get; set; } = 0;
|
public int SalaryPosition { get; set; } = 0;
|
||||||
|
|
||||||
public string FullName { get; set; } = string.Empty;
|
public string FullName { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrganizationItem
|
public class OrganizationItem
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Order { get; set; } = 0;
|
public int Order { get; set; } = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue