Authored by hugufei

fix

... ... @@ -28,29 +28,25 @@ public class SceneRecommendBrandsService {
private UserPersionalFactorComponent userPersionalFactorComponent;
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result) {
getRecommendBrands(paramMap, result, null);
}
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result, BoolQueryBuilder extFilter) {
if (result != null && result.getData() != null) {
JSONObject data = (JSONObject) result.getData();
JSONObject commonFilters = data.getJSONObject("filter");
if (commonFilters != null) {
getRecommendBrandsNew(commonFilters, paramMap);
queryRecommendBrandsNew(commonFilters, paramMap);
}
}
}
private void getRecommendBrandsNew(JSONObject commonFilters, Map<String, String> paramMap) {
private void queryRecommendBrandsNew(JSONObject commonFilters, Map<String, String> paramMap) {
JSONArray recommendBrands = new JSONArray();
JSONArray brandList = commonFilters.getJSONArray("brand");
if (!CollectionUtils.isEmpty(brandList)) {
recommendBrands = getRecommendBrands(paramMap, brandList);
recommendBrands = queryRecommendBrands(paramMap, brandList);
}
commonFilters.put("recommendBrand", recommendBrands);
}
private JSONArray getRecommendBrands(Map<String, String> paramMap, JSONArray brandList) {
private JSONArray queryRecommendBrands(Map<String, String> paramMap, JSONArray brandList) {
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));
... ...
... ... @@ -197,7 +197,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService {
// 0、解析promotion的限制条件
BoolQueryBuilder mustFilter = promotionSceneHelper.getMustFilterByPromotion(promotionConditions);
SearchApiResult result = sceneSelectionsService.aggregations(paramMap, mustFilter);
sceneRecommendBrandsService.getRecommendBrands(paramMap, result, mustFilter);
sceneRecommendBrandsService.getRecommendBrands(paramMap, result);
return result;
} catch (Exception e) {
logger.error(e.getMessage(), e);
... ...