From fd3361dcf78a0382ece13e48871751774efdd266 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 4 Apr 2024 14:12:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=A6=BB=E8=81=8C=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E9=A4=90=E8=A1=A5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jobs/MealSupplementHandlerJob.cs | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs b/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs index 01d942c3..460e705b 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs @@ -46,15 +46,45 @@ public class MealSupplementHandlerJob : BaseJob //档案不存在 if (gainfo == null) { - await DbContext.Updateable() - .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error) - .SetColumns(x => x.Result == "人员档案不存在") + if (await DbContext.Queryable().AS("GainfoLeave").Where(x => x.Code == item.Code).AnyAsync()) + { + try + { + var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List + { + new() + { + UniqueId = item.UniqueId, + Status = "FAIL", + Msg = "人员离职" + } + }); + + await DbContext.Updateable() + .SetColumns(x => x.Result == r) + .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Sucess) + .SetColumns(x => x.Sync == true) .SetColumns(x => x.ModifiedTime == DateTime.Now) .Where(x => x.UniqueId == item.UniqueId) .ExecuteCommandAsync(); + } + catch + { - //后台任务获取人员 - BackgroundJob.Enqueue(x => x.TodoByCodeAsync(item.Code)); + } + } + else + { + await DbContext.Updateable() + .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error) + .SetColumns(x => x.Result == "人员档案不存在") + .SetColumns(x => x.ModifiedTime == DateTime.Now) + .Where(x => x.UniqueId == item.UniqueId) + .ExecuteCommandAsync(); + + //后台任务获取人员 + BackgroundJob.Enqueue(x => x.TodoByCodeAsync(item.Code)); + } continue; }