记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
7fb073da
Commit
7fb073da
authored
May 12, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sqb 下架问题
parent
e07f5bc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
22 deletions
+105
-22
SqbPerformanceGoodsServiceImpl.java
...i/goblin/service/impl/SqbPerformanceGoodsServiceImpl.java
+90
-22
GoblinRedisUtils.java
.../client/admin/zhengzai/goblin/utils/GoblinRedisUtils.java
+15
-0
No files found.
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/service/impl/SqbPerformanceGoodsServiceImpl.java
View file @
7fb073da
...
...
@@ -7,6 +7,8 @@ import com.liquidnet.client.admin.zhengzai.goblin.service.ISqbPerformanceGoodsSe
import
com.liquidnet.client.admin.zhengzai.goblin.utils.GoblinRedisUtils
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinAdminSqbGoodsVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinSqbPerfLinkedGoodsVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinSqbPerfListRespVo
;
import
com.liquidnet.service.goblin.entity.GoblinGoods
;
...
...
@@ -42,21 +44,86 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
/** skuType=33 代表收钱吧商品 */
private
static
final
int
SQB_SKU_TYPE
=
33
;
/** 与前台 Goblin 一致:单品上架状态 3=上架 */
private
static
final
String
SHELVES_ON
=
"3"
;
/**
* 与实体/上下架接口约定一致:0-待上架|1-下架|2-违规|3-上架(见 {@link GoblinGoods#getShelvesStatus} 注释)
*/
private
static
final
String
SHELF_WAIT
=
"0"
;
private
static
final
String
SHELF_OFF
=
"1"
;
private
static
final
String
SHELF_VIOLATION
=
"2"
;
private
static
final
String
SHELF_ON
=
"3"
;
private
static
boolean
isSqbSkuAndSpuOnShelf
(
GoblinGoodsSku
sku
,
GoblinGoods
spu
)
{
if
(
sku
==
null
||
spu
==
null
)
{
return
false
;
private
static
String
trimFlg
(
String
s
)
{
return
s
==
null
?
""
:
s
.
trim
();
}
/** 演出关联列表:是否可售 + 展示文案(与 C 端 {@code GoblinFrontServiceImpl#getPerformanceSelectGoods} 过滤条件对齐) */
private
static
final
class
PerfShelfEval
{
final
boolean
linkable
;
final
String
statusLabel
;
PerfShelfEval
(
boolean
linkable
,
String
statusLabel
)
{
this
.
linkable
=
linkable
;
this
.
statusLabel
=
statusLabel
;
}
}
/**
* Redis 中 SPU、SKU 均有缓存时优先用缓存;否则用 MySQL 行。可售=未删+SPU 展示+非活动独占+SPU/SKU 均为上架(3)。
*/
private
PerfShelfEval
evalPerfShelfState
(
String
skuId
,
String
spuId
,
GoblinGoodsSku
mysqlSku
,
GoblinGoods
mysqlSpu
)
{
String
sid
=
skuId
==
null
?
""
:
skuId
.
trim
();
String
pid
=
spuId
==
null
?
""
:
spuId
.
trim
();
if
(!
StringUtils
.
hasText
(
sid
)
||
!
StringUtils
.
hasText
(
pid
))
{
return
new
PerfShelfEval
(
false
,
"数据异常"
);
}
GoblinGoodsSkuInfoVo
skuVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
sid
);
GoblinGoodsInfoVo
spuVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
pid
);
if
(
skuVo
!=
null
&&
spuVo
!=
null
)
{
return
evalFromSnapshot
(
trimFlg
(
skuVo
.
getDelFlg
()),
trimFlg
(
spuVo
.
getDelFlg
()),
trimFlg
(
skuVo
.
getShelvesStatus
()),
trimFlg
(
spuVo
.
getShelvesStatus
()),
trimFlg
(
spuVo
.
getSpuAppear
()),
spuVo
.
getMarketId
(),
true
);
}
if
(
mysqlSku
==
null
||
mysqlSpu
==
null
)
{
return
new
PerfShelfEval
(
false
,
"缺少商品数据"
);
}
if
(!
"0"
.
equals
(
sku
.
getDelFlg
())
||
!
"0"
.
equals
(
spu
.
getDelFlg
()))
{
return
false
;
return
evalFromSnapshot
(
trimFlg
(
mysqlSku
.
getDelFlg
()),
trimFlg
(
mysqlSpu
.
getDelFlg
()),
trimFlg
(
mysqlSku
.
getShelvesStatus
()),
trimFlg
(
mysqlSpu
.
getShelvesStatus
()),
trimFlg
(
mysqlSpu
.
getSpuAppear
()),
null
,
false
);
}
/**
* @param hasMarketId true 表示来自 Redis,可检查 marketId;MySQL DO 无该字段时传 false
*/
private
static
PerfShelfEval
evalFromSnapshot
(
String
skuDel
,
String
spuDel
,
String
skuShelf
,
String
spuShelf
,
String
spuAppear
,
String
marketId
,
boolean
hasMarketId
)
{
if
(!
"0"
.
equals
(
skuDel
)
||
!
"0"
.
equals
(
spuDel
))
{
return
new
PerfShelfEval
(
false
,
"已删除"
);
}
if
(!
"0"
.
equals
(
spuAppear
))
{
return
new
PerfShelfEval
(
false
,
"SPU隐藏"
);
}
if
(
hasMarketId
&&
StringUtils
.
hasText
(
marketId
))
{
return
new
PerfShelfEval
(
false
,
"活动商品"
);
}
return
SHELVES_ON
.
equals
(
sku
.
getShelvesStatus
())
&&
SHELVES_ON
.
equals
(
spu
.
getShelvesStatus
());
boolean
on
=
SHELF_ON
.
equals
(
skuShelf
)
&&
SHELF_ON
.
equals
(
spuShelf
);
if
(
on
)
{
return
new
PerfShelfEval
(
true
,
"上架"
);
}
return
new
PerfShelfEval
(
false
,
humanizeNotOnShelf
(
skuShelf
,
spuShelf
));
}
private
static
String
shelfStatusLabel
(
boolean
onShelf
)
{
return
onShelf
?
"上架"
:
"已下架"
;
/** 非「上架」时的文案:区分待上架(0)、下架(1)、违规(2),避免把同步初始态 0 误标成「已下架」 */
private
static
String
humanizeNotOnShelf
(
String
skuShelf
,
String
spuShelf
)
{
if
(
SHELF_WAIT
.
equals
(
skuShelf
)
||
SHELF_WAIT
.
equals
(
spuShelf
))
{
return
"待上架"
;
}
if
(
SHELF_OFF
.
equals
(
skuShelf
)
||
SHELF_OFF
.
equals
(
spuShelf
))
{
return
"已下架"
;
}
if
(
SHELF_VIOLATION
.
equals
(
skuShelf
)
||
SHELF_VIOLATION
.
equals
(
spuShelf
))
{
return
"违规"
;
}
return
"未上架"
;
}
private
static
String
sqbSpuSkuDisplay
(
String
spuTitle
,
String
skuTitle
)
{
...
...
@@ -149,7 +216,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
if
(
existing
==
null
)
{
GoblinGoods
spu
=
goblinGoodsMapper
.
selectOne
(
new
LambdaQueryWrapper
<
GoblinGoods
>()
.
eq
(
GoblinGoods:
:
getSpuId
,
sku
.
getSpuId
()).
last
(
"LIMIT 1"
));
if
(!
isSqbSkuAndSpuOnShelf
(
sku
,
spu
)
)
{
if
(!
evalPerfShelfState
(
skuId
,
sku
.
getSpuId
(),
sku
,
spu
).
linkable
)
{
return
ResponseDto
.
failure
(
"商品未上架或已下架,不可关联。请先让商户上架后再操作。skuId="
+
skuId
);
}
}
...
...
@@ -262,7 +329,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
LambdaQueryWrapper
<
GoblinGoods
>
goodsQuery
=
new
LambdaQueryWrapper
<>();
goodsQuery
.
in
(
GoblinGoods:
:
getSpuId
,
spuIdList
)
.
select
(
GoblinGoods:
:
getSpuId
,
GoblinGoods:
:
getName
,
GoblinGoods:
:
getCoverPic
,
GoblinGoods:
:
getShelvesStatus
,
GoblinGoods:
:
getDelFlg
);
GoblinGoods:
:
getShelvesStatus
,
GoblinGoods:
:
getDelFlg
,
GoblinGoods:
:
getSpuAppear
);
for
(
GoblinGoods
g
:
goblinGoodsMapper
.
selectList
(
goodsQuery
))
{
if
(
g
.
getSpuId
()
!=
null
)
{
spuNameById
.
put
(
g
.
getSpuId
(),
g
.
getName
());
...
...
@@ -281,7 +348,8 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
vo
.
setSettlementPrice
(
rel
.
getSettlementPrice
());
vo
.
setStatus
(
rel
.
getStatus
());
GoblinGoodsSku
sku
=
skuMap
.
get
(
rel
.
getSkuId
());
String
relSkuId
=
rel
.
getSkuId
()
==
null
?
null
:
rel
.
getSkuId
().
trim
();
GoblinGoodsSku
sku
=
relSkuId
==
null
?
null
:
skuMap
.
get
(
relSkuId
);
if
(
sku
!=
null
)
{
vo
.
setSkuName
(
sku
.
getName
());
vo
.
setSpuName
(
spuNameById
.
getOrDefault
(
rel
.
getSpuId
(),
""
));
...
...
@@ -289,12 +357,12 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
vo
.
setPrice
(
sku
.
getPrice
());
vo
.
setStock
(
sku
.
getSkuStock
());
GoblinGoods
spu
=
spuById
.
get
(
rel
.
getSpuId
());
boolean
onShelf
=
isSqbSkuAndSpuOnShelf
(
sku
,
spu
);
vo
.
setLinkable
(
onShelf
);
vo
.
setShelfStatusLabel
(
shelfStatusLabel
(
onShelf
)
);
PerfShelfEval
ev
=
evalPerfShelfState
(
relSkuId
,
rel
.
getSpuId
(),
sku
,
spu
);
vo
.
setLinkable
(
ev
.
linkable
);
vo
.
setShelfStatusLabel
(
ev
.
statusLabel
);
}
else
{
vo
.
setLinkable
(
false
);
vo
.
setShelfStatusLabel
(
"
已下架
"
);
vo
.
setShelfStatusLabel
(
"
无SKU记录
"
);
}
goodsList
.
add
(
vo
);
}
...
...
@@ -347,7 +415,7 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
LambdaQueryWrapper
<
GoblinGoods
>
gq
=
new
LambdaQueryWrapper
<>();
gq
.
in
(
GoblinGoods:
:
getSpuId
,
spuIdForTitle
)
.
select
(
GoblinGoods:
:
getSpuId
,
GoblinGoods:
:
getName
,
GoblinGoods:
:
getCoverPic
,
GoblinGoods:
:
getShelvesStatus
,
GoblinGoods:
:
getDelFlg
);
GoblinGoods:
:
getShelvesStatus
,
GoblinGoods:
:
getDelFlg
,
GoblinGoods:
:
getSpuAppear
);
for
(
GoblinGoods
g
:
goblinGoodsMapper
.
selectList
(
gq
))
{
if
(
g
.
getSpuId
()
!=
null
)
{
spuTitleById
.
put
(
g
.
getSpuId
(),
g
.
getName
());
...
...
@@ -367,10 +435,10 @@ public class SqbPerformanceGoodsServiceImpl implements ISqbPerformanceGoodsServi
vo
.
setSpuTitle
(
spuTitle
);
vo
.
setSkuTitle
(
skuTitle
);
GoblinGoods
spu
=
spuRowById
.
get
(
sku
.
getSpuId
());
boolean
onShelf
=
isSqbSkuAndSpuOnShelf
(
sku
,
spu
);
vo
.
setLinkable
(
onShelf
);
vo
.
setShelfStatusLabel
(
shelfStatusLabel
(
onShelf
)
);
vo
.
setTitle
(
sqbSpuSkuDisplay
(
spuTitle
,
skuTitle
)
+
(
onShelf
?
""
:
"(已下架
)"
));
PerfShelfEval
ev
=
evalPerfShelfState
(
sku
.
getSkuId
(),
sku
.
getSpuId
(),
sku
,
spu
);
vo
.
setLinkable
(
ev
.
linkable
);
vo
.
setShelfStatusLabel
(
ev
.
statusLabel
);
vo
.
setTitle
(
sqbSpuSkuDisplay
(
spuTitle
,
skuTitle
)
+
(
ev
.
linkable
?
""
:
"("
+
ev
.
statusLabel
+
"
)"
));
vo
.
setSkuPic
(
pickSkuOrSpuCover
(
sku
.
getSkuPic
(),
spuCoverById
.
get
(
sku
.
getSpuId
())));
vo
.
setPrice
(
sku
.
getPrice
());
vo
.
setSkuStock
(
sku
.
getSkuStock
());
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/utils/GoblinRedisUtils.java
View file @
7fb073da
...
...
@@ -224,6 +224,21 @@ public class GoblinRedisUtils {
return
vo
;
}
/**
* 与 goblin 服务一致:SPU 基础缓存(用于后台与 C 端上下架状态对齐)
*/
public
GoblinGoodsInfoVo
getGoodsInfoVo
(
String
spuId
)
{
if
(
spuId
==
null
||
spuId
.
isEmpty
())
{
return
null
;
}
String
rk
=
GoblinRedisConst
.
BASIC_GOODS
.
concat
(
spuId
);
GoblinGoodsInfoVo
vo
=
(
GoblinGoodsInfoVo
)
redisDataSourceUtil
.
getRedisGoblinUtil
().
get
(
rk
);
if
(
null
==
vo
)
{
return
null
;
}
return
vo
;
}
//覆盖 站位宾哥要dto
public
void
setNftNumDetails
(
String
num
,
String
skuId
,
GalaxyNftPublishAndBuyReqDto
dto
)
{
String
redisKey
=
GoblinRedisConst
.
GOBLIN_NUM_DETAILS
.
concat
(
num
).
concat
(
skuId
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment