Authored by hugufei

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

... ... @@ -145,9 +145,7 @@ public class RecallConfigService {
* @return
*/
public List<SortBrand> queryConfigSortBrandList(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys, int configSortBrandCount) {
List<SortBrand> pageConfigSortBrands = recallConfigSortBrandService.queryConfigSortBrand(pageFactor, filterSortBrandKeys);
Collections.shuffle(pageConfigSortBrands);
return CollectionUtils.safeSubList(pageConfigSortBrands, 0, configSortBrandCount);
return recallConfigSortBrandService.queryConfigSortBrand(pageFactor, filterSortBrandKeys,configSortBrandCount);
}
public static void main(String[] args) {
... ...
package com.yoho.search.recall.config;
import com.yoho.search.base.utils.CollectionUtils;
import com.yoho.search.core.personalized.models.SortBrand;
import com.yoho.search.recall.models.personal.PagePersonalFactor;
import org.springframework.stereotype.Component;
... ... @@ -9,10 +10,19 @@ import java.util.*;
@Component
class RecallConfigSortBrandService {
private Map<String,SortBrand> allConfigSortBrand = new HashMap<>();
public List<SortBrand> queryConfigSortBrand(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys) {
return new ArrayList<>();
//pageFactor.getSortBrandList();
/**
* 随机获取页面中,属于配置的品牌品类
*
* @param pageFactor
* @param filterSortBrandKeys
* @param size
* @return
*/
public List<SortBrand> queryConfigSortBrand(PagePersonalFactor pageFactor, Set<String> filterSortBrandKeys, int size) {
//return new ArrayList<>();
List<SortBrand> pageSortBrands = new ArrayList<>();
pageSortBrands.addAll(pageFactor.getSortBrandList());
Collections.shuffle(pageSortBrands);
return CollectionUtils.safeSubList(pageSortBrands, 0, size);
}
}
... ...