Authored by hugufei

SearchApiResultUtils返回错误时,直接打日志

Showing 36 changed files with 278 additions and 303 deletions
@@ -68,8 +68,7 @@ public class ProductListWithSknAspect { @@ -68,8 +68,7 @@ public class ProductListWithSknAspect {
68 productListResult.put("product_list", productReturnInfoList); 68 productListResult.put("product_list", productReturnInfoList);
69 return searchApiResult.setData(productListResult); 69 return searchApiResult.setData(productListResult);
70 }catch (Exception e){ 70 }catch (Exception e){
71 - logger.error(e.getMessage(),e);  
72 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 71 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
73 } 72 }
74 } 73 }
75 74
@@ -89,8 +88,7 @@ public class ProductListWithSknAspect { @@ -89,8 +88,7 @@ public class ProductListWithSknAspect {
89 jsonObject.remove("skn_list"); 88 jsonObject.remove("skn_list");
90 return searchApiResult.setData(jsonObject); 89 return searchApiResult.setData(jsonObject);
91 } catch (Exception e) { 90 } catch (Exception e) {
92 - logger.error(e.getMessage(),e);  
93 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 91 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
94 } 92 }
95 } 93 }
96 94
@@ -10,19 +10,8 @@ import java.util.Map; @@ -10,19 +10,8 @@ import java.util.Map;
10 10
11 public class SearchApiResultUtils { 11 public class SearchApiResultUtils {
12 12
13 - private static final Logger logger = LoggerFactory.getLogger(SearchApiResultUtils.class);  
14 -  
15 - public static SearchApiResult errorSearchApiResult(final String funName, final Map<String, ?> paramMap, final Exception e) {  
16 - logger.error("[※查询]失败:[func={}][param={}][message={}][stack={}]", funName, JsonUtil.toJson(paramMap), e.getMessage(), e);  
17 - SearchApiResult searchApiResult = new SearchApiResult();  
18 - searchApiResult.setCode(500);  
19 - searchApiResult.setMessage(e.getMessage());  
20 - searchApiResult.setData(null);  
21 - return searchApiResult;  
22 - }  
23 -  
24 - public static SearchApiResult errorSearchApiResult(final String funName, final Object param, final Exception e) {  
25 - logger.error("[※查询]失败:[func={}][param={}][message={}][stack={}]", funName, JsonUtil.toJson(param), e.getMessage(), e); 13 + public static SearchApiResult errorSearchApiResult(final Logger logger,final Object param, final Exception e) {
  14 + logger.error("[※查询]失败:[param={}][message={}][stack={}]", param==null?"":JsonUtil.toJson(param), e.getMessage(), e);
26 SearchApiResult searchApiResult = new SearchApiResult(); 15 SearchApiResult searchApiResult = new SearchApiResult();
27 searchApiResult.setCode(500); 16 searchApiResult.setCode(500);
28 searchApiResult.setMessage(e.getMessage()); 17 searchApiResult.setMessage(e.getMessage());
@@ -30,7 +19,8 @@ public class SearchApiResultUtils { @@ -30,7 +19,8 @@ public class SearchApiResultUtils {
30 return searchApiResult; 19 return searchApiResult;
31 } 20 }
32 21
33 - public static SearchApiResult defaultErrorSearchApiResult(final Exception e) { 22 + public static SearchApiResult defaultErrorSearchApiResult(final Logger logger,final Exception e) {
  23 + logger.error(e.getMessage(),e);
34 SearchApiResult searchApiResult = new SearchApiResult(); 24 SearchApiResult searchApiResult = new SearchApiResult();
35 searchApiResult.setCode(500); 25 searchApiResult.setCode(500);
36 searchApiResult.setMessage(e.getMessage()); 26 searchApiResult.setMessage(e.getMessage());
1 package com.yoho.search.service.scene.general; 1 package com.yoho.search.service.scene.general;
2 2
3 -import java.util.Date;  
4 -import java.util.Map;  
5 -  
6 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
7 import com.yoho.search.base.utils.DateUtil; 4 import com.yoho.search.base.utils.DateUtil;
8 import com.yoho.search.base.utils.ISearchConstants; 5 import com.yoho.search.base.utils.ISearchConstants;
9 import com.yoho.search.base.utils.ProductIndexEsField; 6 import com.yoho.search.base.utils.ProductIndexEsField;
10 -import com.yoho.search.cache.beans.AbstractCacheAbleService;  
11 -import com.yoho.search.cache.model.SearchCache; 7 +import com.yoho.search.cache.CacheTimeConstants;
  8 +import com.yoho.search.cache.beans.AbstractCacheComponent;
  9 +import com.yoho.search.common.SearchCommonService;
12 import com.yoho.search.common.utils.SearchApiResultUtils; 10 import com.yoho.search.common.utils.SearchApiResultUtils;
13 import com.yoho.search.core.es.model.SearchParam; 11 import com.yoho.search.core.es.model.SearchParam;
14 import com.yoho.search.core.es.model.SearchResult; 12 import com.yoho.search.core.es.model.SearchResult;
15 -import com.yoho.search.common.SearchCommonService; 13 +import com.yoho.search.models.SearchApiResult;
16 import com.yoho.search.service.helper.SearchCommonHelper; 14 import com.yoho.search.service.helper.SearchCommonHelper;
17 import com.yoho.search.service.helper.SearchParamHelper; 15 import com.yoho.search.service.helper.SearchParamHelper;
  16 +import com.yoho.search.service.recall.models.common.ParamQueryFilter;
18 import org.apache.commons.lang.StringUtils; 17 import org.apache.commons.lang.StringUtils;
19 -import org.elasticsearch.action.search.SearchType;  
20 import org.elasticsearch.index.query.BoolQueryBuilder; 18 import org.elasticsearch.index.query.BoolQueryBuilder;
21 -  
22 -import com.yoho.search.models.SearchApiResult;  
23 import org.elasticsearch.index.query.QueryBuilder; 19 import org.elasticsearch.index.query.QueryBuilder;
24 import org.elasticsearch.index.query.QueryBuilders; 20 import org.elasticsearch.index.query.QueryBuilders;
25 import org.slf4j.Logger; 21 import org.slf4j.Logger;
@@ -27,133 +23,157 @@ import org.slf4j.LoggerFactory; @@ -27,133 +23,157 @@ import org.slf4j.LoggerFactory;
27 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
29 25
30 -@Service  
31 -public class ProductCountService extends AbstractCacheAbleService {  
32 -  
33 - private static final Logger Logger = LoggerFactory.getLogger(ProductCountService.class);  
34 -  
35 - @Autowired  
36 - private SearchCommonService searchCommonService;  
37 - @Autowired  
38 - private SearchCommonHelper searchCommonHelper;  
39 - @Autowired  
40 - private SearchParamHelper searchParamHelper;  
41 -  
42 - @Override  
43 - public SearchCache getSearchCache() {  
44 - return searchCacheFactory.getProductCountSearchCache();  
45 - }  
46 -  
47 - private long queryProductCount(SearchParam searchParam) {  
48 - // 1)为searchParam设置默认值  
49 - searchParam.setAggregationBuilders(null);  
50 - searchParam.setSearchType(SearchType.QUERY_THEN_FETCH);  
51 -  
52 - final String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;  
53 -  
54 - // 2) 先从缓存中获取,如果能取到,则直接返回  
55 - JSONObject jsonObject = searchCacheService.getJSONObjectFromCache(this.searchCache, ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam);  
56 - if (jsonObject != null) {  
57 - return jsonObject.getLongValue("total");  
58 - }  
59 - // 3) 执行检索  
60 - SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);  
61 - // 4) 构造返回结果  
62 - JSONObject result = new JSONObject();  
63 - long total = 0;  
64 - if (searchResult != null) {  
65 - total = searchResult.getTotal();  
66 - }  
67 - result.put("total", total);  
68 - searchCacheService.addJSONObjectToCache(this.searchCache, indexName, searchParam, result);  
69 - return total;  
70 - }  
71 -  
72 - public SearchApiResult productCount(Map<String, String> paramMap) {  
73 - try {  
74 - Logger.info("[func=productCount][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis());  
75 - // 1)、构造通用参数  
76 - SearchParam searchParam = searchParamHelper.buildDefault(paramMap);  
77 - long count = this.queryProductCount(searchParam);  
78 - JSONObject result = new JSONObject();  
79 - result.put("total", count);  
80 - return new SearchApiResult().setData(result);  
81 - } catch (Exception e) {  
82 - return SearchApiResultUtils.errorSearchApiResult("productCount", paramMap, e);  
83 - }  
84 - }  
85 -  
86 - public long countByQuery(Map<String, String> paramMap) {  
87 - try {  
88 - Logger.info("[func=countByQuery][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis());  
89 - // 1)关键参数检测  
90 - String query = paramMap.get("query");  
91 - if (StringUtils.isBlank(query)) {  
92 - return 0;  
93 - }  
94 - // 2)默认的must_filter  
95 - BoolQueryBuilder mustFilter = QueryBuilders.boolQuery();  
96 - mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.status, 1));  
97 - mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.attribute, 2));  
98 - mustFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.storageNum).gte(1));  
99 - mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.isOutlets, 2));  
100 - if (!searchCommonHelper.containGlobal(paramMap)) {  
101 - mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));  
102 - }  
103 - // 3、构造searchParam  
104 - SearchParam searchParam = searchParamHelper.buildWithMustFilter(paramMap, mustFilter);  
105 - return this.queryProductCount(searchParam);  
106 - } catch (Exception e) {  
107 - Logger.error(e.getMessage(), e);  
108 - return 0L;  
109 - }  
110 - }  
111 -  
112 - private BoolQueryBuilder genScoreDefaultFilter() {  
113 - BoolQueryBuilder mustFilter = QueryBuilders.boolQuery();  
114 - mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.status, 1));  
115 - mustFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.storageNum).gte(10));  
116 - mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.isOutlets, 2));  
117 - mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.attribute, 2));  
118 - mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));  
119 - return mustFilter;  
120 - }  
121 -  
122 - private long queryCount(QueryBuilder paramFilter, BoolQueryBuilder scoreFilter) {  
123 - BoolQueryBuilder filter = new BoolQueryBuilder();  
124 - filter.must(paramFilter);  
125 - filter.must(scoreFilter);  
126 - SearchParam searchParam = new SearchParam();  
127 - searchParam.setFiter(filter);  
128 - return this.queryProductCount(searchParam);  
129 - }  
130 -  
131 - public BoolQueryBuilder genScoreFilter(BoolQueryBuilder paramFilter) {  
132 - BoolQueryBuilder scoreFilter = this.genScoreDefaultFilter();  
133 - long totalCount = this.queryCount(paramFilter, scoreFilter);  
134 - if (totalCount <= 2000) {  
135 - return scoreFilter;  
136 - }  
137 - // 零点那一刻命中不了,得想办法解决【比如凌晨两点再切数量】  
138 - long todayLastTimeSecond = DateUtil.getLastTimeSecond(new Date());  
139 - long oneMonthInSecond = 30 * 24 * 60 * 60;  
140 - int tryCount = 1;  
141 - while (tryCount <= 3) {  
142 - scoreFilter = this.genScoreDefaultFilter();  
143 - scoreFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.firstShelveTime).from(todayLastTimeSecond - tryCount * oneMonthInSecond));  
144 - totalCount = this.queryCount(paramFilter, scoreFilter);  
145 - if (totalCount >= 1000) {  
146 - return scoreFilter;  
147 - }  
148 - tryCount++;  
149 - }  
150 - return scoreFilter;  
151 - }  
152 -  
153 - public static void main(String[] args) {  
154 - long todayLastTimeSecond = DateUtil.getLastTimeSecond(new Date());  
155 - long oneMonthInSecond = 30 * 24 * 60 * 60;  
156 - System.out.println(todayLastTimeSecond - 1 * oneMonthInSecond);  
157 - } 26 +import java.util.Date;
  27 +import java.util.Map;
