1. 同步主数据物料时,需要控制批次大小
This commit is contained in:
@@ -72,4 +72,5 @@ public interface ErrorCodeConstants {
|
|||||||
|
|
||||||
// ========== 主数据同步 ==========
|
// ========== 主数据同步 ==========
|
||||||
ErrorCode MASTER_DATA_SYNC_DISABLED = new ErrorCode(1_027_900_001, "主数据同步功能已禁用");
|
ErrorCode MASTER_DATA_SYNC_DISABLED = new ErrorCode(1_027_900_001, "主数据同步功能已禁用");
|
||||||
|
ErrorCode MASTER_DATA_SYNC_BATCH_SIZE_TOO_LARGE = new ErrorCode(1_027_900_002, "最大批次不得超过 1000");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ public class MasterDataSyncServiceImpl implements MasterDataSyncService {
|
|||||||
if (!properties.isEnabled()) {
|
if (!properties.isEnabled()) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MASTER_DATA_SYNC_DISABLED);
|
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MASTER_DATA_SYNC_DISABLED);
|
||||||
}
|
}
|
||||||
|
if (command.getBatchSize() > 1000) {
|
||||||
|
throw ServiceExceptionUtil.exception(ErrorCodeConstants.MASTER_DATA_SYNC_BATCH_SIZE_TOO_LARGE, command.getBatchSize());
|
||||||
|
}
|
||||||
MasterDataSyncReport report = MasterDataSyncReport.start(command);
|
MasterDataSyncReport report = MasterDataSyncReport.start(command);
|
||||||
List<String> materialCodes = sanitizeCodes(command.getMaterialCodes());
|
List<String> materialCodes = sanitizeCodes(command.getMaterialCodes());
|
||||||
report.setMaterialCodes(materialCodes);
|
report.setMaterialCodes(materialCodes);
|
||||||
@@ -306,7 +309,11 @@ public class MasterDataSyncServiceImpl implements MasterDataSyncService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MaterialInfomationDO current = existingById.get(codeId);
|
MaterialInfomationDO current = existingById.get(codeId);
|
||||||
String name = normalizeValue(item.getMaterialName());
|
// 名称优先取 MDM 的长描述(desclong),若为空再回退到 desc1
|
||||||
|
String name = normalizeValue(item.getLongDescription());
|
||||||
|
if (name == null) {
|
||||||
|
name = normalizeValue(item.getMaterialName());
|
||||||
|
}
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
MaterialInfomationDO created = MaterialInfomationDO.builder()
|
MaterialInfomationDO created = MaterialInfomationDO.builder()
|
||||||
.id(codeId)
|
.id(codeId)
|
||||||
|
|||||||
Reference in New Issue
Block a user