20230922-ljl-fixBug
ljl 1 year ago
parent cebcab0be4
commit bc24100d2a

@ -582,18 +582,19 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
shopIds.add(String.valueOf(shopId));
List<String> purchaseOrderIds = purchaseOrders.stream().map(x -> x.getPurchaseOrderId().toString()).collect(Collectors.toList());
List<PurchaseOrderItem> allItems = getPurchaseOrderItemsMapByPurchaseOrderIds(shopIds, purchaseOrderIds, status);
Map<Integer, List<PurchaseOrderItem>> purchaseOrderIdAndItemMap = new HashMap<>();
Map<Long, List<PurchaseOrderItem>> purchaseOrderIdAndItemMap = new HashMap<>();
for (PurchaseOrderItem item: allItems) {
List<PurchaseOrderItem> subItems;
if (purchaseOrderIdAndItemMap.containsKey(item.getPurchaseOrderId())) {
subItems = purchaseOrderIdAndItemMap.get(item.getPurchaseOrderId());
} else {
subItems = new ArrayList<>();
List<PurchaseOrderItem> subItems = new ArrayList<>();
Long purchaseOrderId = Long.valueOf(item.getPurchaseOrderId());
if (purchaseOrderIdAndItemMap.containsKey(purchaseOrderId)) {
subItems = purchaseOrderIdAndItemMap.get(purchaseOrderId);
}
subItems.add(item);
purchaseOrderIdAndItemMap.put(item.getPurchaseOrderId(), subItems);
purchaseOrderIdAndItemMap.put(purchaseOrderId, subItems);
}
for (PurchaseOrder purchaseOrder : purchaseOrders) {
Long purchaseOrderId = purchaseOrder.getPurchaseOrderId();
purchaseOrder.setItems(purchaseOrderIdAndItemMap.get(purchaseOrderId));
}
}
return purchaseOrders;

Loading…
Cancel
Save