任务调度-新增必选修规则自动匹配人员

master
xiaochanghai 10 months ago
parent feea120763
commit 4a8249a715
  1. 1
      Tiobon.Core.IServices/Ghre/IGhre_StudyRuleServices.cs
  2. 15
      Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs
  3. 30
      Tiobon.Core.Tasks/QuartzNet/Jobs/Job_StaffIn_Quartz.cs

@ -8,5 +8,6 @@ namespace Tiobon.Core.IServices
/// </summary>
public interface IGhre_StudyRuleServices :IBaseServices<Ghre_StudyRule, Ghre_StudyRuleDto, InsertGhre_StudyRuleInput, EditGhre_StudyRuleInput>
{
Task StaffIn();
}
}

@ -37,7 +37,6 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
_ghre_StudyRuleStaffServices = ghre_StudyRuleStaffServices;
}
public override async Task<ServicePageResult<Ghre_StudyRuleDto>> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true)
{
if (string.IsNullOrWhiteSpace(filter.orderBy))
@ -466,4 +465,18 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
}
return true;
}
public async Task StaffIn()
{
var dt = Db.GetDate();
var staffs = await Db.Queryable<Ghra_Staff>()
.Where(x => x.Indate != null && x.Indate.Value.Date == dt.Date)
.Select(x => new
{
x.StaffID,
x.StaffEname,
x.Indate,
x.OutDate
}).ToListAsync();
}
}

@ -0,0 +1,30 @@
using Tiobon.Core.IServices;
using Quartz;
/// <summary>
/// 这里要注意下,命名空间和程序集是一样的,不然反射不到
/// </summary>
namespace Tiobon.Core.Tasks;
public class Job_StaffIn_Quartz : JobBase, IJob
{
private readonly IGhre_StudyRuleServices _ghre_StudyRuleServices;
public Job_StaffIn_Quartz(IGhre_StudyRuleServices ghre_StudyRuleServices, ITasksQzServices tasksQzServices, ITasksLogServices tasksLogServices)
: base(tasksQzServices, tasksLogServices)
{
_ghre_StudyRuleServices = ghre_StudyRuleServices;
}
public async Task Execute(IJobExecutionContext context)
{
var executeLog = await ExecuteJob(context, async () => await Run(context));
}
public async Task Run(IJobExecutionContext context)
{
Console.WriteLine($"Job_StaffIn_Quartz 执行 {DateTime.Now.ToShortTimeString()}");
await _ghre_StudyRuleServices.StaffIn();
// 也可以通过数据库配置,获取传递过来的参数
JobDataMap data = context.JobDetail.JobDataMap;
//int jobId = data.GetInt("JobParam");
}
}
Loading…
Cancel
Save