fix ProductPricePlanMqListener
Showing
1 changed file
with
6 additions
and
16 deletions
@@ -7,10 +7,10 @@ import com.alibaba.fastjson.JSONObject; | @@ -7,10 +7,10 @@ import com.alibaba.fastjson.JSONObject; | ||
7 | import com.yoho.search.base.utils.ConvertUtils; | 7 | import com.yoho.search.base.utils.ConvertUtils; |
8 | import com.yoho.search.base.utils.EventReportEnum; | 8 | import com.yoho.search.base.utils.EventReportEnum; |
9 | import com.yoho.search.base.utils.ISearchConstants; | 9 | import com.yoho.search.base.utils.ISearchConstants; |
10 | -import com.yoho.search.base.utils.PriceUtil; | ||
11 | import com.yoho.search.consumer.index.common.IYohoIndexService; | 10 | import com.yoho.search.consumer.index.common.IYohoIndexService; |
12 | import com.yoho.search.consumer.index.increment.AbstractIndexMqListener; | 11 | import com.yoho.search.consumer.index.increment.AbstractIndexMqListener; |
13 | import com.yoho.search.consumer.service.base.ProductPricePlanService; | 12 | import com.yoho.search.consumer.service.base.ProductPricePlanService; |
13 | +import com.yoho.search.consumer.service.logic.VipPriceLogicServie; | ||
14 | import com.yoho.search.dal.model.ProductPricePlan; | 14 | import com.yoho.search.dal.model.ProductPricePlan; |
15 | 15 | ||
16 | @Component | 16 | @Component |
@@ -18,13 +18,10 @@ public class ProductPricePlanMqListener extends AbstractIndexMqListener { | @@ -18,13 +18,10 @@ public class ProductPricePlanMqListener extends AbstractIndexMqListener { | ||
18 | 18 | ||
19 | @Autowired | 19 | @Autowired |
20 | private ProductPricePlanService productPricePlanService; | 20 | private ProductPricePlanService productPricePlanService; |
21 | - | ||
22 | @Autowired | 21 | @Autowired |
23 | private IYohoIndexService indexService; | 22 | private IYohoIndexService indexService; |
24 | - | ||
25 | - private static final int VIP1PRICE_POSITION = 0; | ||
26 | - private static final int VIP2PRICE_POSITION = 1; | ||
27 | - private static final int VIP3PRICE_POSITION = 2; | 23 | + @Autowired |
24 | + private VipPriceLogicServie vipPriceLogicServie; | ||
28 | 25 | ||
29 | @Override | 26 | @Override |
30 | public String getIndexName() { | 27 | public String getIndexName() { |
@@ -49,17 +46,10 @@ public class ProductPricePlanMqListener extends AbstractIndexMqListener { | @@ -49,17 +46,10 @@ public class ProductPricePlanMqListener extends AbstractIndexMqListener { | ||
49 | return; | 46 | return; |
50 | } | 47 | } |
51 | productPricePlanService.saveOrUpdate(productPricePlan); | 48 | productPricePlanService.saveOrUpdate(productPricePlan); |
52 | - | ||
53 | - // 将productPricePlan转成JSONObject | ||
54 | - JSONObject productPricePlanJsonObject = (JSONObject) JSONObject.toJSON(productPricePlan); | ||
55 | - // 特殊处理vip*Price | ||
56 | - double[] vipPriceArray = PriceUtil.getVipPriceDoubleArray(productPricePlan.getCurrentSaleprice(), productPricePlan.getVipPrice(), productPricePlan.getVip1Price(), | ||
57 | - productPricePlan.getVip2Price(), productPricePlan.getVip3Price(), productPricePlan.getVipDiscountType()); | ||
58 | - productPricePlanJsonObject.put("vip1Price", vipPriceArray[VIP1PRICE_POSITION]); | ||
59 | - productPricePlanJsonObject.put("vip2Price", vipPriceArray[VIP2PRICE_POSITION]); | ||
60 | - productPricePlanJsonObject.put("vip3Price", vipPriceArray[VIP3PRICE_POSITION]); | 49 | + // 填充价格相关参数 |
50 | + vipPriceLogicServie.fillProductPricePlanVipPrice(productPricePlan); | ||
61 | String idValue = String.valueOf(productPricePlan.getId()); | 51 | String idValue = String.valueOf(productPricePlan.getId()); |
62 | - indexService.updateIndexData(this.getIndexName(), idValue, productPricePlanJsonObject); | 52 | + indexService.updateIndexData(this.getIndexName(), idValue, (JSONObject) JSONObject.toJSON(productPricePlan)); |
63 | } | 53 | } |
64 | 54 | ||
65 | } | 55 | } |
-
Please register or login to post a comment