fix log chunk

This commit is contained in:
2024-02-21 18:35:45 +08:00
parent 177b0862f2
commit fe4b7b0394

View File

@@ -6,6 +6,7 @@ using Dlhis.Entity.Basic.Enums;
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
using Dlhis.ScheduledTask.SyncSapInfo.Comparers;
using Dlhis.ScheduledTask.SyncSapInfo.Services;
using Microsoft.Extensions.Logging;
namespace Dlhis.ScheduledTask.SyncSapInfo.Job;
@@ -45,9 +46,12 @@ public class SyncPersonJob
{
var failure = 0;
var workCodes = persons.Select(x => x.ZWORKCODE).ToList();
var chunks = workCodes.Chunk(4000).ToList();
foreach (var searchCodes in workCodes.Chunk(4000))
foreach (var searchCodes in chunks)
{
_logger.LogInformation("SAP分批处理Chunk数量:{count}", searchCodes.Count());
var existsWorkCodes = await _dbContext.Queryable<GainfoSapEntity>()
.Where(x => searchCodes.Contains(x.ename))
.Select(x => x.ename)