158 28
  29 +@Service
  30 +public class ProductCountService extends AbstractCacheComponent<Long> {
  31 +
  32 + private static final Logger logger = LoggerFactory.getLogger(ProductCountService.class);
  33 +
  34 + @Autowired
  35 + private SearchCommonService searchCommonService;
  36 + @Autowired
  37 + private SearchCommonHelper searchCommonHelper;
  38 + @Autowired
  39 + private SearchParamHelper searchParamHelper;
  40 +
  41 + /**
  42 + * 获取商品数量
  43 + *
  44 + * @param paramMap
  45 + * @return
  46 + */
  47 + public SearchApiResult productCount(Map<String, String> paramMap) {
  48 + try {
  49 + // 1、构造ParamQueryFilter
  50 + ParamQueryFilter paramQueryFilter = searchParamHelper.buildParamQueryFilter(paramMap);
  51 + // 2、执行查询
  52 + Long count = super.queryWithCache(paramQueryFilter, paramMap);
  53 + long countValue = count == null ? 0 : count.longValue();
  54 + //3、构造返回结果
  55 + JSONObject result = new JSONObject();
  56 + result.put("total", count);
  57 + return new SearchApiResult().setData(result);
  58 + } catch (Exception e) {
  59 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
  60 + }
  61 + }
  62 +
  63 + /**
  64 + * 根据query查询商品数量,并添加一些默认的条件
  65 + *
  66 + * @param paramMap
  67 + * @return
  68 + */
  69 + public long countByQuery(Map<String, String> paramMap) {
  70 + try {
  71 + // 1、关键参数检测
  72 + String query = paramMap.get("query");
  73 + if (StringUtils.isBlank(query)) {
  74 + return 0;
  75 + }
  76 + // 2、构造ParamQueryFilter
  77 + BoolQueryBuilder mustFilter = QueryBuilders.boolQuery();
  78 + mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.status, 1));
  79 + mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.attribute, 2));
  80 + mustFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.storageNum).gte(1));
  81 + mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.isOutlets, 2));
  82 + if (!searchCommonHelper.containGlobal(paramMap)) {
  83 + mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));
  84 + }
  85 + ParamQueryFilter paramQueryFilter = searchParamHelper.buildParamQueryFilter(paramMap, mustFilter);
  86 +
  87 + // 3、执行查询
  88 + Long count = super.queryWithCache(paramQueryFilter, paramMap);
  89 +
  90 + // 4、返回结果
  91 + return count == null ? 0 : count.longValue();
  92 + } catch (Exception e) {
  93 + logger.error(e.getMessage(), e);
  94 + return 0L;
  95 + }
  96 + }
  97 +
  98 +
  99 + /**
  100 + * 根据当前的查询条件,生成额外的过滤器--模糊搜索向量计算圈定范围时使用
  101 + *
  102 + * @param paramFilter
  103 + * @return
  104 + */
  105 + public BoolQueryBuilder genScoreFilter(BoolQueryBuilder paramFilter) {
  106 + BoolQueryBuilder scoreFilter = this.genScoreDefaultFilter();
  107 + long totalCount = this.queryCountWithScoreFilter(paramFilter, scoreFilter);
  108 + if (totalCount <= 2000) {
  109 + return scoreFilter;
  110 + }
  111 + // 零点那一刻命中不了,得想办法解决【比如凌晨两点再切数量】
  112 + long todayLastTimeSecond = DateUtil.getLastTimeSecond(new Date());
  113 + long oneMonthInSecond = 30 * 24 * 60 * 60;
  114 + int tryCount = 1;
  115 + while (tryCount <= 3) {
  116 + scoreFilter = this.genScoreDefaultFilter();
  117 + scoreFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.firstShelveTime).from(todayLastTimeSecond - tryCount * oneMonthInSecond));
  118 + totalCount = this.queryCountWithScoreFilter(paramFilter, scoreFilter);
  119 + if (totalCount >= 1000) {
  120 + return scoreFilter;
  121 + }
  122 + tryCount++;
  123 + }
  124 + return scoreFilter;
  125 + }
  126 +
  127 + private BoolQueryBuilder genScoreDefaultFilter() {
  128 + BoolQueryBuilder mustFilter = QueryBuilders.boolQuery();
  129 + mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.status, 1));
  130 + mustFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.storageNum).gte(10));
  131 + mustFilter.must(QueryBuilders.termQuery(ProductIndexEsField.isOutlets, 2));
  132 + mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.attribute, 2));
  133 + mustFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));
  134 + return mustFilter;
  135 + }
  136 +
  137 + private long queryCountWithScoreFilter(QueryBuilder paramFilter, BoolQueryBuilder scoreFilter) {
  138 + try {
  139 + //1、构建ParamQueryFilter
  140 + BoolQueryBuilder filter = new BoolQueryBuilder();
  141 + filter.must(paramFilter);
  142 + filter.must(scoreFilter);
  143 + ParamQueryFilter paramQueryFilter = new ParamQueryFilter(QueryBuilders.matchAllQuery(), filter);
  144 +
  145 + // 2、执行查询
  146 + Long count = super.queryWithCache(paramQueryFilter, null);
  147 +
  148 + // 3、返回结果
  149 + return count == null ? 0 : count.longValue();
  150 + } catch (Exception e) {
  151 + logger.error(e.getMessage(), e);
  152 + return 0L;
  153 + }
  154 + }
  155 +
  156 + @Override
  157 + protected Long doRealQuery(ParamQueryFilter paramQueryFilter, Map<String, String> paramMap) throws Exception {
  158 + // 1、构造SearchParam
  159 + SearchParam searchParam = searchParamHelper.buildSearchParam(paramQueryFilter);
  160 + searchParam.setSize(0);
  161 +
  162 + // 2、 执行检索
  163 + final String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
  164 + SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);
  165 +
  166 + // 3、 构造返回结果
  167 + return searchResult == null ? 0 : searchResult.getTotal();
  168 + }
  169 +
  170 + @Override
  171 + protected int cacheTimeInMinute() {
  172 + return CacheTimeConstants.CACHE_15_MINUTE;
  173 + }
  174 +
  175 + @Override
  176 + protected String cacheSceneKey() {
  177 + return "PRODUCT_COUNT";
  178 + }
