From 4c2e6d0d8e707082a1eb6ba5f4972304bc8fb40e Mon Sep 17 00:00:00 2001 From: liguoyang Date: Sun, 7 Apr 2024 15:25:24 +0800 Subject: [PATCH] fix job --- .../Jobs/MealSupplementHandlerJob.cs | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs b/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs index 10f06979..38b9f6d7 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs @@ -42,9 +42,7 @@ public class MealSupplementHandlerJob : BaseJob foreach (var item in mealSupplements) { - GainfoMealEntity mealUser = null; var gainfo = await DbContext.Queryable().Where(x => x.Code == item.Code).SingleAsync(); - //档案不存在 if (gainfo == null) { gainfo = await DbContext.Queryable().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync(); @@ -94,27 +92,27 @@ public class MealSupplementHandlerJob : BaseJob continue; } } - else - { - //创建余额数据 - mealUser = await DbContext.Queryable().Where(x => x.UserCode == gainfo.Code).SingleAsync(); - if (mealUser == null) - { - mealUser = new GainfoMealEntity - { - Balance = 0, - BalanceOfRecharge = 0, - BalanceOfSubsidies = 0, - UserNo = gainfo.No, - UserCode = gainfo.Code, - Version = 0, - TenantId = gainfo.Factory, - }; - await DbContext.InsertAsync(mealUser); - } + + //创建余额数据 + var mealUser = await DbContext.Queryable().Where(x => x.UserCode == gainfo.Code).SingleAsync(); + if (mealUser == null) + { + mealUser = new GainfoMealEntity + { + Balance = 0, + BalanceOfRecharge = 0, + BalanceOfSubsidies = 0, + UserNo = gainfo.No, + UserCode = gainfo.Code, + Version = 0, + TenantId = gainfo.Factory, + }; + + await DbContext.InsertAsync(mealUser); } + if (item.Workplace == "5") { //todo 海宁餐补数据