diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs new file mode 100644 index 00000000..0c01efc2 --- /dev/null +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs @@ -0,0 +1,386 @@ +using SqlSugar; +using System.Dynamic; +using Tiobon.Core.Common.DB.Dapper.Extensions; +using Tiobon.Core.Model.ViewModels.Extend; + +namespace Tiobon.Core.Api.Controllers; + +[AllowAnonymous, Route("Ghrh_ResumeTemplatePreview/[action]"), ApiExplorerSettings(GroupName = Grouping.GroupName_Other)] +public class Ghrh_ResumeTemplatePreviewController : Controller +{ + + private readonly ISqlSugarClient _db; + private readonly IGhrh_ResumeServices _ghrh_ResumeServices; + private readonly IGhrh_ResumeHomeServices _ghrh_ResumeHomeServices; + + + public Ghrh_ResumeTemplatePreviewController(ISqlSugarClient db, + IGhrh_ResumeServices ghrh_ResumeServices, + IGhrh_ResumeHomeServices ghrh_ResumeHomeServices) + { + _db = db; + _ghrh_ResumeServices = ghrh_ResumeServices; + _ghrh_ResumeHomeServices = ghrh_ResumeHomeServices; + } + /// + /// Index + /// + /// + public async Task Index() + { + string sql = @"DECLARE @ID BIGINT = 1 + +BEGIN + DECLARE + @MasterTemplateID INT = 0, + @TemplateType INT -- 母版设定ID + SELECT @TemplateType = TemplateType + FROM Ghrh_ResumeTemplate + WHERE ID = @ID + SELECT @MasterTemplateID = ID + FROM Ghrh_ResumeTemplate + WHERE IsEnable = 1 AND TemplateType = 1 + + SELECT * + FROM (SELECT a.ID, + a.ID ResumeTemplateInfoGroupID, + b.ID ResumeInfoGroupID, + b.GroupName tabName, + b.GroupType tabKey, + b.TableName, + b.TablePKIDName, -- 是否可挑选栏位 + ISNULL (a.IsDisplay, 0) isDisplay, + isnull (a.SortNo, b.SortNo) SortNo, + CASE + WHEN b.GroupType = 'Base' THEN 'list' + WHEN b.GroupType = 'Attachment' THEN 'Attachment' + WHEN b.GroupType = 'Statement' THEN 'Statement' + ELSE 'block' + END AS type, + -- case when ISNULL(a.IsDisplay,0)=0 then '' + CASE + WHEN 1 = 2 + THEN + '' + ELSE + CASE + WHEN b.GroupType = 'Base' -- 读取各模板设定 + THEN + isnull + ( + (SELECT pp.ColumnName field, + pp.ResumeInfoColumnName label, + pp.IsRequired required, + pp.ColumnType elementType, + CASE + WHEN pp.DataSourceType = + 'ParaDetailNo' + THEN + (SELECT 'TBParaDetail_' + + ParaTypeNo + + '_' + + ParaMasterNo + FROM Ghrs_ParaMaster + WHERE ParaMasterId = + pp.DataSource) + WHEN pp.DataSourceType = + 'CommonList' + THEN + (SELECT 'CommonList_' + + ListCommonSqlNo + FROM Ghrs_ListCommonSql + WHERE ListCommonSqlId = + pp.DataSource) + ELSE + NULL + END dataSource, + pp.DataType dataType, + pp.MultipleSelect multipleSelect, + kk.SortNo sortNo, + pp.Placeholder placeholder, + pp.Editable editable + FROM Ghrh_ResumeTemplateInfoGroupColumn kk, + Ghrh_ResumeInfoColumn pp + WHERE kk.ResumeTemplateInfoGroupID = a.ID + -- a.ResumeTemplateInfoGroupID + AND kk.ResumeInfoColumnID = pp.ID + AND kk.IsDisplay = 1 + AND pp.IsEnable = 1 + AND kk.IsEnable = 1 + order by kk.SortNo + FOR JSON PATH, INCLUDE_NULL_VALUES), + '') + WHEN b.GroupType = 'Photo' -- 读取各模板设定 + THEN + (SELECT PhotoType + FROM Ghrh_ResumeTemplate + WHERE ResumeTemplateID = @MasterTemplateID + FOR JSON PATH, INCLUDE_NULL_VALUES) + WHEN b.GroupType NOT IN ('Base', 'Photo') -- 读取母版的设定 + THEN + isnull + ( + (SELECT pp.ColumnName field, + pp.ResumeInfoColumnName label, + pp.IsRequired required, + pp.ColumnType elementType, + CASE + WHEN pp.DataSourceType = + 'ParaDetailNo' + THEN + (SELECT 'TBParaDetail_' + + ParaTypeNo + + '_' + + ParaMasterNo + FROM Ghrs_ParaMaster + WHERE ParaMasterId = + pp.DataSource) + WHEN pp.DataSourceType = + 'CommonList' + THEN + (SELECT 'CommonList_' + + ListCommonSqlNo + FROM Ghrs_ListCommonSql + WHERE ListCommonSqlId = + pp.DataSource) + ELSE + NULL + END dataSource, + pp.DataType dataType, + pp.MultipleSelect multipleSelect, + kk.SortNo sortNo, + pp.Placeholder placeholder, + pp.Editable editable + FROM Ghrh_ResumeTemplateInfoGroupColumn kk, + Ghrh_ResumeInfoColumn pp + WHERE kk.ResumeTemplateID = + @MasterTemplateID + AND kk.ResumeInfoGroupId = b.Id + -- b.ResumeInfoGroupId + AND pp.Id = kk.ResumeInfoColumnId + AND kk.IsDisplay = 1 + AND pp.IsEnable = 1 + AND kk.IsEnable = 1 + order by kk.SortNo + FOR JSON PATH, INCLUDE_NULL_VALUES), + '') + END + END children1 + FROM Ghrh_ResumeInfoGroup b + LEFT JOIN Ghrh_ResumeTemplateInfoGroup a + ON a.ResumeInfoGroupId = b.ID + AND a.IsEnable = 1 + AND a.ResumeTemplateID = @ID + WHERE b.IsEnable = 1) a + WHERE a.IsDisplay = 1 + -- order by ISNULL(a.IsDisplay,0) desc,isnull(a.SortNo,b.SortNo) -- 显示的放上面, 不显示的放下面, 再按照序号排序 + ORDER BY a.SortNo ASC +END"; + var columns = await _db.Ado.SqlQueryAsync(sql); + columns.ForEach(x => + { + if (x.children1.IsNotEmptyOrNull()) + x.children = JsonHelper.JsonToObj>(x.children1); + if (x.children != null) + { + + x.children = x.children.Where(o => o.label != "附件").ToList(); + if (x.tabKey == "Base") + { + x.children.ForEach(o => + { + if (o.field == "TitleId") o.field = "TitleName"; + if (o.field == "Gender") o.field = "GenderLabel"; + if (o.field == "Education") o.field = "EducationLabel"; + if (o.field == "Nation") o.field = "NationLabel"; + if (o.field == "MaritalStatus") o.field = "MaritalStatusLabel"; + if (o.field == "PoliticStatus") o.field = "PoliticStatusLabel"; + if (o.field == "UrgentRelation") o.field = "UrgentRelationLabel"; + if (o.field == "CertificateType") o.field = "CertificateTypeLabel"; + if (o.field == "RegisteredType") o.field = "RegisteredTypeLabel"; + }); + } + if (x.tabKey == "Family") + x.children.ForEach(o => + { + if (o.field == "Gender") o.field = "GenderLabel"; + }); + } + x.children1 = null; + }); + ViewBag.Columns = columns.Where(o => o.tabName != "附件").ToList(); + + + + #region Data + dynamic Data = new ExpandoObject(); + + var formColumns = await QueryResumeFormColumn(1); + + #region Base + var id = 1856146208591056896; + var entity = await _ghrh_ResumeServices.QueryById(id); + var columnNames = formColumns.Where(x => x.GroupType == "Base").Select(x => x.ColumnName).ToList(); + columnNames = columnNames.Distinct().ToList(); + var dicts = new Dictionary + { + }; + columnNames.Add("TitleName"); + columnNames.Add("GenderLabel"); + columnNames.Add("EducationLabel"); + columnNames.Add("NationLabel"); + columnNames.Add("MaritalStatusLabel"); + columnNames.Add("PoliticStatusLabel"); + columnNames.Add("UrgentRelationLabel"); + columnNames.Add("CertificateTypeLabel"); + columnNames.Add("RegisteredTypeLabel"); + columnNames.ForEach(x => + { + var value = entity.GetPropertyValue(x); + dicts.Add(x, value); + }); + ViewBag.BaseDic = dicts; + #endregion + + #region 家庭关系 + + columnNames = formColumns.Where(x => x.GroupType == "Family").Select(x => x.ColumnName).ToList(); + columnNames = columnNames.Distinct().ToList(); + columnNames.Add("GenderLabel"); + columnNames.Add("GenderLabel"); + var familys = await _ghrh_ResumeHomeServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + var familyDic = new List>(); + familys.ForEach(family => + { + var dicts = new Dictionary(); + columnNames.ForEach(x => + { + var value = family.GetPropertyValue(x); + dicts.Add(x, value); + }); + if (columnNames.Any(x => x == "AttachmentIDs")) + dicts["AttachmentIDs"] = family.AttachmentIDs; + familyDic.Add(dicts); + }); + + ViewBag.FamilyDic = familyDic; + #endregion + + //#region 教育背景 + + //columnNames = formColumns.Where(x => x.GroupType == "Education").Select(x => x.ColumnName).ToList(); + //columnNames = columnNames.Distinct().ToList(); + //var educations = await _ghrh_ResumeEduBGServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + //var educationDic = new List>(); + //educations.ForEach(education => + //{ + // var dicts = new Dictionary(); + // columnNames.ForEach(x => + // { + // var value = education.GetPropertyValue(x); + // dicts.Add(x, value); + // }); + // if (columnNames.Any(x => x == "AttachmentIDs")) + // dicts["AttachmentIDs"] = education.AttachmentIDs; + // educationDic.Add(dicts); + //}); + + //Data.Education = educationDic; + //#endregion + + //#region 工作经历 + //columnNames = formColumns.Where(x => x.GroupType == "WorkExp").Select(x => x.ColumnName).ToList(); + //columnNames = columnNames.Distinct().ToList(); + //var workExps = await _ghrh_ResumeWorkExpServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + //var workExpDic = new List>(); + //workExps.ForEach(workExp => + //{ + // var dicts = new Dictionary(); + // columnNames.ForEach(x => + // { + // var value = workExp.GetPropertyValue(x); + // dicts.Add(x, value); + // }); + // if (columnNames.Any(x => x == "AttachmentIDs")) + // dicts["AttachmentIDs"] = workExp.AttachmentIDs; + // workExpDic.Add(dicts); + //}); + + //Data.WorkExp = workExpDic; + //#endregion + + //#region 证件 + //columnNames = formColumns.Where(x => x.GroupType == "Licence").Select(x => x.ColumnName).ToList(); + //columnNames = columnNames.Distinct().ToList(); + //var Licences = await _ghrh_ResumeLicenceServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + //var licenceDic = new List>(); + //Licences.ForEach(licence => + //{ + // var dicts = new Dictionary(); + // columnNames.ForEach(x => + // { + // var value = licence.GetPropertyValue(x); + // dicts.Add(x, value); + // }); + // if (columnNames.Any(x => x == "AttachmentIDs")) + // dicts["AttachmentIDs"] = licence.AttachmentIDs; + // licenceDic.Add(dicts); + //}); + + //Data.Licence = licenceDic; + //#endregion + + //#region 简历培训记录 + //columnNames = formColumns.Where(x => x.GroupType == "Training").Select(x => x.ColumnName).ToList(); + //columnNames = columnNames.Distinct().ToList(); + //var Trainings = await _ghrh_ResumeTrainingServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + //var trainingDic = new List>(); + //Trainings.ForEach(training => + //{ + // var dicts = new Dictionary(); + // columnNames.ForEach(x => + // { + // var value = training.GetPropertyValue(x); + // dicts.Add(x, value); + // }); + // if (columnNames.Any(x => x == "AttachmentIDs")) + // dicts["AttachmentIDs"] = training.AttachmentIDs; + // trainingDic.Add(dicts); + //}); + + //Data.Training = trainingDic; + //#endregion + + //Data.Attachment = await Db.Queryable().Where(x => x.TableName == id.ObjToString()).ToListAsync(); + //var statements = await _ghrh_ResumeStatementServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id);//证件 + + //Data.Statement = statements.ToDictionary(person => person.StatementCode, person => person.TrueOrFalse); + + #endregion + + return View(); + } + + [NonAction] + public async Task> QueryResumeFormColumn(long resumeTemplateID) + { + var sql = @$"DECLARE @ResumeTemplateID BIGINT = {resumeTemplateID} + + SELECT A.ColumnName, A.ResumeInfoColumnName ColumnNameDesc, A.ColumnType, D.GroupType + FROM Ghrh_ResumeInfoColumn A + LEFT JOIN Ghrh_ResumeTemplateInfoGroupColumn B + ON B.ResumeInfoColumnID = A.ID + AND B.IsDisplay = 1 + AND B.IsEnable = 1 + AND A.IsEnable = 1 + JOIN Ghrh_ResumeTemplateInfoGroup C + ON B.ResumeTemplateInfoGroupID = C.Id + JOIN Ghrh_ResumeInfoGroup D + ON C.ResumeInfoGroupId = D.ID AND D.IsEnable = 1 + WHERE C.ResumeTemplateID = @ResumeTemplateID + -- AND D.GroupType = 'Base' + ORDER BY D.GroupType, b.SortNo"; + + return await _db.Ado.SqlQueryAsync(sql); + } +} diff --git a/Tiobon.Core.Api/Program.cs b/Tiobon.Core.Api/Program.cs index 39025c2d..e663c164 100644 --- a/Tiobon.Core.Api/Program.cs +++ b/Tiobon.Core.Api/Program.cs @@ -114,6 +114,7 @@ builder.Services.AddKafkaSetup(builder.Configuration); builder.Services.AddEventBusSetup(); builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddMvc(); builder.Services.Replace(ServiceDescriptor.Transient()); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 330b51c3..79d676da 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1578,6 +1578,12 @@ + + + Index + + + 简历培训记录(Controller) diff --git a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml new file mode 100644 index 00000000..04258105 --- /dev/null +++ b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml @@ -0,0 +1,201 @@ +@using Tiobon.Core.Model.ViewModels.Extend +@{ + ViewData["Title"] = "测试测试"; + Layout = "~/Views/Shared/_Layout.cshtml"; + List Columns = ViewBag.Columns; + Dictionary BaseDic = ViewBag.BaseDic; + List> FamilyDic = ViewBag.FamilyDic; +} + +
+
+
+ + @if (Columns != null && Columns.Count > 0) + { + foreach (var item in Columns) + { + if (item.tabKey == "Photo") + { +
+
+ +
+
+
zy001 
+
 
+
T1006   | 测试一部    | 岗位: (无)    | 职等: (无)  
+
+
+ } + else if (item.tabKey == "Base") + { +
+ @item.tabName +
+ if (item.children != null && item.children.Any()) + foreach (var children in item.children) + { +
+
@(children.label):
+
+ @{ + if (BaseDic.ContainsKey(children.field)) + { + if (children.field == "Birthday" || children.field == "GraduateDate") + @DateTimeHelper.ConvertToDayString(BaseDic[children.field]) + else + @BaseDic[children.field] + } + } +
+
+ } + } + else if (item.tabKey == "Family") + { + if (FamilyDic.Count > 0) + { +
+ @item.tabName +
+ } + for (var i = 0; i < FamilyDic.Count; i++) + { + if (i > 0) + { +
+ } + if (item.children != null && item.children.Any()) + foreach (var children in item.children) + { +
+
@(children.label):
+
+ @{ + if (FamilyDic[i].ContainsKey(children.field)) + { + if (children.field == "Birth") + @DateTimeHelper.ConvertToDayString(FamilyDic[i][children.field]) + else + @FamilyDic[i][children.field] + } + } +
+
+ } + } + + } + } + } +
+
+
\ No newline at end of file diff --git a/Tiobon.Core.Api/Views/Shared/_Layout.cshtml b/Tiobon.Core.Api/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..c136b0d6 --- /dev/null +++ b/Tiobon.Core.Api/Views/Shared/_Layout.cshtml @@ -0,0 +1,13 @@ + + + + + + 乔邦科技 | @ViewData["Title"] + @RenderSection("Styles", required: false) + + + @RenderBody() + @RenderSection("Scripts", required: false) + + \ No newline at end of file diff --git a/Tiobon.Core.Model/View/Ghrh/Ghrh_ResumeHome.Dto.View.cs b/Tiobon.Core.Model/View/Ghrh/Ghrh_ResumeHome.Dto.View.cs index a66a48bf..ab22799b 100644 --- a/Tiobon.Core.Model/View/Ghrh/Ghrh_ResumeHome.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghrh/Ghrh_ResumeHome.Dto.View.cs @@ -34,4 +34,17 @@ public class Ghrh_ResumeHomeDto : Ghrh_ResumeHome ///
public string UpdateDataInfo { get; set; } public List AttachmentIDs { get; set; } + + /// + /// 性别 + /// + public string GenderLabel { get; set; } + + /// + /// 关系 + /// + public string RelationTypeLabel { get; set; } + + + } diff --git a/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs b/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs index c852a5f8..0a6bb3c2 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs @@ -30,8 +30,9 @@ public class ResumeFormColumn1 { public string ColumnName { get; set; } public string ColumnNameDesc { get; set; } - - public string GroupType { get; set; } + + public string GroupType { get; set; } + public string ColumnType { get; set; } } diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeHomeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeHomeServices.cs index 39d5061c..c73475d2 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeHomeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeHomeServices.cs @@ -19,8 +19,10 @@ public class Ghrh_ResumeHomeServices : BaseServices x.Id.ToString()).ToList(); var attachments = await Db.Queryable().Where(x => ids.Contains(x.TableName)).ToListAsync(); - data.ForEach(x => + data.ForEach(async x => { + x.GenderLabel = await GetParaLabel("Gender", x.Gender); + x.RelationTypeLabel = await GetParaLabel("SocialRelationType", x.RelationType); x.AttachmentIDs = attachments .Where(o => o.TableName == x.Id.ToString()) .Select(o => new ResumeAttachment() diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index 8aacafec..aa2813e0 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -1,4 +1,5 @@ -using Org.BouncyCastle.Crypto; +using Microsoft.IdentityModel.Tokens; +using Org.BouncyCastle.Crypto; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; @@ -318,7 +319,9 @@ public class Ghrh_ResumeServices : BaseServices x.Id == o.ResumeId).ToList(); x.WorkExp = workExps.Where(o => x.Id == o.ResumeId).ToList(); if (x.Tags.IsNotEmptyOrNull()) @@ -2232,7 +2235,7 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1"; { var dt = Db.GetDate().AddDays(-30); - var list = await base.Query(x => x.Status == "Recycled" && x.RecycledTime <= dt); + var list = await base.Query(x => x.Status == "Recycled" && x.RecycledTime <= dt); var ids = list.Select(x => x.Id).ToList(); if (ids.Any()) await Db.Updateable()