记得上下班打卡 | 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
cb751a2d
Commit
cb751a2d
authored
Mar 31, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收钱 同步参数校验
parent
1ae61d36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
9 deletions
+61
-9
GoblinStoreMgtSqbGoodsController.java
...n/controller/manage/GoblinStoreMgtSqbGoodsController.java
+61
-9
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtSqbGoodsController.java
View file @
cb751a2d
...
...
@@ -73,16 +73,19 @@ public class GoblinStoreMgtSqbGoodsController {
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
if
(
CollectionUtils
.
isEmpty
(
items
))
{
return
ResponseDto
.
success
(
buildAddResult
(
0
,
0
,
0
));
return
ResponseDto
.
success
(
buildAddResult
(
0
,
0
,
0
,
Collections
.
emptyList
()
));
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"收钱吧商品管理:批量添加:[items={}]"
,
JsonUtils
.
toJson
(
items
));
}
int
addSuccess
=
0
,
alreadyExists
=
0
,
addFail
=
0
;
List
<
String
>
invalidReasons
=
new
ArrayList
<>();
for
(
GoblinSqbPerfGoodsVo
sqbGoods
:
items
)
{
if
(
sqbGoods
==
null
||
StringUtils
.
isBlank
(
sqbGoods
.
getSpuId
())
||
StringUtils
.
isBlank
(
sqbGoods
.
getMallSn
()))
{
String
invalidReason
=
validateSqbGoodsForSync
(
sqbGoods
);
if
(
StringUtils
.
isNotBlank
(
invalidReason
))
{
addFail
++;
invalidReasons
.
add
(
invalidReason
);
continue
;
}
if
(
existsSqbSpu
(
sqbGoods
.
getMallSn
(),
sqbGoods
.
getSpuId
()))
{
...
...
@@ -109,7 +112,7 @@ public class GoblinStoreMgtSqbGoodsController {
log
.
error
(
"收钱吧商品管理:批量添加失败, storeId={}, sqbSpuId={}"
,
storeId
,
sqbGoods
.
getSpuId
(),
e
);
}
}
return
ResponseDto
.
success
(
buildAddResult
(
addSuccess
,
alreadyExists
,
addFail
));
return
ResponseDto
.
success
(
buildAddResult
(
addSuccess
,
alreadyExists
,
addFail
,
invalidReasons
));
}
@ApiOperationSupport
(
order
=
2
)
...
...
@@ -122,10 +125,11 @@ public class GoblinStoreMgtSqbGoodsController {
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149002"
));
}
if
(
CollectionUtils
.
isEmpty
(
localSpuIds
))
{
return
ResponseDto
.
success
(
buildEditResult
(
0
,
0
,
0
,
0
));
return
ResponseDto
.
success
(
buildEditResult
(
0
,
0
,
0
,
0
,
Collections
.
emptyList
()
));
}
int
editSuccess
=
0
,
notAdded
=
0
,
sqbNotFound
=
0
,
editFail
=
0
;
List
<
String
>
invalidReasons
=
new
ArrayList
<>();
for
(
String
localSpuId
:
localSpuIds
)
{
if
(
StringUtils
.
isBlank
(
localSpuId
))
{
editFail
++;
...
...
@@ -154,6 +158,12 @@ public class GoblinStoreMgtSqbGoodsController {
sqbNotFound
++;
continue
;
}
String
invalidReason
=
validateSqbGoodsForSync
(
sqbGoods
);
if
(
StringUtils
.
isNotBlank
(
invalidReason
))
{
editFail
++;
invalidReasons
.
add
(
"localSpuId="
+
localSpuId
+
", "
+
invalidReason
);
continue
;
}
try
{
if
(
goblinstoreMgtSqbGoodsService
.
sqbGoodsEditSpu
(
currentUid
,
sqbGoods
,
localGoodsInfoVo
))
{
...
...
@@ -167,7 +177,7 @@ public class GoblinStoreMgtSqbGoodsController {
storeId
,
localSpuId
,
sqbSpuId
,
e
);
}
}
return
ResponseDto
.
success
(
buildEditResult
(
editSuccess
,
notAdded
,
sqbNotFound
,
editFail
));
return
ResponseDto
.
success
(
buildEditResult
(
editSuccess
,
notAdded
,
sqbNotFound
,
editFail
,
invalidReasons
));
}
private
boolean
existsSqbSpu
(
String
mallSn
,
String
sqbSpuId
)
{
...
...
@@ -225,20 +235,62 @@ public class GoblinStoreMgtSqbGoodsController {
return
null
;
}
private
Map
<
String
,
Integer
>
buildAddResult
(
int
addSuccess
,
int
alreadyExists
,
int
addFail
)
{
Map
<
String
,
Integer
>
result
=
new
HashMap
<>();
private
String
validateSqbGoodsForSync
(
GoblinSqbPerfGoodsVo
sqbGoods
)
{
if
(
sqbGoods
==
null
)
{
return
"收钱吧商品为空"
;
}
if
(
StringUtils
.
isBlank
(
sqbGoods
.
getMallSn
()))
{
return
"收钱吧商品校验失败: mallSn为空, spuId="
+
StringUtils
.
defaultString
(
sqbGoods
.
getSpuId
());
}
if
(
StringUtils
.
isBlank
(
sqbGoods
.
getSignature
()))
{
return
"收钱吧商品校验失败: signature为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
StringUtils
.
defaultString
(
sqbGoods
.
getSpuId
());
}
if
(
StringUtils
.
isBlank
(
sqbGoods
.
getSpuId
()))
{
return
"收钱吧商品校验失败: spuId为空, mallSn="
+
sqbGoods
.
getMallSn
();
}
if
(
StringUtils
.
isBlank
(
sqbGoods
.
getTitle
()))
{
return
"收钱吧商品校验失败: title为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
sqbGoods
.
getSpuId
();
}
if
(
CollectionUtils
.
isEmpty
(
sqbGoods
.
getSkuResults
()))
{
return
"收钱吧商品校验失败: skuResults为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
sqbGoods
.
getSpuId
();
}
for
(
int
i
=
0
;
i
<
sqbGoods
.
getSkuResults
().
size
();
i
++)
{
MallProductsQueryData
.
Sku
sku
=
sqbGoods
.
getSkuResults
().
get
(
i
);
if
(
sku
==
null
)
{
return
"收钱吧商品校验失败: skuResults["
+
i
+
"]为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
sqbGoods
.
getSpuId
();
}
if
(
StringUtils
.
isBlank
(
sku
.
getSkuId
()))
{
return
"收钱吧商品校验失败: skuId为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
sqbGoods
.
getSpuId
()
+
", index="
+
i
;
}
if
(
StringUtils
.
isBlank
(
sku
.
getSkuName
()))
{
return
"收钱吧商品校验失败: skuName为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
sqbGoods
.
getSpuId
()
+
", skuId="
+
sku
.
getSkuId
();
}
if
(
sku
.
getPrice
()
==
null
)
{
return
"收钱吧商品校验失败: price为空, mallSn="
+
sqbGoods
.
getMallSn
()
+
", spuId="
+
sqbGoods
.
getSpuId
()
+
", skuId="
+
sku
.
getSkuId
();
}
}
return
null
;
}
private
Map
<
String
,
Object
>
buildAddResult
(
int
addSuccess
,
int
alreadyExists
,
int
addFail
,
List
<
String
>
invalidReasons
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"addSuccess"
,
addSuccess
);
result
.
put
(
"alreadyExists"
,
alreadyExists
);
result
.
put
(
"addFail"
,
addFail
);
result
.
put
(
"invalidCount"
,
CollectionUtils
.
isEmpty
(
invalidReasons
)
?
0
:
invalidReasons
.
size
());
result
.
put
(
"invalidReasons"
,
invalidReasons
);
return
result
;
}
private
Map
<
String
,
Integer
>
buildEditResult
(
int
editSuccess
,
int
notAdded
,
int
sqbNotFound
,
int
editFail
)
{
Map
<
String
,
Integer
>
result
=
new
HashMap
<>();
private
Map
<
String
,
Object
>
buildEditResult
(
int
editSuccess
,
int
notAdded
,
int
sqbNotFound
,
int
editFail
,
List
<
String
>
invalidReasons
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"editSuccess"
,
editSuccess
);
result
.
put
(
"notAdded"
,
notAdded
);
result
.
put
(
"sqbNotFound"
,
sqbNotFound
);
result
.
put
(
"editFail"
,
editFail
);
result
.
put
(
"invalidCount"
,
CollectionUtils
.
isEmpty
(
invalidReasons
)
?
0
:
invalidReasons
.
size
());
result
.
put
(
"invalidReasons"
,
invalidReasons
);
return
result
;
}
}
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