Authored by hugufei

拼团展示参数: "showType";//1、只展示已开始的 2、只展示即将开始的 3、展示全部

@@ -10,6 +10,6 @@ public class SearchRequestCollageParams { @@ -10,6 +10,6 @@ public class SearchRequestCollageParams {
10 public static final String COLLAGE_PARAM_PAYLIMIT = "payLimit";//支付限制:0或NULL 无限制 1:仅APP可支付 2:仅小程序可支付 10 public static final String COLLAGE_PARAM_PAYLIMIT = "payLimit";//支付限制:0或NULL 无限制 1:仅APP可支付 2:仅小程序可支付
11 public static final String COLLAGE_PARAM_PRODUCTLIMIT = "productLimit";//商品限制:0或null 无限制 1:参团SKN和开团一致 11 public static final String COLLAGE_PARAM_PRODUCTLIMIT = "productLimit";//商品限制:0或null 无限制 1:参团SKN和开团一致
12 public static final String COLLAGE_PARAM_PEOPLENUMLIMIT = "peopleNum";//拼团人数 12 public static final String COLLAGE_PARAM_PEOPLENUMLIMIT = "peopleNum";//拼团人数
13 - public static final String COLLAGE_PARAM_ONLY_SHOW_BEGIN = "onlyShowBegin";//是否只展示开始的 13 + public static final String COLLAGE_PARAM_SHOW_TYPE = "showType";//1、只展示已开始的 2、只展示即将开始的 3、展示全部
14 14
15 } 15 }
@@ -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
@@ -81,8 +81,11 @@ public class CollagePageService extends AbstractPageSceneService { @@ -81,8 +81,11 @@ public class CollagePageService extends AbstractPageSceneService {
81 paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITEDBUY, "N");// 不支持限购 81 paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITEDBUY, "N");// 不支持限购
82 paramMap.put(SearchRequestParams.PARAM_SEARCH_ISDESPOSITADVANCE, "N");// 不支持定金预售 82 paramMap.put(SearchRequestParams.PARAM_SEARCH_ISDESPOSITADVANCE, "N");// 不支持定金预售
83 paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITTIMEADVANCE, "N");// 不支持定金促销 83 paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITTIMEADVANCE, "N");// 不支持定金促销
84 - // 只展示已开始的  
85 - paramMap.put(SearchRequestCollageParams.COLLAGE_PARAM_ONLY_SHOW_BEGIN, "Y"); 84 +
  85 + // 展示类型 1、只展示已开始的 2、只展示即将开始的 3、展示全部
  86 + String showType = MapUtils.getString(paramMap,SearchRequestCollageParams.COLLAGE_PARAM_SHOW_TYPE,"1");
  87 + paramMap.put(SearchRequestCollageParams.COLLAGE_PARAM_SHOW_TYPE, showType);
  88 +
86 //排序字段转义 89 //排序字段转义
87 String orderValue = paramMap.get("order"); 90 String orderValue = paramMap.get("order");
88 if (orderValue != null && orderTransfer.containsKey(orderValue)) { 91 if (orderValue != null && orderTransfer.containsKey(orderValue)) {