namespace Tiobon.Core.Services; /// /// 面试工单 (服务) /// public class Ghrh_InterviewOrderServices : BaseServices, IGhrh_InterviewOrderServices { private readonly IBaseRepository _dal; private readonly IGhrh_InterviewLogServices _ghrh_InterviewLogServices; private readonly IGhrh_InterviewRecordServices _ghrh_InterviewRecordServices; public Ghrh_InterviewOrderServices(ICaching caching, IGhrh_InterviewLogServices ghrh_InterviewLogServices, IGhrh_InterviewRecordServices ghrh_InterviewRecordServices, IBaseRepository dal) { this._dal = dal; base.BaseDal = dal; base._caching = caching; _ghrh_InterviewLogServices = ghrh_InterviewLogServices; _ghrh_InterviewRecordServices = ghrh_InterviewRecordServices; } public override async Task Add(InsertGhrh_InterviewOrderInput entity) { var result = await base.Add(entity); var usser = await GetUser(); await _ghrh_InterviewLogServices.Add(new InsertGhrh_InterviewLogInput() { OrderId = result, RemarkSz = $"用户【{usser?.UserName ?? App.User.ID.ToString()}】推荐了简历!" }); await Db.Updateable() .SetColumns(it => it.RecommendCount == it.RecommendCount + 1) .Where(it => it.Id == entity.RequestId) .ExecuteCommandAsync(); return result; } public override async Task> QueryDto(Expression> whereExpression) { var data = await base.QueryDto(whereExpression); var ids = data.Select(x => x.Id).ToList(); var records = await _ghrh_InterviewRecordServices.Query(x => x.OrderId != null && ids.Contains(x.OrderId.Value)); data.ForEach(x => { var record = records.Where(o => x.Round == o.Round && o.OrderId == x.Id).FirstOrDefault(); if (record != null) { if (record.PlanInterviewTime1.IsNotEmptyOrNull()) x.OptionalInterviewTime += record.PlanInterviewTime1; if (record.PlanInterviewTime2.IsNotEmptyOrNull()) x.OptionalInterviewTime += "," + record.PlanInterviewTime2; if (record.PlanInterviewTime3.IsNotEmptyOrNull()) x.OptionalInterviewTime += "," + record.PlanInterviewTime3; x.InterviewTime = record.InterviewTime; } }); return data; } }