Authored by wangnan

重建PI代码重构

... ... @@ -33,9 +33,8 @@ public class ProductPriceBuilder implements ViewBuilder {
@Override
public void build(List<ProductIndexBO> productIndexBOs, List<Integer> ids, List<Integer> skns) {
Map<Integer, ProductPrice> productPricesMap = mapGenerator.getProductPricesMap(ids);
for (ProductIndexBO p : productIndexBOs) {
ProductIndexBO pi = new ProductIndexBO();
ProductPrice pp = productPricesMap.get(p.getProductId());
for (ProductIndexBO pi : productIndexBOs) {
ProductPrice pp = productPricesMap.get(pi.getProductId());
try {
if (pp != null) {
pi.setSpecialPrice(pp.getSpecialPrice());
... ... @@ -75,7 +74,7 @@ public class ProductPriceBuilder implements ViewBuilder {
break;
}
} else {
logger.warn("[class=ProductIndexLogicService][function=buildProductPrice][productId={}] VipDiscountType is null ", p.getProductId());
logger.warn("[class=ProductIndexLogicService][function=buildProductPrice][productId={}] VipDiscountType is null ", pi.getProductId());
}
pi.setSalesPrice(getBigDecimalFromDouble(salesPrice));
pi.setVipPrice(getBigDecimalFromDouble(vipPrice));
... ... @@ -119,7 +118,7 @@ public class ProductPriceBuilder implements ViewBuilder {
//计算isNew(规则:首次上架7天内展示且折扣率大于等于88折)
pi.setIsnew("N");
if (isNew(p.getFirstShelveTime(), pp.getMarketPrice(), pp.getSalesPrice())) {
if (isNew(pi.getFirstShelveTime(), pp.getMarketPrice(), pp.getSalesPrice())) {
pi.setIsnew("Y");
}
... ...