Authored by hugufei

fix bug

@@ -10,10 +10,12 @@ import com.yoho.search.base.utils.ISearchConstants; @@ -10,10 +10,12 @@ import com.yoho.search.base.utils.ISearchConstants;
10 import com.yoho.search.common.SearchCommonService; 10 import com.yoho.search.common.SearchCommonService;
11 import com.yoho.search.core.es.model.SearchParam; 11 import com.yoho.search.core.es.model.SearchParam;
12 import com.yoho.search.core.es.model.SearchResult; 12 import com.yoho.search.core.es.model.SearchResult;
  13 +import com.yoho.search.core.es.utils.SearchParamUtils;
13 import com.yoho.search.dal.model.ProductCutpriceConfig; 14 import com.yoho.search.dal.model.ProductCutpriceConfig;
14 import org.apache.commons.collections.MapUtils; 15 import org.apache.commons.collections.MapUtils;
15 import org.elasticsearch.index.query.BoolQueryBuilder; 16 import org.elasticsearch.index.query.BoolQueryBuilder;
16 import org.elasticsearch.index.query.QueryBuilders; 17 import org.elasticsearch.index.query.QueryBuilders;
  18 +import org.elasticsearch.search.builder.SearchSourceBuilder;
17 import org.elasticsearch.search.sort.SortBuilder; 19 import org.elasticsearch.search.sort.SortBuilder;
18 import org.elasticsearch.search.sort.SortBuilders; 20 import org.elasticsearch.search.sort.SortBuilders;
19 import org.elasticsearch.search.sort.SortOrder; 21 import org.elasticsearch.search.sort.SortOrder;
@@ -53,8 +55,8 @@ public class CutpriceConfigIndexBaseService { @@ -53,8 +55,8 @@ public class CutpriceConfigIndexBaseService {
53 BoolQueryBuilder filter = QueryBuilders.boolQuery(); 55 BoolQueryBuilder filter = QueryBuilders.boolQuery();
54 filter.must(QueryBuilders.termQuery("status", 1)); 56 filter.must(QueryBuilders.termQuery("status", 1));
55 int current = DateUtil.getCurrentTimeSecond(); 57 int current = DateUtil.getCurrentTimeSecond();
56 - filter.must(QueryBuilders.rangeQuery("beginTime").gte(current));  
57 - filter.must(QueryBuilders.rangeQuery("endTime").lte(current)); 58 + filter.must(QueryBuilders.rangeQuery("beginTime").lte(current));
  59 + filter.must(QueryBuilders.rangeQuery("endTime").gte(current));
58 searchParam.setFiter(filter); 60 searchParam.setFiter(filter);
59 61
60 //2、设置排序条件 62 //2、设置排序条件
@@ -66,6 +68,8 @@ public class CutpriceConfigIndexBaseService { @@ -66,6 +68,8 @@ public class CutpriceConfigIndexBaseService {
66 searchParam.setOffset(0); 68 searchParam.setOffset(0);
67 searchParam.setSize(300); 69 searchParam.setSize(300);
68 70
  71 + SearchSourceBuilder ss = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
  72 + System.out.println(ss);
69 //4、执行es搜索 73 //4、执行es搜索
70 SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_CUT_PRICE_CONFIG, searchParam); 74 SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_CUT_PRICE_CONFIG, searchParam);
71 75
@@ -89,7 +93,8 @@ public class CutpriceConfigIndexBaseService { @@ -89,7 +93,8 @@ public class CutpriceConfigIndexBaseService {
89 93
90 public void fillIsProductCutPrice(List<Map<String, Object>> productList) { 94 public void fillIsProductCutPrice(List<Map<String, Object>> productList) {
91 try { 95 try {
92 - List<Integer> productCutpriceConfigPoolIds = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY); 96 + //List<Integer> productCutpriceConfigPoolIds = CUT_PRICE_CONFIG_CACHE.get(CACHE_KEY);
  97 + List<Integer> productCutpriceConfigPoolIds = this.buildCurrentProductCutpricePoolIds();
93 if (productCutpriceConfigPoolIds == null || productCutpriceConfigPoolIds.isEmpty()) { 98 if (productCutpriceConfigPoolIds == null || productCutpriceConfigPoolIds.isEmpty()) {
94 return; 99 return;
95 } 100 }