...
|
...
|
@@ -4,6 +4,7 @@ import java.util.ArrayList; |
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -19,9 +20,11 @@ import com.yoho.search.core.es.model.SearchResult; |
|
|
import com.yoho.search.models.SearchApiResult;
|
|
|
import com.yoho.search.service.base.ProductListSortService;
|
|
|
import com.yoho.search.service.base.SearchCommonService;
|
|
|
import com.yoho.search.service.base.SearchDynamicConfigService;
|
|
|
import com.yoho.search.service.base.index.ProductIndexBaseService;
|
|
|
import com.yoho.search.service.helper.SearchParamHelper;
|
|
|
import com.yoho.search.service.helper.SearchSortHelper;
|
|
|
import com.yoho.search.service.recall.CommonSceneProductListService;
|
|
|
|
|
|
@Service
|
|
|
public class SceneProductListService extends AbstractCacheAbleService {
|
...
|
...
|
@@ -38,12 +41,46 @@ public class SceneProductListService extends AbstractCacheAbleService { |
|
|
private SearchSortHelper searchSortHelper;
|
|
|
@Autowired
|
|
|
private ProductListSortService productListSortService;
|
|
|
@Autowired
|
|
|
private SearchDynamicConfigService searchDynamicConfigService;
|
|
|
@Autowired
|
|
|
private CommonSceneProductListService commonSceneProductListService;
|
|
|
|
|
|
@Override
|
|
|
public SearchCache getSearchCache() {
|
|
|
return searchCacheFactory.getSceneProductListSearchCache();
|
|
|
}
|
|
|
|
|
|
private boolean isPersionalScene(Map<String, String> paramMap) {
|
|
|
int uid = MapUtils.getIntValue(paramMap, "uid", 0);
|
|
|
String order = MapUtils.getString(paramMap, "order", "");
|
|
|
if (uid > 0 && StringUtils.isEmpty(order)) {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 场景化的商品列表接口
|
|
|
*
|
|
|
* @param paramMap
|
|
|
* @return
|
|
|
*/
|
|
|
public SearchApiResult productList(Map<String, String> paramMap) {
|
|
|
// 1、新个性化方案是否打开
|
|
|
boolean searchPersionalNewStrategyOpen = searchDynamicConfigService.searchPersionalNewStrategyOpen();
|
|
|
if (!searchPersionalNewStrategyOpen) {
|
|
|
return this.sceneProductListDefault(paramMap);
|
|
|
}
|
|
|
// 2、走新的个性化方案的场景
|
|
|
boolean isPersionalScene = this.isPersionalScene(paramMap);
|
|
|
if (isPersionalScene) {
|
|
|
return commonSceneProductListService.productListForPersional(paramMap);
|
|
|
} else {
|
|
|
return commonSceneProductListService.productListForDefault(paramMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取商品列表
|
|
|
*
|
...
|
...
|
@@ -51,7 +88,7 @@ public class SceneProductListService extends AbstractCacheAbleService { |
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public SearchApiResult productList(Map<String, String> paramMap) {
|
|
|
private SearchApiResult sceneProductListDefault(Map<String, String> paramMap) {
|
|
|
try {
|
|
|
// 1)构造搜索参数
|
|
|
SearchParam searchParam = this.buildProductListSearchParam(paramMap);
|
...
|
...
|
|