Authored by chenchao

fix size num in deposit order detail

... ... @@ -225,16 +225,21 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
}
int offset = (req.getPage() - 1) * limit;
List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit);
List<ProductVo> productVoList = buildProductVoListWithSkuSummary(paogs);
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = new HashMap<>(paogs.size());
for(AppraiseOrderGoods paog : paogs) {
Integer prdId;
List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectAllByOrderCodePrdId(orderCode, prdId = paog.getProductId());
prdIdAOSListMap.put(prdId, paosList);
}
List<ProductVo> productVoList = buildProductVoListWithSkuSummary(paogs, prdIdAOSListMap);
respBuilder.data(productVoList);
return respBuilder.build();
}
List<ProductVo> buildProductVoListWithSkuSummary(List<AppraiseOrderGoods> paogs){
return paogs.parallelStream().map(paog-> ProductConvertor.convertProductVo(paog, null))
List<ProductVo> buildProductVoListWithSkuSummary(List<AppraiseOrderGoods> paogs,Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap){
Function<List<AppraiseOrderStorage>,ProductVo> function = (aosList)-> ProductVo.builder().sizeNum(aosList.size()).build();
return paogs.parallelStream().map(paog-> ProductConvertor.convertProductVo(paog, function.apply(prdIdAOSListMap.get(paog.getProductId()))))
.collect(Collectors.toCollection(()->new ArrayList<>(paogs.size())));
}
... ... @@ -354,4 +359,7 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
.storageIdSOCRMap(storageIdSOCRMap)
.build();
}
}
... ...