...
|
...
|
@@ -67,14 +67,19 @@ public class ProductServiceImpl implements ProductService{ |
|
|
productInfo.setLeastPrice(new BigDecimal(0));
|
|
|
setBrand(productInfo, product.getBrandId());
|
|
|
setSeries(productInfo, product.getSeriesId());
|
|
|
productInfo.setLeastPrice(null);
|
|
|
|
|
|
|
|
|
List<GoodsBO> goodsBOList = getGoodsList(product.getId());
|
|
|
if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) {
|
|
|
GoodsBO goodsBO = goodsBOList.get(0);
|
|
|
List<GoodsSize> goodsSizes = goodsBO.getSizeList();
|
|
|
if (!CollectionUtils.isEmpty(goodsSizes)) {
|
|
|
BigDecimal leastPrice = goodsSizes.stream().map(GoodsSize::getLeastPrice).filter(Objects::nonNull).min((p1, p2) -> (p1.compareTo(p2))).get();
|
|
|
productInfo.setLeastPrice(leastPrice);
|
|
|
List<BigDecimal> leastPriceList = goodsSizes.stream().map(GoodsSize::getLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
if (!CollectionUtils.isEmpty(leastPriceList)) {
|
|
|
BigDecimal leastPrice = leastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
|
|
|
productInfo.setLeastPrice(leastPrice);
|
|
|
}
|
|
|
goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy));
|
|
|
}
|
|
|
}
|
...
|
...
|
|