From fe4b7b0394444b51826daa6ee7c84d9d59674c3b Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 21 Feb 2024 18:35:45 +0800 Subject: [PATCH] fix log chunk --- Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs b/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs index 41c8f388..9e5aebcf 100644 --- a/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs +++ b/Src/Dlhis.ScheduledTask/SyncSapInfo/Job/SyncPersonJob.cs @@ -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() .Where(x => searchCodes.Contains(x.ename)) .Select(x => x.ename)