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.
75 lines
2.9 KiB
75 lines
2.9 KiB
namespace Tiobon.Core.Services;
|
|
|
|
/// <summary>
|
|
/// 招聘模板 (服务)
|
|
/// </summary>
|
|
public class Ghrh_TemplateServices : BaseServices<Ghrh_Template, Ghrh_TemplateDto, InsertGhrh_TemplateInput, EditGhrh_TemplateInput>, IGhrh_TemplateServices
|
|
{
|
|
private readonly IBaseRepository<Ghrh_Template> _dal;
|
|
public Ghrh_TemplateServices(ICaching caching, IBaseRepository<Ghrh_Template> dal)
|
|
{
|
|
this._dal = dal;
|
|
base.BaseDal = dal;
|
|
base._caching = caching;
|
|
}
|
|
|
|
#region 是否开启
|
|
public async Task<ServiceResult> SwitchPublish(long id, int? isPublish)
|
|
{
|
|
|
|
if (isPublish == 0)
|
|
return ServiceResult.OprateFailed("当前已开启状态 不可以取消!");
|
|
|
|
await Db.Updateable<Ghrh_Template>()
|
|
.SetColumns(it => new Ghrh_Template()
|
|
{
|
|
IsPublish = 0,
|
|
UpdateBy = App.User.ID,
|
|
UpdateTime = DateTime.Now
|
|
})
|
|
.Where(it => it.IsPublish == 1)
|
|
.ExecuteCommandAsync();
|
|
await Db.Updateable<Ghrh_Template>()
|
|
.SetColumns(it => new Ghrh_Template()
|
|
{
|
|
IsPublish = isPublish,
|
|
UpdateBy = App.User.ID,
|
|
UpdateTime = DateTime.Now
|
|
})
|
|
.Where(it => it.Id == id)
|
|
.ExecuteCommandAsync();
|
|
return ServiceResult.OprateSuccess();
|
|
}
|
|
#endregion
|
|
|
|
#region 获取Offer模板字段
|
|
public async Task<ServiceResult<List<CustomFieldView>>> QueryOfferTags()
|
|
{
|
|
var list = new List<CustomFieldView>()
|
|
{
|
|
new CustomFieldView { GroupName = "中文", Fields = StringHelper.GetFieldDesc<OfferTemplate>().Select(o => new ModelTagView2Item { Name=o.Key,Code=o.Key}).ToList() },
|
|
new CustomFieldView { GroupName = "英文", Fields = StringHelper.GetFieldDesc<OfferTemplate1>().Select(o => new ModelTagView2Item { Name=o.Value+"_EN",Code=o.Value+"_EN"}).ToList() },
|
|
};
|
|
return await Task.FromResult(ServiceResult<List<CustomFieldView>>.OprateSuccess("查询成功!", list));
|
|
}
|
|
#endregion
|
|
|
|
#region 预览Offer简历
|
|
public async Task<ServiceResult<string>> Preview(long resumeId)
|
|
{
|
|
var resume = await Db.Queryable<Ghrh_Resume>().Where(x => x.Id == resumeId).SingleAsync();
|
|
var result = string.Empty;
|
|
var template = await base.QuerySingle(x => x.IsPublish == 1);
|
|
if (template != null)
|
|
{
|
|
result = template.TemplateContent;
|
|
result = result.Replace("[姓名]", resume.StaffName);
|
|
result = result.Replace("[电话]", resume.Mobile);
|
|
result = result.Replace("[邮箱]", resume.Email);
|
|
result = result.Replace("[身份证号码]", resume.IdCardNo);
|
|
result = result.Replace("[StaffName_EN]", resume.StaffEname);
|
|
}
|
|
return await Task.FromResult(ServiceResult<string>.OprateSuccess("查询成功!", result));
|
|
}
|
|
#endregion
|
|
} |