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

Commit a7bad411 authored by 姜秀龙's avatar 姜秀龙

收钱吧 支付需要 sku 维度。这里有个待解决问题下单 redis 没降级

parent b798387d
...@@ -1095,7 +1095,6 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -1095,7 +1095,6 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
new LambdaQueryWrapper<GoblinSqbPerformanceGoods>() new LambdaQueryWrapper<GoblinSqbPerformanceGoods>()
.eq(GoblinSqbPerformanceGoods::getPerformancesId, performancesId) .eq(GoblinSqbPerformanceGoods::getPerformancesId, performancesId)
.eq(GoblinSqbPerformanceGoods::getStatus, 1) .eq(GoblinSqbPerformanceGoods::getStatus, 1)
.groupBy(GoblinSqbPerformanceGoods::getSpuId)
.orderByAsc(GoblinSqbPerformanceGoods::getSort, GoblinSqbPerformanceGoods::getMid)); .orderByAsc(GoblinSqbPerformanceGoods::getSort, GoblinSqbPerformanceGoods::getMid));
if (relations == null) { if (relations == null) {
...@@ -1109,7 +1108,19 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -1109,7 +1108,19 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
// 这样如果商品在 SPU 层面下架,虽然关联关系还在缓存,但这里会动态过滤掉 // 这样如果商品在 SPU 层面下架,虽然关联关系还在缓存,但这里会动态过滤掉
ArrayList<GoblinGoodsInfoVo> allGoods = ObjectUtil.goblinGoodsInfoVoArrayList(); ArrayList<GoblinGoodsInfoVo> allGoods = ObjectUtil.goblinGoodsInfoVoArrayList();
if (!CollectionUtils.isEmpty(relations)) { if (!CollectionUtils.isEmpty(relations)) {
// 说明:relations 关联的是 SKU(同一 SPU 可能多条),下单侧需要完整 SKU 关系,所以 Redis 缓存必须保留全量。
// 前端“推荐商品列表”展示按 SPU 去重:取排序最靠前的一条关联作为该 SPU 的展示代表。
LinkedHashMap<String, GoblinSqbPerformanceGoods> uniqueSpuRelMap = new LinkedHashMap<>();
for (GoblinSqbPerformanceGoods rel : relations) { for (GoblinSqbPerformanceGoods rel : relations) {
if (rel == null || StringUtil.isBlank(rel.getSpuId())) {
continue;
}
if (!uniqueSpuRelMap.containsKey(rel.getSpuId())) {
uniqueSpuRelMap.put(rel.getSpuId(), rel);
}
}
for (GoblinSqbPerformanceGoods rel : uniqueSpuRelMap.values()) {
if (rel == null || StringUtil.isBlank(rel.getSpuId())) { if (rel == null || StringUtil.isBlank(rel.getSpuId())) {
continue; continue;
} }
......
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