fix size num in deposit order detail
Showing
1 changed file
with
13 additions
and
5 deletions
@@ -225,16 +225,21 @@ public class SellerDepositOrderListService extends AbsOrderViewService { | @@ -225,16 +225,21 @@ public class SellerDepositOrderListService extends AbsOrderViewService { | ||
225 | } | 225 | } |
226 | int offset = (req.getPage() - 1) * limit; | 226 | int offset = (req.getPage() - 1) * limit; |
227 | List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit); | 227 | List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit); |
228 | - | ||
229 | - List<ProductVo> productVoList = buildProductVoListWithSkuSummary(paogs); | 228 | + Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = new HashMap<>(paogs.size()); |
229 | + for(AppraiseOrderGoods paog : paogs) { | ||
230 | + Integer prdId; | ||
231 | + List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectAllByOrderCodePrdId(orderCode, prdId = paog.getProductId()); | ||
232 | + prdIdAOSListMap.put(prdId, paosList); | ||
233 | + } | ||
234 | + List<ProductVo> productVoList = buildProductVoListWithSkuSummary(paogs, prdIdAOSListMap); | ||
230 | 235 | ||
231 | respBuilder.data(productVoList); | 236 | respBuilder.data(productVoList); |
232 | return respBuilder.build(); | 237 | return respBuilder.build(); |
233 | } | 238 | } |
234 | 239 | ||
235 | - List<ProductVo> buildProductVoListWithSkuSummary(List<AppraiseOrderGoods> paogs){ | ||
236 | - | ||
237 | - return paogs.parallelStream().map(paog-> ProductConvertor.convertProductVo(paog, null)) | 240 | + List<ProductVo> buildProductVoListWithSkuSummary(List<AppraiseOrderGoods> paogs,Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap){ |
241 | + Function<List<AppraiseOrderStorage>,ProductVo> function = (aosList)-> ProductVo.builder().sizeNum(aosList.size()).build(); | ||
242 | + return paogs.parallelStream().map(paog-> ProductConvertor.convertProductVo(paog, function.apply(prdIdAOSListMap.get(paog.getProductId())))) | ||
238 | .collect(Collectors.toCollection(()->new ArrayList<>(paogs.size()))); | 243 | .collect(Collectors.toCollection(()->new ArrayList<>(paogs.size()))); |
239 | } | 244 | } |
240 | 245 | ||
@@ -354,4 +359,7 @@ public class SellerDepositOrderListService extends AbsOrderViewService { | @@ -354,4 +359,7 @@ public class SellerDepositOrderListService extends AbsOrderViewService { | ||
354 | .storageIdSOCRMap(storageIdSOCRMap) | 359 | .storageIdSOCRMap(storageIdSOCRMap) |
355 | .build(); | 360 | .build(); |
356 | } | 361 | } |
362 | + | ||
363 | + | ||
364 | + | ||
357 | } | 365 | } |
-
Please register or login to post a comment