159 } 179 }
@@ -75,7 +75,7 @@ public class RecentService implements ApplicationEventPublisherAware { @@ -75,7 +75,7 @@ public class RecentService implements ApplicationEventPublisherAware {
75 logger.error(e.getMessage(),e); 75 logger.error(e.getMessage(),e);
76 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_RECENT.getEventName(), EventReportEnum.SEARCHCONTROLLER_RECENT.getFunctionName(), 76 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_RECENT.getEventName(), EventReportEnum.SEARCHCONTROLLER_RECENT.getFunctionName(),
77 EventReportEnum.SEARCHCONTROLLER_RECENT.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 77 EventReportEnum.SEARCHCONTROLLER_RECENT.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
78 - return SearchApiResultUtils.errorSearchApiResult("recent", paramMap, e); 78 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
79 } 79 }
80 } 80 }
81 81
@@ -68,8 +68,7 @@ public class SelectionsForAppService { @@ -68,8 +68,7 @@ public class SelectionsForAppService {
68 dataMap.put("filter", this.getAggResultMap(paramMap, aggMaps)); 68 dataMap.put("filter", this.getAggResultMap(paramMap, aggMaps));
69 return new SearchApiResult().setData(dataMap); 69 return new SearchApiResult().setData(dataMap);
70 } catch (Exception e) { 70 } catch (Exception e) {
71 - logger.error(e.getMessage(),e);  
72 - return SearchApiResultUtils.errorSearchApiResult("getSelectionsForApp", paramMap, e); 71 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
73 } 72 }
74 } 73 }
75 74
@@ -146,7 +146,7 @@ public class SortGroupService extends AbstractCacheAbleService implements Applic @@ -146,7 +146,7 @@ public class SortGroupService extends AbstractCacheAbleService implements Applic
146 } catch (Exception e) { 146 } catch (Exception e) {
147 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_SORTGROUP.getEventName(), EventReportEnum.SEARCHCONTROLLER_SORTGROUP.getFunctionName(), 147 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_SORTGROUP.getEventName(), EventReportEnum.SEARCHCONTROLLER_SORTGROUP.getFunctionName(),
148 EventReportEnum.SEARCHCONTROLLER_SORTGROUP.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 148 EventReportEnum.SEARCHCONTROLLER_SORTGROUP.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
149 - return SearchApiResultUtils.errorSearchApiResult("sortGroup", paramMap, e); 149 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
150 } 150 }
151 } 151 }
152 152
@@ -30,8 +30,7 @@ public class FreeShippingSceneService extends BaseSceneService { @@ -30,8 +30,7 @@ public class FreeShippingSceneService extends BaseSceneService {
30 // 2、返回商品列表 30 // 2、返回商品列表
31 return sceneProductListService.productList(paramMap); 31 return sceneProductListService.productList(paramMap);
32 } catch (Exception e) { 32 } catch (Exception e) {
33 - logger.error("[func=FreeShippingOrderSceneProductList][params=" + paramMap + "]", e);  
34 - return SearchApiResultUtils.errorSearchApiResult("FreeShippingOrderSceneProductList", paramMap, e); 33 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
35 } 34 }
36 } 35 }
37 36
@@ -114,7 +114,7 @@ public class HelperService extends BaseService implements ApplicationEventPublis @@ -114,7 +114,7 @@ public class HelperService extends BaseService implements ApplicationEventPublis
114 } catch (Exception e) { 114 } catch (Exception e) {
115 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_HELPER.getEventName(), EventReportEnum.SEARCHCONTROLLER_HELPER.getFunctionName(), 115 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_HELPER.getEventName(), EventReportEnum.SEARCHCONTROLLER_HELPER.getFunctionName(),
116 EventReportEnum.SEARCHCONTROLLER_HELPER.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 116 EventReportEnum.SEARCHCONTROLLER_HELPER.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
117 - return SearchApiResultUtils.errorSearchApiResult("helper", paramMap, e); 117 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
118 } 118 }
119 } 119 }
120 120
@@ -79,7 +79,7 @@ public class ImageRepertoryService extends BaseService implements ApplicationEve @@ -79,7 +79,7 @@ public class ImageRepertoryService extends BaseService implements ApplicationEve
79 } catch (Exception e) { 79 } catch (Exception e) {
80 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_IMAGEREPERTORY.getEventName(), EventReportEnum.SEARCHCONTROLLER_IMAGEREPERTORY.getFunctionName(), 80 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_IMAGEREPERTORY.getEventName(), EventReportEnum.SEARCHCONTROLLER_IMAGEREPERTORY.getFunctionName(),
81 EventReportEnum.SEARCHCONTROLLER_IMAGEREPERTORY.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 81 EventReportEnum.SEARCHCONTROLLER_IMAGEREPERTORY.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
82 - return SearchApiResultUtils.errorSearchApiResult("imageRepertory", paramMap, e); 82 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
83 } 83 }
84 } 84 }
85 85
@@ -122,7 +122,7 @@ public class RobotQuestionService extends BaseService implements ApplicationEven @@ -122,7 +122,7 @@ public class RobotQuestionService extends BaseService implements ApplicationEven
122 } catch (Exception e) { 122 } catch (Exception e) {
123 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getEventName(), EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getFunctionName(), 123 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getEventName(), EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getFunctionName(),
124 EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 124 EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
125 - return SearchApiResultUtils.errorSearchApiResult("robotquestion", paramMap, e); 125 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
126 } 126 }
127 } 127 }
128 128
@@ -241,7 +241,7 @@ public class RobotQuestionService extends BaseService implements ApplicationEven @@ -241,7 +241,7 @@ public class RobotQuestionService extends BaseService implements ApplicationEven
241 } catch (Exception e) { 241 } catch (Exception e) {
242 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getEventName(), EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getFunctionName(), 242 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getEventName(), EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getFunctionName(),
243 EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 243 EventReportEnum.SEARCHCONTROLLER_ROBOTQUESTION.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
244 - return SearchApiResultUtils.errorSearchApiResult("robotquestion", paramMap, e); 244 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
245 } 245 }
246 } 246 }
247 247
@@ -42,8 +42,7 @@ public class ProductListWithPhraseService { @@ -42,8 +42,7 @@ public class ProductListWithPhraseService {
42 JSONObject productListResult = productListHelper.buildProductListResult(searchResult,searchParam.getSize(),false, NotRecallTypeEnum.NOT_PERSIONAL); 42 JSONObject productListResult = productListHelper.buildProductListResult(searchResult,searchParam.getSize(),false, NotRecallTypeEnum.NOT_PERSIONAL);
43 return new SearchApiResult().setData(productListResult); 43 return new SearchApiResult().setData(productListResult);
44 } catch (Exception e) { 44 } catch (Exception e) {
45 - logger.error("[func=productListWithPhrase][params=" + paramMap + "]", e);  
46 - return SearchApiResultUtils.errorSearchApiResult("productListWithPhrase", paramMap, e); 45 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
47 } 46 }
48 } 47 }
49 48
@@ -19,6 +19,8 @@ import com.yoho.search.service.scene.pages.entrance.ProductListSwitchService; @@ -19,6 +19,8 @@ import com.yoho.search.service.scene.pages.entrance.ProductListSwitchService;
19 import org.apache.commons.collections.CollectionUtils; 19 import org.apache.commons.collections.CollectionUtils;
20 import org.apache.commons.lang3.StringUtils; 20 import org.apache.commons.lang3.StringUtils;
21 import org.elasticsearch.index.query.BoolQueryBuilder; 21 import org.elasticsearch.index.query.BoolQueryBuilder;
  22 +import org.slf4j.Logger;
  23 +import org.slf4j.LoggerFactory;
