...
|
...
|
@@ -13,6 +13,7 @@ import com.yoho.search.core.es.model.SearchResult; |
|
|
import com.yoho.search.core.es.utils.SearchParamUtils;
|
|
|
import com.yoho.search.dal.model.ProductCutpriceConfig;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
...
|
...
|
@@ -68,7 +69,7 @@ public class CutpriceConfigIndexBaseService { |
|
|
searchParam.setOffset(0);
|
|
|
searchParam.setSize(300);
|
|
|
|
|
|
SearchSourceBuilder ss = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
|
|
|
SearchSourceBuilder ss = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
|
|
|
System.out.println(ss);
|
|
|
//4、执行es搜索
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_CUT_PRICE_CONFIG, searchParam);
|
...
|
...
|
@@ -93,18 +94,16 @@ public class CutpriceConfigIndexBaseService { |
|
|
|
|
|
public void fillIsProductCutPrice(List<Map<String, Object>> productList) {
|
|
|
try {
|
|
|
//List<Integer> productCutpriceConfigPoolIds = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY);
|
|
|
List<Integer> productCutpriceConfigPoolIds = this.buildCurrentProductCutpricePoolIds();
|
|
|
if (productCutpriceConfigPoolIds == null || productCutpriceConfigPoolIds.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
List<Integer> productCutpriceConfigPoolIds = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY);
|
|
|
for (Map<String, Object> product : productList) {
|
|
|
try {
|
|
|
String productPoolIdStr = MapUtils.getString(product, PRODUCTINDEX_FIELD_POOLIDS, "");
|
|
|
String productPoolIdStr = MapUtils.getString(product, "pool_ids", "");
|
|
|
boolean is_product_cutprice = this.isProductCutprice(productCutpriceConfigPoolIds, productPoolIdStr);
|
|
|
product.put("is_product_cutprice", is_product_cutprice ? "Y" : "N");
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
}finally {
|
|
|
product.remove("pool_ids");
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
...
|
...
|
@@ -113,6 +112,12 @@ public class CutpriceConfigIndexBaseService { |
|
|
}
|
|
|
|
|
|
private boolean isProductCutprice(List<Integer> currentCutPricePoolIds, String productPoolIdStr) {
|
|
|
if (currentCutPricePoolIds == null || currentCutPricePoolIds.isEmpty()) {
|
|
|
return false;
|
|
|
}
|
|
|
if (StringUtils.isEmpty(productPoolIdStr)) {
|
|
|
return false;
|
|
|
}
|
|
|
List<Integer> productPoolIdList = ConvertUtils.stringToIntList(productPoolIdStr, ",");
|
|
|
for (Integer pool : productPoolIdList) {
|
|
|
if (currentCutPricePoolIds.contains(pool)) {
|
...
|
...
|
|