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
c9025fff
Commit
c9025fff
authored
Apr 13, 2021
by
徐康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
套餐固定搭配单规格加料
parent
8a0532a2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
5 deletions
+79
-5
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+79
-5
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
c9025fff
...
@@ -755,6 +755,83 @@ public class ShoppingCartConvertAdapter {
...
@@ -755,6 +755,83 @@ public class ShoppingCartConvertAdapter {
}
}
}
}
/**
* 更新套餐固定商品、可选商品信息
*
* @param comboxGoods 固定商品或可选商品
* @param parentProductBean 套餐服商品
* @param isComboxGoods 是否是固定商品
* @return
*/
private
void
updateComboxGoodsInfoForMCoffeeWithMaterial
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
,
ProductTypeBeanDTO
parentProductBean
,
boolean
isComboxGoods
,
ProductTypeBeanDTO
productTypeBeanDTO
)
{
if
(
"0"
.
equals
(
comboxGoods
.
getGoodsId
())){
return
;
}
ProductTypeBeanDTO
.
ProductComboType
productComboType
=
new
ProductTypeBeanDTO
.
ProductComboType
();
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
=
new
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
();
if
(
isComboxGoods
)
{
productComboType
=
parentProductBean
.
getProductComboList
().
stream
().
filter
(
p
->
ObjectUtils
.
equals
(
comboxGoods
.
getGoodsId
(),
p
.
getProductId
())).
findFirst
().
orElse
(
new
ProductTypeBeanDTO
.
ProductComboType
());
}
else
{
Map
<
String
,
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
>
map
=
new
HashMap
<>();
parentProductBean
.
getProductGroupList
().
stream
().
map
(
t
->
t
.
getGroupDetail
()).
forEach
(
group
->
group
.
forEach
(
detailType
->
map
.
put
(
detailType
.
getProductId
(),
detailType
)));
groupDetailType
=
map
.
get
(
comboxGoods
.
getGoodsId
());
}
// 若是固定商品则取商品详情的FinalPrice,若是可选商品则取MarkUpPrice
Long
finalPrice
=
isComboxGoods
?
(
null
!=
productComboType
.
getFinalPrice
()
?
productComboType
.
getFinalPrice
().
longValue
()
:
0L
)
:
(
null
!=
groupDetailType
.
getMarkUpPrice
()
?
groupDetailType
.
getMarkUpPrice
().
longValue
()
:
0L
);
// 设置商品详情
Map
<
String
,
String
>
attributes
=
getAttributesNew
(
comboxGoods
.
getExtra
());
comboxGoods
.
setSpuId
(
comboxGoods
.
getSpuId
());
comboxGoods
.
setName
(
isComboxGoods
?
productComboType
.
getProductName
()
:
groupDetailType
.
getProductName
());
comboxGoods
.
setSpuName
(
comboxGoods
.
getName
());
comboxGoods
.
setSpecProductId
(
attributes
.
get
(
ATTRIBUTEID
));
comboxGoods
.
setSubName
(
attributes
.
get
(
ATTRIBUTENAME
));
comboxGoods
.
setPic
(
isComboxGoods
?
productComboType
.
getPicture
()
:
groupDetailType
.
getPicture
());
comboxGoods
.
setOriginalPrice
(
isComboxGoods
?
(
null
!=
productComboType
.
getFinalPrice
()
?
productComboType
.
getFinalPrice
().
longValue
()
:
0L
)
:
(
null
!=
groupDetailType
.
getProductFinalPrice
()
?
groupDetailType
.
getProductFinalPrice
().
longValue
()
:
0L
));
comboxGoods
.
setOriginalAmount
(
comboxGoods
.
getOriginalPrice
()
*
comboxGoods
.
getQty
());
comboxGoods
.
setAmount
(
finalPrice
*
comboxGoods
.
getQty
());
comboxGoods
.
setCustomerCode
(
isComboxGoods
?
(
StringUtils
.
isNotEmpty
(
productComboType
.
getCustomerCode
())
?
productComboType
.
getCustomerCode
()
:
""
)
:
(
StringUtils
.
isNotEmpty
(
groupDetailType
.
getCustomerCode
())
?
groupDetailType
.
getCustomerCode
()
:
""
));
comboxGoods
.
setFinalPrice
(
finalPrice
);
comboxGoods
.
setWeightType
(
isComboxGoods
?
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
productComboType
.
getWeightType
())
:
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
groupDetailType
.
getWeightType
()));
comboxGoods
.
setUnit
(
isComboxGoods
?
(
StringUtils
.
isNotEmpty
(
productComboType
.
getUnit
())
?
productComboType
.
getUnit
()
:
""
)
:
(
StringUtils
.
isNotEmpty
(
groupDetailType
.
getUnit
())
?
groupDetailType
.
getUnit
()
:
""
));
comboxGoods
.
setWeight
(
isComboxGoods
?
(
null
==
productComboType
.
getWeight
()
?
0
:
productComboType
.
getWeight
())
:
(
null
==
groupDetailType
.
getWeight
()
?
0
:
groupDetailType
.
getWeight
()));
comboxGoods
.
setTax
(
isComboxGoods
?
(
null
==
productComboType
.
getTax
()
?
0
:
productComboType
.
getTax
())
:
(
null
==
groupDetailType
.
getTax
()
?
0
:
groupDetailType
.
getTax
()));
comboxGoods
.
setTaxId
(
isComboxGoods
?
(
StringUtils
.
isNotEmpty
(
productComboType
.
getTaxId
())
?
productComboType
.
getTaxId
()
:
""
)
:
(
StringUtils
.
isNotEmpty
(
groupDetailType
.
getTaxId
())
?
groupDetailType
.
getTaxId
()
:
""
));
//2020/10/22 套餐内可选商品加料,暂无
if
(
CollectionUtils
.
isNotEmpty
(
comboxGoods
.
getProductMaterialList
())){
if
(
CollectionUtils
.
isNotEmpty
(
productTypeBeanDTO
.
getAdditionalGroupList
()))
{
List
<
ProductTypeBeanDTO
.
ProductGroupType
>
productGroupTypes
=
productTypeBeanDTO
.
getAdditionalGroupList
();
Map
<
String
,
List
<
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
>>
productGroupTypeMap
=
productGroupTypes
.
stream
().
collect
(
Collectors
.
toMap
(
ProductTypeBeanDTO
.
ProductGroupType
::
getGroupCode
,
ProductTypeBeanDTO
.
ProductGroupType
::
getGroupDetail
,
(
k1
,
k2
)
->
k1
));
comboxGoods
.
getProductMaterialList
().
stream
().
forEach
(
o
->
{
List
<
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
>
list
=
productGroupTypeMap
.
get
(
o
.
getCustomerCode
().
split
(
"_"
)[
0
]);
for
(
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType1
:
list
)
{
if
(
groupDetailType1
.
getProductId
()
==
o
.
getSpuId
())
{
o
.
setAmount
(
groupDetailType1
.
getProductFinalPrice
().
longValue
());
o
.
setFinalPrice
(
groupDetailType1
.
getProductFinalPrice
().
longValue
());
o
.
setOriginalAmount
(
groupDetailType1
.
getProductFinalPrice
().
longValue
());
o
.
setOriginalPrice
(
groupDetailType1
.
getProductFinalPrice
().
longValue
());
o
.
setSpuName
(
groupDetailType1
.
getProductName
());
break
;
}
}
});
}
else
{
comboxGoods
.
setProductMaterialList
(
new
ArrayList
<>());
}
}
}
/**
/**
* 更新套餐可选商品加料信息
* 更新套餐可选商品加料信息
...
@@ -955,8 +1032,7 @@ public class ShoppingCartConvertAdapter {
...
@@ -955,8 +1032,7 @@ public class ShoppingCartConvertAdapter {
updateComboxGoodsInfoFor
(
productCombo
,
productBeanDTO
,
true
);
updateComboxGoodsInfoFor
(
productCombo
,
productBeanDTO
,
true
);
}
else
{
}
else
{
//套餐子商品为单品
//套餐子商品为单品
// updateComboxGoodsInfoForMCoffee(productCombo, spuProduct, true);
updateComboxGoodsInfoForMCoffeeWithMaterial
(
productCombo
,
spuProduct
,
true
,
subProductTypeMap
.
get
(
productCombo
.
getGoodsId
()));
updateComboxGoodsInfoFor
(
productCombo
,
spuProduct
,
true
);
}
}
}
}
}
}
...
@@ -970,9 +1046,7 @@ public class ShoppingCartConvertAdapter {
...
@@ -970,9 +1046,7 @@ public class ShoppingCartConvertAdapter {
}
}
}
else
{
}
else
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
// updateComboxGoodsInfoForMCoffee(productGroup, spuProduct, false);
updateComboxGoodsInfoForMCoffeeProductGroup
(
productGroup
,
spuProduct
,
subProductTypeMap
,
false
);
updateComboxGoodsInfoForMCoffeeProductGroup
(
productGroup
,
spuProduct
,
subProductTypeMap
,
false
);
}
}
}
}
}
}
...
...
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