Commit b17ec07d by 周立明

refactor(goods-listing): 去重升级商品id集合

避免重复查询相同的升级商品信息,减少不必要的远程调用开销
1 parent 74b5b3aa
......@@ -265,7 +265,7 @@ public class GoodsListingProductBaseService {
extendedInsuranceTypeIdList.addAll(equityTypeIdList);
List<Integer> allServiceItemIdList = this.getAllServiceItemIdList();
List<Integer> upgradeGoodsIds = productBaseList.stream().flatMap(o -> o.getDetailList().stream()).filter(o -> Objects.nonNull(o.getUpgradeGoodsId()))
.map(GoodsListingProductDetailDTO::getUpgradeGoodsId).collect(Collectors.toList());
.map(GoodsListingProductDetailDTO::getUpgradeGoodsId).distinct().collect(Collectors.toList());
Map<Integer, UpgradeGoodsDTO> upgradeGoodsMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(upgradeGoodsIds)) {
List<UpgradeGoodsDTO> upgradeGoodsList = goodsListingProductDetailService.getUpgradeGoodsByUpgradeGoodsIds(upgradeGoodsIds);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!