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
508efe29
Commit
508efe29
authored
Dec 07, 2020
by
孙昱
Browse files
Options
Browse Files
Download
Plain Diff
sunyu::update::merge code
parents
ec9aea7a
34275a17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
18 deletions
+73
-18
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+19
-9
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
+0
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+30
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
+24
-9
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
508efe29
...
...
@@ -509,7 +509,11 @@ public class ShoppingCartConvertAdapter {
?
cartGoods
.
getSkuId
()
:
cartGoods
.
getSpuId
());
// 应产品要求
// 普通商品,取商品的finalePrice(普通商品售价);套餐商品,取originalPrice(套餐价格)
productType
.
setPrice
(
cartGoods
.
getFinalPrice
()
==
null
?
0
:
cartGoods
.
getFinalPrice
().
intValue
());
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
));
...
...
@@ -638,8 +642,13 @@ public class ShoppingCartConvertAdapter {
//更新当前商品行价格
Long
newOrigOriginalPrice
=
0L
;
if
(
isSetMealProduct
)
{
newOrigOriginalPrice
+=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
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
();
}
...
...
@@ -852,22 +861,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
());
...
...
@@ -1031,5 +1042,4 @@ public class ShoppingCartConvertAdapter {
);
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
0 → 100644
View file @
508efe29
This diff is collapsed.
Click to expand it.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
508efe29
...
...
@@ -1369,6 +1369,36 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setTaxId
(
productBeanListSpuClass
.
get
(
0
).
getTaxId
());
}
//套餐商品赋值
if
(
ObjectUtils
.
equals
(
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
())){
cartGoods
.
setOriginalPrice
(
productBeanListSpuClass
.
get
(
0
).
getOriginalPrice
());
cartGoods
.
setFinalPrice
(
productBeanListSpuClass
.
get
(
0
).
getFinalPrice
());
cartGoods
.
setPackPrice
(
productBeanListSpuClass
.
get
(
0
).
getPackPrice
());
cartGoods
.
setCustomerCode
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
());
cartGoods
.
setName
(
productBeanListSpuClass
.
get
(
0
).
getName
());
cartGoods
.
setSpuName
(
productBeanListSpuClass
.
get
(
0
).
getName
());
cartGoods
.
setSkuName
(
productBeanListSpuClass
.
get
(
0
).
getName
());
cartGoods
.
setPic
(
productBeanListSpuClass
.
get
(
0
).
getPicture
());
cartGoods
.
setStockLimit
(
productBeanListSpuClass
.
get
(
0
).
getStockLimit
()
==
1
);
cartGoods
.
setTax
(
productBeanListSpuClass
.
get
(
0
).
getTax
());
cartGoods
.
setTaxId
(
productBeanListSpuClass
.
get
(
0
).
getTaxId
());
//套餐可选商品赋值
if
(
CollectionUtils
.
isNotEmpty
(
productBeanListSpuClass
.
get
(
0
).
getProductGroupList
())){
for
(
ProductBeanDTO
.
ProductGroupType
groupType
:
productBeanListSpuClass
.
get
(
0
).
getProductGroupList
())
{
if
(
CollectionUtils
.
isNotEmpty
(
groupType
.
getGroupDetail
())){
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
detailType
:
groupType
.
getGroupDetail
())
{
for
(
CartGoods
.
ComboxGoods
groupGoods
:
cartGoods
.
getProductGroupList
())
{
if
(
detailType
.
getProductId
().
equals
(
groupGoods
.
getGoodsId
()))
{
groupGoods
.
setFinalPrice
(
detailType
.
getMarkUpPrice
().
longValue
());
groupGoods
.
setOriginalPrice
(
detailType
.
getProductPrice
().
longValue
());
}
}
}
}
}
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
View file @
508efe29
package
cn
.
freemud
.
service
.
impl
.
mcoffee
.
calculation
;
import
cn.freemud.adapter.ShoppingCartConvertAdapter
;
import
cn.freemud.adapter.ShoppingCartMccafeAdapter
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto
;
import
cn.freemud.entities.dto.UserLoginInfoDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
...
...
@@ -38,6 +39,8 @@ public class SetMealCalculation {
@Autowired
private
ShoppingCartConvertAdapter
shoppingCartConvertAdapter
;
@Autowired
private
ShoppingCartMccafeAdapter
shoppingCartMccafeAdapter
;
public
void
updateShoppingCartGoodsDiscount
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
...
...
@@ -62,11 +65,15 @@ public class SetMealCalculation {
cartGoods
.
setPackPrice
(
cartGoods
.
getPackPrice
()
*
cartGoods
.
getQty
());
// 可选商品现总价
productGroupTotalAmount
=
0
l
;
long
productGroupAmount
=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()
*
t
.
getQty
()).
sum
();
long
productGroupAmount
=
null
==
cartGoods
.
getProductGroupList
()
?
0
:
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
(
null
!=
t
.
getFinalPrice
()
?
t
.
getFinalPrice
():
0
)
*
(
null
!=
t
.
getQty
()
?
t
.
getQty
():
0
)).
sum
();
productGroupTotalAmount
+=
productGroupAmount
*
cartGoods
.
getQty
();
// 固定商品现总价
long
productComboAmount
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()
*
t
.
getQty
()).
sum
();
long
productComboAmount
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
(
null
!=
t
.
getFinalPrice
()
?
t
.
getFinalPrice
():
0
)
*
(
null
!=
t
.
getQty
()
?
t
.
getQty
():
0
)).
sum
();
long
productComboTotalAmount
=
productComboAmount
*
cartGoods
.
getQty
();
long
materialPrice
=
0
l
;
...
...
@@ -79,15 +86,23 @@ public class SetMealCalculation {
comboxmaterialPrice
+=
null
!=
materialGoods
.
getFinalPrice
()
?
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
()
:
0
;
}
}
comboxGoods
.
setAmount
(
comboxGoods
.
getAmount
()+
comboxmaterialPrice
);
comboxGoods
.
setAmount
((
null
==
comboxGoods
.
getAmount
()
?
0
:
comboxGoods
.
getAmount
())+
comboxmaterialPrice
);
materialPrice
=
materialPrice
+
comboxmaterialPrice
;
}
}
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
);
cartGoods
.
setOriginalPrice
(
productComboTotalAmount
);
cartGoods
.
setAmount
(
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
);
cartGoods
.
setFinalPrice
(
productComboTotalAmount
);
Long
amount
=
null
!=
cartGoods
.
getFinalPrice
()
?
cartGoods
.
getFinalPrice
()*
cartGoods
.
getQty
()
+
productGroupTotalAmount
+
materialPrice
:
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
;
Long
comboOriginalPriceAmount
=
null
!=
cartGoods
.
getOriginalAmount
()
?
cartGoods
.
getOriginalAmount
()
:
productComboTotalAmount
;
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
comboOriginalPriceAmount
+
materialPrice
);
cartGoods
.
setOriginalPrice
(
null
!=
cartGoods
.
getOriginalPrice
()
?
cartGoods
.
getOriginalPrice
()
:
productComboTotalAmount
);
cartGoods
.
setAmount
(
amount
);
cartGoods
.
setFinalPrice
(
null
!=
cartGoods
.
getFinalPrice
()
?
cartGoods
.
getFinalPrice
()
:
productComboTotalAmount
);
// 套餐(固定商品)现价
// String toastMsg = getTotalAmount(cartGoods, productGroupAmount, numberMap, goodsMap);
...
...
@@ -131,11 +146,11 @@ public class SetMealCalculation {
int
productGroupDiscountAmount
=
cartGoods
.
getProductGroupList
().
stream
().
mapToInt
(
t
->
t
.
getFinalPrice
().
intValue
()
*
t
.
getQty
()).
sum
();
// totalDiscountAmount += discountAmount - productGroupDiscountAmount * cartGoods.getQty();
// 添加套餐父商品
ShoppingCartGoodsDto
.
CartGoodsDetailDto
parentCartGoods
=
shoppingCart
Convert
Adapter
.
convertCartGoods2DetailGoods
(
cartGoods
,
apportionGoods
,
duplicateGoodsMap
);
ShoppingCartGoodsDto
.
CartGoodsDetailDto
parentCartGoods
=
shoppingCart
Mccafe
Adapter
.
convertCartGoods2DetailGoods
(
cartGoods
,
apportionGoods
,
duplicateGoodsMap
);
// parentCartGoods.setTotalDiscountAmount(parentCartGoods.getTotalDiscountAmount()+ cartGoods.getOriginalAmount().intValue() - cartGoods.getAmount().intValue());
// parentCartGoods.getActivityDiscountsDtos().add(getActivityDiscountsDto(discountAmount - productGroupDiscountAmount * cartGoods.getQty()));
// 添加套餐固定商品&可选商品: 做均摊
parentCartGoods
.
setComboProducts
(
shoppingCart
Convert
Adapter
.
convertComboxGoods2DetailGoods
(
cartGoods
,
parentCartGoods
.
getTotalDiscountAmount
()));
parentCartGoods
.
setComboProducts
(
shoppingCart
Mccafe
Adapter
.
convertComboxGoods2DetailGoods
(
cartGoods
,
parentCartGoods
.
getTotalDiscountAmount
()));
cartGoodsDetailDtos
.
add
(
parentCartGoods
);
}
}
...
...
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