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
ca1521a4
Commit
ca1521a4
authored
Apr 12, 2021
by
徐康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品数量校验
parent
451a5627
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
shopping-cart-application-service/src/main/java/cn/freemud/interceptor/ServiceException.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+9
-10
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/interceptor/ServiceException.java
View file @
ca1521a4
...
@@ -23,6 +23,7 @@ public class ServiceException extends RuntimeException {
...
@@ -23,6 +23,7 @@ public class ServiceException extends RuntimeException {
public
ServiceException
(
ResponseResult
result
,
String
message
)
{
public
ServiceException
(
ResponseResult
result
,
String
message
)
{
this
.
result
=
result
;
this
.
result
=
result
;
this
.
message
=
message
;
this
.
message
=
message
;
this
.
result
.
setMessage
(
message
);
}
}
public
ResponseResult
getResult
()
{
public
ResponseResult
getResult
()
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
ca1521a4
...
@@ -1535,7 +1535,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1535,7 +1535,6 @@ public class ShoppingCartMCoffeeServiceImpl {
return
isSpecialGoods
;
return
isSpecialGoods
;
}
}
public
static
void
setClassificationAndPrice
(
CartGoods
cartGoods
,
List
<
ProductBeanDTO
>
productBeanListSpuClass
)
{
public
static
void
setClassificationAndPrice
(
CartGoods
cartGoods
,
List
<
ProductBeanDTO
>
productBeanListSpuClass
)
{
if
(
productBeanListSpuClass
==
null
||
productBeanListSpuClass
.
size
()
==
0
)
{
if
(
productBeanListSpuClass
==
null
||
productBeanListSpuClass
.
size
()
==
0
)
{
return
;
return
;
...
@@ -1578,15 +1577,15 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1578,15 +1577,15 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setTaxId
(
productBeanListSpuClass
.
get
(
0
).
getTaxId
());
cartGoods
.
setTaxId
(
productBeanListSpuClass
.
get
(
0
).
getTaxId
());
//套餐固定商品赋值
//套餐固定商品赋值
if
(
CollectionUtils
.
isNotEmpty
(
productBeanListSpuClass
.
get
(
0
).
getProductComboList
())){
if
(
CollectionUtils
.
isNotEmpty
(
productBeanListSpuClass
.
get
(
0
).
getProductComboList
())
&&
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductComboList
())
){
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductComboList
())){
Map
<
String
,
Integer
>
productMap
=
productBeanListSpuClass
.
get
(
0
).
getProductComboList
().
stream
()
for
(
CartGoods
.
ComboxGoods
comboxGoods
:
cartGoods
.
getProductComboList
())
{
.
collect
(
Collectors
.
toMap
(
ProductBeanDTO
.
ProductComboType
::
getProductId
,
ProductBeanDTO
.
ProductComboType
::
getQuantity
,
(
k1
,
k2
)
->
k1
+
k2
));
for
(
ProductBeanDTO
.
ProductComboType
comboType:
productBeanListSpuClass
.
get
(
0
).
getProductComboList
()){
if
(
comboxGoods
.
getGoodsId
().
equals
(
comboType
.
getProductId
())
&&
comboType
.
getQuantity
()>
0
){
Map
<
String
,
Integer
>
cartGoodsMap
=
cartGoods
.
getProductComboList
().
stream
()
comboxGoods
.
setQty
(
comboType
.
getQuantity
(
));
.
collect
(
Collectors
.
toMap
(
CartGoods
.
ComboxGoods
::
getGoodsId
,
CartGoods
.
ComboxGoods
::
getQty
,
(
k1
,
k2
)
->
k1
+
k2
));
}
}
if
(
productMap
.
entrySet
().
stream
().
filter
(
o
->
o
.
getValue
()
!=
cartGoodsMap
.
get
(
o
.
getKey
())).
findFirst
().
isPresent
())
{
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_VERSION_ERROR
,
"加购套餐子商品数量异常"
);
}
}
}
}
...
...
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