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
9a5d07bd
Commit
9a5d07bd
authored
Dec 14, 2020
by
孙昱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sunyu::update::fix bug about groupProduct add Material
parent
2a6aa1ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
46 deletions
+28
-46
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+28
-46
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
9a5d07bd
...
...
@@ -612,10 +612,10 @@ public class ShoppingCartConvertAdapter {
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productCombo
:
cartGoods
.
getProductComboList
()){
//套餐子商品多规格商品
if
(
productCombo
.
getSpuId
()
==
null
&&
!
productCombo
.
getSkuId
().
equals
(
productCombo
.
getSpuId
())
){
updateComboxGoodsInfoForMCoffee
(
productCombo
,
spuProduct
,
true
);
updateComboxGoodsInfoForMCoffee
(
productCombo
,
spuProduct
,
true
,
null
);
}
else
{
//套餐子商品为单品
updateComboxGoodsInfoForMCoffee
(
productCombo
,
spuProduct
,
true
);
updateComboxGoodsInfoForMCoffee
(
productCombo
,
spuProduct
,
true
,
null
);
}
}
}
...
...
@@ -625,11 +625,11 @@ public class ShoppingCartConvertAdapter {
//套餐子商品多规格商品
if
(
comboxGoods
.
getSpuId
()
==
null
&&
!
comboxGoods
.
getSkuId
().
equals
(
comboxGoods
.
getSpuId
())
){
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
);
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
,
null
);
}
}
else
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
);
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
,
null
);
}
}
}
...
...
@@ -674,7 +674,8 @@ public class ShoppingCartConvertAdapter {
* @param isComboxGoods 是否是固定商品
* @return
*/
private
void
updateComboxGoodsInfoForMCoffee
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
,
ProductTypeBeanDTO
parentProductBean
,
boolean
isComboxGoods
)
{
private
void
updateComboxGoodsInfoForMCoffee
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
,
ProductTypeBeanDTO
parentProductBean
,
boolean
isComboxGoods
,
Map
<
String
,
ProductTypeBeanDTO
>
subProductTypeMap
)
{
if
(
"0"
.
equals
(
comboxGoods
.
getGoodsId
())){
return
;
}
...
...
@@ -720,24 +721,7 @@ public class ShoppingCartConvertAdapter {
//2020/12/10 套餐内可选商品加料
if
(
CollectionUtils
.
isNotEmpty
(
comboxGoods
.
getProductMaterialList
())){
if
(
CollectionUtils
.
isNotEmpty
(
parentProductBean
.
getAdditionalGroupList
()))
{
List
<
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
>
groupDetail
=
new
ArrayList
<>();
for
(
ProductTypeBeanDTO
.
ProductGroupType
productGroupType
:
parentProductBean
.
getAdditionalGroupList
()){
groupDetail
.
addAll
(
productGroupType
.
getGroupDetail
());
}
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
productMaterial
:
comboxGoods
.
getProductMaterialList
()){
for
(
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
detailType
:
groupDetail
){
if
(
detailType
.
getProductId
().
equals
(
productMaterial
.
getSpuId
())){
productMaterial
.
setSpuId
(
detailType
.
getProductId
());
productMaterial
.
setAmount
(
detailType
.
getProductFinalPrice
().
longValue
());
productMaterial
.
setFinalPrice
(
detailType
.
getProductFinalPrice
().
longValue
());
productMaterial
.
setOriginalAmount
(
detailType
.
getProductFinalPrice
().
longValue
());
productMaterial
.
setOriginalPrice
(
detailType
.
getProductFinalPrice
().
longValue
());
productMaterial
.
setSpuName
(
detailType
.
getProductName
());
}
}
}
}
resolveMaterialForProductGroup
(
comboxGoods
,
subProductTypeMap
);
}
}
...
...
@@ -811,19 +795,17 @@ public class ShoppingCartConvertAdapter {
/**
* 可选商品组加料处理逻辑
* @param cartGoods
* @param spuProduct
* @param comboxGoods
* @param subProductTypeMap
*/
private
void
resolveMaterialForProductGroup
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
cartGoods
,
ProductTypeBeanDTO
spuProduct
,
Map
<
String
,
ProductTypeBeanDTO
>
subProductTypeMap
){
private
void
resolveMaterialForProductGroup
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
,
Map
<
String
,
ProductTypeBeanDTO
>
subProductTypeMap
){
//可选商品加料信息提取
List
<
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
>
groupProductMaterial
=
new
ArrayList
<>();
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
:
cartGoods
.
getProductGroupList
())
{
groupProductMaterial
.
addAll
(
comboxGoods
.
getProductMaterialList
());
}
groupProductMaterial
.
addAll
(
comboxGoods
.
getProductMaterialList
());
if
(
null
!=
subProductTypeMap
&&
!
subProductTypeMap
.
isEmpty
())
{
ProductTypeBeanDTO
productTypeBeanDTO
=
subProductTypeMap
.
get
(
c
artGoods
);
ProductTypeBeanDTO
productTypeBeanDTO
=
subProductTypeMap
.
get
(
c
omboxGoods
.
getSkuId
()
);
if
(
CollectionUtils
.
isNotEmpty
(
productTypeBeanDTO
.
getAdditionalGroupList
())){
List
<
String
>
materialSpu
=
new
ArrayList
<>();
HashMap
<
String
,
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
>
materialHash
=
new
HashMap
<>();
...
...
@@ -840,15 +822,15 @@ public class ShoppingCartConvertAdapter {
//加车小料和商品小料没有交集则提示商品信息有异常
if
(
CollectionUtils
.
isEmpty
(
groupProductMaterial
.
stream
().
filter
(
e
->
materialSpu
.
contains
(
e
.
getSpuId
())).
collect
(
Collectors
.
toList
())))
{
cart
Goods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
c
art
Goods
.
setProductMaterialList
(
new
ArrayList
<>());
// combox
Goods.setGoodsType(com.freemud.sdk.api.assortment.shoppingcart.constant.GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType());
c
ombox
Goods
.
setProductMaterialList
(
new
ArrayList
<>());
return
;
}
ArrayList
<
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
>
materialGoodsList
=
new
ArrayList
<>();
Long
materialAmount
=
0L
;
Long
originalMaterAmount
=
0L
;
String
materialSubName
=
c
art
Goods
.
getSubName
();
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
materialGoods
:
c
art
Goods
.
getProductMaterialList
())
{
String
materialSubName
=
c
ombox
Goods
.
getSubName
();
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
materialGoods
:
c
ombox
Goods
.
getProductMaterialList
())
{
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
detail
=
materialHash
.
get
(
materialGoods
.
getSpuId
());
if
(
detail
==
null
)
continue
;
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
material
=
new
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
();
...
...
@@ -856,27 +838,27 @@ public class ShoppingCartConvertAdapter {
material
.
setSpuId
(
detail
.
getProductId
());
//行单价 \ 行总价
material
.
setFinalPrice
(
detail
.
getProductFinalPrice
().
longValue
());
material
.
setAmount
(
detail
.
getProductFinalPrice
().
longValue
()
*
c
art
Goods
.
getQty
());
material
.
setAmount
(
detail
.
getProductFinalPrice
().
longValue
()
*
c
ombox
Goods
.
getQty
());
//原行单价*数量
material
.
setOriginalAmount
(
detail
.
getProductFinalPrice
().
longValue
()
*
c
art
Goods
.
getQty
());
material
.
setOriginalAmount
(
detail
.
getProductFinalPrice
().
longValue
()
*
c
ombox
Goods
.
getQty
());
material
.
setOriginalPrice
(
detail
.
getProductFinalPrice
().
longValue
());
material
.
setCustomerCode
(
materialGoods
.
getCustomerCode
());
materialGoodsList
.
add
(
material
);
materialAmount
+=
detail
.
getProductFinalPrice
().
longValue
()
*
c
art
Goods
.
getQty
();
originalMaterAmount
+=
detail
.
getProductFinalPrice
().
longValue
()
*
c
art
Goods
.
getQty
();
materialAmount
+=
detail
.
getProductFinalPrice
().
longValue
()
*
c
ombox
Goods
.
getQty
();
originalMaterAmount
+=
detail
.
getProductFinalPrice
().
longValue
()
*
c
ombox
Goods
.
getQty
();
;
materialSubName
=
materialSubName
+
"/"
+
detail
.
getProductName
();
}
//设置购物车行记录
c
art
Goods
.
setProductMaterialList
(
materialGoodsList
);
c
ombox
Goods
.
setProductMaterialList
(
materialGoodsList
);
//加料行记录现价总价
c
art
Goods
.
setMaterialAmount
(
materialAmount
);
c
ombox
Goods
.
setMaterialAmount
(
materialAmount
);
//加料行记录原价总价
cart
Goods
.
setOriginalMaterialAmount
(
originalMaterAmount
);
// combox
Goods.setOriginalMaterialAmount(originalMaterAmount);
}
else
{
cart
Goods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
c
art
Goods
.
setProductMaterialList
(
new
ArrayList
<>());
// combox
Goods.setGoodsType(com.freemud.sdk.api.assortment.shoppingcart.constant.GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType());
c
ombox
Goods
.
setProductMaterialList
(
new
ArrayList
<>());
return
;
}
}
...
...
@@ -929,7 +911,7 @@ public class ShoppingCartConvertAdapter {
updateComboxGoodsInfoFor
(
productCombo
,
productBeanDTO
,
true
);
}
else
{
//套餐子商品为单品
updateComboxGoodsInfoForMCoffee
(
productCombo
,
spuProduct
,
true
);
updateComboxGoodsInfoForMCoffee
(
productCombo
,
spuProduct
,
true
,
null
);
}
}
}
...
...
@@ -939,11 +921,11 @@ public class ShoppingCartConvertAdapter {
//套餐子商品多规格商品
if
(
comboxGoods
.
getSpuId
()
!=
null
&&
!
comboxGoods
.
getSkuId
().
equals
(
comboxGoods
.
getSpuId
())
){
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
);
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
,
subProductTypeMap
);
}
}
else
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
);
updateComboxGoodsInfoForMCoffee
(
productGroup
,
spuProduct
,
false
,
subProductTypeMap
);
}
}
}
...
...
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