Authored by hugufei

添加随机获取品牌品类的方法

@@ -145,9 +145,7 @@ public class RecallConfigService { @@ -145,9 +145,7 @@ public class RecallConfigService {
145 * @return 145 * @return
146 */ 146 */
147 public List<SortBrand> queryConfigSortBrandList(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys, int configSortBrandCount) { 147 public List<SortBrand> queryConfigSortBrandList(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys, int configSortBrandCount) {
148 - List<SortBrand> pageConfigSortBrands = recallConfigSortBrandService.queryConfigSortBrand(pageFactor, filterSortBrandKeys);  
149 - Collections.shuffle(pageConfigSortBrands);  
150 - return CollectionUtils.safeSubList(pageConfigSortBrands, 0, configSortBrandCount); 148 + return recallConfigSortBrandService.queryConfigSortBrand(pageFactor, filterSortBrandKeys,configSortBrandCount);
151 } 149 }
152 150
153 public static void main(String[] args) { 151 public static void main(String[] args) {
1 package com.yoho.search.recall.config; 1 package com.yoho.search.recall.config;
2 2
  3 +import com.yoho.search.base.utils.CollectionUtils;
3 import com.yoho.search.core.personalized.models.SortBrand; 4 import com.yoho.search.core.personalized.models.SortBrand;
4 import com.yoho.search.recall.models.personal.PagePersonalFactor; 5 import com.yoho.search.recall.models.personal.PagePersonalFactor;
5 import org.springframework.stereotype.Component; 6 import org.springframework.stereotype.Component;
@@ -9,10 +10,19 @@ import java.util.*; @@ -9,10 +10,19 @@ import java.util.*;
9 @Component 10 @Component
10 class RecallConfigSortBrandService { 11 class RecallConfigSortBrandService {
11 12
12 - private Map<String,SortBrand> allConfigSortBrand = new HashMap<>();  
13 -  
14 - public List<SortBrand> queryConfigSortBrand(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys) {  
15 - return new ArrayList<>();  
16 - //pageFactor.getSortBrandList(); 13 + /**
  14 + * 随机获取页面中,属于配置的品牌品类
  15 + *
  16 + * @param pageFactor
  17 + * @param filterSortBrandKeys
  18 + * @param size
  19 + * @return
  20 + */
  21 + public List<SortBrand> queryConfigSortBrand(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys, int size) {
  22 + //return new ArrayList<>();
  23 + List<SortBrand> pageSortBrands = new ArrayList<>();
  24 + pageSortBrands.addAll(pageFactor.getSortBrandList());
  25 + Collections.shuffle(pageSortBrands);
  26 + return CollectionUtils.safeSubList(pageSortBrands, 0, size);
17 } 27 }
18 } 28 }