diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs index a38bca7d..802eb059 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs @@ -391,7 +391,7 @@ public class Ghrh_ResumeController : BaseController状态 /// [HttpPost, Route("QueryESS")] - public async Task> QueryESS([FromBody] QueryBody body) + public async Task> QueryESS([FromBody] QueryBody body) { var condition = "1=1"; return await _service.QueryESS(body, condition); diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs index 02b9e292..502d0828 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs @@ -56,7 +56,7 @@ public interface IGhrh_ResumeServices : IBaseServices ModifyIsOffer(List ids, bool isOffer); - Task> QueryESS(QueryBody filter, string condition); + Task> QueryESS(QueryBody filter, string condition); Task Fail(List ids); diff --git a/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs b/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs index a38c730f..72dca4d0 100644 --- a/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs @@ -48,5 +48,21 @@ public class Ghrh_ResumeDto : Ghrh_Resume public List TagList { get; set; } public List EduBG { get; set; } public List WorkExp { get; set; } + + + public long? ResumeId { get; set; } + public string OrderNo { get; set; } + public DateTime? RecommendTime { get; set; } + + public int? Round { get; set; } + public bool? IsPass { get; set; } + public string InterviewResult { get; set; } + public string OrderStatus { get; set; } + + public int? StaffId { get; set; } + public string CancelReason { get; set; } + public bool? IsCancel { get; set; } + public bool? IsAllowAssess { get; set; } + } diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs index 42259c56..656a4309 100644 --- a/Tiobon.Core.Services/BASE/BaseServices.cs +++ b/Tiobon.Core.Services/BASE/BaseServices.cs @@ -1381,15 +1381,15 @@ public class BaseServices : IBaseServ } #endregion - public string GetQueryString(string sqlSelect, int? currentPage = null, int? pageSize = null, string sortField = null, string sortDirection = null) + public string GetQueryString(string sqlSelect, int? currentPage = null, int? pageSize = null, string sortField = null) { string queryString = string.Empty; if (string.IsNullOrEmpty(sortField)) queryString = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY ROW_ID) NUM FROM (SELECT * FROM (" + sqlSelect + " WHERE 1=1 "; else { - if (!string.IsNullOrEmpty(sortDirection)) - queryString = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY " + sortField + " " + sortDirection + ") NUM FROM (SELECT * FROM (" + sqlSelect + " "; + if (!string.IsNullOrEmpty(sortField)) + queryString = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY " + sortField + ") NUM FROM (SELECT * FROM (" + sqlSelect + " "; else queryString = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY " + sortField + " DESC) NUM FROM (SELECT * FROM (" + sqlSelect + " "; } diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index a4c393ed..9849369b 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -232,7 +232,7 @@ public class Ghrh_ResumeServices : BaseServices tagIds.Contains(x.Id)); list.ForEach(async x => { - //x.ResumeId = x.Id; + x.ResumeId = x.Id; if (x.TitleId != null) x.TitleName = titles.Where(o => o.TitleID == x.TitleId).FirstOrDefault()?.TitleName; x.TitleLabel = x.TitleName; x.GenderLabel = await GetParaLabel("Gender", x.Gender); @@ -1824,7 +1824,7 @@ END"; #endregion #region ESS端查询简历记录 - public async Task> QueryESS(QueryBody filter, string condition) + public async Task> QueryESS(QueryBody filter, string condition) { int? staffId = GetStaffId(); RefAsync totalCount = 0; @@ -2063,11 +2063,78 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1"; sql += " AND " + condition; if (filter.pageSize == 0) filter.pageSize = 10000; - var data = await Db.SqlQueryable(sql) - .OrderBy(filter.orderBy) - .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); - - return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, data); + + var sql1 = GetQueryString(sql, filter.pageNum, filter.pageSize, filter.orderBy); + + totalCount = await Db.Ado.GetIntAsync("select count(0) from ( " + sql + ") A"); + var list = DbAccess.QueryList(sql); + //var data = await Db.SqlQueryable(sql) + // .OrderBy(filter.orderBy) + // .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); + + var ids = list.Select(x => x.ResumeId).ToList(); + var titleIds = list.Where(x => x.TitleId != null).Select(x => x.TitleId.Value).Distinct().ToList(); + + var titles = await Db.Queryable().Where(x => x.TitleID != null && titleIds.Contains(x.TitleID.Value)).ToListAsync(); + var eduBGs = await _ghrh_ResumeEduBGServices.QueryDto(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value)); + var workExps = await _ghrh_ResumeWorkExpServices.QueryDto(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value)); + eduBGs.ForEach(async x => + { + x.DegreeLevelLabel = await GetParaLabel("EducationalBGLevel", x.DegreeLevel); + x.BeginDate1 = DateTimeHelper.ConvertToDayString(x.BeginDate); + x.EndDate1 = DateTimeHelper.ConvertToDayString(x.EndDate); + }); + workExps.ForEach(x => + { + x.BeginDate1 = DateTimeHelper.ConvertToDayString(x.BeginDate); + x.EndDate1 = DateTimeHelper.ConvertToDayString(x.EndDate); + }); + + var tagIds = new List(); + list.ForEach(x => + { + if (x.Tags.IsNotEmptyOrNull()) + tagIds.AddRange(JsonHelper.JsonToObj>(x.Tags)); + }); + + tagIds = tagIds.Distinct().ToList(); + var tags = await _ghrh_ResumeTagServices.QueryDto(x => tagIds.Contains(x.Id)); + list.ForEach(async x => + { + //x.ResumeId = x.Id; + if (x.TitleId != null) x.TitleName = titles.Where(o => o.TitleID == x.TitleId).FirstOrDefault()?.TitleName; + x.TitleLabel = x.TitleName; + x.GenderLabel = await GetParaLabel("Gender", x.Gender); + x.EducationLabel = await GetParaLabel("EducationalBGLevel", x.Education); + x.NationLabel = await GetParaLabel("A02", x.Nation); + x.MaritalStatusLabel = await GetParaLabel("A03", x.MaritalStatus); + x.PoliticStatusLabel = await GetParaLabel("A04", x.PoliticStatus); + x.UrgentRelationLabel = await GetParaLabel("SocialRelationType", x.UrgentRelation); + x.CertificateTypeLabel = await GetParaLabel("D51", x.CertificateType); + x.RegisteredTypeLabel = await GetParaLabel("A08", x.RegisteredType); + + x.EduBG = eduBGs.Where(o => x.ResumeId == o.ResumeId).ToList(); + x.WorkExp = workExps.Where(o => x.ResumeId == o.ResumeId).ToList(); + if (x.Tags.IsNotEmptyOrNull()) + { + var tagIds1 = JsonHelper.JsonToObj>(x.Tags); + x.TagList = tags.Where(o => tagIds1.Contains(o.Id)).Select(o => o.TagName).ToList(); + } + + #region 计算年龄 + if (x.Birthday != null && x.Birthday > DateTime.MinValue) + { + DateTime birthdate = (DateTime)x.Birthday; + DateTime now = DateTime.Now; + int age = now.Year - birthdate.Year; + if (now.Month < birthdate.Month || (now.Month == birthdate.Month && now.Day < birthdate.Day)) + age--; + x.Age = age; + } + #endregion + }); + + return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, list); } #endregion