|
|
@ -1787,18 +1787,18 @@ public class OpenOrderServiceImpl implements IOpenOrderService { |
|
|
|
Set<String> importStandardOuPaiDTOSet = importStandardOuPaiDTOS.stream().map(ImportStandardOuPaiDTO::getOrderPackageCode).collect(Collectors.toSet()); |
|
|
|
Set<String> importStandardOuPaiDTOSet = importStandardOuPaiDTOS.stream().map(ImportStandardOuPaiDTO::getOrderPackageCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
|
|
//把pacakgeDetailExcelDTOS中的元素的orderPackageCode属性分组
|
|
|
|
//把pacakgeDetailExcelDTOS中的元素的orderPackageCode属性分组
|
|
|
|
Map<String, Long> orderPackageCodeCounts = importStandardOuPaiDTOS.stream() |
|
|
|
// Map<String, Long> orderPackageCodeCounts = importStandardOuPaiDTOS.stream()
|
|
|
|
.collect(Collectors.groupingBy(ImportStandardOuPaiDTO::getOrderPackageCode, Collectors.counting())); |
|
|
|
// .collect(Collectors.groupingBy(ImportStandardOuPaiDTO::getOrderPackageCode, Collectors.counting()));
|
|
|
|
|
|
|
|
//
|
|
|
|
Set<String> duplicateOrderPackageCodes = orderPackageCodeCounts.entrySet().stream() |
|
|
|
// Set<String> duplicateOrderPackageCodes = orderPackageCodeCounts.entrySet().stream()
|
|
|
|
.filter(entry -> entry.getValue() > 1) |
|
|
|
// .filter(entry -> entry.getValue() > 1)
|
|
|
|
.map(Map.Entry::getKey) |
|
|
|
// .map(Map.Entry::getKey)
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
// .collect(Collectors.toSet());
|
|
|
|
|
|
|
|
//
|
|
|
|
if(!duplicateOrderPackageCodes.isEmpty()){ |
|
|
|
// if(!duplicateOrderPackageCodes.isEmpty()){
|
|
|
|
log.warn("#################importStandardOuPai: 包条码重复 {}",duplicateOrderPackageCodes); |
|
|
|
// log.warn("#################importStandardOuPai: 包条码重复 {}",duplicateOrderPackageCodes);
|
|
|
|
return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); |
|
|
|
// return R.fail(405, "包条码重复"+duplicateOrderPackageCodes);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
List<String> orderPackageCodeKeys = new ArrayList<>(importStandardOuPaiDTOSet); |
|
|
|
List<String> orderPackageCodeKeys = new ArrayList<>(importStandardOuPaiDTOSet); |
|
|
|
|
|
|
|
|
|
|
@ -1818,6 +1818,20 @@ public class OpenOrderServiceImpl implements IOpenOrderService { |
|
|
|
hasOrderPackageCodeList.addAll(hasOrderPackageCodes); |
|
|
|
hasOrderPackageCodeList.addAll(hasOrderPackageCodes); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailEntity> updateMaterialList = new ArrayList<>(); |
|
|
|
|
|
|
|
//把importStandardOuPaiDTOS转化成orderPackageCode为key的Map
|
|
|
|
|
|
|
|
Map<String, ImportStandardOuPaiDTO> importStandardOuPaiDTOMap = importStandardOuPaiDTOS.stream().collect(Collectors.toMap(ImportStandardOuPaiDTO::getOrderPackageCode, Function.identity(), (a, b) -> a)); |
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailEntity> hasAdvanceDetailList = advanceDetailService.findListByOrderPackageCodeList(hasOrderPackageCodeList); |
|
|
|
|
|
|
|
hasAdvanceDetailList.forEach(advanceDetailEntity -> { |
|
|
|
|
|
|
|
ImportStandardOuPaiDTO importStandardOuPaiDTO = importStandardOuPaiDTOMap.get(advanceDetailEntity.getOrderPackageCode()); |
|
|
|
|
|
|
|
TrunklineAdvanceDetailEntity updateMaterialEntity = new TrunklineAdvanceDetailEntity(); |
|
|
|
|
|
|
|
updateMaterialEntity.setId(advanceDetailEntity.getId()); |
|
|
|
|
|
|
|
updateMaterialEntity.setMaterialCode(importStandardOuPaiDTO.getMaterialCode()); |
|
|
|
|
|
|
|
updateMaterialEntity.setMaterialName(importStandardOuPaiDTO.getMaterialName()); |
|
|
|
|
|
|
|
updateMaterialList.add(updateMaterialEntity); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//排除importStandardOuPaiDTOS中orderPackageCode在hasOrderPackageCodeList中存在的元素
|
|
|
|
//排除importStandardOuPaiDTOS中orderPackageCode在hasOrderPackageCodeList中存在的元素
|
|
|
|
importStandardOuPaiDTOS = importStandardOuPaiDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
importStandardOuPaiDTOS = importStandardOuPaiDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
@ -2077,6 +2091,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { |
|
|
|
carsLoadAsyncService.sendRabbitMessageLoadScanData(advanceEntityList); |
|
|
|
carsLoadAsyncService.sendRabbitMessageLoadScanData(advanceEntityList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(updateMaterialList)){ |
|
|
|
|
|
|
|
advanceDetailService.updateBatchById(updateMaterialList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int successNum = advanceDetailEntities.size(); |
|
|
|
int successNum = advanceDetailEntities.size(); |
|
|
|
|
|
|
|
|
|
|
|
return R.success("成功导入"+successNum+"条"); |
|
|
|
return R.success("成功导入"+successNum+"条"); |
|
|
|