fix 处理已知问题
This commit is contained in:
38
Src/Dlhis.ScheduledTask/Jobs/SendMsgToWorkGridLeaderJob.cs
Normal file
38
Src/Dlhis.ScheduledTask/Jobs/SendMsgToWorkGridLeaderJob.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Dlhis.Basic.Api;
|
||||
using Dlhis.Basic.Api.Requests;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.ScheduledTask.Attributes;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到网格长
|
||||
/// </summary>
|
||||
[RecurringJob(nameof(SendMsgToWorkGridLeaderJob), "0 0 18 * * ? ", Name = "发送信息到网格长")]
|
||||
public class SendMsgToWorkGridLeaderJob : BaseJob
|
||||
{
|
||||
public SendMsgToWorkGridLeaderJob(IServiceProvider serviceProvider) : base(serviceProvider)
|
||||
{
|
||||
}
|
||||
|
||||
protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
{
|
||||
//
|
||||
var infos = await DbContext.Queryable<WorkGridEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.LeaderUserCode == ga.Code)
|
||||
.Select((x, ga) => new
|
||||
{
|
||||
x.LeaderUserCode,
|
||||
WorkGridName = x.Name,
|
||||
UserName = x.Name,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var dingtalkApi = serviceProvider.GetService<IDingTalkApi>();
|
||||
await dingtalkApi.SendWorkMessageAsync(new JinkoSendWorkMessageRequest
|
||||
{
|
||||
Content = "你好,网格长,请看到消息后,前往人脸应用平台,执行明天的排班,已排班的请忽略!",
|
||||
WorkCodes = infos.Select(x => x.LeaderUserCode).ToList()
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user