CouponSceneService.java
2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.yoho.search.service.scene;
import com.yoho.search.base.utils.SearchPageIdDefine;
import com.yoho.search.common.utils.SearchApiResultUtils;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.service.scene.list.ProductListSwitchService;
import com.yoho.search.service.scene.common.AbstractSceneService;
import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class CouponSceneService extends AbstractSceneService {
private static final Logger logger = LoggerFactory.getLogger(CouponSceneService.class);
@Autowired
private ProductListSwitchService sceneProductListService;
@Autowired
private SceneSelectionsService sceneSelectionsService;
@Autowired
private RecommendBrandsService recommendBrandsService;
@Override
public String pageId() {
return SearchPageIdDefine.PAGE_ID_COUPON;
}
@Override
public void addParamsToParamMap(Map<String, String> paramMap) {
super.addDefaultParamsToParamMap(paramMap);
super.filterNotNormalToMap(paramMap);
}
@Override
public SearchApiResult productList(Map<String, String> paramMap) {
try {
// 1、添加默认参数
this.addParamsToParamMap(paramMap);
// 2、返回商品列表
return sceneProductListService.productList(paramMap);
} catch (Exception e) {
logger.error("[func=CouponProductList][params=" + paramMap + "]", e);
return SearchApiResultUtils.errorSearchApiResult("CouponProductList", paramMap, e);
}
}
@Override
public SearchApiResult aggregations(Map<String, String> paramMap) {
try {
// 1、添加默认参数
this.addParamsToParamMap(paramMap);
// 2、返回聚合结果
SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
recommendBrandsService.getRecommendBrands(paramMap, result);
return result;
} catch (Exception e) {
logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);
return SearchApiResultUtils.errorSearchApiResult("Couponaggregations", paramMap, e);
}
}
}