|
|
|
@ -1070,6 +1070,52 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
InputStream inputStream = file.getInputStream(); |
|
|
|
|
|
|
|
|
|
List<PacakgeDetailExcelDTO> pacakgeDetailExcelDTOS = EasyExcel.read(inputStream).head(PacakgeDetailExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); |
|
|
|
|
//排除pacakgeDetailExcelDTOS中的orderPackageCode为空的元素
|
|
|
|
|
pacakgeDetailExcelDTOS = pacakgeDetailExcelDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
//把pacakgeDetailExcelDTOS转成以orderPacakgeCode为一个Set集合
|
|
|
|
|
Set<String> pacakgeDetailExcelDTOSet = pacakgeDetailExcelDTOS.stream().map(PacakgeDetailExcelDTO::getOrderPackageCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
//把pacakgeDetailExcelDTOS中的元素的orderPackageCode属性分组
|
|
|
|
|
Map<String, Long> orderPackageCodeCounts = pacakgeDetailExcelDTOS.stream() |
|
|
|
|
.collect(Collectors.groupingBy(PacakgeDetailExcelDTO::getOrderPackageCode, Collectors.counting())); |
|
|
|
|
|
|
|
|
|
Set<String> duplicateOrderPackageCodes = orderPackageCodeCounts.entrySet().stream() |
|
|
|
|
.filter(entry -> entry.getValue() > 1) |
|
|
|
|
.map(Map.Entry::getKey) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if(!duplicateOrderPackageCodes.isEmpty()){ |
|
|
|
|
log.warn("#####################openLabelHasPacakage: 包条码重复 {}",duplicateOrderPackageCodes); |
|
|
|
|
return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<String> orderPackageCodeKeys = new ArrayList<>(pacakgeDetailExcelDTOSet); |
|
|
|
|
|
|
|
|
|
List<String> hasOrderPackageCodeList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//把orderPackageCodeKeys每2000个元素为一组
|
|
|
|
|
int batchSize = 2000; |
|
|
|
|
List<List<String>> orderPackageCodeGroups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderPackageCodeKeys.size(); i += batchSize) { |
|
|
|
|
int endIndex = Math.min(i + batchSize, orderPackageCodeKeys.size()); |
|
|
|
|
orderPackageCodeGroups.add(orderPackageCodeKeys.subList(i, endIndex)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
orderPackageCodeGroups.forEach(orderPackageCodeGroup -> { |
|
|
|
|
List<String> hasOrderPackageCodes = advanceDetailService.findListByExistsAndOrderPackageCodes(orderPackageCodeGroup); |
|
|
|
|
hasOrderPackageCodeList.addAll(hasOrderPackageCodes); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//排除pacakgeDetailExcelDTOS中orderPackageCode在hasOrderPackageCodeList中存在的元素
|
|
|
|
|
pacakgeDetailExcelDTOS = pacakgeDetailExcelDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if(pacakgeDetailExcelDTOS.isEmpty()){ |
|
|
|
|
log.warn("##################openLabelHasPacakage: 没有需要处理的数据 pacakgeDetailExcelDTOS={}",pacakgeDetailExcelDTOS); |
|
|
|
|
return R.data(advanceEntityList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, List<PacakgeDetailExcelDTO>> listMap = pacakgeDetailExcelDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); |
|
|
|
|
|
|
|
|
@ -1080,7 +1126,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,TrunklineAdvanceEntity> advanceEntityMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
@ -1090,7 +1136,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
//把orderCodes转成List
|
|
|
|
|
List<String> orderCodeList = new ArrayList<>(orderCodes); |
|
|
|
|
//把orderCodeList分成每2000个元素一组
|
|
|
|
|
int batchSize = 2000; |
|
|
|
|
List<List<String>> orderedGroups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderCodeList.size(); i += batchSize) { |
|
|
|
@ -1333,6 +1378,53 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
|
|
|
|
|
List<ImportCustomizedOuPaiDTO> importCustomizedOuPaiDTOS = EasyExcel.read(inputStream).head(ImportCustomizedOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); |
|
|
|
|
|
|
|
|
|
//排除pacakgeDetailExcelDTOS中的orderPackageCode为空的元素
|
|
|
|
|
importCustomizedOuPaiDTOS = importCustomizedOuPaiDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
//把pacakgeDetailExcelDTOS转成以orderPacakgeCode为一个Set集合
|
|
|
|
|
Set<String> importCustomizedOuPaiDTOSet = importCustomizedOuPaiDTOS.stream().map(ImportCustomizedOuPaiDTO::getOrderPackageCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
//把pacakgeDetailExcelDTOS中的元素的orderPackageCode属性分组
|
|
|
|
|
Map<String, Long> orderPackageCodeCounts = importCustomizedOuPaiDTOS.stream() |
|
|
|
|
.collect(Collectors.groupingBy(ImportCustomizedOuPaiDTO::getOrderPackageCode, Collectors.counting())); |
|
|
|
|
|
|
|
|
|
Set<String> duplicateOrderPackageCodes = orderPackageCodeCounts.entrySet().stream() |
|
|
|
|
.filter(entry -> entry.getValue() > 1) |
|
|
|
|
.map(Map.Entry::getKey) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if(!duplicateOrderPackageCodes.isEmpty()){ |
|
|
|
|
log.warn("#################importCustomizedOuPai: 包条码重复 {}",duplicateOrderPackageCodes); |
|
|
|
|
return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<String> orderPackageCodeKeys = new ArrayList<>(importCustomizedOuPaiDTOSet); |
|
|
|
|
|
|
|
|
|
List<String> hasOrderPackageCodeList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//把orderPackageCodeKeys每2000个元素为一组
|
|
|
|
|
int batchSize = 2000; |
|
|
|
|
List<List<String>> orderPackageCodeGroups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderPackageCodeKeys.size(); i += batchSize) { |
|
|
|
|
int endIndex = Math.min(i + batchSize, orderPackageCodeKeys.size()); |
|
|
|
|
orderPackageCodeGroups.add(orderPackageCodeKeys.subList(i, endIndex)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
orderPackageCodeGroups.forEach(orderPackageCodeGroup -> { |
|
|
|
|
List<String> hasOrderPackageCodes = advanceDetailService.findListByExistsAndOrderPackageCodes(orderPackageCodeGroup); |
|
|
|
|
hasOrderPackageCodeList.addAll(hasOrderPackageCodes); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//排除pacakgeDetailExcelDTOS中orderPackageCode在hasOrderPackageCodeList中存在的元素
|
|
|
|
|
importCustomizedOuPaiDTOS = importCustomizedOuPaiDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if(importCustomizedOuPaiDTOS.isEmpty()){ |
|
|
|
|
log.warn("##################importCustomizedOuPai: 没有需要处理的数据 importCustomizedOuPaiDTOS={}",importCustomizedOuPaiDTOS); |
|
|
|
|
return R.data(advanceEntityList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, List<ImportCustomizedOuPaiDTO>> listMap = importCustomizedOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); |
|
|
|
|
|
|
|
|
|
listMap.remove("null&null"); |
|
|
|
@ -1344,7 +1436,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
//把orderCodes转成List
|
|
|
|
|
List<String> orderCodeList = new ArrayList<>(orderCodes); |
|
|
|
|
//把orderCodeList分成每2000个元素一组
|
|
|
|
|
int batchSize = 2000; |
|
|
|
|
List<List<String>> orderedGroups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderCodeList.size(); i += batchSize) { |
|
|
|
@ -1354,8 +1445,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
Map<String,TrunklineAdvanceEntity> advanceEntityMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
List<Long> advanceIds = new ArrayList<>(); |
|
|
|
@ -1544,6 +1633,54 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
InputStream inputStream = file.getInputStream(); |
|
|
|
|
|
|
|
|
|
List<ImportStandardOuPaiDTO> importStandardOuPaiDTOS = EasyExcel.read(inputStream).head(ImportStandardOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); |
|
|
|
|
|
|
|
|
|
//排除importStandardOuPaiDTOS中的orderPackageCode为空的元素
|
|
|
|
|
importStandardOuPaiDTOS = importStandardOuPaiDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
//把importStandardOuPaiDTOS转成以orderPacakgeCode为一个Set集合
|
|
|
|
|
Set<String> importStandardOuPaiDTOSet = importStandardOuPaiDTOS.stream().map(ImportStandardOuPaiDTO::getOrderPackageCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
//把pacakgeDetailExcelDTOS中的元素的orderPackageCode属性分组
|
|
|
|
|
Map<String, Long> orderPackageCodeCounts = importStandardOuPaiDTOS.stream() |
|
|
|
|
.collect(Collectors.groupingBy(ImportStandardOuPaiDTO::getOrderPackageCode, Collectors.counting())); |
|
|
|
|
|
|
|
|
|
Set<String> duplicateOrderPackageCodes = orderPackageCodeCounts.entrySet().stream() |
|
|
|
|
.filter(entry -> entry.getValue() > 1) |
|
|
|
|
.map(Map.Entry::getKey) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
if(!duplicateOrderPackageCodes.isEmpty()){ |
|
|
|
|
log.warn("#################importStandardOuPai: 包条码重复 {}",duplicateOrderPackageCodes); |
|
|
|
|
return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<String> orderPackageCodeKeys = new ArrayList<>(importStandardOuPaiDTOSet); |
|
|
|
|
|
|
|
|
|
List<String> hasOrderPackageCodeList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//把orderPackageCodeKeys每2000个元素为一组
|
|
|
|
|
int batchSize = 2000; |
|
|
|
|
List<List<String>> orderPackageCodeGroups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderPackageCodeKeys.size(); i += batchSize) { |
|
|
|
|
int endIndex = Math.min(i + batchSize, orderPackageCodeKeys.size()); |
|
|
|
|
orderPackageCodeGroups.add(orderPackageCodeKeys.subList(i, endIndex)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
orderPackageCodeGroups.forEach(orderPackageCodeGroup -> { |
|
|
|
|
List<String> hasOrderPackageCodes = advanceDetailService.findListByExistsAndOrderPackageCodes(orderPackageCodeGroup); |
|
|
|
|
hasOrderPackageCodeList.addAll(hasOrderPackageCodes); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//排除importStandardOuPaiDTOS中orderPackageCode在hasOrderPackageCodeList中存在的元素
|
|
|
|
|
importStandardOuPaiDTOS = importStandardOuPaiDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if(importStandardOuPaiDTOS.isEmpty()){ |
|
|
|
|
log.warn("##################importStandardOuPai: 没有需要处理的数据 importStandardOuPaiDTOS={}",importStandardOuPaiDTOS); |
|
|
|
|
return R.data(advanceEntityList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, List<ImportStandardOuPaiDTO>> listMap = importStandardOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber())); |
|
|
|
|
|
|
|
|
|
listMap.remove("null&null"); |
|
|
|
@ -1553,8 +1690,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
Map<String,TrunklineAdvanceEntity> advanceEntityMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
List<Long> advanceIds = new ArrayList<>(); |
|
|
|
@ -1563,7 +1698,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
//把orderCodes转成List
|
|
|
|
|
List<String> orderCodeList = new ArrayList<>(orderCodes); |
|
|
|
|
//把orderCodeList分成每2000个元素一组
|
|
|
|
|
int batchSize = 2000; |
|
|
|
|
List<List<String>> orderedGroups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < orderCodeList.size(); i += batchSize) { |
|
|
|
|