22 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.stereotype.Service; 25 import org.springframework.stereotype.Service;
24 26
@@ -30,6 +32,8 @@ import java.util.stream.Collectors; @@ -30,6 +32,8 @@ import java.util.stream.Collectors;
30 @Service 32 @Service
31 public class SearchHongRenService extends BaseSceneService { 33 public class SearchHongRenService extends BaseSceneService {
32 34
  35 + private static final Logger logger = LoggerFactory.getLogger(SearchHongRenService.class);
  36 +
33 @Autowired 37 @Autowired
34 protected SearchCacheService searchCacheService; 38 protected SearchCacheService searchCacheService;
35 @Autowired 39 @Autowired
@@ -93,7 +97,7 @@ public class SearchHongRenService extends BaseSceneService { @@ -93,7 +97,7 @@ public class SearchHongRenService extends BaseSceneService {
93 } 97 }
94 return productListResult; 98 return productListResult;
95 } catch (Exception e) { 99 } catch (Exception e) {
96 - return SearchApiResultUtils.errorSearchApiResult("hrfuzzyProductList", paramMap, e); 100 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
97 } 101 }
98 } 102 }
99 103
@@ -95,7 +95,7 @@ public class SknImageVectorsService implements ApplicationEventPublisherAware { @@ -95,7 +95,7 @@ public class SknImageVectorsService implements ApplicationEventPublisherAware {
95 } catch (Exception e) { 95 } catch (Exception e) {
96 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getEventName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO 96 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getEventName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO
97 .getFunctionName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 97 .getFunctionName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
98 - return SearchApiResultUtils.errorSearchApiResult("searchSknByPhoto", paramMap, e); 98 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
99 } 99 }
100 } 100 }
101 101
@@ -270,7 +270,7 @@ public class SknImageVectorsService implements ApplicationEventPublisherAware { @@ -270,7 +270,7 @@ public class SknImageVectorsService implements ApplicationEventPublisherAware {
270 } catch (Exception e) { 270 } catch (Exception e) {
271 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getEventName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO 271 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getEventName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO
272 .getFunctionName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 272 .getFunctionName(), EventReportEnum.SEARCHCONTROLLER_SEARCHSKNBYPHOTO.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
273 - return SearchApiResultUtils.errorSearchApiResult("searchListByPhotoSkns", paramMap, e); 273 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
274 } 274 }
275 } 275 }
276 } 276 }
@@ -33,7 +33,7 @@ public class ProductListDslService { @@ -33,7 +33,7 @@ public class ProductListDslService {
33 logger.info("[func=getESDsl][dsl=\n{}]", searchApiResult.getData()); 33 logger.info("[func=getESDsl][dsl=\n{}]", searchApiResult.getData());
34 return searchApiResult; 34 return searchApiResult;
35 } catch (Exception e) { 35 } catch (Exception e) {
36 - return SearchApiResultUtils.errorSearchApiResult("getESDsl", paramMap, e); 36 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
37 } 37 }
38 } 38 }
39 39
@@ -49,8 +49,7 @@ public class BrandPageSceneService extends AbstractPageSceneService { @@ -49,8 +49,7 @@ public class BrandPageSceneService extends AbstractPageSceneService {
49 // 2、返回商品列表 49 // 2、返回商品列表
50 return sceneProductListService.productList(paramMap); 50 return sceneProductListService.productList(paramMap);
51 } catch (Exception e) { 51 } catch (Exception e) {
52 - logger.error("[func=BrandProductList][params=" + paramMap + "]", e);  
53 - return SearchApiResultUtils.errorSearchApiResult("BrandProductList", paramMap, e); 52 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
54 } 53 }
55 } 54 }
56 55
@@ -68,8 +67,7 @@ public class BrandPageSceneService extends AbstractPageSceneService { @@ -68,8 +67,7 @@ public class BrandPageSceneService extends AbstractPageSceneService {
68 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 67 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
69 return result; 68 return result;
70 } catch (Exception e) { 69 } catch (Exception e) {
71 - logger.error("[func=BrandAggregations][params=" + paramMap + "]", e);  
72 - return SearchApiResultUtils.errorSearchApiResult("BrandAggregations", paramMap, e); 70 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
73 } 71 }
74 } 72 }
75 } 73 }
@@ -78,8 +78,7 @@ public class BreakSizePageSceneService extends AbstractPageSceneService { @@ -78,8 +78,7 @@ public class BreakSizePageSceneService extends AbstractPageSceneService {
78 // 2、返回商品列表 78 // 2、返回商品列表
79 return sceneProductListService.productList(paramMap); 79 return sceneProductListService.productList(paramMap);
80 } catch (Exception e) { 80 } catch (Exception e) {
81 - logger.error("[func=CouponProductList][params=" + paramMap + "]", e);  
82 - return SearchApiResultUtils.errorSearchApiResult("CouponProductList", paramMap, e); 81 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
83 } 82 }
84 } 83 }
85 84
@@ -94,8 +93,7 @@ public class BreakSizePageSceneService extends AbstractPageSceneService { @@ -94,8 +93,7 @@ public class BreakSizePageSceneService extends AbstractPageSceneService {
94 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 93 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
95 return result; 94 return result;
96 } catch (Exception e) { 95 } catch (Exception e) {
97 - logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);  
98 - return SearchApiResultUtils.errorSearchApiResult("Couponaggregations", paramMap, e); 96 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
99 } 97 }
100 } 98 }
101 99
@@ -135,8 +133,7 @@ public class BreakSizePageSceneService extends AbstractPageSceneService { @@ -135,8 +133,7 @@ public class BreakSizePageSceneService extends AbstractPageSceneService {
135 data.put("list", sortWithSizeList); 133 data.put("list", sortWithSizeList);
136 return new SearchApiResult().setData(data); 134 return new SearchApiResult().setData(data);
137 } catch (Exception e) { 135 } catch (Exception e) {
138 - logger.error(e.getMessage(), e);  
139 - return SearchApiResultUtils.errorSearchApiResult("sortSizes", paramMap, e); 136 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
140 } 137 }
141 } 138 }
142 139
@@ -43,8 +43,7 @@ public class CommonPageSceneService extends AbstractPageSceneService { @@ -43,8 +43,7 @@ public class CommonPageSceneService extends AbstractPageSceneService {
43 // 2、返回商品列表 43 // 2、返回商品列表
44 return sceneProductListService.productList(paramMap); 44 return sceneProductListService.productList(paramMap);
45 } catch (Exception e) { 45 } catch (Exception e) {
46 - logger.error("[func=CommonProductList][params=" + paramMap + "]", e);  
47 - return SearchApiResultUtils.errorSearchApiResult("CommonSceneService", paramMap, e); 46 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
48 } 47 }
49 } 48 }
50 49
@@ -58,8 +57,7 @@ public class CommonPageSceneService extends AbstractPageSceneService { @@ -58,8 +57,7 @@ public class CommonPageSceneService extends AbstractPageSceneService {
58 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 57 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
59 return result; 58 return result;
60 } catch (Exception e) { 59 } catch (Exception e) {
61 - logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);  
62 - return SearchApiResultUtils.errorSearchApiResult("CommonAggregations", paramMap, e); 60 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
63 } 61 }
64 } 62 }
65 63
@@ -44,8 +44,7 @@ public class CouponPageSceneService extends AbstractPageSceneService { @@ -44,8 +44,7 @@ public class CouponPageSceneService extends AbstractPageSceneService {
44 // 2、返回商品列表 44 // 2、返回商品列表
45 return sceneProductListService.productList(paramMap); 45 return sceneProductListService.productList(paramMap);
46 } catch (Exception e) { 46 } catch (Exception e) {
47 - logger.error("[func=CouponProductList][params=" + paramMap + "]", e);  
48 - return SearchApiResultUtils.errorSearchApiResult("CouponProductList", paramMap, e); 47 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
49 } 48 }
50 } 49 }
51 50
@@ -59,8 +58,7 @@ public class CouponPageSceneService extends AbstractPageSceneService { @@ -59,8 +58,7 @@ public class CouponPageSceneService extends AbstractPageSceneService {
59 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 58 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
60 return result; 59 return result;
61 } catch (Exception e) { 60 } catch (Exception e) {
62 - logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);  
63 - return SearchApiResultUtils.errorSearchApiResult("Couponaggregations", paramMap, e); 61 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
64 } 62 }
65 } 63 }
66 } 64 }
@@ -106,8 +106,7 @@ public class FuzzySceneService extends AbstractPageSceneService { @@ -106,8 +106,7 @@ public class FuzzySceneService extends AbstractPageSceneService {
106 dataMap.put(RECOMMEND_PROMOTION_LIST, pageAggregationHelper.subRecommendPromotions(promotions.getData(), this.getPage(paramMap), 1)); 106 dataMap.put(RECOMMEND_PROMOTION_LIST, pageAggregationHelper.subRecommendPromotions(promotions.getData(), this.getPage(paramMap), 1));
107 return productListResult; 107 return productListResult;
108 } catch (Exception e) { 108 } catch (Exception e) {
109 - logger.error(e.getMessage(), e);  
110 - return SearchApiResultUtils.errorSearchApiResult("fuzzyProductList", paramMap, e); 109 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
111 } 110 }
112 } 111 }
113 112
@@ -77,8 +77,7 @@ public class MiniappFuzzyPageSceneService extends AbstractPageSceneService { @@ -77,8 +77,7 @@ public class MiniappFuzzyPageSceneService extends AbstractPageSceneService {
77 //6、返回结果 77 //6、返回结果
78 return productListResult; 78 return productListResult;
79 } catch (Exception e) { 79 } catch (Exception e) {
80 - logger.error(e.getMessage(), e);  
81 - return SearchApiResultUtils.errorSearchApiResult("SappFuzzySceneService productList Exception", paramMap, e); 80 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
82 } 81 }
83 } 82 }
84 83
@@ -53,8 +53,7 @@ public class NewArrivalPageSceneService extends AbstractPageSceneService { @@ -53,8 +53,7 @@ public class NewArrivalPageSceneService extends AbstractPageSceneService {
53 // 2、返回商品列表 53 // 2、返回商品列表
54 return sceneProductListService.productList(paramMap); 54 return sceneProductListService.productList(paramMap);
55 } catch (Exception e) { 55 } catch (Exception e) {
56 - logger.error("[func=NewArrivalProductList][params=" + paramMap + "]", e);  
57 - return SearchApiResultUtils.errorSearchApiResult("NewArrivalProductList", paramMap, e); 56 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
58 } 57 }
59 } 58 }
60 59
@@ -68,8 +67,7 @@ public class NewArrivalPageSceneService extends AbstractPageSceneService { @@ -68,8 +67,7 @@ public class NewArrivalPageSceneService extends AbstractPageSceneService {
68 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 67 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
69 return result; 68 return result;
70 } catch (Exception e) { 69 } catch (Exception e) {
71 - logger.error("[func=NewArrivalAggregations][params=" + paramMap + "]", e);  
72 - return SearchApiResultUtils.errorSearchApiResult("NewArrivalAggregations", paramMap, e); 70 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
73 } 71 }
74 } 72 }
75 73
@@ -81,8 +79,7 @@ public class NewArrivalPageSceneService extends AbstractPageSceneService { @@ -81,8 +79,7 @@ public class NewArrivalPageSceneService extends AbstractPageSceneService {
81 List<IAggregation> aggregations = pageSelectionsService.getNewArrivalOldAggregations(paramMap); 79 List<IAggregation> aggregations = pageSelectionsService.getNewArrivalOldAggregations(paramMap);
82 return pageSelectionsService.aggregations(paramMap, aggregations); 80 return pageSelectionsService.aggregations(paramMap, aggregations);
83 } catch (Exception e) { 81 } catch (Exception e) {
84 - logger.error("[func=ShopAggregations][params=" + paramMap + "]", e);  
85 - return SearchApiResultUtils.errorSearchApiResult("ShopAggregations", paramMap, e); 82 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
86 } 83 }
87 } 84 }
88 85
@@ -54,8 +54,7 @@ public class ProductPoolPageSceneService extends AbstractPageSceneService { @@ -54,8 +54,7 @@ public class ProductPoolPageSceneService extends AbstractPageSceneService {
54 this.addParamsToParamMap(paramMap); 54 this.addParamsToParamMap(paramMap);
55 return productListSwitchService.productList(paramMap); 55 return productListSwitchService.productList(paramMap);
56 } catch (Exception e) { 56 } catch (Exception e) {
57 - logger.error("[func=PoolProductList][params=" + paramMap + "]", e);  
58 - return SearchApiResultUtils.errorSearchApiResult("PoolProductList", paramMap, e); 57 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
59 } 58 }
60 } 59 }
61 60
@@ -76,7 +75,7 @@ public class ProductPoolPageSceneService extends AbstractPageSceneService { @@ -76,7 +75,7 @@ public class ProductPoolPageSceneService extends AbstractPageSceneService {
76 // 2)直接调商品列表接口 75 // 2)直接调商品列表接口
77 return productListSwitchService.productList(paramMap); 76 return productListSwitchService.productList(paramMap);
78 } catch (Exception e) { 77 } catch (Exception e) {
79 - return SearchApiResultUtils.errorSearchApiResult("productPool", paramMap, e); 78 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
80 } 79 }
81 } 80 }
82 81
@@ -93,8 +92,7 @@ public class ProductPoolPageSceneService extends AbstractPageSceneService { @@ -93,8 +92,7 @@ public class ProductPoolPageSceneService extends AbstractPageSceneService {
93 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 92 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
94 return result; 93 return result;
95 } catch (Exception e) { 94 } catch (Exception e) {
96 - logger.error("[func=PoolAggregations][params=" + paramMap + "]", e);  
97 - return SearchApiResultUtils.errorSearchApiResult("PoolAggregations", paramMap, e); 95 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
98 } 96 }
99 } 97 }
100 } 98 }
@@ -52,8 +52,7 @@ public class ReducePricePageSceneService extends AbstractPageSceneService { @@ -52,8 +52,7 @@ public class ReducePricePageSceneService extends AbstractPageSceneService {
52 // 2、返回商品列表 52 // 2、返回商品列表
53 return sceneProductListService.productList(paramMap); 53 return sceneProductListService.productList(paramMap);
54 } catch (Exception e) { 54 } catch (Exception e) {
55 - logger.error("[func=NewArrivalProductList][params=" + paramMap + "]", e);  
56 - return SearchApiResultUtils.errorSearchApiResult("NewArrivalProductList", paramMap, e); 55 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
57 } 56 }
58 } 57 }
59 58
@@ -66,8 +65,7 @@ public class ReducePricePageSceneService extends AbstractPageSceneService { @@ -66,8 +65,7 @@ public class ReducePricePageSceneService extends AbstractPageSceneService {
66 List<IAggregation> aggregation = pageSelectionsService.getReducePriceAggregations(paramMap); 65 List<IAggregation> aggregation = pageSelectionsService.getReducePriceAggregations(paramMap);
67 return pageSelectionsService.aggregations(paramMap, aggregation); 66 return pageSelectionsService.aggregations(paramMap, aggregation);
68 } catch (Exception e) { 67 } catch (Exception e) {
69 - logger.error("[func=NewArrivalAggregations][params=" + paramMap + "]", e);  
70 - return SearchApiResultUtils.errorSearchApiResult("NewArrivalAggregations", paramMap, e); 68 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
71 } 69 }
72 } 70 }
73 71
@@ -52,8 +52,7 @@ public class ShopPageSceneService extends AbstractPageSceneService { @@ -52,8 +52,7 @@ public class ShopPageSceneService extends AbstractPageSceneService {
52 // 2、返回商品列表 52 // 2、返回商品列表
53 return sceneProductListService.productList(paramMap); 53 return sceneProductListService.productList(paramMap);
54 } catch (Exception e) { 54 } catch (Exception e) {
55 - logger.error("[func=ShopProductList][params=" + paramMap + "]", e);  
56 - return SearchApiResultUtils.errorSearchApiResult("ShopProductList", paramMap, e); 55 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
57 } 56 }
58 } 57 }
59 58
@@ -71,8 +70,7 @@ public class ShopPageSceneService extends AbstractPageSceneService { @@ -71,8 +70,7 @@ public class ShopPageSceneService extends AbstractPageSceneService {
71 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result); 70 scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
72 return result; 71 return result;
73 } catch (Exception e) { 72 } catch (Exception e) {
74 - logger.error("[func=ShopAggregations][params=" + paramMap + "]", e);  
75 - return SearchApiResultUtils.errorSearchApiResult("ShopAggregations", paramMap, e); 73 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
76 } 74 }
77 } 75 }
78 76
@@ -88,8 +86,7 @@ public class ShopPageSceneService extends AbstractPageSceneService { @@ -88,8 +86,7 @@ public class ShopPageSceneService extends AbstractPageSceneService {
88 List<IAggregation> aggregations = pageSelectionsService.getShopOldAggregations(paramMap); 86 List<IAggregation> aggregations = pageSelectionsService.getShopOldAggregations(paramMap);
89 return pageSelectionsService.aggregations(paramMap, aggregations); 87 return pageSelectionsService.aggregations(paramMap, aggregations);
90 } catch (Exception e) { 88 } catch (Exception e) {
91 - logger.error("[func=ShopAggregations][params=" + paramMap + "]", e);  
92 - return SearchApiResultUtils.errorSearchApiResult("ShopAggregations", paramMap, e); 89 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
93 } 90 }
94 } 91 }
95 } 92 }
1 package com.yoho.search.service.scene.pages; 1 package com.yoho.search.service.scene.pages;
2 2
3 -import java.util.Map;  
4 - 3 +import com.yoho.search.base.utils.SearchPageIdDefine;
  4 +import com.yoho.search.common.SearchRequestParams;
  5 +import com.yoho.search.common.utils.SearchApiResultUtils;
  6 +import com.yoho.search.models.SearchApiResult;
  7 +import com.yoho.search.service.scene.pages.entrance.ProductListSwitchService;
