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