diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs index 1b60bb10..702491e3 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeTemplatePreviewController.cs @@ -2,6 +2,7 @@ using SqlSugar; using System.Dynamic; using Tiobon.Core.Common.DB.Dapper.Extensions; +using Tiobon.Core.Common.Extensions; using Tiobon.Core.Model.ViewModels.Extend; namespace Tiobon.Core.Api.Controllers; @@ -218,12 +219,17 @@ END"; if (o.field == "RegisteredType") o.field = "RegisteredTypeLabel"; if (o.field == "EduDegree") o.field = "EduDegreeLabel"; if (o.field == "ApplyStatus") o.field = "ApplyStatusLabel"; + if (o.field == "Channel") + { + o.field = "ChannelLabel"; + } }); - x.children = x.children.Where(o => o.field != "EduDegreeLabel" - && o.field != "GenderLabel" + x.children = x.children.Where(o => o.field != "EduDegree" + && o.field != "Gende" && o.field != "StaffName" - && o.field != "ApplyStatusLabel" + && o.field != "ApplyStatus" + && o.field != "Channel" && o.field != "WorkYears" && o.field != "WorkYears" && o.field != "Age").ToList(); @@ -292,11 +298,21 @@ END"; columnNames.Add("RegisteredTypeLabel"); columnNames.Add("EduDegreeLabel"); columnNames.Add("ApplyStatusLabel"); + columnNames.Add("ChannelLabel"); columnNames.ForEach(x => { var value = entity.GetPropertyValue(x); - dicts.Add(x, value); + if (x == "RemarkSz") + { + if (value.ToString().IsNotEmptyOrNull()) + value = "
" + value.ToString().Replace("\n", "
") + "
"; + dicts.Add(x, value); + + } + else + dicts.Add(x, value); }); + ViewBag.BaseDic = dicts; ViewBag.entity = entity; #endregion diff --git a/Tiobon.Core.Api/Program.cs b/Tiobon.Core.Api/Program.cs index 4dc0d9c7..2221f322 100644 --- a/Tiobon.Core.Api/Program.cs +++ b/Tiobon.Core.Api/Program.cs @@ -1,6 +1,4 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Reflection; -using Autofac; +using Autofac; using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Server.Kestrel.Core; @@ -9,9 +7,11 @@ using Microsoft.IdentityModel.Logging; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; using Serilog; -using Tiobon.Core.Common.DB.Dapper.Extensions; +using System.IdentityModel.Tokens.Jwt; +using System.Reflection; using Tiobon.Core; using Tiobon.Core.Common.Core; +using Tiobon.Core.Common.DB.Dapper.Extensions; using Tiobon.Core.Extensions; using Tiobon.Core.Extensions.Apollo; using Tiobon.Core.Extensions.Middlewares; @@ -19,9 +19,8 @@ using Tiobon.Core.Extensions.ServiceExtensions; using Tiobon.Core.Filter; using Tiobon.Core.Hubs; using Tiobon.Core.Serilog.Utility; -using DinkToPdf.Contracts; -using DinkToPdf; -using Microsoft.Extensions.FileProviders; +using WkHtmlToPdfDotNet; +using WkHtmlToPdfDotNet.Contracts; var builder = WebApplication.CreateBuilder(args); diff --git a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml index 98c0dc8b..e1528a00 100644 --- a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml +++ b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml @@ -16,7 +16,112 @@ bool displaySignatureArea = ViewBag.DisplaySignatureArea; } +
@@ -26,84 +131,195 @@ { if (item.tabKey == "Photo") { -
-
-
- @if (!string.IsNullOrEmpty(entity.PhotoUrl)) - { - - } -
-
-
@(entity.StaffName) 
-
@(entity.ApplyStatusLabel) 
-
经验:@(entity.WorkYears)年工作经验   | 年龄:@(entity.Age)    | 学历: @(entity.EduDegreeLabel)  
-
+
+
+ @if (!string.IsNullOrEmpty(entity.PhotoUrl)) + { + + } +
+
+
@(entity.StaffName) 
+
@(entity.ApplyStatusLabel) 
+
经验:@(entity.WorkYears)年工作经验   | 年龄:@(entity.Age)    | 学历: @(entity.EduDegreeLabel)  
} else if (item.tabKey == "Base") { -
-
+
+
@item.tabName
@if (item.children != null && item.children.Any()) - @foreach (var children in item.children) + { + for (int i = 0; i < item.children.Count; i = i + 2) { -
-
@(children.label):
-
- @{ - if (BaseDic.ContainsKey(children.field)) + if (item.children[i].field == "RemarkSz" || ((i + 1) < item.children.Count && item.children[i + 1].field == "RemarkSz")) + { +
+
+
@(item.children[i].label):
+ @if (item.children[i].field == "Birthday" || item.children[i].field == "GraduateDate" || item.children[i].field == "Indate") { - if (children.field == "Birthday" || children.field == "GraduateDate" || children.field == "Indate") - @DateTimeHelper.ConvertToDayString(BaseDic[children.field]) +
+ @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i].field]) +
+ } + else + { +
@Html.Raw(BaseDic[item.children[i].field])
+ } + +
+
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+ @if (item.children[i + 1].field == "Birthday" || item.children[i + 1].field == "GraduateDate" || item.children[i + 1].field == "Indate") + { +
+ @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i + 1].field]) +
+ } else - @BaseDic[children.field] + { +
@Html.Raw(BaseDic[item.children[i + 1].field])
+ } +
+ } +
+ } + else + { +
+
+
@(item.children[i].label):
+ @if (item.children[i].field == "Birthday" || item.children[i].field == "GraduateDate" || item.children[i].field == "Indate") + { +
+ @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i].field]) +
+ } + else + { +
@BaseDic[item.children[i].field]
} +
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+ @if (item.children[i + 1].field == "Birthday" || item.children[i + 1].field == "GraduateDate" || item.children[i + 1].field == "Indate") + { +
+ @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i + 1].field]) +
+ } + else + { +
@BaseDic[item.children[i + 1].field]
+ } +
}
-
+ } } -
+ } +
} else if (item.tabKey == "Family") { @if (FamilyDic.Count > 0) { -
- @if (FamilyDic.Count > 0) - { -
- @item.tabName -
- } - @for (var i = 0; i < FamilyDic.Count; i++) +
+
+ @item.tabName +
+ @for (var j = 0; j < FamilyDic.Count; j++) { - @if (i > 0) + @if (j > 0) { -
+
} @if (item.children != null && item.children.Any()) { - @foreach (var children in item.children) + for (int i = 0; i < item.children.Count; i = i + 2) { -
-
@(children.label):
-
- @{ - if (FamilyDic[i].ContainsKey(children.field)) + if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注")) + { +
+
+
@(item.children[i].label):
+ @if (item.children[i].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i].field]) +
+ } + else { - if (children.field == "Birth") - @DateTimeHelper.ConvertToDayString(FamilyDic[i][children.field]) +
@FamilyDic[j][item.children[i].field]
+ } + +
+
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+ @if (item.children[i + 1].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i + 1].field]) +
+ } else - @FamilyDic[i][children.field] + { +
@FamilyDic[j][item.children[i + 1].field]
+ } +
+ } +
+ } + else + { +
+
+
@(item.children[i].label):
+ @if (item.children[i].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i].field]) +
} + else + { +
@FamilyDic[j][item.children[i].field]
+ } +
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+ @if (item.children[i + 1].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i + 1].field]) +
+ } + else + { +
@FamilyDic[j][item.children[i + 1].field]
+ } +
}
-
+ } } } } @@ -112,153 +328,283 @@ } else if (item.tabKey == "Education") { -
- @{ - if (EducationDic.Count > 0) - { -
- @item.tabName -
- } - for (var i = 0; i < EducationDic.Count; i++) + @if (EducationDic.Count > 0) + { +
+ +
+ @item.tabName +
+ @for (var j = 0; j < EducationDic.Count; j++) { - if (i > 0) + @if (j > 0) { -
+
} - if (item.children != null && item.children.Any()) - foreach (var children in item.children) + @if (item.children != null && item.children.Any()) + { + for (int i = 0; i < item.children.Count; i = i + 2) { -
-
@(children.label):
-
- @{ - if (EducationDic[i].ContainsKey(children.field)) + if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注")) + { +
+
+
@(item.children[i].label):
+ @if (item.children[i].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i].field]) +
+ } + else { - @EducationDic[i][children.field] +
@EducationDic[j][item.children[i].field]
} + +
+
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+ @if (item.children[i + 1].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i + 1].field]) +
+ } + else + { +
@EducationDic[j][item.children[i + 1].field]
+ } +
}
-
+ } + else + { +
+
+
@(item.children[i].label):
+ @if (item.children[i].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i].field]) +
+ } + else + { +
@EducationDic[j][item.children[i].field]
+ } +
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+ @if (item.children[i + 1].field == "Birth") + { +
+ @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i + 1].field]) +
+ } + else + { +
@EducationDic[j][item.children[i + 1].field]
+ } +
+ } +
+ } } + } } - } -
+
+ } } else if (item.tabKey == "WorkExp") { -
- @{ - if (WorkExpDic.Count > 0) - { -
- @item.tabName -
- } - for (var i = 0; i < WorkExpDic.Count; i++) + @if (WorkExpDic.Count > 0) + { +
+
+ @item.tabName +
+ @for (var j = 0; j < WorkExpDic.Count; j++) { - if (i > 0) + @if (j > 0) { -
+
} - if (item.children != null && item.children.Any()) - foreach (var children in item.children) + @if (item.children != null && item.children.Any()) + { + for (int i = 0; i < item.children.Count; i = i + 2) { -
-
@(children.label):
-
- @{ - if (WorkExpDic[i].ContainsKey(children.field)) - { - @WorkExpDic[i][children.field] - } + if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注")) + { +
+
+
@(item.children[i].label):
+
@WorkExpDic[j][item.children[i].field]
+
+
+ @if ((i + 1) < item.children.Count) + { +
+
+
@(item.children[i + 1].label):
+
@WorkExpDic[j][item.children[i + 1].field]
+
+
+ } + } + else + { +
+
+
@(item.children[i].label):
+
@WorkExpDic[j][item.children[i].field]
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+
@WorkExpDic[j][item.children[i + 1].field]
+
}
-
+ } } + } } - } -
- +
+ } } else if (item.tabKey == "Licence") { -
- @{ - if (LicenceDic.Count > 0) - { -
- @item.tabName -
- } - for (var i = 0; i < LicenceDic.Count; i++) + @if (LicenceDic.Count > 0) + { +
+
+ @item.tabName +
+ @for (var j = 0; j < LicenceDic.Count; j++) { - if (i > 0) + @if (j > 0) { -
+
} - if (item.children != null && item.children.Any()) - foreach (var children in item.children) + @if (item.children != null && item.children.Any()) + { + for (int i = 0; i < item.children.Count; i = i + 2) { -
-
@(children.label):
-
- @{ - if (LicenceDic[i].ContainsKey(children.field)) - { - @LicenceDic[i][children.field] - } + if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注")) + { +
+
+
@(item.children[i].label):
+
@LicenceDic[j][item.children[i].field]
+
+
+ @if ((i + 1) < item.children.Count) + { +
+
+
@(item.children[i + 1].label):
+
@LicenceDic[j][item.children[i + 1].field]
+
+
+ } + } + else + { +
+
+
@(item.children[i].label):
+
@LicenceDic[j][item.children[i].field]
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+
@LicenceDic[j][item.children[i + 1].field]
+
}
-
+ } } + } } - } -
+
+ } } else if (item.tabKey == "Training") { -
- @{ - if (TrainingDic.Count > 0) - { -
- @item.tabName -
- } - for (var i = 0; i < TrainingDic.Count; i++) + @if (TrainingDic.Count > 0) + { +
+
+ @item.tabName +
+ @for (var j = 0; j < TrainingDic.Count; j++) { - if (i > 0) + @if (j > 0) { -
+
} - if (item.children != null && item.children.Any()) - foreach (var children in item.children) + @if (item.children != null && item.children.Any()) + { + for (int i = 0; i < item.children.Count; i = i + 2) { -
-
@(children.label):
-
- @{ - if (TrainingDic[i].ContainsKey(children.field)) - { - @TrainingDic[i][children.field] - } + if (item.children[i].label == "培训说明" || ((i + 1) < item.children.Count && item.children[i + 1].label == "培训说明")) + { +
+
+
@(item.children[i].label):
+
@TrainingDic[j][item.children[i].field]
+
+
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+
@TrainingDic[j][item.children[i + 1].field]
+
}
-
+ } + else + { +
+
+
@(item.children[i].label):
+
@TrainingDic[j][item.children[i].field]
+
+ @if ((i + 1) < item.children.Count) + { +
+
@(item.children[i + 1].label):
+
@TrainingDic[j][item.children[i + 1].field]
+
+ } +
+ } } + } } - } -
+
+ } } else if (item.tabKey == "Statement") { -
+ +
@{ var ii = 0; if (item.children != null && item.children.Any()) { -
+
@item.tabName
} @@ -266,13 +612,8 @@ if (item.children != null && item.children.Any()) foreach (var children in item.children) { - - // if (ii > 0) - // { - //
- // } -
-
+
+

@(ii + 1). @(children.placeholder): @{ ii++; @@ -287,11 +628,9 @@ }

-
-
} -
+

@Html.Raw(ViewBag.StatementRemark)

@@ -301,7 +640,7 @@ }
} - +
} } diff --git a/Tiobon.Core.Api/wwwroot/css/resume.css b/Tiobon.Core.Api/wwwroot/css/resume.css index 352958b8..c65238fb 100644 --- a/Tiobon.Core.Api/wwwroot/css/resume.css +++ b/Tiobon.Core.Api/wwwroot/css/resume.css @@ -1,109 +1,2 @@  -body { - color: #000000d9; - font-size: 14px; - font-family: Noto Sans SC, PingFang SC, tahoma, arial, Hiragino Sans GB, Hiragino Sans GB W3, Microsoft Yahei, STHeitiSC-Light, Helvetica-Light, sans-serif !important; - page-break-before: always; -} -.ghr-preview-staff-info .pageContainer { - background-color: #fff; - overflow-y: auto; -} - - - - .ghr-preview-staff-info .pageContainer .a4page { - width: 794px; - /* padding: 40px; */ - box-sizing: border-box; - /* page-break-after: always; */ - } - -.pageContainer .a4page.displayMode { - margin: 20px auto; - /* border: 1px #d3d3d3 solid; - box-shadow: 0 0 5px #0000001a; */ - /* display: flex; */ - flex-wrap: wrap; -} - -.ghr-preview-staff-base-info .staffPhoto { - width: 100px; - height: 100px; - display: inline-block; - vertical-align: top; - position: relative; -} - - .ghr-preview-staff-base-info .staffPhoto img { - width: 100%; - height: 100%; - -o-object-fit: contain; - object-fit: contain; - } - -.ghr-preview-staff-base-info .staffBaseInfo { - height: 100px; - display: inline-block; - vertical-align: top; - padding-left: 25px; -} - - .ghr-preview-staff-base-info .staffBaseInfo .staffName { - font-size: 20px; - margin-top: 10px; - } - - .ghr-preview-staff-base-info .staffBaseInfo .staffEName { - font-size: 16px; - color: #5d5d5d; - } - - .ghr-preview-staff-base-info .staffBaseInfo .staffHumanResourcesMsg { - font-size: 16px; - color: #5d5d5d; - margin-top: 15px; - } - -.ghr-preview-staff-resume-title { - height: 26px; - line-height: 26px; - font-size: 18px; - color: #242424; - margin: 10px 0; - border-left: 2px solid #ff9300; - padding-left: 15px; - width: 100% -} - -.ghr-preview-staff-resume-block-item { - width: 50%; - display: inline-block; - vertical-align: top; - min-height: 25px; - word-break: break-all; - line-height: 25px; - margin: 5px 0; - flex-flow: row wrap; -} - - .ghr-preview-staff-resume-block-item .label { - width: 150px; - display: inline-block; - vertical-align: top; - height: 25px; - line-height: 25px; - text-align: right; - } - - .ghr-preview-staff-resume-block-item .itemValue { - display: inline-block; - vertical-align: top; - min-height: 25px; - line-height: 25px; - } - -.page-break-inside { - page-break-inside: avoid; -} diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index 04c3cec0..b9e31883 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -1,9 +1,9 @@ -using DinkToPdf; -using DinkToPdf.Contracts; -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Hosting; using System.IO.Compression; +using WkHtmlToPdfDotNet; +using WkHtmlToPdfDotNet.Contracts; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; @@ -3071,6 +3071,7 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 #endregion #region 简历下载 + public async Task> Download(List ids) { string frontUrl = AppSettings.app(["Startup", "FrontUrl"]); @@ -3103,15 +3104,15 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 GlobalSettings = globalSettings, Objects = { objectSettings } }; + string pathHeader = "wwwroot/files/pdf_files"; + var fileName = entity.StaffName + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf"; var fileBytes = _converter.Convert(pdf); - string pathHeader = "wwwroot/files/pdf_files"; if (!Directory.Exists(pathHeader)) Directory.CreateDirectory(pathHeader); var ms = new MemoryStream(fileBytes); var file = new FormFile(ms, 0, ms.Length, Path.GetFileNameWithoutExtension(pathHeader), Path.GetFileName(pathHeader)); - var fileName = entity.StaffName + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf"; await using (var fs = System.IO.File.Create(pathHeader + "/" + fileName)) { await file.CopyToAsync(fs); diff --git a/Tiobon.Core.Services/Tiobon.Core.Services.csproj b/Tiobon.Core.Services/Tiobon.Core.Services.csproj index 1c210dda..2863da8a 100644 --- a/Tiobon.Core.Services/Tiobon.Core.Services.csproj +++ b/Tiobon.Core.Services/Tiobon.Core.Services.csproj @@ -22,7 +22,7 @@ - +