5 import com.yoho.search.service.scene.pages.selections.PageSelectionsBrandsService; 8 import com.yoho.search.service.scene.pages.selections.PageSelectionsBrandsService;
6 import com.yoho.search.service.scene.pages.selections.PageSelectionsService; 9 import com.yoho.search.service.scene.pages.selections.PageSelectionsService;
7 import org.apache.commons.lang.StringUtils; 10 import org.apache.commons.lang.StringUtils;
@@ -10,67 +13,61 @@ import org.slf4j.LoggerFactory; @@ -10,67 +13,61 @@ import org.slf4j.LoggerFactory;
10 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
12 15
13 -import com.yoho.search.base.utils.SearchPageIdDefine;  
14 -import com.yoho.search.common.utils.SearchApiResultUtils;  
15 -import com.yoho.search.models.SearchApiResult;  
16 -import com.yoho.search.common.SearchRequestParams;  
17 -import com.yoho.search.service.scene.pages.entrance.ProductListSwitchService; 16 +import java.util.Map;
18 17
19 @Service 18 @Service
20 public class ZqPageSceneService extends AbstractPageSceneService { 19 public class ZqPageSceneService extends AbstractPageSceneService {
21 20
22 - private static final Logger logger = LoggerFactory.getLogger(ZqPageSceneService.class); 21 + private static final Logger logger = LoggerFactory.getLogger(ZqPageSceneService.class);
23 22
24 - @Autowired  
25 - private ProductListSwitchService sceneProductListService;  
26 - @Autowired  
27 - private PageSelectionsService pageSelectionsService;  
28 - @Autowired  
29 - private PageSelectionsBrandsService scenePageSelectionsBrandsService; 23 + @Autowired
  24 + private ProductListSwitchService sceneProductListService;
  25 + @Autowired
  26 + private PageSelectionsService pageSelectionsService;
  27 + @Autowired
  28 + private PageSelectionsBrandsService scenePageSelectionsBrandsService;
30 29
31 - @Override  
32 - public String pageId() {  
33 - return SearchPageIdDefine.PAGE_ID_ZQ;  
34 - } 30 + @Override
  31 + public String pageId() {
  32 + return SearchPageIdDefine.PAGE_ID_ZQ;
  33 + }
35 34
36 - @Override  
37 - public void addParamsToParamMap(Map<String, String> paramMap) {  
38 - super.addDefaultParamsToParamMap(paramMap);  
39 - } 35 + @Override
  36 + public void addParamsToParamMap(Map<String, String> paramMap) {
  37 + super.addDefaultParamsToParamMap(paramMap);
  38 + }
40 39
41 - @Override  
42 - public SearchApiResult productList(Map<String, String> paramMap) {  
43 - try {  
44 - // 0、参数校验  
45 - if (StringUtils.isBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_ISPROMOTION))) {  
46 - return new SearchApiResult().setCode(400).setMessage("请传promotion参数");  
47 - }  
48 - // 1、添加默认参数  
49 - this.addParamsToParamMap(paramMap);  
50 - // 2、返回商品列表  
51 - return sceneProductListService.productList(paramMap);  
52 - } catch (Exception e) {  
53 - logger.error("[func=zqProductList][params=" + paramMap + "]", e);  
54 - return SearchApiResultUtils.errorSearchApiResult("zqProductList", paramMap, e);  
55 - }  
56 - } 40 + @Override
  41 + public SearchApiResult productList(Map<String, String> paramMap) {
  42 + try {
  43 + // 0、参数校验
  44 + if (StringUtils.isBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_ISPROMOTION))) {
  45 + return new SearchApiResult().setCode(400).setMessage("请传promotion参数");
  46 + }
  47 + // 1、添加默认参数
  48 + this.addParamsToParamMap(paramMap);
  49 + // 2、返回商品列表
  50 + return sceneProductListService.productList(paramMap);
  51 + } catch (Exception e) {
  52 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
  53 + }
  54 + }
