|
|
|
@ -108,6 +108,7 @@ import static com.spring.modules.part.task.PartRelatedTask.convertToSQLString; |
|
|
|
public class PartInformationServiceImpl extends ServiceImpl<PartInformationMapper, PartInformationEntity> 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<String> PROJECT_PART_PRODUCT_CATEGORIES = Arrays.asList("Label", "Diecut", "Decoration", "Material"); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@ -1337,13 +1338,18 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
if (pendingSyncPartNos.isEmpty()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
PartInformationEntity syncData = new PartInformationEntity(); |
|
|
|
syncData.setDrawingNo(drawingNo); |
|
|
|
syncData.setUpdateBy(data.getUpdateBy()); |
|
|
|
UpdateWrapper<PartInformationEntity> 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<String> 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<PartInformationEntity> 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); |
|
|
|
|