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

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

sqb 下架问题

parent 7fb073da
...@@ -68,9 +68,11 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi ...@@ -68,9 +68,11 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
} }
/** /**
* Redis 中 SPU、SKU 均有缓存时优先用缓存;否则用 MySQL 行。可售=未删+SPU 展示+非活动独占+SPU/SKU 均为上架(3)。 * 上下架/可售判断:与店铺 {@code POST store/mgt/goods/list} 一致——该列表的 {@code shelvesStatus} 来自 Mongo
* {@link com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo}(见 {@code GoblinMongoUtils#getMgtGoodsInfoVos}),
* 不是读 MySQL;admin 模块无 Mongo 时以 Redis(与 goblin 缓存同源)为准,MySQL 仅兜底。
*/ */
private PerfShelfEval evalPerfShelfState(String skuId, String spuId, GoblinGoodsSku mysqlSku, GoblinGoods mysqlSpu) { private PerfShelfEval evalShelfState(String skuId, String spuId, GoblinGoodsSku mysqlSku, GoblinGoods mysqlSpu) {
String sid = skuId == null ? "" : skuId.trim(); String sid = skuId == null ? "" : skuId.trim();
String pid = spuId == null ? "" : spuId.trim(); String pid = spuId == null ? "" : spuId.trim();
if (!StringUtils.hasText(sid) || !StringUtils.hasText(pid)) { if (!StringUtils.hasText(sid) || !StringUtils.hasText(pid)) {
...@@ -216,7 +218,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi ...@@ -216,7 +218,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
if (existing == null) { if (existing == null) {
GoblinGoods spu = goblinGoodsMapper.selectOne(new LambdaQueryWrapper<GoblinGoods>() GoblinGoods spu = goblinGoodsMapper.selectOne(new LambdaQueryWrapper<GoblinGoods>()
.eq(GoblinGoods::getSpuId, sku.getSpuId()).last("LIMIT 1")); .eq(GoblinGoods::getSpuId, sku.getSpuId()).last("LIMIT 1"));
if (!evalPerfShelfState(skuId, sku.getSpuId(), sku, spu).linkable) { if (!evalShelfState(skuId, sku.getSpuId(), sku, spu).linkable) {
return ResponseDto.failure("商品未上架或已下架,不可关联。请先让商户上架后再操作。skuId=" + skuId); return ResponseDto.failure("商品未上架或已下架,不可关联。请先让商户上架后再操作。skuId=" + skuId);
} }
} }
...@@ -357,7 +359,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi ...@@ -357,7 +359,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
vo.setPrice(sku.getPrice()); vo.setPrice(sku.getPrice());
vo.setStock(sku.getSkuStock()); vo.setStock(sku.getSkuStock());
GoblinGoods spu = spuById.get(rel.getSpuId()); GoblinGoods spu = spuById.get(rel.getSpuId());
PerfShelfEval ev = evalPerfShelfState(relSkuId, rel.getSpuId(), sku, spu); PerfShelfEval ev = evalShelfState(relSkuId, rel.getSpuId(), sku, spu);
vo.setLinkable(ev.linkable); vo.setLinkable(ev.linkable);
vo.setShelfStatusLabel(ev.statusLabel); vo.setShelfStatusLabel(ev.statusLabel);
} else { } else {
...@@ -435,7 +437,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi ...@@ -435,7 +437,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
vo.setSpuTitle(spuTitle); vo.setSpuTitle(spuTitle);
vo.setSkuTitle(skuTitle); vo.setSkuTitle(skuTitle);
GoblinGoods spu = spuRowById.get(sku.getSpuId()); GoblinGoods spu = spuRowById.get(sku.getSpuId());
PerfShelfEval ev = evalPerfShelfState(sku.getSkuId(), sku.getSpuId(), sku, spu); PerfShelfEval ev = evalShelfState(sku.getSkuId(), sku.getSpuId(), sku, spu);
vo.setLinkable(ev.linkable); vo.setLinkable(ev.linkable);
vo.setShelfStatusLabel(ev.statusLabel); vo.setShelfStatusLabel(ev.statusLabel);
vo.setTitle(sqbSpuSkuDisplay(spuTitle, skuTitle) + (ev.linkable ? "" : "(" + ev.statusLabel + ")")); vo.setTitle(sqbSpuSkuDisplay(spuTitle, skuTitle) + (ev.linkable ? "" : "(" + ev.statusLabel + ")"));
......
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