提交 07e82b2a 作者: 张小凤

MiniProgram

上级 1aec4c41
...@@ -19,6 +19,7 @@ import java.util.ArrayList; ...@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @Author small @Date 2023/5/16 15:08 @Version 1.0 * @Author small @Date 2023/5/16 15:08 @Version 1.0
...@@ -171,54 +172,35 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall ...@@ -171,54 +172,35 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList)); return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
} }
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息 // 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息 // 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId); list = list.stream().peek(d -> {
list = List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
list.stream() for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
.peek( if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
d -> { IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); // 获取商品清单信息
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { List<ProductInventoryVO> productInventoryList = new ArrayList<>();
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); // 获取行业规格绑定的产品规格信息
// 获取商品清单信息 List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList()));
List<IndustryProductInventoryDO> industryProdInventory = Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId));
goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId()); getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap);
List<ProductInventoryVO> productInventoryList = new ArrayList<>(); MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO();
// 获取行业规格绑定的产品规格信息 industrySpecDTO.setId(e.getId());
List<InventorySpecDO> inventorySpecDOList = industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
goodsInfoDao.listInventorySpec( industrySpecDTO.setIndustrySkuId(d.getSkuId());
industryProdInventory.stream() industrySpecDTO.setProductInventoryList(productInventoryList);
.map(IndustryProductInventoryDO::getId) industrySpec.add(industrySpecDTO);
.collect(Collectors.toList())); }
Map<Integer, List<InventorySpecDO>> inventoryMap = }
inventorySpecDOList.stream() d.setIndustrySpecList(industrySpec);
.collect( }).collect(Collectors.toList());
Collectors.groupingBy(
InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(
industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpecDTO.setProductInventoryList(productInventoryList);
industrySpec.add(industrySpecDTO);
}
}
d.setIndustrySpecList(industrySpec);
})
.collect(Collectors.toList());
return list; return list;
} }
......
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
product_sku_id productSkuId, product_sku_id productSkuId,
is_selected selected is_selected selected
FROM industry_product_inventory FROM industry_product_inventory
WHERE industry_spec_id = #{id} WHERE industry_spec_id = #{industrySpecId}
AND is_deleted = 0 AND is_deleted = 0
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论