|
|
package com.yoho.search.service.scene.common;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import com.yoho.search.common.utils.SearchKeyWordUtils;
|
|
|
import com.yoho.search.models.SearchApiResult;
|
|
|
import com.yoho.search.common.SearchRequestParams;
|
|
|
import com.yoho.search.models.SearchApiResult;
|
|
|
|
|
|
public abstract class AbstractSceneService {
|
|
|
import java.util.Map;
|
|
|
|
|
|
public abstract class AbstractSceneService extends BaseSceneService{
|
|
|
|
|
|
protected static final String RECOMMEND_PROMOTION_LIST = "recommend_promotion_list";
|
|
|
protected static final String CUSTOMIZE_TAG_LIST = "customize_tag";
|
|
|
protected static final String STANDARD = "standard";
|
|
|
|
|
|
protected Map<String, String> newParamMap(Map<String, String> paramMap) {
|
|
|
return new HashMap<>(paramMap);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 去除非正常商品的显示
|
|
|
* @param paramMap
|
|
|
*/
|
|
|
protected void filterNotNormalToMap(Map<String, String> paramMap) {
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITED, "N");// 不支持限定
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_CONTAIN_SECKILL, "N");// 不支持秒杀
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_CONTAIN_GLOBAL, "N");// 不支持全球购
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ISADVANCE, "N");// 不支持预售
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_BUNDLETYPE, "0");// 不支持套餐
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITEDBUY, "N");// 不支持限购
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ISDESPOSITADVANCE, "N");// 不支持定金预售
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ISLIMITTIMEADVANCE, "N");// 不支持定金促销
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 场景化的默认参数
|
|
|
*
|
|
|
* @param paramMap
|
|
|
*/
|
|
|
protected void addDefaultParamsToParamMap(Map<String, String> paramMap) {
|
|
|
super.addDefaultParamsToParamMap(paramMap);
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_PAGEID, this.pageId());// 根据场景划分的页面id
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_GLOBAL_FILTER_BRAND, "Y");// 页面屏蔽
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_STATUS, "1");// 上架
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_STOCKNUM, "1");// 有库存
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_SHOWSOLDOUT, "1");// 显示延期显示的商品
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ISOUTLETS, "2");// 非奥莱
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_ATTRIBUTE_NOT, "2");// 非赠品
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_NEEDSMALLSORT, "1");// 品类聚合时带上小分类
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_AGG_WITH_PARAM_BRAND, "Y");// 聚合时使用参数中自带的参数
|
|
|
// 关键词反转码
|
|
|
String keyword = SearchKeyWordUtils.getParamKeyword(paramMap, SearchRequestParams.PARAM_SEARCH_QUERY);// 转码
|
|
|
if (!StringUtils.isBlank(keyword)) {
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_QUERY, keyword);
|
|
|
paramMap.put("is_encode", "0");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected int getPage(Map<String, String> paramMap) {
|
|
|
int page = StringUtils.isBlank(paramMap.get("page")) ? 1 : Integer.parseInt(paramMap.get("page"));
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
public abstract void addParamsToParamMap(Map<String, String> paramMap);
|
...
|
...
|
|