From 2cf18f1602f9695a9d0bb840f4d59eb8da763167 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 10 Sep 2026 13:03:13 +0800 Subject: [PATCH] =?UTF-8?q?2026-09-10=20=E7=89=A9=E6=96=99=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0=E3=80=90=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=BC=96=E7=A0=81=E3=80=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PartInformationServiceImpl.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java index 694efc6e..7ee330c6 100644 --- a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java @@ -108,6 +108,7 @@ import static com.spring.modules.part.task.PartRelatedTask.convertToSQLString; public class PartInformationServiceImpl extends ServiceImpl implements PartInformationService { private static final int DRAWING_NO_SYNC_PART_PREFIX_LENGTH = 8; + private static final int DRAWING_NO_SYNC_BATCH_SIZE = 1000; private static final List PROJECT_PART_PRODUCT_CATEGORIES = Arrays.asList("Label", "Diecut", "Decoration", "Material"); @Autowired @@ -1337,13 +1338,18 @@ public class PartInformationServiceImpl extends ServiceImpl syncWrapper = new UpdateWrapper<>(); - syncWrapper.eq("site", site); - syncWrapper.in("part_no", pendingSyncPartNos); - int syncRows = partInformationMapper.update(syncData, syncWrapper); + int syncRows = 0; + for (int i = 0; i < pendingSyncPartNos.size(); i += DRAWING_NO_SYNC_BATCH_SIZE) { + List batchPartNos = pendingSyncPartNos.subList( + i, Math.min(i + DRAWING_NO_SYNC_BATCH_SIZE, pendingSyncPartNos.size())); + PartInformationEntity syncData = new PartInformationEntity(); + syncData.setDrawingNo(drawingNo); + syncData.setUpdateBy(data.getUpdateBy()); + UpdateWrapper syncWrapper = new UpdateWrapper<>(); + syncWrapper.eq("site", site); + syncWrapper.in("part_no", batchPartNos); + syncRows += partInformationMapper.update(syncData, syncWrapper); + } if (syncRows > 0) { log.info("同前8位编码联动成功,site={}, sourcePartNo={}, prefix={}, drawingNo={}, syncRows={}", site, partNo, partNoPrefix, drawingNo, syncRows);