Authored by wangnan

fix

... ... @@ -7,9 +7,7 @@ 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.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.index.fullbuild.ShopsIndexBuilder;
import com.yoho.search.consumer.service.base.ShopService;
import com.yoho.search.consumer.service.bo.ShopsBO;
import com.yoho.search.core.es.model.ESBluk;
import com.yoho.search.core.es.utils.IgnoreSomeException;
import com.yoho.search.dal.model.Shops;
... ... @@ -20,14 +18,12 @@ import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import retrofit.http.HEAD;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by wangnan on 2016/12/1.
*/
... ... @@ -39,8 +35,6 @@ public class ShopsMqListener extends AbstractMqListener implements ChannelAwareM
private IYohoIndexService indexService;
@Autowired
private ShopService shopService;
@Autowired
private ShopsIndexBuilder shopsIndexBuilder;
@Override
public void onMessage(Message message, Channel channel) throws Exception {
... ... @@ -79,15 +73,6 @@ public class ShopsMqListener extends AbstractMqListener implements ChannelAwareM
String idValue = shops.getShopsId().toString();
shopService.saveOrUpdate(shops);
logger.info("[func=updateData][step=saveToDb][indexName={}] [id={}][cost={}ms]", indexName, idValue, (System.currentTimeMillis() - begin));
List<Integer> ids = new ArrayList<>();
ids.add(shops.getShopsId());
List<ShopsBO> shopBOs = shopsIndexBuilder.getShopsBOs(ids);
if(!CollectionUtils.isEmpty(shopBOs)){
ShopsBO shopsBO = shopBOs.get(0);
List<ESBluk> results = new ArrayList<ESBluk>();
results.add(new ESBluk(JSONObject.toJSONString(this.beanToMap(shopsBO)), shopsBO.getShopsId().toString(), indexName, indexName, false));
indexService.bulk(results);
}
List<ESBluk> results = new ArrayList<ESBluk>();
results.add(new ESBluk(JSONObject.toJSONString(this.beanToMap(shops)), shops.getShopsId().toString(), indexName, indexName, false));
indexService.bulk(results);
... ...