...
|
...
|
@@ -7,10 +7,10 @@ import com.alibaba.fastjson.JSONObject; |
|
|
import com.yoho.search.base.utils.ConvertUtils;
|
|
|
import com.yoho.search.base.utils.EventReportEnum;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
|
|
import com.yoho.search.base.utils.PriceUtil;
|
|
|
import com.yoho.search.consumer.index.common.IYohoIndexService;
|
|
|
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
|
|
|
import com.yoho.search.consumer.service.base.ProductPricePlanService;
|
|
|
import com.yoho.search.consumer.service.logic.VipPriceLogicServie;
|
|
|
import com.yoho.search.dal.model.ProductPricePlan;
|
|
|
|
|
|
@Component
|
...
|
...
|
@@ -18,13 +18,10 @@ public class ProductPricePlanMqListener extends AbstractIndexMqListener { |
|
|
|
|
|
@Autowired
|
|
|
private ProductPricePlanService productPricePlanService;
|
|
|
|
|
|
@Autowired
|
|
|
private IYohoIndexService indexService;
|
|
|
|
|
|
private static final int VIP1PRICE_POSITION = 0;
|
|
|
private static final int VIP2PRICE_POSITION = 1;
|
|
|
private static final int VIP3PRICE_POSITION = 2;
|
|
|
@Autowired
|
|
|
private VipPriceLogicServie vipPriceLogicServie;
|
|
|
|
|
|
@Override
|
|
|
public String getIndexName() {
|
...
|
...
|
@@ -49,17 +46,10 @@ public class ProductPricePlanMqListener extends AbstractIndexMqListener { |
|
|
return;
|
|
|
}
|
|
|
productPricePlanService.saveOrUpdate(productPricePlan);
|
|
|
|
|
|
// 将productPricePlan转成JSONObject
|
|
|
JSONObject productPricePlanJsonObject = (JSONObject) JSONObject.toJSON(productPricePlan);
|
|
|
// 特殊处理vip*Price
|
|
|
double[] vipPriceArray = PriceUtil.getVipPriceDoubleArray(productPricePlan.getCurrentSaleprice(), productPricePlan.getVipPrice(), productPricePlan.getVip1Price(),
|
|
|
productPricePlan.getVip2Price(), productPricePlan.getVip3Price(), productPricePlan.getVipDiscountType());
|
|
|
productPricePlanJsonObject.put("vip1Price", vipPriceArray[VIP1PRICE_POSITION]);
|
|
|
productPricePlanJsonObject.put("vip2Price", vipPriceArray[VIP2PRICE_POSITION]);
|
|
|
productPricePlanJsonObject.put("vip3Price", vipPriceArray[VIP3PRICE_POSITION]);
|
|
|
// 填充价格相关参数
|
|
|
vipPriceLogicServie.fillProductPricePlanVipPrice(productPricePlan);
|
|
|
String idValue = String.valueOf(productPricePlan.getId());
|
|
|
indexService.updateIndexData(this.getIndexName(), idValue, productPricePlanJsonObject);
|
|
|
indexService.updateIndexData(this.getIndexName(), idValue, (JSONObject) JSONObject.toJSON(productPricePlan));
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|