...
|
...
|
@@ -58,9 +58,9 @@ public class CollageActivityIndexBaseService extends BaseService { |
|
|
LoadingCache<String, Map<Integer, Map<String, Object>>> allValidActivitysCache = CacheBuilder.newBuilder()
|
|
|
.maximumSize(10).expireAfterWrite(1, TimeUnit.MINUTES).build(new CacheLoader<String, Map<Integer, Map<String, Object>>>() {
|
|
|
public Map<Integer, Map<String, Object>> load(String key) {
|
|
|
//默认查询开始和即将开始的
|
|
|
//默认查询全部
|
|
|
Map<String, String> paramMap = new HashMap<>();
|
|
|
paramMap.put(SearchRequestCollageParams.COLLAGE_PARAM_ONLY_SHOW_BEGIN, "N");
|
|
|
paramMap.put(SearchRequestCollageParams.COLLAGE_PARAM_SHOW_TYPE, "3");
|
|
|
return queryValidActivitys(paramMap);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -87,17 +87,19 @@ public class CollageActivityIndexBaseService extends BaseService { |
|
|
hasBeginFilter.must(QueryBuilders.rangeQuery("beginTime").lte(current));//过滤活动开始时间
|
|
|
hasBeginFilter.must(QueryBuilders.rangeQuery("endTime").gte(current));//过滤活动结束时间
|
|
|
|
|
|
//2、执行参数判断
|
|
|
String onlyShowBegin = MapUtils.getString(paramMap, SearchRequestCollageParams.COLLAGE_PARAM_ONLY_SHOW_BEGIN, "N");
|
|
|
if ("Y".equalsIgnoreCase(onlyShowBegin)) {
|
|
|
return hasBeginFilter;
|
|
|
}
|
|
|
|
|
|
//3、生成即将开始的过滤条件
|
|
|
//2、即将开始的过滤条件
|
|
|
BoolQueryBuilder notBeginFilter = QueryBuilders.boolQuery();
|
|
|
notBeginFilter.must(QueryBuilders.rangeQuery("beginTime").gte(current));//过滤活动开始时间
|
|
|
notBeginFilter.must(QueryBuilders.rangeQuery("endTime").gte(current));//过滤活动结束时间
|
|
|
|
|
|
//3、执行参数判断
|
|
|
String showType = MapUtils.getString(paramMap, SearchRequestCollageParams.COLLAGE_PARAM_SHOW_TYPE, "1");
|
|
|
if ("1".equalsIgnoreCase(showType)) {
|
|
|
return hasBeginFilter;
|
|
|
}
|
|
|
if ("2".equalsIgnoreCase(showType)) {
|
|
|
return notBeginFilter;
|
|
|
}
|
|
|
return QueryBuilders.boolQuery().should(hasBeginFilter).should(notBeginFilter);
|
|
|
}
|
|
|
|
...
|
...
|
|