Authored by caoyan

UFO建议价

@@ -8,6 +8,7 @@ import java.util.stream.Collectors; @@ -8,6 +8,7 @@ import java.util.stream.Collectors;
8 import org.apache.commons.collections.CollectionUtils; 8 import org.apache.commons.collections.CollectionUtils;
9 import org.apache.commons.lang3.StringUtils; 9 import org.apache.commons.lang3.StringUtils;
10 import org.elasticsearch.common.collect.Lists; 10 import org.elasticsearch.common.collect.Lists;
  11 +import org.elasticsearch.common.collect.Maps;
11 import org.slf4j.Logger; 12 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
@@ -89,9 +90,6 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -89,9 +90,6 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
89 //查询商品名称 90 //查询商品名称
90 List<Integer> productIdList = cscList.stream().map(ChannelSkuCompare::getProductId).collect(Collectors.toList()); 91 List<Integer> productIdList = cscList.stream().map(ChannelSkuCompare::getProductId).collect(Collectors.toList());
91 List<Product> productList = productMapper.selectProductListByIds(productIdList); 92 List<Product> productList = productMapper.selectProductListByIds(productIdList);
92 -// if(CollectionUtils.isEmpty(productList)) {  
93 -// return null;  
94 -// }  
95 Map<Integer, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p->p)); 93 Map<Integer, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p->p));
96 94
97 //查询尺码名称 95 //查询尺码名称
@@ -106,8 +104,11 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -106,8 +104,11 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
106 104
107 //查询商品图片 105 //查询商品图片
108 List<Integer> goodsIdList = CollectionUtil.map(storageList, Storage::getGoodsId); 106 List<Integer> goodsIdList = CollectionUtil.map(storageList, Storage::getGoodsId);
  107 + Map<Integer, String> goodsIdImageMap = Maps.newHashMap();
  108 + if(CollectionUtils.isNotEmpty(goodsIdList)) {
109 List<Goods> goodsList = goodsMapper.selectByIds(goodsIdList); 109 List<Goods> goodsList = goodsMapper.selectByIds(goodsIdList);
110 - Map<Integer, String> goodsIdImageMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, Goods::getColorImage)); 110 + goodsIdImageMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, Goods::getColorImage));
  111 + }
111 112
112 //计算UFO当前价,可售sku最低价 113 //计算UFO当前价,可售sku最低价
113 List<StoragePrice> storagePriceList = storagePriceMapper.selectMinPriceByStorageIdList(skuList); 114 List<StoragePrice> storagePriceList = storagePriceMapper.selectMinPriceByStorageIdList(skuList);