Authored by iknitting

都过滤掉情况,返回一个

... ... @@ -178,17 +178,15 @@ public class CsSearchResourceService {
return;
}
// 过滤掉无库存、下架的
filterProductList(sknReturnInfoList);
if (CollectionUtils.isEmpty(sknReturnInfoList)) {
return;
}
sknReturnInfoList = filterProductList(sknReturnInfoList);
// 构造skn map
Map<Integer, Map<String, Object>> sknReturnInfoMap = buildSknReturnInfoMap(sknReturnInfoList);
// 构建最终的主体精选resource
buildFianlThemeResource(validResources, sknReturnInfoMap);
}
private void filterProductList(List<Map<String, Object>> sknReturnInfoList) {
private List<Map<String, Object>> filterProductList(List<Map<String, Object>> sknReturnInfoList) {
List<Map<String, Object>> old = Lists.newArrayList(sknReturnInfoList);
Iterator<Map<String, Object>> iterator = sknReturnInfoList.iterator();
while (iterator.hasNext()) {
Map<String, Object> product = iterator.next();
... ... @@ -197,6 +195,12 @@ public class CsSearchResourceService {
continue;
}
}
// 都过滤掉的话,返回原来的
if(CollectionUtils.isEmpty(sknReturnInfoList)){
return old;
}else{
return sknReturnInfoList;
}
}
private void buildFianlThemeResource(List<Map<String, Object>> validResources, Map<Integer, Map<String, Object>> sknReturnInfoMap) {
... ...