You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Tiobon.Web.Core/Tiobon.Core.Services/Ghrh/Ghrh_InterviewOrderServices.cs

66 lines
2.7 KiB

namespace Tiobon.Core.Services;
/// <summary>
/// 面试工单 (服务)
/// </summary>
public class Ghrh_InterviewOrderServices : BaseServices<Ghrh_InterviewOrder, Ghrh_InterviewOrderDto, InsertGhrh_InterviewOrderInput, EditGhrh_InterviewOrderInput>, IGhrh_InterviewOrderServices
{
private readonly IBaseRepository<Ghrh_InterviewOrder> _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<Ghrh_InterviewOrder> dal)
{
this._dal = dal;
base.BaseDal = dal;
base._caching = caching;
_ghrh_InterviewLogServices = ghrh_InterviewLogServices;
_ghrh_InterviewRecordServices = ghrh_InterviewRecordServices;
}
public override async Task<long> 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<Ghrh_HumanRequest>()
.SetColumns(it => it.RecommendCount == it.RecommendCount + 1)
.Where(it => it.Id == entity.RequestId)
.ExecuteCommandAsync();
return result;
}
public override async Task<List<Ghrh_InterviewOrderDto>> QueryDto(Expression<Func<Ghrh_InterviewOrder, bool>> 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;
}
}