From db4d91710ac42a0fab84ed7bd1895173162259aa Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Fri, 20 Dec 2024 11:38:25 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=BE=85=E9=9D=A2=E8=AF=95=E3=80=91?= =?UTF-8?q?=E8=A1=8C=E4=BF=A1=E6=81=AF=E4=B8=AD=E7=9A=84=E3=80=90=E6=94=B9?= =?UTF-8?q?=E6=9C=9F=E3=80=91=E3=80=90=E5=8F=96=E6=B6=88=E3=80=91=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=94=AF=E6=8C=81=E5=8A=9F=E8=83=BD=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghrh/Ghrh_OfferApplyOrderController.cs | 12 ++ .../Controllers/Ghrh/Ghrh_ResumeController.cs | 10 +- Tiobon.Core.Api/Tiobon.Core.Model.xml | 10 ++ Tiobon.Core.Api/Tiobon.Core.xml | 14 +- .../Ghrh/IGhrh_OfferApplyOrderServices.cs | 2 + .../Ghrh/IGhrh_ResumeServices.cs | 2 +- .../View/Ghrh/Ghrh_Resume.Dto.View.cs | 10 ++ Tiobon.Core.Services/CommonServices.cs | 48 +++-- .../Ghrh/Ghrh_OfferApplyOrderServices.cs | 29 +++ .../Ghrh/Ghrh_ResumeServices.cs | 167 ++++++++++-------- Tiobon.Core/Tiobon.Core.xml | 16 +- 11 files changed, 215 insertions(+), 105 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs index 6ca7a778..79419813 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs @@ -22,4 +22,16 @@ public class Ghrh_OfferApplyOrderController : BaseController> QueryResume(long id) => await _service.QueryResume(id); #endregion + + #region 临时新增 + /// + /// 临时新增 + /// + /// 简历ID + /// 简历ID + /// + [HttpPost, Route("TempAdd/{resumeId}")] + public async Task TempAdd(long resumeId, InsertGhrh_OfferApplyOrderInput entity) => await _service.TempAdd(resumeId, entity); + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs index e023e740..7d30779c 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs @@ -338,12 +338,14 @@ public class Ghrh_ResumeController : BaseController /// 转入已发Offer /// - /// 简历Id,列表 + /// 简历Id + /// 扩展栏位 + /// 扩展栏位 /// - [HttpPost, Route("TransferHasSendOffer")] - public async Task TransferHasSendOffer([FromBody] List ids) + [HttpPost, Route("TransferHasSendOffer/{id}/{templateId}")] + public async Task TransferHasSendOffer(long id, long templateId, [FromBody] Dictionary extFields) { - return await _service.TransferHasSendOffer(ids); + return await _service.TransferHasSendOffer(id, templateId, extFields); } #endregion diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index 5095fb1c..671dc563 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -28242,6 +28242,16 @@ 面试地点 + + + 是否可以改期 + + + + + 是否可以取消 + + 教育背景(Dto.View1) diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 931afc53..752f0fba 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1335,6 +1335,14 @@ 简历ID + + + 临时新增 + + 简历ID + 简历ID + + 录用审批单薪资(Controller) @@ -1514,11 +1522,13 @@ 面试官列表 - + 转入已发Offer - 简历Id,列表 + 简历Id + 扩展栏位 + 扩展栏位 diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_OfferApplyOrderServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_OfferApplyOrderServices.cs index ca55c150..aa855d54 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_OfferApplyOrderServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_OfferApplyOrderServices.cs @@ -10,4 +10,6 @@ namespace Tiobon.Core.IServices; public interface IGhrh_OfferApplyOrderServices : IBaseServices { Task> QueryResume(long resumeId); + + Task TempAdd(long resumeId, InsertGhrh_OfferApplyOrderInput entity); } \ No newline at end of file diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs index c2fa667b..4c3c7ef5 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs @@ -52,7 +52,7 @@ public interface IGhrh_ResumeServices : IBaseServices ModifyInterviewer(long id, List InterviewStaffs); - Task TransferHasSendOffer(List ids); + Task TransferHasSendOffer(long id, long templateId, Dictionary extFields); Task SendOffer(long id, long templateId, Dictionary extFields); Task RemindHasOffer(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 e40bf351..fdd53ffa 100644 --- a/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs @@ -252,4 +252,14 @@ public class Ghrh_ResumeDto : Ghrh_Resume /// public string InterviewAddress { get; set; } + /// + /// 是否可以改期 + /// + public bool IsAllowChangeDate { get; set; } = false; + + /// + /// 是否可以取消 + /// + public bool IsAllowCancel { get; set; } = false; + } diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 19201fb8..c1b2b046 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -1767,24 +1767,36 @@ public partial class CommonServices : BaseServices>, ICommon icon = "ess-icon-reject", position = "left" }); - result.JM_PageControlT1.Toolbar.Add(new Toolbar() - { - display = true, - fnKey = "TBD23YN", - fnTitle = "改期", - fnType = "row", - icon = "ess-icon-reject", - position = "left" - }); - result.JM_PageControlT1.Toolbar.Add(new Toolbar() - { - display = true, - fnKey = "TBD24YN", - fnTitle = "取消", - fnType = "row", - icon = "ess-icon-reject", - position = "left" - }); + //sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + // FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId + // WHERE A.UserID = {App.User.ID} + // AND A.IsEnable = 1 + // AND B.IsEnable = 1 + // AND B.RoleNo LIKE 'RecruitResume%'"; + //toolbarRoles = DbAccess.QueryList(sql); + //if (toolbarRoles != null && toolbarRoles.Any()) + //{ + // if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeESSChangeDate").Any()) + // result.JM_PageControlT1.Toolbar.Add(new Toolbar() + // { + // display = true, + // fnKey = "TBD23YN", + // fnTitle = "改期", + // fnType = "row", + // icon = "ess-icon-reject", + // position = "left" + // }); + // if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeESSCancel").Any()) + // result.JM_PageControlT1.Toolbar.Add(new Toolbar() + // { + // display = true, + // fnKey = "TBD24YN", + // fnTitle = "取消", + // fnType = "row", + // icon = "ess-icon-reject", + // position = "left" + // }); + //} break; case "F_OfferTemplate": toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault(); diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs index ed8721e6..2a6aeae3 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs @@ -171,6 +171,35 @@ public class Ghrh_OfferApplyOrderServices : BaseServices TempAdd(long resumeId, InsertGhrh_OfferApplyOrderInput entity) + { + + entity.OrderNo = await GenerateContinuousSequence("Ghrh_OfferApplyOrder", "OrderNo", "LYSQ"); + entity.ApplicantId = GetStaffId(); + entity.ApplyTime = DateTime.Now; + var id = await base.Add(entity); + + #region 写入数据,并判断是否有错误 + var sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghrh_OfferApplyOrder WHERE Id !='{id}'"; + var id1 = await Db.Ado.GetLongAsync(sql); + sql = $"UPDATE Ghrh_OfferApplyOrder SET Id={id1} WHERE Id ='{id}'"; + await Db.Ado.ExecuteCommandAsync(sql); + id = id1; + #endregion + + if (entity.Items.IsNotEmptyOrNull()) + { + entity.Items.ForEach(x => + { + x.OrderId = id; + }); + await _ghrh_OfferApplyOrderSalaryServices.Add(entity.Items); + } + + return id; + } + public override async Task Update(long Id, EditGhrh_OfferApplyOrderInput editModel) { diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index 58e05256..7e9ce465 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.Extensions.Hosting; using System.ComponentModel; +using System.Drawing; using System.IO.Compression; using static Tiobon.Core.Model.Consts; @@ -314,7 +315,7 @@ public class Ghrh_ResumeServices : BaseServices().Where(x => x.ConfigCode == "ESS_Recruit_Custom_Transfer_Staff").FirstAsync(); - var applyOrders = await Db.Queryable().Where(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value) && x.WorkState == 0).ToListAsync(); + var applyOrders = await Db.Queryable().Where(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value) && x.WorkState == 0 && x.WorkNo != null).ToListAsync(); #endregion list.ForEach(async x => @@ -366,20 +367,16 @@ public class Ghrh_ResumeServices : BaseServices o.ResumeId == x.ResumeId)) - x.OfferApplyExist = true; - } if (x.Status == DIC_INTERVIEW_ORDER_STATUS.HasSendOffer) { //x.InterviewResult = "推荐中"; x.TransferStaffType = sendOfferConfig?.ConfigValue ?? "System"; } + //x.InterviewResult = "推荐中"; + x.OfferApplyType = offerApplyConfig?.ConfigValue ?? "System"; + if (applyOrders.Any(o => o.ResumeId == x.ResumeId)) + x.OfferApplyExist = true; x.InterviewTime1 = order.InterviewTime; x.InterviewContent = order.InterviewContent; @@ -2174,29 +2171,49 @@ END"; #endregion #region 转入已发Offer - public async Task TransferHasSendOffer(List ids) + public async Task TransferHasSendOffer(long id, long templateId, Dictionary extFields) { - for (int i = 0; i < ids.Count; i++) - { - var id = ids[i]; - var entity = await base.QueryById(id); - if (entity == null) - return ServiceResult.OprateFailed("无效的简历ID!"); + var entity = await base.QueryById(id); + if (entity == null) + return ServiceResult.OprateFailed("无效的简历ID!"); - await UpdateResumeStatus(entity, DIC_INTERVIEW_ORDER_STATUS.HasSendOffer); + var content = (await _ghrh_TemplateServices.Preview(id, templateId, extFields)).Data; + var offerFileUrl = await GenerateOffer(entity, content); - var order = await _ghrh_InterviewOrderServices.QuerySingle(x => x.ResumeId == id); - if (order != null) - { + await UpdateResumeStatus(entity, DIC_INTERVIEW_ORDER_STATUS.HasSendOffer); - await UpdateInterviewOrderStatus(order, DIC_INTERVIEW_ORDER_STATUS.HasSendOffer); - await UpdateInterviewRecordStatus(order, DIC_INTERVIEW_ORDER_STATUS.HasSendOffer); + var order = await _ghrh_InterviewOrderServices.QuerySingle(x => x.ResumeId == id); + if (order != null) + { + await UpdateInterviewOrderStatus(order, DIC_INTERVIEW_ORDER_STATUS.HasSendOffer); + await UpdateInterviewRecordStatus(order, DIC_INTERVIEW_ORDER_STATUS.HasSendOffer); - await LogRecord(order.Id, "变更状态为:已发offer!", id, null, "TransferHasSendOffer"); - } - else - await LogRecord(null, "变更状态为:已发offer!", id, null, "TransferHasSendOffer"); + await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput() + { + InterviewOrderId = order.Id, + ResumeId = id, + StaffId = App.User.StaffId, + StaffName = App.User.StaffName + "(" + App.User.StaffNo + ")", + Source = "TransferHasSendOffer", + Reverse1 = offerFileUrl, + UserId = App.User.ID, + UserName = App.User.Name, + RemarkSz = $"变更状态为:已发offer!", + }); } + else + await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput() + { + InterviewOrderId = null, + ResumeId = id, + StaffId = App.User.StaffId, + StaffName = App.User.StaffName + "(" + App.User.StaffNo + ")", + Source = "TransferHasSendOffer", + Reverse1 = offerFileUrl, + UserId = App.User.ID, + UserName = App.User.Name, + RemarkSz = $"变更状态为:已发offer!", + }); return ServiceResult.OprateSuccess(); } @@ -2234,6 +2251,38 @@ END"; var id1 = await Db.Insertable(mailOutbox).ExecuteReturnIdentityAsync(); #endregion + #region 生成Offer PDf + entity.OfferFileUrl = await GenerateOffer(entity, content); + 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 = "SendOffer", + Reverse1 = entity.OfferFileUrl, + UserId = App.User.ID, + UserName = App.User.Name, + RemarkSz = $"给【{entity.StaffName}】发送Offer!", + }); + + #endregion + + return ServiceResult.OprateSuccess(); + } + + /// + /// 生成Offer + /// + /// + /// + /// + /// + public async Task GenerateOffer(Ghrh_ResumeDto entity, string content) + { + #region 生成Offer PDf var globalSettings = new GlobalSettings { @@ -2269,25 +2318,10 @@ END"; await file.CopyToAsync(fs); fs.Flush(); } - entity.OfferFileUrl = "/Advanced/files/pdf_files/" + fileName; - await Update(entity, ["OfferFileUrl"]); + return "/Advanced/files/pdf_files/" + fileName; - await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput() - { - InterviewOrderId = order.Id, - ResumeId = id, - StaffId = App.User.StaffId, - StaffName = App.User.StaffName + "(" + App.User.StaffNo + ")", - Source = "SendOffer", - Reverse1 = entity.OfferFileUrl, - UserId = App.User.ID, - UserName = App.User.Name, - RemarkSz = $"给【{entity.StaffName}】发送Offer!", - }); #endregion - - return ServiceResult.OprateSuccess(); } #endregion @@ -2746,6 +2780,14 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; var tags = await _ghrh_ResumeTagServices.QueryDto(x => tagIds.Contains(x.Id)); var orders = await _ghrh_InterviewOrderServices.QueryDto(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value)); + sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId + WHERE A.UserID = {App.User.ID} + AND A.IsEnable = 1 + AND B.IsEnable = 1 + AND B.RoleNo LIKE 'RecruitResume%'"; + var toolbarRoles = DbAccess.QueryList(sql); + list.ForEach(async x => { //x.ResumeId = x.Id; @@ -2786,6 +2828,11 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; x.InterviewTime1 = "已改期"; } + + if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeESSChangeDate").Any()) + x.IsAllowChangeDate = true; + if (toolbarRoles.Where(x => x.RoleNo == "RecruitResumeESSCancel").Any()) + x.IsAllowCancel = true; }); return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, list); @@ -3695,41 +3742,7 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; 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; + entity.OfferFileUrl = await GenerateOffer(entity, content); await Update(entity, ["OfferFileUrl"]); await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput() diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 1c820449..752f0fba 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1335,6 +1335,14 @@ 简历ID + + + 临时新增 + + 简历ID + 简历ID + + 录用审批单薪资(Controller) @@ -1514,11 +1522,13 @@ 面试官列表 - + - 发offer + 转入已发Offer - 简历Id,列表 + 简历Id + 扩展栏位 + 扩展栏位