Authored by wangnan

商品人气值获取方式修改 fix

@@ -13,7 +13,6 @@ import java.math.BigDecimal; @@ -13,7 +13,6 @@ import java.math.BigDecimal;
13 import java.text.DecimalFormat; 13 import java.text.DecimalFormat;
14 import java.util.List; 14 import java.util.List;
15 import java.util.Map; 15 import java.util.Map;
16 -import java.util.Optional;  
17 import java.util.stream.Collectors; 16 import java.util.stream.Collectors;
18 17
19 /** 18 /**
@@ -44,9 +43,18 @@ public class HeatValueBuilder implements ViewBuilder { @@ -44,9 +43,18 @@ public class HeatValueBuilder implements ViewBuilder {
44 return; 43 return;
45 } 44 }
46 Map<Integer, ProductHeatValues> productHeatValueMap = productHeatValuesList.stream().collect(Collectors.toMap(ProductHeatValues::getProductSkn, (p) -> p)); 45 Map<Integer, ProductHeatValues> productHeatValueMap = productHeatValuesList.stream().collect(Collectors.toMap(ProductHeatValues::getProductSkn, (p) -> p));
47 - productIndexBOs.stream().forEach(productIndexBO -> productIndexBO.setHeatValue(Optional.ofNullable(countHeatValue(productHeatValueMap.get(productIndexBO.getProductSkn()))).orElse(new BigDecimal(0)))); 46 + for (ProductIndexBO productIndexBO : productIndexBOs) {
  47 + ProductHeatValues productHeatValues = productHeatValueMap.get(productIndexBO.getProductSkn());
  48 + productIndexBO.setHeatValue(new BigDecimal(0));
  49 + if (productHeatValues != null) {
  50 + productIndexBO.setHeatValue(countHeatValue(productHeatValues));
  51 + }
  52 + }
48 } 53 }
49 54
  55 + /**
  56 + * ProductIndexHeatValueUpdateFlow也调用
  57 + */
50 public BigDecimal countHeatValue(ProductHeatValues productHeatValues) { 58 public BigDecimal countHeatValue(ProductHeatValues productHeatValues) {
51 //每个值乘以系数 59 //每个值乘以系数
52 BigDecimal shareOrderNum = productHeatValues.getShareorderNum().multiply(shareOrderNumFactor); 60 BigDecimal shareOrderNum = productHeatValues.getShareorderNum().multiply(shareOrderNumFactor);