Authored by wangnan

fix

@@ -7,9 +7,7 @@ import com.yoho.search.base.utils.ConvertUtils; @@ -7,9 +7,7 @@ import com.yoho.search.base.utils.ConvertUtils;
7 import com.yoho.search.base.utils.EventReportEnum; 7 import com.yoho.search.base.utils.EventReportEnum;
8 import com.yoho.search.base.utils.ISearchConstants; 8 import com.yoho.search.base.utils.ISearchConstants;
9 import com.yoho.search.consumer.index.common.IYohoIndexService; 9 import com.yoho.search.consumer.index.common.IYohoIndexService;
10 -import com.yoho.search.consumer.index.fullbuild.ShopsIndexBuilder;  
11 import com.yoho.search.consumer.service.base.ShopService; 10 import com.yoho.search.consumer.service.base.ShopService;
12 -import com.yoho.search.consumer.service.bo.ShopsBO;  
13 import com.yoho.search.core.es.model.ESBluk; 11 import com.yoho.search.core.es.model.ESBluk;
14 import com.yoho.search.core.es.utils.IgnoreSomeException; 12 import com.yoho.search.core.es.utils.IgnoreSomeException;
15 import com.yoho.search.dal.model.Shops; 13 import com.yoho.search.dal.model.Shops;
@@ -20,14 +18,12 @@ import org.springframework.amqp.core.Message; @@ -20,14 +18,12 @@ import org.springframework.amqp.core.Message;
20 import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; 18 import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
21 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.stereotype.Component; 20 import org.springframework.stereotype.Component;
23 -import retrofit.http.HEAD;  
24 21
25 import java.util.ArrayList; 22 import java.util.ArrayList;
26 import java.util.List; 23 import java.util.List;
27 import java.util.Map; 24 import java.util.Map;
28 25
29 26
30 -  
31 /** 27 /**
32 * Created by wangnan on 2016/12/1. 28 * Created by wangnan on 2016/12/1.
33 */ 29 */
@@ -39,8 +35,6 @@ public class ShopsMqListener extends AbstractMqListener implements ChannelAwareM @@ -39,8 +35,6 @@ public class ShopsMqListener extends AbstractMqListener implements ChannelAwareM
39 private IYohoIndexService indexService; 35 private IYohoIndexService indexService;
40 @Autowired 36 @Autowired
41 private ShopService shopService; 37 private ShopService shopService;
42 - @Autowired  
43 - private ShopsIndexBuilder shopsIndexBuilder;  
44 38
45 @Override 39 @Override
46 public void onMessage(Message message, Channel channel) throws Exception { 40 public void onMessage(Message message, Channel channel) throws Exception {
@@ -79,15 +73,6 @@ public class ShopsMqListener extends AbstractMqListener implements ChannelAwareM @@ -79,15 +73,6 @@ public class ShopsMqListener extends AbstractMqListener implements ChannelAwareM
79 String idValue = shops.getShopsId().toString(); 73 String idValue = shops.getShopsId().toString();
80 shopService.saveOrUpdate(shops); 74 shopService.saveOrUpdate(shops);
81 logger.info("[func=updateData][step=saveToDb][indexName={}] [id={}][cost={}ms]", indexName, idValue, (System.currentTimeMillis() - begin)); 75 logger.info("[func=updateData][step=saveToDb][indexName={}] [id={}][cost={}ms]", indexName, idValue, (System.currentTimeMillis() - begin));
82 - List<Integer> ids = new ArrayList<>();  
83 - ids.add(shops.getShopsId());  
84 - List<ShopsBO> shopBOs = shopsIndexBuilder.getShopsBOs(ids);  
85 - if(!CollectionUtils.isEmpty(shopBOs)){  
86 - ShopsBO shopsBO = shopBOs.get(0);  
87 - List<ESBluk> results = new ArrayList<ESBluk>();  
88 - results.add(new ESBluk(JSONObject.toJSONString(this.beanToMap(shopsBO)), shopsBO.getShopsId().toString(), indexName, indexName, false));  
89 - indexService.bulk(results);  
90 - }  
91 List<ESBluk> results = new ArrayList<ESBluk>(); 76 List<ESBluk> results = new ArrayList<ESBluk>();
92 results.add(new ESBluk(JSONObject.toJSONString(this.beanToMap(shops)), shops.getShopsId().toString(), indexName, indexName, false)); 77 results.add(new ESBluk(JSONObject.toJSONString(this.beanToMap(shops)), shops.getShopsId().toString(), indexName, indexName, false));
93 indexService.bulk(results); 78 indexService.bulk(results);