Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
yimu
mall-server
Commits
e6432353
Commit
e6432353
authored
Feb 25, 2022
by
wlx@33.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化盲盒购买
parent
70eaf279
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
IOrderBindBoxServiceImpl.java
...er/front/order/service/impl/IOrderBindBoxServiceImpl.java
+10
-10
No files found.
mall-server-front/src/main/java/com/fzm/mall/server/front/order/service/impl/IOrderBindBoxServiceImpl.java
View file @
e6432353
...
@@ -30,17 +30,17 @@ public class IOrderBindBoxServiceImpl implements IOrderBindBoxService {
...
@@ -30,17 +30,17 @@ public class IOrderBindBoxServiceImpl implements IOrderBindBoxService {
* 从数据库获取库存大于0的盲盒sku列表
* 从数据库获取库存大于0的盲盒sku列表
*/
*/
List
<
SkuVo
>
skuList
=
goodSkuMapper
.
listAvailableSku
(
goodsId
);
List
<
SkuVo
>
skuList
=
goodSkuMapper
.
listAvailableSku
(
goodsId
);
i
f
(!
CollectionUtils
.
isEmpty
(
skuList
))
{
i
nt
difficulty
=
skuList
.
stream
().
map
(
SkuVo:
:
getDifficulty
).
findFirst
().
get
();
int
difficulty
=
skuList
.
stream
().
map
(
SkuVo:
:
getDifficulty
).
findFirst
().
get
();
while
(!
CollectionUtils
.
isEmpty
(
skuList
)){
result
=
genRandomSku
(
skuList
,
difficulty
);
result
=
genRandomSku
(
skuList
,
difficulty
);
}
if
(
result
==
null
)
{
if
(
result
==
null
)
{
throw
new
RuntimeException
(
"库存不足!!!"
);
throw
new
RuntimeException
(
"库存不足!!!"
);
}
}
//加时间锁
//加时间锁
int
i
=
goodSkuMapper
.
delStock
(
result
.
getSkuId
(),
GoodMainConst
.
BLIND_BOX_ORDER_SKU_NUM
,
result
.
getUpdateTime
());
int
i
=
goodSkuMapper
.
delStock
(
result
.
getSkuId
(),
GoodMainConst
.
BLIND_BOX_ORDER_SKU_NUM
,
result
.
getUpdateTime
());
if
(
i
==
0
)
{
if
(
i
==
0
)
{
skuList
.
remove
(
result
);
throw
new
RuntimeException
(
"活动火爆"
);
}
}
}
return
result
;
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