diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs index e8cdad5c..cb2c71c9 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs @@ -243,4 +243,16 @@ public class Ghrh_ResumeController : BaseController SubscribeInterview(long id, [FromBody] List times) => await _service.SubscribeInterview(id, times); #endregion + + #region 安排面试 + /// + /// 面试官约面 + /// + /// 简历Id + /// 时间段,2024/10/12 10:00~2024/10/12 11:00 + /// + [HttpPost, Route("ScheduleInterview/{id}")] + public async Task ScheduleInterview(long id, [FromBody] string time) => await _service.ScheduleInterview(id, time); + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index f018c7bf..4b42958b 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1372,6 +1372,14 @@ 时间段列表,["2024/10/12 10:00~2024/10/12 11:00"],最多三个,超过三个取前三 + + + 面试官约面 + + 简历Id + 时间段,2024/10/12 10:00~2024/10/12 11:00 + + 教育背景(Controller) diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs index 5f940665..ef35331f 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs @@ -38,4 +38,5 @@ public interface IGhrh_ResumeServices : IBaseServices RemindHasRecommend(long id); Task SubscribeInterview(long id, List times); + Task ScheduleInterview(long id, string time); } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index 01238174..abb52cef 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -1333,30 +1333,48 @@ END"; #endregion #region 安排面试 - public async Task ScheduleInterview(long id) + public async Task ScheduleInterview(long id, string time) { - var entity = await _ghrh_InterviewOrderServices.QueryById(id); + var entity = await base.QueryById(id); if (entity == null) - return ServiceResult.OprateFailed("无效的简历工单ID!"); + return ServiceResult.OprateFailed("无效的简历ID!"); - if (entity.Status != DIC_INTERVIEW_ORDER_STATUS.HasRecommended) - return ServiceResult.OprateFailed("已推荐状态下简历才可安排面试!"); + if (entity.Status != DIC_INTERVIEW_ORDER_STATUS.WaitAppointment) + return ServiceResult.OprateFailed("待预约状态下才能安排面试!"); - var order = await Db.Queryable().FirstAsync(x => x.ResumeId == id); + if (time.IndexOf("~") < 0) + throw new Exception($"传入时间【{time}】无效,请检查格式!"); + var array = time.Split('~'); + try + { + Convert.ToDateTime(array[0]); + Convert.ToDateTime(array[1]); + } + catch (Exception) + { + throw new Exception($"传入时间【{time}】无效,请检查格式!"); + } + var order = await _ghrh_InterviewOrderServices.QuerySingle(x => x.ResumeId == id); if (order != null) { var record = await _ghrh_InterviewRecordServices.QuerySingle(x => x.Round == order.Round && x.OrderId == order.Id); - if (record.FirstViewTime.IsNotEmptyOrNull()) - return ServiceResult.OprateFailed("面试官已查看简历,暂不可发送提醒!"); + record.InterviewTime = time; + record.InterviewBeginTime = Convert.ToDateTime(array[0]); + record.InterviewEndTime = Convert.ToDateTime(array[1]); - if (record.ReceiverIds.IsNotEmptyOrNull()) - { + record.Status = DIC_INTERVIEW_ORDER_STATUS.WaitInterview; - var staffs = JsonHelper.JsonToObj>(record.ReceiverIds); - await SendMessage(staffs.Select(x => x.StaffId).ToList(), "简历提醒", "您有个简历推荐,请及时查看!"); - } + await _ghrh_InterviewRecordServices.Update(record, ["InterviewTime", "InterviewBeginTime", "InterviewEndTime", "Status"]); + var usser = await GetUser(); + await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput() + { + OrderId = order.Id, + RemarkSz = $"用户【{usser?.UserName ?? App.User.ID.ToString()}】安排面试,面试时间:{time}!" + }); + entity.Status = DIC_INTERVIEW_ORDER_STATUS.WaitInterview; + await Update(entity, ["Status"]); } return ServiceResult.OprateSuccess();