fix 餐补人员却失自动同步

This commit is contained in:
2024-04-03 22:59:25 +08:00
parent 174a44cf2f
commit aa07a90b78
3 changed files with 8 additions and 22 deletions

View File

@@ -38,12 +38,6 @@ public class WerkEntity : SugarBaseEntity
[SugarColumn(IsNullable = false, ColumnDescription = "差异数")]
public int DiffNumber { get; set; }
/// <summary>
/// 权限变更数
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "权限变更数")]
public int PermissionChangeNumber { get; set; }
/// <summary>
/// 最近同步时间
/// </summary>

View File

@@ -90,13 +90,8 @@ public class GainfoUpdateService : IGainfoUpdateService
var d = modifiedPersons.First();
_logger.LogInformation("差异信息:{json}", d.ToJson());
_logger.LogInformation("差异信息:{json}", (await _dbContext.Queryable<GainfoSapEntity>().Where(x => x.ename == d.ZWORKCODE).FirstAsync())?.ToJson());
var tenantResult = await _tenantApi.GetTenantsInternalAsync();
_tenants = tenantResult.Data;
await SavePersonAsync(modifiedPersons);
werkInfo.PermissionChangeNumber = 0;
await _dbContext.UpdateAsync(werkInfo);
}
}
@@ -131,18 +126,7 @@ public class GainfoUpdateService : IGainfoUpdateService
_logger.LogInformation("SAP人员差异数量为:{count}", modifiedPersons.Count);
if (modifiedPersons.Count > 0)
{
//var tenantResult = await _tenantApi.GetTenantsInternalAsync();
//_tenants = tenantResult.Data;
//var codes = modifiedPersons.Select(x => x.ZWORKCODE).ToList();
//var userNos = await _dbContext.Queryable<GainfoEntity>().Where(x => codes.Contains(x.Code)).Select(x => x.No).ToListAsync();
//var dtoResult = await _devicePermissionApi.GetPermissionUsersInfoAsync(userNos);
//var dto = dtoResult.Data;
await SavePersonAsync(modifiedPersons);
//var rResult = await _devicePermissionApi.RePermissionUsersInfoAsync(dto);
//var r = rResult.Data;
}
}
@@ -152,6 +136,9 @@ public class GainfoUpdateService : IGainfoUpdateService
private async Task SavePersonAsync(List<SapPersonItem> persons)
{
var tenantResult = await _tenantApi.GetTenantsInternalAsync();
_tenants = tenantResult.Data;
var workCodes = persons.Select(x => x.ZWORKCODE).ToList();
var chunks = workCodes.Chunk(4000).ToList();

View File

@@ -6,6 +6,7 @@ using Dlhis.Entity.Canteen.Entities;
using Dlhis.Entity.Canteen.Enums;
using Dlhis.ScheduledTask.Common.Request;
using Dlhis.ScheduledTask.Common.Services;
using Hangfire;
using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.Scheduled;
@@ -51,6 +52,10 @@ public class MealSupplementHandlerJob : BaseJob
.SetColumns(x => x.ModifiedTime == DateTime.Now)
.Where(x => x.UniqueId == item.UniqueId)
.ExecuteCommandAsync();
//后台任务获取人员
BackgroundJob.Enqueue<IGainfoUpdateService>(x => x.TodoByCodeAsync(item.Code));
continue;
}
else