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
c6524ae3
Commit
c6524ae3
authored
Mar 25, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210319-多规格加料组问题-lcf'
parents
7b3ce3ab
829863b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
2 deletions
+31
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
+31
-2
No files found.
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
View file @
c6524ae3
...
@@ -371,20 +371,49 @@ public class ShoppingCartAdapter {
...
@@ -371,20 +371,49 @@ public class ShoppingCartAdapter {
private
void
checkMaterialProduct
(
CartGoods
cartGoods
,
ProductBeanDTO
spuProduct
)
{
private
void
checkMaterialProduct
(
CartGoods
cartGoods
,
ProductBeanDTO
spuProduct
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
return
;
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
return
;
ProductBeanDTO
.
SkuProductBean
skuProductBean
=
null
;
boolean
isSkuProduct
=
ObjectUtils
.
equals
(
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
());
if
(
isSkuProduct
){
if
(
CollectionUtils
.
isEmpty
(
spuProduct
.
getSkuList
())){
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
cartGoods
.
setProductMaterialList
(
new
ArrayList
<>());
return
;
}
else
{
skuProductBean
=
spuProduct
.
getSkuList
().
stream
().
filter
(
p
->
p
.
getSkuId
().
equals
(
cartGoods
.
getSkuId
())).
findFirst
().
orElse
(
null
);
if
(
skuProductBean
==
null
||
CollectionUtils
.
isEmpty
(
skuProductBean
.
getAdditionalGroupList
())){
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
cartGoods
.
setProductMaterialList
(
new
ArrayList
<>());
return
;
}
}
}
else
{
//加料信息为空
//加料信息为空
if
(
CollectionUtils
.
isEmpty
(
spuProduct
.
getAdditionalGroupList
()))
{
if
(
CollectionUtils
.
isEmpty
(
spuProduct
.
getAdditionalGroupList
()))
{
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
cartGoods
.
setProductMaterialList
(
new
ArrayList
<>());
cartGoods
.
setProductMaterialList
(
new
ArrayList
<>());
return
;
return
;
}
}
}
//提取加料信息
//提取加料信息
List
<
String
>
materialSpu
=
new
ArrayList
<>();
List
<
String
>
materialSpu
=
new
ArrayList
<>();
List
<
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
>
groupDetail
=
spuProduct
.
getAdditionalGroupList
().
get
(
0
).
getGroupDetail
();
HashMap
<
String
,
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
>
materialHash
=
new
HashMap
<>();
HashMap
<
String
,
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
>
materialHash
=
new
HashMap
<>();
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
:
groupDetail
)
{
if
(
isSkuProduct
){
List
<
ProductBeanDTO
.
ProductGroupType
>
groupList
=
skuProductBean
.
getAdditionalGroupList
();
for
(
ProductBeanDTO
.
ProductGroupType
groupDetail
:
groupList
)
{
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
:
groupDetail
.
getGroupDetail
())
{
materialHash
.
put
(
groupDetailType
.
getProductId
(),
groupDetailType
);
materialHash
.
put
(
groupDetailType
.
getProductId
(),
groupDetailType
);
materialSpu
.
add
(
groupDetailType
.
getProductId
());
materialSpu
.
add
(
groupDetailType
.
getProductId
());
}
}
}
}
else
{
List
<
ProductBeanDTO
.
ProductGroupType
>
groupList
=
spuProduct
.
getAdditionalGroupList
();
for
(
ProductBeanDTO
.
ProductGroupType
groupDetail
:
groupList
){
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
:
groupDetail
.
getGroupDetail
())
{
materialHash
.
put
(
groupDetailType
.
getProductId
(),
groupDetailType
);
materialSpu
.
add
(
groupDetailType
.
getProductId
());
}
}
}
//加车小料和商品小料没有交集则提示商品信息有异常
//加车小料和商品小料没有交集则提示商品信息有异常
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
().
stream
().
filter
(
e
->
materialSpu
.
contains
(
e
.
getSpuId
())).
collect
(
Collectors
.
toList
())))
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
().
stream
().
filter
(
e
->
materialSpu
.
contains
(
e
.
getSpuId
())).
collect
(
Collectors
.
toList
())))
{
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
...
...
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