diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs index 6d84725e..d5f69c8e 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_OfferApplyOrderController.cs @@ -31,7 +31,7 @@ public class Ghrh_OfferApplyOrderController : BaseController简历ID /// [HttpPost, Route("TempAdd/{resumeId}")] - public async Task> TempAdd(long resumeId, InsertGhrh_OfferApplyOrderInput entity) => await _service.TempAdd(resumeId, entity); + public async Task> TempAdd(long resumeId, [FromBody] InsertGhrh_OfferApplyOrderInput entity) => await _service.TempAdd(resumeId, entity); #endregion } \ No newline at end of file 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 fdd53ffa..6f5a8fe5 100644 --- a/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghrh/Ghrh_Resume.Dto.View.cs @@ -187,6 +187,11 @@ public class Ghrh_ResumeDto : Ghrh_Resume /// public string Birthday1 { get; set; } + /// + /// 录用公司 + /// + public string HireCompanyName { get; set; } + /// /// 用人部门 /// diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs index cf1b213a..7739e071 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs @@ -1,5 +1,5 @@ using AgileObjects.AgileMapper.Extensions.Internal; -using NPOI.Util.Collections; +using System.ComponentModel.Design; namespace Tiobon.Core.Services; @@ -177,31 +177,45 @@ 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; - entity.WorkState = 1; - 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()) + var order = await base.QuerySingle(x => x.ResumeId == resumeId); + if (order is null) { - entity.Items.ForEach(x => + var resume = await Db.Queryable().Where(x => x.Id == resumeId).FirstAsync(); + entity.OrderNo = await GenerateContinuousSequence("Ghrh_OfferApplyOrder", "OrderNo", "LYSQ"); + entity.ApplicantId = GetStaffId(); + entity.ApplyTime = DateTime.Now; + entity.WorkState = 1; + entity.ResumeId = resumeId; + entity.StaffName = resume.StaffName; + entity.ResumeId = resumeId; + 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()) { - x.OrderId = id; - }); - await _ghrh_OfferApplyOrderSalaryServices.Add(entity.Items); + entity.Items.ForEach(x => + { + x.OrderId = id; + }); + await _ghrh_OfferApplyOrderSalaryServices.Add(entity.Items); + } + + return ServiceResult.OprateSuccess("保存成功", id); } + else + { + var edit = Mapper.Map(entity).ToANew(); + await base.Update(order.Id, edit, null, ["OrderNo", "ApplicantId", "ApplyTime", "WorkState", "ResumeId"]); + return ServiceResult.OprateSuccess("修改成功!", order.Id); - return ServiceResult.OprateSuccess("保存成功", id); + } } public override async Task Update(long Id, EditGhrh_OfferApplyOrderInput editModel) @@ -284,7 +298,8 @@ public class Ghrh_OfferApplyOrderServices : BaseServices x.ResumeId == resumeId); if (applyOrder != null) { - + + obj.CompanyId = applyOrder.CompanyId; obj.DeptId = applyOrder.DeptId; obj.TitleId = applyOrder.TitleId; obj.Channel = applyOrder.Channel; @@ -293,7 +308,8 @@ public class Ghrh_OfferApplyOrderServices : 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 && x.WorkNo != null).ToListAsync(); + var applyOrders = await Db.Queryable().Where(x => x.ResumeId != null && ids.Contains(x.ResumeId.Value) && x.WorkState == 0).ToListAsync(); #endregion list.ForEach(async x => @@ -375,8 +371,15 @@ public class Ghrh_ResumeServices : BaseServices o.ResumeId == x.ResumeId)) - x.OfferApplyExist = true; + var applyOrder = applyOrders.Where((o => o.ResumeId == x.ResumeId)).SingleOrDefault(); + if (applyOrder != null) + { + if (applyOrder.WorkNo.IsNotEmptyOrNull()) + x.OfferApplyExist = true; + //x.HireCompanyName = (await Db.Queryable().Where(x => x.DeptID == applyOrder.DeptId).FirstAsync())?.DeptName + x.HireDeptName = (await Db.Queryable().Where(x => x.DeptID == applyOrder.DeptId).FirstAsync())?.DeptName; + x.HireTitleName = (await Db.Queryable().Where(x => x.TitleID == applyOrder.TitleId).FirstAsync())?.TitleName; + } x.InterviewTime1 = order.InterviewTime; x.InterviewContent = order.InterviewContent; @@ -1599,7 +1602,7 @@ END"; return ServiceResult.OprateFailed("至少选择一名面试者!"); recommend.InterviewStaffs = recommend.InterviewStaffs.Where(x => x.StaffId != null).Distinct().ToList(); - + if (recommend.RequestId.IsNotEmptyOrNull()) { @@ -2107,7 +2110,7 @@ END"; InterviewIds = JsonHelper.ObjToJson(interviewIds), Interviewer = string.Join(",", interviewer.Select(o => o.StaffName)) }); - + //await Db.Updateable() // .SetColumns(it => new Ghrh_InterviewRecord() // { @@ -2116,7 +2119,7 @@ END"; // }) // .Where(it => it.Status == DIC_INTERVIEW_ORDER_STATUS.WaitInterview && it.OrderId == order.Id) // .ExecuteCommandAsync(); - + for (int i = 0; i < input.InterviewStaffs.Count; i++) { await _ghrh_InterviewRecordServices.Add(new InsertGhrh_InterviewRecordInput() @@ -2939,6 +2942,13 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; // result.DeptManagerEmail = staff.Email; // } //} + + var applyOrder = await Db.Queryable().Where(x => x.ResumeId == id).FirstAsync(); + if (applyOrder != null) + { + result.DeptName = (await Db.Queryable().Where(x => x.DeptID == applyOrder.DeptId).FirstAsync())?.DeptName; + result.TitleName = (await Db.Queryable().Where(x => x.TitleID == applyOrder.TitleId).FirstAsync())?.TitleName; + } #endregion return ServiceResult.OprateSuccess("查询成功", result); diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 752f0fba..8ddb88ed 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1491,7 +1491,7 @@ - 重新安排面试-直接发起 + 重新安排面试-直接发起新的 简历Id input