|
@@ -28,29 +28,25 @@ public class SceneRecommendBrandsService { |
|
@@ -28,29 +28,25 @@ public class SceneRecommendBrandsService { |
28
|
private UserPersionalFactorComponent userPersionalFactorComponent;
|
28
|
private UserPersionalFactorComponent userPersionalFactorComponent;
|
29
|
|
29
|
|
30
|
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result) {
|
30
|
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result) {
|
31
|
- getRecommendBrands(paramMap, result, null);
|
|
|
32
|
- }
|
|
|
33
|
-
|
|
|
34
|
- public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result, BoolQueryBuilder extFilter) {
|
|
|
35
|
if (result != null && result.getData() != null) {
|
31
|
if (result != null && result.getData() != null) {
|
36
|
JSONObject data = (JSONObject) result.getData();
|
32
|
JSONObject data = (JSONObject) result.getData();
|
37
|
JSONObject commonFilters = data.getJSONObject("filter");
|
33
|
JSONObject commonFilters = data.getJSONObject("filter");
|
38
|
if (commonFilters != null) {
|
34
|
if (commonFilters != null) {
|
39
|
- getRecommendBrandsNew(commonFilters, paramMap);
|
35
|
+ queryRecommendBrandsNew(commonFilters, paramMap);
|
40
|
}
|
36
|
}
|
41
|
}
|
37
|
}
|
42
|
}
|
38
|
}
|
43
|
|
39
|
|
44
|
- private void getRecommendBrandsNew(JSONObject commonFilters, Map<String, String> paramMap) {
|
40
|
+ private void queryRecommendBrandsNew(JSONObject commonFilters, Map<String, String> paramMap) {
|
45
|
JSONArray recommendBrands = new JSONArray();
|
41
|
JSONArray recommendBrands = new JSONArray();
|
46
|
JSONArray brandList = commonFilters.getJSONArray("brand");
|
42
|
JSONArray brandList = commonFilters.getJSONArray("brand");
|
47
|
if (!CollectionUtils.isEmpty(brandList)) {
|
43
|
if (!CollectionUtils.isEmpty(brandList)) {
|
48
|
- recommendBrands = getRecommendBrands(paramMap, brandList);
|
44
|
+ recommendBrands = queryRecommendBrands(paramMap, brandList);
|
49
|
}
|
45
|
}
|
50
|
commonFilters.put("recommendBrand", recommendBrands);
|
46
|
commonFilters.put("recommendBrand", recommendBrands);
|
51
|
}
|
47
|
}
|
52
|
|
48
|
|
53
|
- private JSONArray getRecommendBrands(Map<String, String> paramMap, JSONArray brandList) {
|
49
|
+ private JSONArray queryRecommendBrands(Map<String, String> paramMap, JSONArray brandList) {
|
54
|
List<JSONObject> brandListTemp = JSON.parseObject(brandList.toJSONString(), new TypeReference<List<JSONObject>>() {
|
50
|
List<JSONObject> brandListTemp = JSON.parseObject(brandList.toJSONString(), new TypeReference<List<JSONObject>>() {
|
55
|
});
|
51
|
});
|
56
|
Map<Integer, JSONObject> brandIdMap = brandListTemp.stream().collect(Collectors.toMap(e -> e.getInteger("id"), Function.identity(), (m1, m2) -> m2));
|
52
|
Map<Integer, JSONObject> brandIdMap = brandListTemp.stream().collect(Collectors.toMap(e -> e.getInteger("id"), Function.identity(), (m1, m2) -> m2));
|