简历库 Offer下载按钮新增权限角色控制

master
xiaochanghai 6 months ago
parent b46a0f5b79
commit 43b8ca1d80
  1. 13
      Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs
  2. 9
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 2
      Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs
  4. 19
      Tiobon.Core.Services/CommonServices.cs
  5. 68
      Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs
  6. 9
      Tiobon.Core/Tiobon.Core.xml

@ -496,4 +496,17 @@ public class Ghrh_ResumeController : BaseController<IGhrh_ResumeServices, Ghrh_R
public async Task<ServiceResult<List<ResumeLog>>> Log(long id) => await _service.Log(id); public async Task<ServiceResult<List<ResumeLog>>> Log(long id) => await _service.Log(id);
#endregion #endregion
#region 获取面试日志
/// <summary>
/// 获取面试日志
/// </summary>
/// <param name="id">简历Id</param>
/// <param name="extFields">扩展栏位</param>
/// <param name="templateId">扩展栏位</param>
/// <returns></returns>
[HttpPost, Route("OfferDownLoad/{id}/{templateId}")]
public async Task<ServiceResult<string>> OfferDownLoad(long id, long templateId, [FromBody] Dictionary<string, string> extFields) => await _service.OfferDownLoad(id, templateId, extFields);
#endregion
} }

@ -1597,6 +1597,15 @@
<param name="id">简历ID</param> <param name="id">简历ID</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghrh_ResumeController.OfferDownLoad(System.Int64,System.Int64,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
获取面试日志
</summary>
<param name="id">简历Id</param>
<param name="extFields">扩展栏位</param>
<param name="templateId">扩展栏位</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghrh_ResumeEduBGController"> <member name="T:Tiobon.Core.Api.Controllers.Ghrh_ResumeEduBGController">
<summary> <summary>
教育背景(Controller) 教育背景(Controller)

@ -77,4 +77,6 @@ public interface IGhrh_ResumeServices : IBaseServices<Ghrh_Resume, Ghrh_ResumeDt
Task Shihua_OA_Sync(); Task Shihua_OA_Sync();
Task<ServiceResult<List<ResumeLog>>> Log(long id); Task<ServiceResult<List<ResumeLog>>> Log(long id);
Task<ServiceResult<string>> OfferDownLoad(long id, long templateId, Dictionary<string, string> extFields);
} }

@ -1472,15 +1472,16 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
position = "left" position = "left"
}); });
result.JM_PageControlT1.Toolbar.Add(new Toolbar() if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeOfferDownLoad").Any())
{ result.JM_PageControlT1.Toolbar.Add(new Toolbar()
display = true, {
fnKey = "TBD27YN", display = true,
fnTitle = "Offer下载", fnKey = "TBD27YN",
fnType = "row", fnTitle = "Offer下载",
icon = "ess-icon-reject", fnType = "row",
position = "left" icon = "ess-icon-reject",
}); position = "left"
});
if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeTag").Any()) if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeTag").Any())
result.JM_PageControlT1.Toolbar.Add(new Toolbar() result.JM_PageControlT1.Toolbar.Add(new Toolbar()
{ {

@ -2,7 +2,6 @@
using DinkToPdf.Contracts; using DinkToPdf.Contracts;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using NPOI.OpenXmlFormats.Wordprocessing;
using System.IO.Compression; using System.IO.Compression;
using static Tiobon.Core.Model.Consts; using static Tiobon.Core.Model.Consts;
@ -3641,6 +3640,7 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status";
break; break;
case "SendOffer": case "SendOffer":
case "OfferDownLoad":
if (interviewLog.Reverse1.IsNotEmptyOrNull()) if (interviewLog.Reverse1.IsNotEmptyOrNull())
item.OfferFileUrl = interviewLog.Reverse1; item.OfferFileUrl = interviewLog.Reverse1;
break; break;
@ -3668,6 +3668,72 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status";
} }
#endregion #endregion
#region Offer下载
public async Task<ServiceResult<string>> OfferDownLoad(long id, long templateId, Dictionary<string, string> extFields)
{
var entity = await base.QueryById(id);
if (entity == null)
return ServiceResult<string>.OprateFailed("无效的简历ID!");
var order = await _ghrh_InterviewOrderServices.QuerySingle(x => x.ResumeId == id);
var content = (await _ghrh_TemplateServices.Preview(id, templateId, extFields)).Data;
#region 生成Offer PDf
var globalSettings = new GlobalSettings
{
ColorMode = ColorMode.Color,
Orientation = Orientation.Portrait,
PaperSize = PaperKind.A4,
DocumentTitle = entity.StaffName,
};
var objectSettings = new ObjectSettings
{
PagesCount = true,
HtmlContent = content,
WebSettings = { DefaultEncoding = "utf-8" },
};
var pdf = new HtmlToPdfDocument()
{
GlobalSettings = globalSettings,
Objects = { objectSettings }
};
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);
fs.Flush();
}
entity.OfferFileUrl = "/Advanced/files/pdf_files/" + fileName;
await Update(entity, ["OfferFileUrl"]);
await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput()
{
InterviewOrderId = order.Id,
ResumeId = id,
StaffId = App.User.StaffId,
StaffName = App.User.StaffName + "(" + App.User.StaffNo + ")",
Source = "OfferDownLoad",
Reverse1 = entity.OfferFileUrl,
UserId = App.User.ID,
UserName = App.User.Name,
RemarkSz = $"下载Offer!",
});
#endregion
return ServiceResult<string>.OprateSuccess("获取成功", entity.OfferFileUrl);
}
#endregion
#region 通用方法 #region 通用方法
/// <summary> /// <summary>
/// 记录日志 /// 记录日志

@ -1597,6 +1597,15 @@
<param name="id">简历ID</param> <param name="id">简历ID</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghrh_ResumeController.OfferDownLoad(System.Int64,System.Int64,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
获取面试日志
</summary>
<param name="id">简历Id</param>
<param name="extFields">扩展栏位</param>
<param name="templateId">扩展栏位</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghrh_ResumeEduBGController"> <member name="T:Tiobon.Core.Api.Controllers.Ghrh_ResumeEduBGController">
<summary> <summary>
教育背景(Controller) 教育背景(Controller)

Loading…
Cancel
Save