|
|
|
@ -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<Ghrh_Resume, Ghrh_ResumeDto, Ins |
|
|
|
|
//【简历库-录用-已发offer】配置按钮 |
|
|
|
|
var sendOfferConfig = await Db.Queryable<Ghrh_Config>().Where(x => x.ConfigCode == "ESS_Recruit_Custom_Transfer_Staff").FirstAsync(); |
|
|
|
|
|
|
|
|
|
var applyOrders = await Db.Queryable<Ghrh_OfferApplyOrder>().Where(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value) && x.WorkState == 0).ToListAsync(); |
|
|
|
|
var applyOrders = await Db.Queryable<Ghrh_OfferApplyOrder>().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<Ghrh_Resume, Ghrh_ResumeDto, Ins |
|
|
|
|
//x.InterviewResult = "推荐中"; |
|
|
|
|
x.AppointmentFeedback = order.AppointmentFeedback.IsNotEmptyOrNull() ? order.AppointmentFeedback : "(约面反馈未填写)"; |
|
|
|
|
} |
|
|
|
|
else if (x.Status == DIC_INTERVIEW_ORDER_STATUS.HasInterview && x.IsPass == true) |
|
|
|
|
{ |
|
|
|
|
//x.InterviewResult = "推荐中"; |
|
|
|
|
x.OfferApplyType = offerApplyConfig?.ConfigValue ?? "System"; |
|
|
|
|
|
|
|
|
|
if (applyOrders.Any(o => 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<ServiceResult> TransferHasSendOffer(List<long> ids) |
|
|
|
|
public async Task<ServiceResult> TransferHasSendOffer(long id, long templateId, Dictionary<string, string> 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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 生成Offer |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="templateId"></param> |
|
|
|
|
/// <param name="extFields"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public async Task<string> 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<ToolbarRole>(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<Ghrh_ResumeDto>(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() |
|
|
|
|