...
|
...
|
@@ -26,19 +26,16 @@ public class SceneRecommendBrandsService { |
|
|
|
|
|
@Autowired
|
|
|
private UserPersionalFactorComponent userPersionalFactorComponent;
|
|
|
@Autowired
|
|
|
private IAggRecommendService aggRecommendService;
|
|
|
@Autowired
|
|
|
private SearchDynamicConfigService searchDynamicConfigService;
|
|
|
|
|
|
private JSONArray getRecommendBrands(Map<String, String> paramMap, JSONArray brandList) {
|
|
|
List<JSONObject> brandListTemp = JSON.parseObject(brandList.toJSONString(), new TypeReference<List<JSONObject>>() {});
|
|
|
List<JSONObject> brandListTemp = JSON.parseObject(brandList.toJSONString(), new TypeReference<List<JSONObject>>() {
|
|
|
});
|
|
|
Map<Integer, JSONObject> brandIdMap = brandListTemp.stream().collect(Collectors.toMap(e -> e.getInteger("id"), Function.identity(), (m1, m2) -> m2));
|
|
|
int uid = MapUtils.getIntValue(paramMap, "uid", 0);
|
|
|
String udid = MapUtils.getString(paramMap, "udid", "");
|
|
|
int recommendBrandCount = Integer.parseInt(paramMap.getOrDefault(SearchRequestParams.PARAM_SEARCH_VIEWNUM, "8"));
|
|
|
JSONArray recBrands = new JSONArray(recommendBrandCount);
|
|
|
UserPersonalFactorRspNew userFactor = userPersionalFactorComponent.queryUserPersionalFactor(uid, udid,null);
|
|
|
UserPersonalFactorRspNew userFactor = userPersionalFactorComponent.queryUserPersionalFactor(uid, udid, null);
|
|
|
List<Integer> brandIds = new ArrayList<>();
|
|
|
if (userFactor != null) {
|
|
|
List<SortBrand> sortBrandList = new ArrayList<>(userFactor.getRealTimeSortBrandList());
|
...
|
...
|
@@ -80,11 +77,7 @@ public class SceneRecommendBrandsService { |
|
|
JSONObject data = (JSONObject) result.getData();
|
|
|
JSONObject commonFilters = data.getJSONObject("filter");
|
|
|
if (commonFilters != null) {
|
|
|
if (searchDynamicConfigService.isRecommendBrandUserPersonalOpen()) {
|
|
|
getRecommendBrandsNew(commonFilters, paramMap);
|
|
|
} else {
|
|
|
getRecommendBrandsOld(commonFilters, paramMap, extFilter);
|
|
|
}
|
|
|
getRecommendBrandsNew(commonFilters, paramMap);
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -97,10 +90,4 @@ public class SceneRecommendBrandsService { |
|
|
}
|
|
|
commonFilters.put("recommendBrand", recommendBrands);
|
|
|
}
|
|
|
|
|
|
private void getRecommendBrandsOld(JSONObject commonFilters, Map<String, String> paramMap, BoolQueryBuilder extFilter) {
|
|
|
Map<String, String> newParamMap = new HashMap<>(paramMap);
|
|
|
SearchApiResult searchApiResult = aggRecommendService.aggRecommendBrand(newParamMap, extFilter);
|
|
|
commonFilters.put("recommendBrand", searchApiResult.getData());
|
|
|
}
|
|
|
} |
...
|
...
|
|