Showing
1 changed file
with
9 additions
and
5 deletions
@@ -178,17 +178,15 @@ public class CsSearchResourceService { | @@ -178,17 +178,15 @@ public class CsSearchResourceService { | ||
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | // 过滤掉无库存、下架的 | 180 | // 过滤掉无库存、下架的 |
181 | - filterProductList(sknReturnInfoList); | ||
182 | - if (CollectionUtils.isEmpty(sknReturnInfoList)) { | ||
183 | - return; | ||
184 | - } | 181 | + sknReturnInfoList = filterProductList(sknReturnInfoList); |
185 | // 构造skn map | 182 | // 构造skn map |
186 | Map<Integer, Map<String, Object>> sknReturnInfoMap = buildSknReturnInfoMap(sknReturnInfoList); | 183 | Map<Integer, Map<String, Object>> sknReturnInfoMap = buildSknReturnInfoMap(sknReturnInfoList); |
187 | // 构建最终的主体精选resource | 184 | // 构建最终的主体精选resource |
188 | buildFianlThemeResource(validResources, sknReturnInfoMap); | 185 | buildFianlThemeResource(validResources, sknReturnInfoMap); |
189 | } | 186 | } |
190 | 187 | ||
191 | - private void filterProductList(List<Map<String, Object>> sknReturnInfoList) { | 188 | + private List<Map<String, Object>> filterProductList(List<Map<String, Object>> sknReturnInfoList) { |
189 | + List<Map<String, Object>> old = Lists.newArrayList(sknReturnInfoList); | ||
192 | Iterator<Map<String, Object>> iterator = sknReturnInfoList.iterator(); | 190 | Iterator<Map<String, Object>> iterator = sknReturnInfoList.iterator(); |
193 | while (iterator.hasNext()) { | 191 | while (iterator.hasNext()) { |
194 | Map<String, Object> product = iterator.next(); | 192 | Map<String, Object> product = iterator.next(); |
@@ -197,6 +195,12 @@ public class CsSearchResourceService { | @@ -197,6 +195,12 @@ public class CsSearchResourceService { | ||
197 | continue; | 195 | continue; |
198 | } | 196 | } |
199 | } | 197 | } |
198 | + // 都过滤掉的话,返回原来的 | ||
199 | + if(CollectionUtils.isEmpty(sknReturnInfoList)){ | ||
200 | + return old; | ||
201 | + }else{ | ||
202 | + return sknReturnInfoList; | ||
203 | + } | ||
200 | } | 204 | } |
201 | 205 | ||
202 | private void buildFianlThemeResource(List<Map<String, Object>> validResources, Map<Integer, Map<String, Object>> sknReturnInfoMap) { | 206 | private void buildFianlThemeResource(List<Map<String, Object>> validResources, Map<Integer, Map<String, Object>> sknReturnInfoMap) { |
-
Please register or login to post a comment