Authored by hugufei

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

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