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
195403a0
Commit
195403a0
authored
Dec 14, 2020
by
孙昱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sunyu::updaet::fix bug about groupProduct add Material
parent
fabd82a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
19 deletions
+38
-19
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+38
-19
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
195403a0
...
...
@@ -380,8 +380,8 @@ public class ShoppingCartConvertAdapter {
cartGoods
.
setCreateTimeMili
(
cartGood
.
getCreateTimeMili
());
cartGoods
.
setSkuName
(
cartGood
.
getSkuName
());
cartGoods
.
setSkuName
(
cartGood
.
getSkuName
());
cartGood
.
setClassificationId
(
cartGood
.
getClassificationId
());
cartGood
.
setClassificationName
(
cartGood
.
getClassificationName
());
cartGood
s
.
setClassificationId
(
cartGood
.
getClassificationId
());
cartGood
s
.
setClassificationName
(
cartGood
.
getClassificationName
());
cartGoods
.
setActivityType
(
ActivityTypeEnum
.
TYPE_61
.
getCode
());
return
cartGoods
;
}
...
...
@@ -505,7 +505,11 @@ public class ShoppingCartConvertAdapter {
?
cartGoods
.
getSkuId
()
:
cartGoods
.
getSpuId
());
// 应产品要求
// 普通商品,取商品的finalePrice(普通商品售价);套餐商品,取originalPrice(套餐价格)
if
(
ObjectUtils
.
equals
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
())){
productType
.
setPrice
(
null
==
cartGoods
.
getOriginalPrice
()
?
0
:
cartGoods
.
getOriginalPrice
().
intValue
());
}
else
{
productType
.
setPrice
(
cartGoods
.
getFinalPrice
()
==
null
?
0
:
cartGoods
.
getFinalPrice
().
intValue
());
}
productType
.
setValidatePrice
(
productType
.
getPrice
()
==
0
?
0
:
1
);
productType
.
setValidateAttribute
(
1
);
productType
.
setValidateStatuses
(
Arrays
.
asList
(
2
));
...
...
@@ -634,7 +638,11 @@ public class ShoppingCartConvertAdapter {
//更新当前商品行价格
Long
newOrigOriginalPrice
=
0L
;
if
(
isSetMealProduct
)
{
if
(
null
!=
cartGoods
.
getOriginalPrice
()
&&
cartGoods
.
getOriginalPrice
()>
0
){
newOrigOriginalPrice
+=
cartGoods
.
getOriginalPrice
();
}
else
{
newOrigOriginalPrice
+=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
}
newOrigOriginalPrice
+=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
}
else
{
newOrigOriginalPrice
=
isSkuProduct
?
skuProduct
.
getFinalPrice
()
:
spuProduct
.
getFinalPrice
();
...
...
@@ -676,12 +684,15 @@ public class ShoppingCartConvertAdapter {
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
<>();
if
(
CollectionUtils
.
isNotEmpty
(
parentProductBean
.
getAdditionalGroupList
())){
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
?
productComboType
.
getFinalPrice
().
longValue
()
:
groupDetailType
.
getMarkUpPrice
().
longValue
();
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
());
...
...
@@ -690,26 +701,32 @@ public class ShoppingCartConvertAdapter {
comboxGoods
.
setSpecProductId
(
attributes
.
get
(
ATTRIBUTEID
));
comboxGoods
.
setSubName
(
attributes
.
get
(
ATTRIBUTENAME
));
comboxGoods
.
setPic
(
isComboxGoods
?
productComboType
.
getPicture
()
:
groupDetailType
.
getPicture
());
comboxGoods
.
setOriginalPrice
(
isComboxGoods
?
productComboType
.
getFinalPrice
().
longValue
()
:
groupDetailType
.
getProductFinalPrice
().
longValue
());
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
?
productComboType
.
getCustomerCode
()
:
groupDetailType
.
getCustomerCode
());
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
?
productComboType
.
getUnit
()
:
groupDetailType
.
getUnit
());
comboxGoods
.
setWeight
(
isComboxGoods
?
productComboType
.
getWeight
()
:
groupDetailType
.
getWeight
());
comboxGoods
.
setTax
(
isComboxGoods
?
productComboType
.
getTax
()
:
groupDetailType
.
getTax
());
comboxGoods
.
setTaxId
(
isComboxGoods
?
productComboType
.
getTaxId
()
:
groupDetailType
.
getTaxId
());
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/12/10 套餐内可选商品加料
if
(
CollectionUtils
.
isNotEmpty
(
comboxGoods
.
getProductMaterialList
())){
if
(
CollectionUtils
.
isNotEmpty
(
parentProductBean
.
getAdditionalGroupList
()))
{
List
<
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
>
groupDetail
=
new
ArrayList
<>();
for
(
ProductBeanDTO
.
ProductGroupType
productGroupType
:
parentProductBean
.
getAdditionalGroupList
()){
List
<
Product
Type
BeanDTO
.
ProductGroupType
.
GroupDetailType
>
groupDetail
=
new
ArrayList
<>();
for
(
Product
Type
BeanDTO
.
ProductGroupType
productGroupType
:
parentProductBean
.
getAdditionalGroupList
()){
groupDetail
.
addAll
(
productGroupType
.
getGroupDetail
());
}
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
productMaterial
:
comboxGoods
.
getProductMaterialList
()){
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
detailType
:
groupDetail
){
for
(
Product
Type
BeanDTO
.
ProductGroupType
.
GroupDetailType
detailType
:
groupDetail
){
if
(
detailType
.
getProductId
().
equals
(
productMaterial
.
getSpuId
())){
productMaterial
.
setSpuId
(
detailType
.
getProductId
());
productMaterial
.
setAmount
(
detailType
.
getProductFinalPrice
().
longValue
());
...
...
@@ -846,7 +863,7 @@ public class ShoppingCartConvertAdapter {
//套餐可选商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
()))
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
:
cartGoods
.
getProductGroupList
()){
ProductBeanDTO
productBeanDTO
=
subProductTypeMap
.
get
(
comboxGoods
.
getSpuId
());
Product
Type
BeanDTO
productBeanDTO
=
subProductTypeMap
.
get
(
comboxGoods
.
getSpuId
());
//套餐子商品多规格商品
if
(
comboxGoods
.
getSpuId
()
!=
null
&&
!
comboxGoods
.
getSkuId
().
equals
(
comboxGoods
.
getSpuId
())
){
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
productGroup
:
cartGoods
.
getProductGroupList
())
{
...
...
@@ -863,22 +880,24 @@ public class ShoppingCartConvertAdapter {
//更新当前商品行价格
Long
newOrigOriginalPrice
=
0L
;
if
(
isSetMealProduct
)
{
Long
comboxGoodsFinalPrice
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()).
sum
();
Long
comboxGoodsOriginalPrice
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
Long
groupGoodsOriginalPrice
=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
Long
comboxGoodsFinalPrice
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()).
sum
();
Long
groupGoodsFinalPrice
=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()).
sum
();
cartGoods
.
setOriginalPrice
(
comboxGoodsOriginalPrice
);
cartGoods
.
setOriginalAmount
((
comboxGoodsOriginalPrice
+
groupGoodsOriginalPrice
)*
cartGoods
.
getQty
()
);
cartGoods
.
set
Amount
((
comboxGoodsFinalPrice
+
groupGoodsFinalPrice
)
*
cartGoods
.
getQty
());
cartGoods
.
setOriginalPrice
(
null
!=
cartGoods
.
getOriginalPrice
()?
cartGoods
.
getOriginalPrice
()
:
comboxGoodsOriginalPrice
);
cartGoods
.
set
OriginalAmount
((
cartGoods
.
getOriginalPrice
()+
groupGoodsOriginalPrice
)
*
cartGoods
.
getQty
());
//咨询商品服务,套餐售价取originalPrice
cartGoods
.
setFinalPrice
(
comboxGoodsFinalPrice
);
cartGoods
.
setFinalPrice
(
null
!=
cartGoods
.
getOriginalPrice
()
?
cartGoods
.
getOriginalPrice
()
:
comboxGoodsFinalPrice
);
cartGoods
.
setAmount
((
cartGoods
.
getFinalPrice
()+
groupGoodsFinalPrice
)
*
cartGoods
.
getQty
());
}
else
{
newOrigOriginalPrice
=
isSkuProduct
?
skuProduct
.
getFinalPrice
()
:
spuProduct
.
getFinalPrice
();
cartGoods
.
setOriginalPrice
(
newOrigOriginalPrice
);
cartGoods
.
setOriginalAmount
(
newOrigOriginalPrice
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
(
newOrigOriginalPrice
*
cartGoods
.
getQty
());
//咨询商品服务,套餐售价取originalPrice
cartGoods
.
setFinalPrice
(
isSkuProduct
?
skuProduct
.
get
F
inalPrice
()
:
spuProduct
.
getFinalPrice
());
cartGoods
.
setFinalPrice
(
isSkuProduct
?
skuProduct
.
get
Orig
inalPrice
()
:
spuProduct
.
getFinalPrice
());
}
cartGoods
.
setWeight
(
isSkuProduct
?
skuProduct
.
getWeight
()
:
spuProduct
.
getWeight
());
cartGoods
.
setUnit
(
isSkuProduct
?
skuProduct
.
getUnit
()
:
spuProduct
.
getUnit
());
...
...
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