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
4f35569d
Commit
4f35569d
authored
Feb 18, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加料和可选搭配添加优惠计算
parent
4e872244
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+13
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+9
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+16
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
4f35569d
...
@@ -330,6 +330,12 @@ public class CartGoods {
...
@@ -330,6 +330,12 @@ public class CartGoods {
*/
*/
private
Long
amount
;
private
Long
amount
;
/**
/**
* 当前选择的优惠券优惠
*
*/
private
Integer
currentCouponDiscount
;
/**
* 购物车一行商品的数量
* 购物车一行商品的数量
*/
*/
private
Integer
qty
;
private
Integer
qty
;
...
@@ -573,6 +579,13 @@ public class CartGoods {
...
@@ -573,6 +579,13 @@ public class CartGoods {
private
Long
amount
;
private
Long
amount
;
/**
/**
* 当前选择的优惠券优惠
*
*/
private
Integer
currentCouponDiscount
;
/**
* 麦咖啡入机键位
* 麦咖啡入机键位
*/
*/
private
String
customerCode
;
private
String
customerCode
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
4f35569d
...
@@ -619,8 +619,15 @@ public class CouponServiceImpl implements CouponService {
...
@@ -619,8 +619,15 @@ public class CouponServiceImpl implements CouponService {
// todo :小料价格累加到主商品上
// todo :小料价格累加到主商品上
if
(
CollectionUtils
.
isNotEmpty
(
cartGood
.
getProductMaterialList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGood
.
getProductMaterialList
()))
{
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGood
.
getProductMaterialList
())
{
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGood
.
getProductMaterialList
())
{
product
.
setAmount
(
product
.
getAmount
()
+
materialGoods
.
getAmount
().
intValue
());
Integer
materialCurrentCouponDiscount
=
materialGoods
.
getCurrentCouponDiscount
()
!=
null
?
materialGoods
.
getCurrentCouponDiscount
()
:
0
;
totalAmount
=
totalAmount
+
materialGoods
.
getAmount
();
totalAmount
=
totalAmount
+
materialGoods
.
getAmount
()
+
materialCurrentCouponDiscount
;
}
}
// 可选搭配优惠累加到主商品上
if
(
CollectionUtils
.
isNotEmpty
(
cartGood
.
getProductGroupList
()))
{
for
(
CartGoods
.
ComboxGoods
comboxGoods
:
cartGood
.
getProductGroupList
())
{
Integer
comboxCurrentCouponDiscount
=
comboxGoods
.
getCurrentCouponDiscount
()
!=
null
?
comboxGoods
.
getCurrentCouponDiscount
()
:
0
;
totalAmount
=
totalAmount
+
comboxCurrentCouponDiscount
;
}
}
}
}
// 数量
// 数量
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
4f35569d
...
@@ -140,6 +140,14 @@ public class CalculationCommonService {
...
@@ -140,6 +140,14 @@ public class CalculationCommonService {
}
}
else
{
else
{
amount
+=
mt
.
getRealAmount
();
amount
+=
mt
.
getRealAmount
();
choice
.
setCurrentCouponDiscount
(
0
);
if
(
CollectionUtils
.
isNotEmpty
(
mt
.
getDiscounts
())){
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
mt
.
getDiscounts
().
stream
()
.
filter
(
p
->
p
.
getActivityCode
().
equals
(
couponCode
)).
findFirst
().
orElse
(
null
);
if
(
goodsDiscount
!=
null
){
choice
.
setCurrentCouponDiscount
(
goodsDiscount
.
getDiscount
()
==
null
?
0
:
goodsDiscount
.
getDiscount
().
intValue
());
}
}
choice
.
setAmount
(
mt
.
getRealAmount
().
longValue
());
choice
.
setAmount
(
mt
.
getRealAmount
().
longValue
());
}
}
originPrice
+=
choice
.
getFinalPrice
()
*
choice
.
getQty
()*
cartGoods
.
getQty
();
originPrice
+=
choice
.
getFinalPrice
()
*
choice
.
getQty
()*
cartGoods
.
getQty
();
...
@@ -158,6 +166,14 @@ public class CalculationCommonService {
...
@@ -158,6 +166,14 @@ public class CalculationCommonService {
for
(
CartGoods
.
MaterialGoods
mg
:
cartGoods
.
getProductMaterialList
())
{
for
(
CartGoods
.
MaterialGoods
mg
:
cartGoods
.
getProductMaterialList
())
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
sm
=
sChoices
.
get
(
mg
.
getSpuId
());
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
sm
=
sChoices
.
get
(
mg
.
getSpuId
());
if
(
sm
!=
null
)
{
if
(
sm
!=
null
)
{
mg
.
setCurrentCouponDiscount
(
0
);
if
(
CollectionUtils
.
isNotEmpty
(
sm
.
getDiscounts
())){
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
sm
.
getDiscounts
().
stream
()
.
filter
(
p
->
p
.
getActivityCode
().
equals
(
couponCode
)).
findFirst
().
orElse
(
null
);
if
(
goodsDiscount
!=
null
){
mg
.
setCurrentCouponDiscount
(
goodsDiscount
.
getDiscount
()
==
null
?
0
:
goodsDiscount
.
getDiscount
().
intValue
());
}
}
mg
.
setAmount
(
sm
.
getRealAmount
().
longValue
());
mg
.
setAmount
(
sm
.
getRealAmount
().
longValue
());
}
}
}
}
...
...
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