Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
187fe81c
Commit
187fe81c
authored
May 31, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增 库存校验
parent
cf3b439d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+4
-8
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
187fe81c
...
...
@@ -3204,13 +3204,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//校验库存
List
<
CartGoods
>
stockLimitGoods
=
allCartGoodsList
.
stream
().
filter
(
CartGoods:
:
isStockLimit
).
collect
(
toList
());
List
<
CartGoods
>
notCheckStock
=
allCartGoodsList
.
stream
().
filter
(
cartGoods
->
!
cartGoods
.
isStockLimit
()).
collect
(
toList
());
if
(!
CollectionUtils
.
isEmpty
(
stockLimitGoods
))
{
List
<
Long
>
spuIds
=
stockLimitGoods
.
stream
().
map
(
v
->
Long
.
parseLong
(
v
.
getSpu
Id
())).
collect
(
toList
());
List
<
Long
>
goodsId
=
stockLimitGoods
.
stream
().
map
(
v
->
Long
.
parseLong
(
v
.
getGoods
Id
())).
collect
(
toList
());
GetProductStockRequestDto
requestDto
=
new
GetProductStockRequestDto
();
requestDto
.
setChannel
(
BusinessTypeEnum
.
getByType
(
replaceGoodsRequestVo
.
getMenuType
()).
getCode
());
requestDto
.
setPartnerId
(
replaceGoodsRequestVo
.
getPartnerId
());
requestDto
.
setStoreId
(
replaceGoodsRequestVo
.
getShopId
());
requestDto
.
setProductIds
(
spuIds
);
requestDto
.
setProductIds
(
goodsId
);
GetProductStockResponseDto
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
);
if
(
availableStocks
!=
null
)
{
if
(!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
())){
...
...
@@ -3237,18 +3238,13 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
});
});
// 获取到最新的 库存 stockLimitGoods 数据 放入 nowCartGoodsList 中
List
<
CartGoods
>
notCheckStock
=
allCartGoodsList
.
stream
().
filter
(
cartGoods
->
!
cartGoods
.
isStockLimit
()).
collect
(
toList
());
notCheckStock
.
addAll
(
stockLimitGoods
);
allCartGoodsList
=
notCheckStock
;
notCheckStock
=
null
;
stockLimitGoods
=
null
;
}
else
{
LogUtil
.
info
(
"request check stock limit fail"
,
requestDto
,
null
);
fullReplace
=
false
;
return
fullReplace
;
}
}
allCartGoodsList
=
notCheckStock
;
// fisherman 删除 新门店的缓存数据 重新添加 测试 之后需要放开
shoppingCartNewBaseService
.
clear
(
replaceGoodsRequestVo
.
getPartnerId
(),
replaceGoodsRequestVo
.
getShopId
(),
userId
);
...
...
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