Authored by wangnan9279

拼团购

... ... @@ -12,6 +12,8 @@ import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.model.CollageActivity;
import com.yoho.search.dal.model.CollageBO;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -24,6 +26,9 @@ import java.util.List;
@Component
@SearchMqConsumerListerner(tableName = "collage_activity")
public class CollageActivityMqListener extends AbstractMqListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private IYohoIndexService indexService;
@Autowired
... ... @@ -58,6 +63,12 @@ public class CollageActivityMqListener extends AbstractMqListener {
if (CollectionUtils.isEmpty(collageBOList)) {
return;
}
indexService.updateIndexData(this.getIndexName(), collageBOList.get(0).getId().toString(), collageBOList.get(0));
collageBOList.stream().forEach(collageBO -> {
try {
indexService.updateIndexData(this.getIndexName(), collageBO.getId().toString(), collageBO);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
});
}
}
... ...