57 55
58 - @Override  
59 - public SearchApiResult aggregations(Map<String, String> paramMap) {  
60 - try {  
61 - // 0、参数校验  
62 - if (StringUtils.isBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_ISPROMOTION))) {  
63 - return new SearchApiResult().setCode(400).setMessage("请传promotion参数");  
64 - }  
65 - // 1、添加默认参数  
66 - this.addParamsToParamMap(paramMap);  
67 - // 2、返回聚合结果  
68 - SearchApiResult result = pageSelectionsService.aggregations(paramMap);  
69 - scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);  
70 - return result;  
71 - } catch (Exception e) {  
72 - logger.error("[func=zqProductList][params=" + paramMap + "]", e);  
73 - return SearchApiResultUtils.errorSearchApiResult("zqProductList", paramMap, e);  
74 - }  
75 - } 56 + @Override
  57 + public SearchApiResult aggregations(Map<String, String> paramMap) {
  58 + try {
  59 + // 0、参数校验
  60 + if (StringUtils.isBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_ISPROMOTION))) {
  61 + return new SearchApiResult().setCode(400).setMessage("请传promotion参数");
  62 + }
  63 + // 1、添加默认参数
  64 + this.addParamsToParamMap(paramMap);
  65 + // 2、返回聚合结果
  66 + SearchApiResult result = pageSelectionsService.aggregations(paramMap);
  67 + scenePageSelectionsBrandsService.getRecommendBrands(paramMap, result);
  68 + return result;
  69 + } catch (Exception e) {
  70 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
  71 + }
  72 + }
