Authored by caoyan

UFO建议价

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