fix 逻辑if处理

This commit is contained in:
2024-04-07 15:13:44 +08:00
parent babf8a838b
commit f4421c52f4
2 changed files with 12 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ public abstract class BaseJob : IJob
sqlSugarOptionsService.IgnoreTenant = true; sqlSugarOptionsService.IgnoreTenant = true;
var name = this.GetType().GetCustomAttribute<RecurringJobAttribute>()!.Name; var name = this.GetType().GetCustomAttribute<RecurringJobAttribute>()!.Name;
Logger.LogDebug("[{name}]开始执行...", name); Logger.LogInformation("[{name}]开始执行...", name);
try try
{ {
@@ -42,7 +42,7 @@ public abstract class BaseJob : IJob
} }
finally finally
{ {
Logger.LogDebug("[{name}]执行结束...", name); Logger.LogInformation("[{name}]执行结束...", name);
DbContext.Client.QueryFilter.Restore(); DbContext.Client.QueryFilter.Restore();
sqlSugarOptionsService.IgnoreTenant = false; sqlSugarOptionsService.IgnoreTenant = false;
} }

View File

@@ -48,14 +48,11 @@ public class MealSupplementHandlerJob : BaseJob
if (gainfo == null) if (gainfo == null)
{ {
gainfo = await DbContext.Queryable<GainfoEntity>().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync(); gainfo = await DbContext.Queryable<GainfoEntity>().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync();
if (gainfo != null) if (gainfo != null && gainfo.ResignationDate < item.Date)
{ {
try try
{ {
//离职数据 var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
if (gainfo.ResignationDate < item.Date)
{
var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
{ {
new() new()
{ {
@@ -65,14 +62,14 @@ public class MealSupplementHandlerJob : BaseJob
} }
}); });
await DbContext.Updateable<MealSupplementRecordEntity>() await DbContext.Updateable<MealSupplementRecordEntity>()
.SetColumns(x => x.Result == r) .SetColumns(x => x.Result == r)
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success) .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
.SetColumns(x => x.Sync == true) .SetColumns(x => x.Sync == true)
.SetColumns(x => x.ModifiedTime == DateTime.Now) .SetColumns(x => x.ModifiedTime == DateTime.Now)
.Where(x => x.UniqueId == item.UniqueId) .Where(x => x.UniqueId == item.UniqueId)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
}
} }
catch catch
{ {