76 } 73 }
@@ -91,8 +91,7 @@ public class ProductListWithSupplyService { @@ -91,8 +91,7 @@ public class ProductListWithSupplyService {
91 dataMap.put("product_list", productList); 91 dataMap.put("product_list", productList);
92 return new SearchApiResult().setData(dataMap); 92 return new SearchApiResult().setData(dataMap);
93 } catch (Exception e) { 93 } catch (Exception e) {
94 - logger.error("[func=productListWithSupply][params=" + paramMap + "]", e);  
95 - return SearchApiResultUtils.errorSearchApiResult("productListWithSupply", paramMap, e); 94 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
96 } 95 }
97 } 96 }
98 97
@@ -64,8 +64,7 @@ public class SimilarProductService { @@ -64,8 +64,7 @@ public class SimilarProductService {
64 } 64 }
65 return this.similarProductList(product_skn, viewNum); 65 return this.similarProductList(product_skn, viewNum);
66 } catch (Exception e) { 66 } catch (Exception e) {
67 - logger.error("[func=similarProductList][params=" + paramMap + "]", e);  
68 - return SearchApiResultUtils.errorSearchApiResult("similarProductList", paramMap, e); 67 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
69 } 68 }
70 } 69 }
71 70
@@ -46,8 +46,7 @@ public class AggBrandService extends AbstractCacheComponent<JSONArray> { @@ -46,8 +46,7 @@ public class AggBrandService extends AbstractCacheComponent<JSONArray> {
46 JSONArray brandJSONArray = super.queryWithCache(paramFilter, paramMap); 46 JSONArray brandJSONArray = super.queryWithCache(paramFilter, paramMap);
47 return new SearchApiResult().setData(brandJSONArray); 47 return new SearchApiResult().setData(brandJSONArray);
48 } catch (Exception e) { 48 } catch (Exception e) {
49 - logger.error(e.getMessage(), e);  
50 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 49 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
51 } 50 }
52 } 51 }
53 52
@@ -90,7 +90,7 @@ public class BrandListService implements ApplicationEventPublisherAware { @@ -90,7 +90,7 @@ public class BrandListService implements ApplicationEventPublisherAware {
90 } catch (Exception e) { 90 } catch (Exception e) {
91 publisher.publishEvent(new SearchEvent(EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getEventName(), EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getFunctionName(), 91 publisher.publishEvent(new SearchEvent(EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getEventName(), EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getFunctionName(),
92 EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 92 EventReportEnum.BRANDCONTROLLER_BRAND_LIST.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
93 - return SearchApiResultUtils.errorSearchApiResult("brandList", paramMap, e); 93 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
94 } 94 }
95 } 95 }
96 96
@@ -122,8 +122,7 @@ public class BrandListService implements ApplicationEventPublisherAware { @@ -122,8 +122,7 @@ public class BrandListService implements ApplicationEventPublisherAware {
122 data.put("brands", searchResult.getResultList()); 122 data.put("brands", searchResult.getResultList());
123 return new SearchApiResult().setCode(200).setData(data); 123 return new SearchApiResult().setCode(200).setData(data);
124 } catch (Exception e) { 124 } catch (Exception e) {
125 - logger.error(e.getMessage(), e);  
126 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 125 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
127 } 126 }
128 } 127 }
129 128
@@ -153,8 +152,7 @@ public class BrandListService implements ApplicationEventPublisherAware { @@ -153,8 +152,7 @@ public class BrandListService implements ApplicationEventPublisherAware {
153 data.put("brands", searchResult.getResultList()); 152 data.put("brands", searchResult.getResultList());
154 return new SearchApiResult().setCode(200).setData(data); 153 return new SearchApiResult().setCode(200).setData(data);
155 } catch (Exception e) { 154 } catch (Exception e) {
156 - logger.error(e.getMessage(), e);  
157 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 155 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
158 } 156 }
159 } 157 }
160 158
@@ -188,8 +186,7 @@ public class BrandListService implements ApplicationEventPublisherAware { @@ -188,8 +186,7 @@ public class BrandListService implements ApplicationEventPublisherAware {
188 result.put("brands", makeAllBrandListWithAlifResponse(((MultiBucketsAggregation) aggregationResult.get("brandAlifAgg")))); 186 result.put("brands", makeAllBrandListWithAlifResponse(((MultiBucketsAggregation) aggregationResult.get("brandAlifAgg"))));
189 return searchApiResult.setData(result); 187 return searchApiResult.setData(result);
190 } catch (Exception e) { 188 } catch (Exception e) {
191 - logger.error(e.getMessage(), e);  
192 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 189 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
193 } 190 }
194 } 191 }
195 192
@@ -98,7 +98,7 @@ public class BrandProductListService implements ApplicationEventPublisherAware { @@ -98,7 +98,7 @@ public class BrandProductListService implements ApplicationEventPublisherAware {
98 } catch (Exception e) { 98 } catch (Exception e) {
99 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_GROUP_BRANDS.getEventName(), EventReportEnum.SEARCHCONTROLLER_GROUP_BRANDS.getFunctionName(), 99 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_GROUP_BRANDS.getEventName(), EventReportEnum.SEARCHCONTROLLER_GROUP_BRANDS.getFunctionName(),
100 EventReportEnum.SEARCHCONTROLLER_GROUP_BRANDS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 100 EventReportEnum.SEARCHCONTROLLER_GROUP_BRANDS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
101 - return SearchApiResultUtils.errorSearchApiResult("groupBrands", paramMap, e); 101 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
102 } 102 }
103 } 103 }
104 104
@@ -153,10 +153,9 @@ public class BrandProductListService implements ApplicationEventPublisherAware { @@ -153,10 +153,9 @@ public class BrandProductListService implements ApplicationEventPublisherAware {
153 JSONArray jsonArray = getAggBrandProductListResult(((MultiBucketsAggregation) aggMaps.get("brandAgg")), limit, brandIds, realSortField, realSortOrder); 153 JSONArray jsonArray = getAggBrandProductListResult(((MultiBucketsAggregation) aggMaps.get("brandAgg")), limit, brandIds, realSortField, realSortOrder);
154 return searchApiResult.setData(jsonArray); 154 return searchApiResult.setData(jsonArray);
155 } catch (Exception e) { 155 } catch (Exception e) {
156 - logger.error(e.getMessage(), e);  
157 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_NEW_PRODUCT.getEventName(), EventReportEnum.SEARCHCONTROLLER_NEW_PRODUCT.getFunctionName(), 156 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_NEW_PRODUCT.getEventName(), EventReportEnum.SEARCHCONTROLLER_NEW_PRODUCT.getFunctionName(),
158 EventReportEnum.SEARCHCONTROLLER_NEW_PRODUCT.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 157 EventReportEnum.SEARCHCONTROLLER_NEW_PRODUCT.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
159 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 158 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
160 } 159 }
161 } 160 }
162 161
@@ -94,7 +94,7 @@ public class BrandWithShopsService implements ApplicationEventPublisherAware { @@ -94,7 +94,7 @@ public class BrandWithShopsService implements ApplicationEventPublisherAware {
94 } catch (Exception e) { 94 } catch (Exception e) {
95 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_BRANDS.getEventName(), EventReportEnum.SEARCHCONTROLLER_BRANDS.getFunctionName(), 95 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_BRANDS.getEventName(), EventReportEnum.SEARCHCONTROLLER_BRANDS.getFunctionName(),
96 EventReportEnum.SEARCHCONTROLLER_BRANDS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 96 EventReportEnum.SEARCHCONTROLLER_BRANDS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
97 - return SearchApiResultUtils.errorSearchApiResult("brandsWithShops", paramMap, e); 97 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
98 } 98 }
99 } 99 }
100 100
@@ -62,8 +62,7 @@ public class RecommendBrandService extends AbstractCacheComponent<JSONArray> { @@ -62,8 +62,7 @@ public class RecommendBrandService extends AbstractCacheComponent<JSONArray> {
62 // 5、返回结果 62 // 5、返回结果
63 return new SearchApiResult().setData(brandJSONArray); 63 return new SearchApiResult().setData(brandJSONArray);
64 } catch (Exception e) { 64 } catch (Exception e) {
65 - logger.error(e.getMessage(), e);  
66 - return SearchApiResultUtils.defaultErrorSearchApiResult(e); 65 + return SearchApiResultUtils.defaultErrorSearchApiResult(logger,e);
67 } 66 }
68 } 67 }
69 68
@@ -96,8 +96,7 @@ public class RecommendShopService extends AbstractCacheAbleService { @@ -96,8 +96,7 @@ public class RecommendShopService extends AbstractCacheAbleService {
96 } 96 }
97 return new SearchApiResult().setData(new ArrayList<Map<String, Object>>()); 97 return new SearchApiResult().setData(new ArrayList<Map<String, Object>>());
98 } catch (Exception e) { 98 } catch (Exception e) {
99 - logger.error(e.getMessage(), e);  
100 - return SearchApiResultUtils.errorSearchApiResult("aggRecommendBrand", paramMap, e); 99 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
101 } 100 }
102 } 101 }
103 102
@@ -91,7 +91,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish @@ -91,7 +91,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish
91 } catch (Exception e) { 91 } catch (Exception e) {
92 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getEventName(), EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getFunctionName(), 92 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getEventName(), EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getFunctionName(),
93 EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 93 EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
94 - return SearchApiResultUtils.errorSearchApiResult("group_shops", paramMap, e); 94 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
95 } 95 }
96 } 96 }
97 97
@@ -122,7 +122,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish @@ -122,7 +122,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish
122 } catch (Exception e) { 122 } catch (Exception e) {
123 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getEventName(), EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getFunctionName(), 123 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getEventName(), EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getFunctionName(),
124 EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 124 EventReportEnum.SEARCHCONTROLLER_GROUP_SHOPS.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
125 - return SearchApiResultUtils.errorSearchApiResult("group_shops", paramMap, e); 125 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
126 } 126 }
127 } 127 }
128 128
@@ -175,7 +175,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish @@ -175,7 +175,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish
175 } 175 }
176 return new SearchApiResult().setMessage("shops info").setData(dataMap); 176 return new SearchApiResult().setMessage("shops info").setData(dataMap);
177 } catch (Exception e) { 177 } catch (Exception e) {
178 - return SearchApiResultUtils.errorSearchApiResult("searchShops", paramMap, e); 178 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
179 } 179 }
180 } 180 }
181 181
@@ -222,7 +222,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish @@ -222,7 +222,7 @@ public class ShopsService extends BaseService implements ApplicationEventPublish
222 // 5、返回结果 222 // 5、返回结果
223 return searchApiResult.setData(returnMap); 223 return searchApiResult.setData(returnMap);
224 } catch (Exception e) { 224 } catch (Exception e) {
225 - return SearchApiResultUtils.errorSearchApiResult("searchShopsNew", paramMap, e); 225 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
226 } 226 }
227 } 227 }
228 228
@@ -7,17 +7,17 @@ import com.yoho.search.base.utils.EventReportEnum; @@ -7,17 +7,17 @@ import com.yoho.search.base.utils.EventReportEnum;
7 import com.yoho.search.base.utils.ISearchConstants; 7 import com.yoho.search.base.utils.ISearchConstants;
8 import com.yoho.search.base.utils.ProductIndexEsField; 8 import com.yoho.search.base.utils.ProductIndexEsField;
9 import com.yoho.search.cache.CacheType; 9 import com.yoho.search.cache.CacheType;
  10 +import com.yoho.search.common.SearchCommonService;
  11 +import com.yoho.search.common.SearchRequestParams;
