|
|
package com.yohoufo.product.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.Objects;
|
|
|
import java.util.function.BinaryOperator;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
...
|
...
|
@@ -51,6 +58,7 @@ import com.yohoufo.product.response.ProductSimpleResp; |
|
|
import com.yohoufo.product.response.ProductSortTemplateResp;
|
|
|
import com.yohoufo.product.response.SaleCategoryBo;
|
|
|
import com.yohoufo.product.response.StorageDataResp;
|
|
|
import com.yohoufo.product.response.StorageInfoResp;
|
|
|
import com.yohoufo.product.response.StorageLeastPriceResp;
|
|
|
import com.yohoufo.product.service.ProductService;
|
|
|
|
...
|
...
|
@@ -195,7 +203,7 @@ public class ProductServiceImpl implements ProductService{ |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<StorageDataResp> queryStorageInfoBySkuList(Collection<Integer> skuList){
|
|
|
public List<StorageInfoResp> queryStorageInfoBySkuList(Collection<Integer> skuList){
|
|
|
if (CollectionUtils.isEmpty(skuList)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
...
|
...
|
@@ -208,15 +216,15 @@ public class ProductServiceImpl implements ProductService{ |
|
|
List<StoragePrice> storagePrices = storagePriceMapper.selectBatchLeastPrice(skuList);
|
|
|
|
|
|
Map<Integer, BigDecimal> priceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
|
|
|
List<StorageDataResp> resp = Lists.newArrayList();
|
|
|
List<StorageInfoResp> 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);
|
|
|
StorageInfoResp storageInfoResp = new StorageInfoResp();
|
|
|
storageInfoResp.setProductId(item.getProductId());
|
|
|
storageInfoResp.setSuggestHighPrice(item.getSuggestHighPrice());
|
|
|
storageInfoResp.setSuggestLowPrice(item.getSuggestLowPrice());
|
|
|
storageInfoResp.setStorageId(item.getId());
|
|
|
storageInfoResp.setLeastPrice(priceMap.get(item.getId()));
|
|
|
resp.add(storageInfoResp);
|
|
|
});
|
|
|
|
|
|
return resp;
|
...
|
...
|
|