Authored by mali

求购价格

... ... @@ -124,4 +124,21 @@ public class ProductHelpService {
productInfo.setLeastPrice(leastPrice);
}
}
/**
* 设置商品维度的最高求购价
* @param productInfo
* @param goodsSizes
*/
public void setProductMosterPrice(ProductInfo productInfo, List<GoodsSize> goodsSizes) {
if (CollectionUtils.isEmpty(goodsSizes)) {
return;
}
List<BigDecimal> mosterPriceList = goodsSizes.stream().map(GoodsSize::getBidMosterPrice).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(mosterPriceList)) {
BigDecimal mosterPrice = mosterPriceList.stream().max((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setMosterPrice(mosterPrice);
}
}
}
... ...
... ... @@ -2287,6 +2287,8 @@ public class ProductServiceImpl implements ProductService {
productHelpService.setProductLeastPrice(productInfo, goodsSizes); // 设置商品SKn的最低价
productHelpService.setProductMosterPrice(productInfo, goodsSizes); // 设置商品SKn的最高求购价
bidProductService.setBidStroagePrice(goodsSizes, productId); // 设置尺码的最高求购价
storageService.sort(goodsSizes); // 根据尺码库的排序值排序
... ...