...
|
...
|
@@ -195,8 +195,31 @@ public class ProductServiceImpl implements ProductService{ |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<Storage> queryStorageInfoBySkuList(Collection<Integer> skuList){
|
|
|
return storageMapper.selectByIds(skuList);
|
|
|
public List<StorageDataResp> queryStorageInfoBySkuList(Collection<Integer> skuList){
|
|
|
if (CollectionUtils.isEmpty(skuList)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
|
|
|
List<Storage> storageList = storageMapper.selectByIds(skuList);
|
|
|
if (CollectionUtils.isEmpty(storageList)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
|
|
|
List<StoragePrice> storagePrices = storagePriceMapper.selectBatchLeastPrice(skuList);
|
|
|
|
|
|
Map<Integer, BigDecimal> priceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
|
|
|
List<StorageDataResp> resp = Lists.newArrayList();
|
|
|
storageList.stream().forEach(item -> {
|
|
|
StorageDataResp storageDataResp = new StorageDataResp();
|
|
|
storageDataResp.setProductId(item.getProductId());
|
|
|
storageDataResp.setSuggestHighPrice(item.getSuggestHighPrice());
|
|
|
storageDataResp.setSuggestLowPrice(item.getSuggestLowPrice());
|
|
|
storageDataResp.setStorageId(item.getId());
|
|
|
storageDataResp.setLeastPrice(priceMap.get(item.getId()));
|
|
|
resp.add(storageDataResp);
|
|
|
});
|
|
|
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
|