【代码修复】MALL:拼团活动的商品拼接不正确的问题

This commit is contained in:
YunaiV 2024-07-21 18:23:19 +08:00
parent 743383faf2
commit 4959479ac6

View File

@ -68,10 +68,11 @@ public interface CombinationActivityConvert {
List<ProductSpuRespDTO> spuList) { List<ProductSpuRespDTO> spuList) {
PageResult<CombinationActivityPageItemRespVO> pageResult = convertPage(page); PageResult<CombinationActivityPageItemRespVO> pageResult = convertPage(page);
Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId);
Map<Long, List<CombinationProductDO>> productMap = convertMultiMap(productList, CombinationProductDO::getActivityId);
pageResult.getList().forEach(item -> { pageResult.getList().forEach(item -> {
MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()) MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl())
.setMarketPrice(spu.getMarketPrice())); .setMarketPrice(spu.getMarketPrice()));
item.setProducts(convertList2(productList)); item.setProducts(convertList2(productMap.get(item.getId())));
// 设置统计字段 // 设置统计字段
item.setGroupCount(groupCountMap.getOrDefault(item.getId(), 0)) item.setGroupCount(groupCountMap.getOrDefault(item.getId(), 0))
.setGroupSuccessCount(groupSuccessCountMap.getOrDefault(item.getId(), 0)) .setGroupSuccessCount(groupSuccessCountMap.getOrDefault(item.getId(), 0))