记得上下班打卡 | git大法好,push需谨慎

Commit 8e8cfeaa authored by wangyifan's avatar wangyifan

partner 专题详情增加价格区间字段

parent 1c1e3788
......@@ -66,8 +66,11 @@ public class GoblinStoreMgtArtistTopicDetailVo implements Serializable {
@ApiModelProperty("封面")
private String coverPic;
@ApiModelProperty("售价")
private BigDecimal sellPrice;
@ApiModelProperty("价格区间MIN")
private BigDecimal priceGe;
@ApiModelProperty("价格区间MAX")
private BigDecimal priceLe;
@ApiModelProperty("排序")
private Integer sort;
......
......@@ -39,6 +39,7 @@ public class GoblinArtistTopicVo implements Serializable {
private Integer sort;
private String name;
private String coverPic;
private BigDecimal sellPrice;
private BigDecimal priceGe;
private BigDecimal priceLe;
}
}
......@@ -386,13 +386,27 @@ public class GoblinStoreMgtArtistServiceImpl implements IGoblinStoreMgtArtistSer
}
if (!CollectionUtils.isEmpty(topic.getGoods())) {
Set<String> spuIds = topic.getGoods().stream()
.map(GoblinArtistTopicVo.GoodsItem::getSpuId)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toSet());
Map<String, GoblinGoods> goodsMap = loadGoodsMapBySpuIds(spuIds);
for (GoblinArtistTopicVo.GoodsItem goods : topic.getGoods()) {
GoblinStoreMgtArtistTopicDetailVo.GoodsItem item = new GoblinStoreMgtArtistTopicDetailVo.GoodsItem();
item.setSpuId(goods.getSpuId());
item.setSort(goods.getSort());
item.setName(goods.getName());
item.setCoverPic(goods.getCoverPic());
item.setSellPrice(goods.getSellPrice());
GoblinGoods dbGoods = goodsMap.get(goods.getSpuId());
if (dbGoods != null) {
item.setName(dbGoods.getName());
item.setCoverPic(dbGoods.getCoverPic());
item.setPriceGe(dbGoods.getPriceGe());
item.setPriceLe(dbGoods.getPriceLe());
} else {
item.setPriceGe(goods.getPriceGe());
item.setPriceLe(goods.getPriceLe());
}
vo.getGoods().add(item);
}
}
......@@ -710,7 +724,13 @@ public class GoblinStoreMgtArtistServiceImpl implements IGoblinStoreMgtArtistSer
}
Set<String> spuIds = goods.stream().map(GoblinStoreMgtArtistTopicGoodsItemParams::getSpuId)
.filter(StringUtils::isNotBlank).collect(Collectors.toSet());
if (spuIds.isEmpty()) return Collections.emptyMap();
return loadGoodsMapBySpuIds(spuIds);
}
private Map<String, GoblinGoods> loadGoodsMapBySpuIds(Set<String> spuIds) {
if (CollectionUtils.isEmpty(spuIds)) {
return Collections.emptyMap();
}
List<GoblinGoods> list = goodsMapper.selectList(new LambdaQueryWrapper<GoblinGoods>()
.in(GoblinGoods::getSpuId, spuIds));
Map<String, GoblinGoods> map = new HashMap<>();
......@@ -737,7 +757,8 @@ public class GoblinStoreMgtArtistServiceImpl implements IGoblinStoreMgtArtistSer
if (goods != null) {
item.setName(goods.getName());
item.setCoverPic(goods.getCoverPic());
item.setSellPrice(goods.getSellPrice());
item.setPriceGe(goods.getPriceGe());
item.setPriceLe(goods.getPriceLe());
}
items.add(item);
index++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment