Authored by hugufei

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

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