...
|
...
|
@@ -101,19 +101,20 @@ public class GoodProductListService implements IGoodProductsService { |
|
|
}
|
|
|
|
|
|
// 1.1 SKN参数获取
|
|
|
List<String> product_skns = stringToList(paramMap.getOrDefault(view_product_skn, ""), ",");
|
|
|
List<String> view_product_skns = stringToList(paramMap.getOrDefault(view_product_skn, ""), ",");
|
|
|
List<String> cart_productskns = stringToList(paramMap.getOrDefault(cart_product_skn, ""), ",");
|
|
|
List<String> collect_product_skns = stringToList(paramMap.getOrDefault(collect_product_skn, ""), ",");
|
|
|
|
|
|
// 2、先获取用户浏览的SKN对应的品类列表
|
|
|
List<String> allProductSkn = new ArrayList<String>();
|
|
|
allProductSkn.addAll(product_skns);
|
|
|
allProductSkn.addAll(view_product_skns);
|
|
|
allProductSkn.addAll(cart_productskns);
|
|
|
allProductSkn.addAll(collect_product_skns);
|
|
|
|
|
|
JSONObject sortAndBrandInfo = this.querySknSortAndBrand(allProductSkn);
|
|
|
|
|
|
// 3、再根据品类和品牌推荐SKN
|
|
|
List<String> recommondSkns = this.recommondSknsBySortAndBrandInfo(sortAndBrandInfo, paramMap, product_skns, cart_productskns, collect_product_skns);
|
|
|
List<String> recommondSkns = this.recommondSknsBySortAndBrandInfo(sortAndBrandInfo, paramMap, view_product_skns, cart_productskns, collect_product_skns);
|
|
|
|
|
|
if (searchCommonHelper.isDebugUser(paramMap)) {
|
|
|
logger.warn("goodProductList recommondSkns is : [{}]", recommondSkns);
|
...
|
...
|
@@ -235,7 +236,7 @@ public class GoodProductListService implements IGoodProductsService { |
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
private List<String> recommondSknsBySortAndBrandInfo(JSONObject sortAndBrandInfo, Map<String, String> paramMap, List<String> product_skns, List<String> cart_productskns,
|
|
|
private List<String> recommondSknsBySortAndBrandInfo(JSONObject sortAndBrandInfo, Map<String, String> paramMap, List<String> view_product_skns, List<String> cart_productskns,
|
|
|
List<String> collect_product_skns) throws Exception {
|
|
|
// 1、获取品牌id和品类id
|
|
|
if (sortAndBrandInfo == null || sortAndBrandInfo.isEmpty()) {
|
...
|
...
|
@@ -340,7 +341,7 @@ public class GoodProductListService implements IGoodProductsService { |
|
|
this.addListToJsonArray(recommendedSknJSONArray, cart_productskns);
|
|
|
this.addListToJsonArray(recommendedSknJSONArray, collect_product_skns);
|
|
|
if (cart_productskns.isEmpty() && collect_product_skns.isEmpty()) {
|
|
|
this.addListToJsonArray(recommendedSknJSONArray, product_skns);
|
|
|
this.addListToJsonArray(recommendedSknJSONArray, view_product_skns);
|
|
|
}
|
|
|
searchCacheService.addJSONArrayToCache(productListSearchCache, indexName, searchParam, recommendedSknJSONArray);
|
|
|
return this.jsonArrayToList(recommendedSknJSONArray, String.class);
|
...
|
...
|
|