1
|
-package com.yoho.search.service.scene;
|
|
|
2
|
-
|
|
|
3
|
-import java.util.ArrayList;
|
|
|
4
|
-import java.util.List;
|
|
|
5
|
-import java.util.Map;
|
|
|
6
|
-
|
|
|
7
|
-import org.apache.commons.lang.StringUtils;
|
|
|
8
|
-import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
9
|
-import org.elasticsearch.index.query.QueryBuilders;
|
|
|
10
|
-import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
|
|
|
11
|
-import org.elasticsearch.search.aggregations.Aggregation;
|
|
|
12
|
-import org.slf4j.Logger;
|
|
|
13
|
-import org.slf4j.LoggerFactory;
|
|
|
14
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
15
|
-import org.springframework.stereotype.Service;
|
|
|
16
|
-
|
|
|
17
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
18
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
19
|
-import com.yoho.search.base.utils.ConvertUtils;
|
|
|
20
|
-import com.yoho.search.base.utils.ISearchConstants;
|
|
|
21
|
-import com.yoho.search.base.utils.ProductIndexEsField;
|
|
|
22
|
-import com.yoho.search.common.cache.SearchCacheMatchLogger;
|
|
|
23
|
-import com.yoho.search.common.cache.model.SearchCache;
|
|
|
24
|
-import com.yoho.search.core.es.agg.IAggregation;
|
|
|
25
|
-import com.yoho.search.core.es.model.SearchParam;
|
|
|
26
|
-import com.yoho.search.core.es.model.SearchResult;
|
|
|
27
|
-import com.yoho.search.models.PromotionConditions;
|
|
|
28
|
-import com.yoho.search.models.PromotionParam;
|
|
|
29
|
-import com.yoho.search.models.SearchApiResult;
|
|
|
30
|
-import com.yoho.search.service.aggregations.impls.AggregationFactoryService;
|
|
|
31
|
-import com.yoho.search.service.base.SearchCommonService;
|
|
|
32
|
-import com.yoho.search.service.base.index.ProductIndexBaseService;
|
|
|
33
|
-import com.yoho.search.service.helper.SearchAfterCacheHelper;
|
|
|
34
|
-import com.yoho.search.service.helper.SearchParamHelper;
|
|
|
35
|
-import com.yoho.search.service.helper.SearchSortHelper;
|
|
|
36
|
-import com.yoho.search.service.scene.common.AbstractCacheAbleService;
|
|
|
37
|
-import com.yoho.search.service.scene.common.SceneSelectionsService;
|
|
|
38
|
-import com.yoho.search.service.service.IBrandService;
|
|
|
39
|
-import com.yoho.search.service.service.IDiscountService;
|
|
|
40
|
-import com.yoho.search.service.service.ISearchSortGroupService;
|
|
|
41
|
-import com.yoho.search.service.service.ISelectionsForApp;
|
|
|
42
|
-import com.yoho.search.service.service.ISelectionsForPc;
|
|
|
43
|
-
|
|
|
44
|
-@Service
|
|
|
45
|
-public class PromotionSceneService extends AbstractCacheAbleService {
|
|
|
46
|
-
|
|
|
47
|
- private static Logger logger = LoggerFactory.getLogger(PromotionSceneService.class);
|
|
|
48
|
-
|
|
|
49
|
- @Autowired
|
|
|
50
|
- private SearchSortHelper searchSortHelper;
|
|
|
51
|
- @Autowired
|
|
|
52
|
- private SearchCommonService searchCommonService;
|
|
|
53
|
- @Autowired
|
|
|
54
|
- private AggregationFactoryService aggregationFactoryService;
|
|
|
55
|
- @Autowired
|
|
|
56
|
- private ISelectionsForApp selectionsWithOutAdvanceService;
|
|
|
57
|
- @Autowired
|
|
|
58
|
- private SearchAfterCacheHelper searchAfterCacheService;
|
|
|
59
|
- @Autowired
|
|
|
60
|
- private ISelectionsForPc selectionsForPc;
|
|
|
61
|
- @Autowired
|
|
|
62
|
- private IBrandService brandService;
|
|
|
63
|
- @Autowired
|
|
|
64
|
- private ISearchSortGroupService searchSortGroupService;
|
|
|
65
|
- @Autowired
|
|
|
66
|
- private IDiscountService discountService;
|
|
|
67
|
- @Autowired
|
|
|
68
|
- private ProductIndexBaseService productIndexBaseService;
|
|
|
69
|
- @Autowired
|
|
|
70
|
- private SearchParamHelper searchParamHelper;
|
|
|
71
|
- @Autowired
|
|
|
72
|
- private SceneSelectionsService sceneSelectionsService;
|
|
|
73
|
-
|
|
|
74
|
- @Override
|
|
|
75
|
- public SearchCache getSearchCache() {
|
|
|
76
|
- return searchCacheFactory.getPromotionSearchCache();
|
|
|
77
|
- }
|
|
|
78
|
-
|
|
|
79
|
- private BoolQueryBuilder genConditionFilter(PromotionParam param, boolean isAnd) {
|
|
|
80
|
- BoolQueryBuilder conditionFilter = QueryBuilders.boolQuery();
|
|
|
81
|
- // 判断品牌
|
|
|
82
|
- if (StringUtils.isNotBlank(param.getBrand())) {
|
|
|
83
|
- int[] brandids = ConvertUtils.stringToIntArray(param.getBrand(), ",");
|
|
|
84
|
- BoolQueryBuilder brandFilter = QueryBuilders.boolQuery().must(QueryBuilders.termsQuery(ProductIndexEsField.brandId, brandids));
|
|
|
85
|
- if (isAnd) {
|
|
|
86
|
- conditionFilter.must(brandFilter);
|
|
|
87
|
- } else {
|
|
|
88
|
- conditionFilter.should(brandFilter);
|
|
|
89
|
- }
|
|
|
90
|
- }
|
|
|
91
|
- // 判断不包含品牌
|
|
|
92
|
- if (StringUtils.isNotBlank(param.getNotBrandId())) {
|
|
|
93
|
- int[] notBrandids = ConvertUtils.stringToIntArray(param.getNotBrandId(), ",");
|
|
|
94
|
- BoolQueryBuilder notBrandFilter = QueryBuilders.boolQuery();
|
|
|
95
|
- notBrandFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.brandId, notBrandids));
|
|
|
96
|
- if (isAnd) {
|
|
|
97
|
- conditionFilter.must(notBrandFilter);
|
|
|
98
|
- } else {
|
|
|
99
|
- conditionFilter.should(notBrandFilter);
|
|
|
100
|
- }
|
|
|
101
|
- }
|
|
|
102
|
- // 判断品类
|
|
|
103
|
- if (StringUtils.isNotBlank(param.getSort())) {
|
|
|
104
|
- int[] sortIds = ConvertUtils.stringToIntArray(param.getSort(), ",");
|
|
|
105
|
- BoolQueryBuilder sortFilter = QueryBuilders.boolQuery();
|
|
|
106
|
- sortFilter.should(QueryBuilders.termsQuery(ProductIndexEsField.maxSortId, sortIds));
|
|
|
107
|
- sortFilter.should(QueryBuilders.termsQuery(ProductIndexEsField.middleSortId, sortIds));
|
|
|
108
|
- sortFilter.should(QueryBuilders.termsQuery(ProductIndexEsField.smallSortId, sortIds));
|
|
|
109
|
- if (isAnd) {
|
|
|
110
|
- conditionFilter.must(QueryBuilders.boolQuery().must(sortFilter));
|
|
|
111
|
- } else {
|
|
|
112
|
- conditionFilter.should(QueryBuilders.boolQuery().must(sortFilter));
|
|
|
113
|
- }
|
|
|
114
|
- }
|
|
|
115
|
- // 判断非品类
|
|
|
116
|
- if (StringUtils.isNotBlank(param.getNotSort())) {
|
|
|
117
|
- int[] notSortIds = ConvertUtils.stringToIntArray(param.getNotSort(), ",");
|
|
|
118
|
- BoolQueryBuilder notSortFilter = QueryBuilders.boolQuery();
|
|
|
119
|
- notSortFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.maxSortId, notSortIds));
|
|
|
120
|
- notSortFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.middleSortId, notSortIds));
|
|
|
121
|
- notSortFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.smallSortId, notSortIds));
|
|
|
122
|
- if (isAnd) {
|
|
|
123
|
- conditionFilter.must(notSortFilter);
|
|
|
124
|
- } else {
|
|
|
125
|
- conditionFilter.should(notSortFilter);
|
|
|
126
|
- }
|
|
|
127
|
- }
|
|
|
128
|
- // 判断promotion
|
|
|
129
|
- if (StringUtils.isNotBlank(param.getPromotion())) {
|
|
|
130
|
- int[] promotionIds = ConvertUtils.stringToIntArray(param.getPromotion(), ",");
|
|
|
131
|
- BoolQueryBuilder promotionFilter = QueryBuilders.boolQuery();
|
|
|
132
|
- promotionFilter.must(QueryBuilders.termsQuery(ProductIndexEsField.ispromotion, promotionIds));
|
|
|
133
|
- if (isAnd) {
|
|
|
134
|
- conditionFilter.must(promotionFilter);
|
|
|
135
|
- } else {
|
|
|
136
|
- conditionFilter.should(promotionFilter);
|
|
|
137
|
- }
|
|
|
138
|
- }
|
|
|
139
|
- // 判断非promotion
|
|
|
140
|
- if (StringUtils.isNotBlank(param.getNotPromotion())) {
|
|
|
141
|
- int[] notPromotionIds = ConvertUtils.stringToIntArray(param.getNotPromotion(), ",");
|
|
|
142
|
- BoolQueryBuilder notPromotionFilter = QueryBuilders.boolQuery();
|
|
|
143
|
- notPromotionFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.ispromotion, notPromotionIds));
|
|
|
144
|
- if (isAnd) {
|
|
|
145
|
- conditionFilter.must(notPromotionFilter);
|
|
|
146
|
- } else {
|
|
|
147
|
- conditionFilter.should(notPromotionFilter);
|
|
|
148
|
- }
|
|
|
149
|
- }
|
|
|
150
|
- // 判断skn
|
|
|
151
|
- if (StringUtils.isNotBlank(param.getProductSknStr())) {
|
|
|
152
|
- BoolQueryBuilder sknFilter = QueryBuilders.boolQuery();
|
|
|
153
|
- sknFilter.must(QueryBuilders.termsQuery(ProductIndexEsField.productSkn, param.getProductSknStr().split(",")));
|
|
|
154
|
- if (isAnd) {
|
|
|
155
|
- conditionFilter.must(sknFilter);
|
|
|
156
|
- } else {
|
|
|
157
|
- conditionFilter.should(sknFilter);
|
|
|
158
|
- }
|
|
|
159
|
- }
|
|
|
160
|
- // 判断 非skn
|
|
|
161
|
- if (StringUtils.isNotBlank(param.getNotProductSkn())) {
|
|
|
162
|
- BoolQueryBuilder sknFilter = QueryBuilders.boolQuery();
|
|
|
163
|
- sknFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.productSkn, param.getNotProductSkn().split(",")));
|
|
|
164
|
- if (isAnd) {
|
|
|
165
|
- conditionFilter.must(sknFilter);
|
|
|
166
|
- } else {
|
|
|
167
|
- conditionFilter.should(sknFilter);
|
|
|
168
|
- }
|
|
|
169
|
- }
|
|
|
170
|
- return conditionFilter;
|
|
|
171
|
- }
|
|
|
172
|
-
|
|
|
173
|
- /**
|
|
|
174
|
- * 根据促销列表参数生成过滤条件
|
|
|
175
|
- *
|
|
|
176
|
- * @return
|
|
|
177
|
- */
|
|
|
178
|
- public BoolQueryBuilder getMustFilterByPromotion(PromotionConditions promotionConditions) {
|
|
|
179
|
- if (promotionConditions == null) {
|
|
|
180
|
- return null;
|
|
|
181
|
- }
|
|
|
182
|
- // 生成每种condition的filter列表
|
|
|
183
|
- List<BoolQueryBuilder> conditionsFilter = new ArrayList<BoolQueryBuilder>();
|
|
|
184
|
- List<PromotionParam> promotionParams = promotionConditions.getPromotionParams();
|
|
|
185
|
- for (PromotionParam promotionParam : promotionParams) {
|
|
|
186
|
- boolean isAnd = "any".equals(promotionParam.getAggregator()) ? false : true;
|
|
|
187
|
- BoolQueryBuilder conditionFilter = this.genConditionFilter(promotionParam, isAnd);
|
|
|
188
|
- conditionsFilter.add(conditionFilter);
|
|
|
189
|
- }
|
|
|
190
|
- // 处理总结果
|
|
|
191
|
- String aggregator = promotionConditions.getAggregator();
|
|
|
192
|
- boolean isTotalAnd = "any".equals(aggregator) ? false : true;
|
|
|
193
|
- BoolQueryBuilder allBuilder = QueryBuilders.boolQuery();
|
|
|
194
|
- for (BoolQueryBuilder conditionFilter : conditionsFilter) {
|
|
|
195
|
- if (isTotalAnd) {
|
|
|
196
|
- allBuilder.must(conditionFilter);
|
|
|
197
|
- } else {
|
|
|
198
|
- allBuilder.should(conditionFilter);
|
|
|
199
|
- }
|
|
|
200
|
- }
|
|
|
201
|
- return allBuilder;
|
|
|
202
|
- }
|
|
|
203
|
-
|
|
|
204
|
- public SearchApiResult list(PromotionConditions promotionConditions, Map<String, String> paramMap) throws Exception {
|
|
|
205
|
- // 1、获取mustFilterByPromotion
|
|
|
206
|
- BoolQueryBuilder mustFilterByPromotion = this.getMustFilterByPromotion(promotionConditions);
|
|
|
207
|
-
|
|
|
208
|
- // 2、构造带filter和Query的SearchParam
|
|
|
209
|
- SearchParam searchParam = searchParamHelper.buildWithPersional(paramMap, true, mustFilterByPromotion);
|
|
|
210
|
-
|
|
|
211
|
- // 3、设置聚合条件
|
|
|
212
|
- searchParam.setAggregationBuilders(null);
|
|
|
213
|
- // 4、设置分页参数
|
|
|
214
|
- int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 10 : Integer.parseInt(paramMap.get("viewNum"));
|
|
|
215
|
- int page = StringUtils.isBlank(paramMap.get("page")) ? 1 : Integer.parseInt(paramMap.get("page"));
|
|
|
216
|
- if (page < 1 || pageSize < 0) {
|
|
|
217
|
- throw new IllegalArgumentException("分页参数不合法");
|
|
|
218
|
- }
|
|
|
219
|
- if (pageSize > 100) {
|
|
|
220
|
- pageSize = 100;
|
|
|
221
|
- }
|
|
|
222
|
- searchParam.setOffset((page - 1) * pageSize);
|
|
|
223
|
- searchParam.setSize(pageSize);
|
|
|
224
|
- // 5)设置排序字段
|
|
|
225
|
- searchParam.setSortBuilders(searchSortHelper.buildSortList(paramMap));
|
|
|
226
|
-
|
|
|
227
|
- // 6)从缓存中获取数据
|
|
|
228
|
- final String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
|
|
|
229
|
- JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(this.searchCache, productIndexName, searchParam);
|
|
|
230
|
- if (cacheObject != null) {
|
|
|
231
|
- SearchCacheMatchLogger.doSearchCacheMatchLog("/promotion/list.json", paramMap);
|
|
|
232
|
- return new SearchApiResult().setData(cacheObject);
|
|
|
233
|
- }
|
|
|
234
|
-
|
|
|
235
|
- // 7)查询ES
|
|
|
236
|
- SearchResult searchResult = searchCommonService.doSearch(productIndexName, searchParam);
|
|
|
237
|
- if (searchResult == null) {
|
|
|
238
|
- return new SearchApiResult().setCode(500).setMessage("execption");
|
|
|
239
|
- }
|
|
|
240
|
- // 8)构造返回结果
|
|
|
241
|
- JSONObject dataMap = new JSONObject();
|
|
|
242
|
- dataMap.put("total", searchResult.getTotal());
|
|
|
243
|
- dataMap.put("page", searchResult.getPage());
|
|
|
244
|
- dataMap.put("page_size", searchParam.getSize());
|
|
|
245
|
- dataMap.put("page_total", searchResult.getTotalPage());
|
|
|
246
|
- dataMap.put("product_list", productIndexBaseService.getProductListWithPricePlan(searchResult.getResultList()));
|
|
|
247
|
-
|
|
|
248
|
- // 10)将结果存进缓存
|
|
|
249
|
- searchCacheService.addJSONObjectToCache(this.searchCache, productIndexName, searchParam, dataMap);
|
|
|
250
|
- return new SearchApiResult().setData(dataMap);
|
|
|
251
|
- }
|
|
|
252
|
-
|
|
|
253
|
- public SearchApiResult selectionsForApp(PromotionConditions promotionConditions, Map<String, String> paramMap) throws Exception {
|
|
|
254
|
- // 1、获取mustFilterByPromotion
|
|
|
255
|
- BoolQueryBuilder mustFilterByPromotion = this.getMustFilterByPromotion(promotionConditions);
|
|
|
256
|
- // 2、构造带filter和Query的SearchParam
|
|
|
257
|
- SearchParam searchParam = searchParamHelper.buildWithMustFilter(paramMap, mustFilterByPromotion);
|
|
|
258
|
- // 3、构造聚合条件【7种】
|
|
|
259
|
- List<AbstractAggregationBuilder<?>> aggregationBuilders = new ArrayList<AbstractAggregationBuilder<?>>();
|
|
|
260
|
- searchParam.setAggregationBuilders(aggregationBuilders);
|
|
|
261
|
- // 3.1获取通用的聚合场景
|
|
|
262
|
- aggregationBuilders.addAll(selectionsWithOutAdvanceService.getAllAggregationBuilders(paramMap));
|
|
|
263
|
- // 3.2加上折扣聚合场景
|
|
|
264
|
- IAggregation discountAggregation = aggregationFactoryService.getDiscountAggregation();
|
|
|
265
|
- aggregationBuilders.add(discountAggregation.getBuilder());
|
|
|
266
|
- // 3.3加上品类聚合场景
|
|
|
267
|
- IAggregation sortGroupAggregation = aggregationFactoryService.getSortGroupAggregation(paramMap);
|
|
|
268
|
- aggregationBuilders.add(sortGroupAggregation.getBuilder());
|
|
|
269
|
-
|
|
|
270
|
- // 4、设置分页参数
|
|
|
271
|
- searchParam.setOffset(0);
|
|
|
272
|
- searchParam.setSize(0);
|
|
|
273
|
-
|
|
|
274
|
- final String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
|
|
|
275
|
-
|
|
|
276
|
- // 5、从缓存中取
|
|
|
277
|
- JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(this.searchCache, productIndexName, searchParam);
|
|
|
278
|
- if (cacheObject != null) {
|
|
|
279
|
- Object newCacheObject = searchAfterCacheService.dealFilterCacheObject(cacheObject);
|
|
|
280
|
- newCacheObject = searchAfterCacheService.dealDiscountCacheObject((JSONObject) newCacheObject);
|
|
|
281
|
- SearchCacheMatchLogger.doSearchCacheMatchLog("/promotion/selections.json", paramMap);
|
|
|
282
|
- return new SearchApiResult().setData(newCacheObject);
|
|
|
283
|
- }
|
|
|
284
|
-
|
|
|
285
|
- // 6)查询ES
|
|
|
286
|
- SearchResult searchResult = searchCommonService.doSearch(productIndexName, searchParam);
|
|
|
287
|
- if (searchResult == null) {
|
|
|
288
|
- return new SearchApiResult().setCode(500).setMessage("execption");
|
|
|
289
|
- }
|
|
|
290
|
- // 7)构造并返回聚合结果
|
|
|
291
|
- Map<String, Aggregation> aggMaps = searchResult.getAggMaps();
|
|
|
292
|
- if (aggMaps == null) {
|
|
|
293
|
- return null;
|
|
|
294
|
- }
|
|
|
295
|
- // 8)先拿通用的聚合结果
|
|
|
296
|
- Map<String, Object> commonAggResult = selectionsWithOutAdvanceService.getAggResultMap(paramMap, aggMaps);
|
|
|
297
|
- // 9)获取折扣的聚合结果
|
|
|
298
|
- Object discountAggResult = discountAggregation.getAggregationResponseMap(aggMaps);
|
|
|
299
|
- // 10)获取品类的聚合结果
|
|
|
300
|
- Object sortGroupAggResult = sortGroupAggregation.getAggregationResponseMap(aggMaps);
|
|
|
301
|
-
|
|
|
302
|
- // 11)构造返回对象
|
|
|
303
|
- JSONObject result = new JSONObject();
|
|
|
304
|
- result.put("filter", commonAggResult);
|
|
|
305
|
- result.put("discount", discountAggResult);
|
|
|
306
|
- result.put("sort", sortGroupAggResult);
|
|
|
307
|
-
|
|
|
308
|
- // 12)将结果加入缓存
|
|
|
309
|
- searchCacheService.addJSONObjectToCache(this.searchCache, productIndexName, searchParam, result);
|
|
|
310
|
- return new SearchApiResult().setData(result);
|
|
|
311
|
- }
|
|
|
312
|
-
|
|
|
313
|
- public SearchApiResult selectionsForPc(PromotionConditions promotionConditions, Map<String, String> paramMap) throws Exception {
|
|
|
314
|
- // 1、获取默认的mustFilterByPromotion
|
|
|
315
|
- BoolQueryBuilder mustFilterByPromotion = this.getMustFilterByPromotion(promotionConditions);
|
|
|
316
|
-
|
|
|
317
|
- // 2、调通用的PC聚合逻辑
|
|
|
318
|
- SearchApiResult apiResult = selectionsForPc.getSelectionsForPc(paramMap, mustFilterByPromotion);
|
|
|
319
|
- if (apiResult == null || apiResult.getData() == null) {
|
|
|
320
|
- return apiResult;
|
|
|
321
|
- }
|
|
|
322
|
- JSONObject result = (JSONObject) apiResult.getData();
|
|
|
323
|
- // 3、加入品类聚合结果
|
|
|
324
|
- JSONArray jsonArray = searchSortGroupService.sortGroup(paramMap, mustFilterByPromotion);
|
|
|
325
|
- result.put("sort", jsonArray);
|
|
|
326
|
- // 4、加入折扣聚合结果
|
|
|
327
|
- JSONObject discount = discountService.discount(paramMap, mustFilterByPromotion);
|
|
|
328
|
- result.put("dicount", discount);
|
|
|
329
|
- return new SearchApiResult().setData(result);
|
|
|
330
|
- }
|
|
|
331
|
-
|
|
|
332
|
- public SearchApiResult aggPromotionBrands(PromotionConditions promotionConditions, Map<String, String> paramMap) throws Exception {
|
|
|
333
|
- logger.info("[func=aggPromotionBrands][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis());
|
|
|
334
|
- // 1、设置必须满足的过滤条件
|
|
|
335
|
- BoolQueryBuilder mustFilterByPromotion = this.getMustFilterByPromotion(promotionConditions);
|
|
|
336
|
- // 2、调聚合品牌的方法
|
|
|
337
|
- SearchApiResult searchApiResult = brandService.aggBrand(paramMap, mustFilterByPromotion);
|
|
|
338
|
- return searchApiResult;
|
|
|
339
|
- }
|
|
|
340
|
-
|
|
|
341
|
- /**
|
|
|
342
|
- * 促销列表新版筛选项
|
|
|
343
|
- *
|
|
|
344
|
- * @param promotionConditions
|
|
|
345
|
- * @param paramMap
|
|
|
346
|
- * @return
|
|
|
347
|
- */
|
|
|
348
|
- public SearchApiResult aggregations(PromotionConditions promotionConditions, Map<String, String> paramMap) {
|
|
|
349
|
- try {
|
|
|
350
|
- // 0、解析promotion的限制条件
|
|
|
351
|
- BoolQueryBuilder mustFilter = this.getMustFilterByPromotion(promotionConditions);
|
|
|
352
|
- return sceneSelectionsService.aggregations(paramMap, mustFilter);
|
|
|
353
|
- } catch (Exception e) {
|
|
|
354
|
- logger.error(e.getMessage(), e);
|
|
|
355
|
- return new SearchApiResult().setData(null).setMessage("PromotionAggregations Exception").setCode(500);
|
|
|
356
|
- }
|
|
|
357
|
- }
|
|
|
358
|
-
|
|
|
359
|
-} |
|
|