Authored by wangnan

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

... ... @@ -13,7 +13,6 @@ import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
... ... @@ -44,9 +43,18 @@ public class HeatValueBuilder implements ViewBuilder {
return;
}
Map<Integer, ProductHeatValues> productHeatValueMap = productHeatValuesList.stream().collect(Collectors.toMap(ProductHeatValues::getProductSkn, (p) -> p));
productIndexBOs.stream().forEach(productIndexBO -> productIndexBO.setHeatValue(Optional.ofNullable(countHeatValue(productHeatValueMap.get(productIndexBO.getProductSkn()))).orElse(new BigDecimal(0))));
for (ProductIndexBO productIndexBO : productIndexBOs) {
ProductHeatValues productHeatValues = productHeatValueMap.get(productIndexBO.getProductSkn());
productIndexBO.setHeatValue(new BigDecimal(0));
if (productHeatValues != null) {
productIndexBO.setHeatValue(countHeatValue(productHeatValues));
}
}
}
/**
* ProductIndexHeatValueUpdateFlow也调用
*/
public BigDecimal countHeatValue(ProductHeatValues productHeatValues) {
//每个值乘以系数
BigDecimal shareOrderNum = productHeatValues.getShareorderNum().multiply(shareOrderNumFactor);
... ...