...
|
...
|
@@ -10,10 +10,12 @@ import com.yoho.search.base.utils.ISearchConstants; |
|
|
import com.yoho.search.common.SearchCommonService;
|
|
|
import com.yoho.search.core.es.model.SearchParam;
|
|
|
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.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
|
import org.elasticsearch.search.sort.SortBuilder;
|
|
|
import org.elasticsearch.search.sort.SortBuilders;
|
|
|
import org.elasticsearch.search.sort.SortOrder;
|
...
|
...
|
@@ -53,8 +55,8 @@ public class CutpriceConfigIndexBaseService { |
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
filter.must(QueryBuilders.termQuery("status", 1));
|
|
|
int current = DateUtil.getCurrentTimeSecond();
|
|
|
filter.must(QueryBuilders.rangeQuery("beginTime").gte(current));
|
|
|
filter.must(QueryBuilders.rangeQuery("endTime").lte(current));
|
|
|
filter.must(QueryBuilders.rangeQuery("beginTime").lte(current));
|
|
|
filter.must(QueryBuilders.rangeQuery("endTime").gte(current));
|
|
|
searchParam.setFiter(filter);
|
|
|
|
|
|
//2、设置排序条件
|
...
|
...
|
@@ -66,6 +68,8 @@ public class CutpriceConfigIndexBaseService { |
|
|
searchParam.setOffset(0);
|
|
|
searchParam.setSize(300);
|
|
|
|
|
|
SearchSourceBuilder ss = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
|
|
|
System.out.println(ss);
|
|
|
//4、执行es搜索
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_CUT_PRICE_CONFIG, searchParam);
|
|
|
|
...
|
...
|
@@ -89,7 +93,8 @@ 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 = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY);
|
|
|
List<Integer> productCutpriceConfigPoolIds = this.buildCurrentProductCutpricePoolIds();
|
|
|
if (productCutpriceConfigPoolIds == null || productCutpriceConfigPoolIds.isEmpty()) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
|