Authored by wangnan

重建PI代码重构

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