10 import com.yoho.search.common.utils.SearchApiResultUtils; 12 import com.yoho.search.common.utils.SearchApiResultUtils;
11 import com.yoho.search.core.es.model.SearchParam; 13 import com.yoho.search.core.es.model.SearchParam;
12 import com.yoho.search.core.es.model.SearchResult; 14 import com.yoho.search.core.es.model.SearchResult;
13 import com.yoho.search.core.es.utils.IgnoreSomeException; 15 import com.yoho.search.core.es.utils.IgnoreSomeException;
14 import com.yoho.search.models.SearchApiResult; 16 import com.yoho.search.models.SearchApiResult;
15 -import com.yoho.search.common.SearchCommonService;  
16 -import com.yoho.search.common.SearchRequestParams;  
17 -import com.yoho.search.service.index.WebProductIndexBaseService;  
18 import com.yoho.search.service.helper.SearchParamHelper; 17 import com.yoho.search.service.helper.SearchParamHelper;
19 import com.yoho.search.service.helper.SearchQueryHelper; 18 import com.yoho.search.service.helper.SearchQueryHelper;
20 import com.yoho.search.service.helper.SearchSortHelper; 19 import com.yoho.search.service.helper.SearchSortHelper;
  20 +import com.yoho.search.service.index.WebProductIndexBaseService;
21 import org.apache.commons.collections.MapUtils; 21 import org.apache.commons.collections.MapUtils;
22 import org.apache.commons.lang.StringUtils; 22 import org.apache.commons.lang.StringUtils;
23 import org.elasticsearch.index.query.BoolQueryBuilder; 23 import org.elasticsearch.index.query.BoolQueryBuilder;
@@ -97,7 +97,7 @@ public class WebNewShelveService implements ApplicationEventPublisherAware { @@ -97,7 +97,7 @@ public class WebNewShelveService implements ApplicationEventPublisherAware {
97 } catch (Exception e) { 97 } catch (Exception e) {
98 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_NEW_SHELVE.getEventName(), EventReportEnum.SEARCHCONTROLLER_NEW_SHELVE.getFunctionName(), 98 publisher.publishEvent(new SearchEvent(EventReportEnum.SEARCHCONTROLLER_NEW_SHELVE.getEventName(), EventReportEnum.SEARCHCONTROLLER_NEW_SHELVE.getFunctionName(),
99 EventReportEnum.SEARCHCONTROLLER_NEW_SHELVE.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null)); 99 EventReportEnum.SEARCHCONTROLLER_NEW_SHELVE.getMoudleName(), "exception", IgnoreSomeException.filterSomeException(e), null));
100 - return SearchApiResultUtils.errorSearchApiResult("searchNewestProductWithDiffBrand", paramMap, e); 100 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
101 } 101 }
102 } 102 }
103 103
@@ -136,11 +136,11 @@ public class WebNewShelveService implements ApplicationEventPublisherAware { @@ -136,11 +136,11 @@ public class WebNewShelveService implements ApplicationEventPublisherAware {
136 JSONArray productList = this.buildProductListResult(productEsSourceList); 136 JSONArray productList = this.buildProductListResult(productEsSourceList);
137 return searchApiResult.setData(productList); 137 return searchApiResult.setData(productList);
138 } catch (Exception e) { 138 } catch (Exception e) {
139 - return SearchApiResultUtils.errorSearchApiResult("webNewShelvesProductList", paramMap, e); 139 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
140 } 140 }
141 } 141 }
142 142
143 - private List<SearchParam> buildWebNewShelveSearchParams(Map<String, String> paramMap, List<String> misortList,String sortField) { 143 + private List<SearchParam> buildWebNewShelveSearchParams(Map<String, String> paramMap, List<String> misortList, String sortField) {
144 try { 144 try {
145 //1、参数重组 145 //1、参数重组
146 Map<String, String> paramNew = new HashMap<>(); 146 Map<String, String> paramNew = new HashMap<>();
@@ -75,8 +75,7 @@ public class WebProductListService extends AbstractCacheAbleService { @@ -75,8 +75,7 @@ public class WebProductListService extends AbstractCacheAbleService {
75 } 75 }
76 return searchResult; 76 return searchResult;
77 } catch (Exception e) { 77 } catch (Exception e) {
78 - logger.error("[func=productList][params=" + paramMap + "]", e);  
79 - return SearchApiResultUtils.errorSearchApiResult("productList", paramMap, e); 78 + return SearchApiResultUtils.errorSearchApiResult(logger, paramMap, e);
80 } 79 }
81 } 80 }
82 81