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
84454917
Commit
84454917
authored
Mar 09, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2020218-购物车加料优惠券fix-lcf'
parents
70385e1a
8256e773
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-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
+10
-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 @
84454917
...
...
@@ -332,6 +332,12 @@ public class CartGoods {
*/
private
Long
amount
;
/**
* 当前选择的优惠券优惠
*
*/
private
Integer
currentCouponDiscount
;
/**
* 购物车一行商品的数量
*/
private
Integer
qty
;
...
...
@@ -588,6 +594,13 @@ public class CartGoods {
private
Long
amount
;
/**
* 当前选择的优惠券优惠
*
*/
private
Integer
currentCouponDiscount
;
/**
* 麦咖啡入机键位
*/
private
String
customerCode
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
84454917
...
...
@@ -624,8 +624,16 @@ public class CouponServiceImpl implements CouponService {
// todo :小料价格累加到主商品上
if
(
CollectionUtils
.
isNotEmpty
(
cartGood
.
getProductMaterialList
()))
{
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGood
.
getProductMaterialList
())
{
product
.
setAmount
(
product
.
getAmount
()
+
materialGoods
.
getAmount
().
intValue
());
totalAmount
=
totalAmount
+
materialGoods
.
getAmount
();
Integer
materialCurrentCouponDiscount
=
materialGoods
.
getCurrentCouponDiscount
()
!=
null
?
materialGoods
.
getCurrentCouponDiscount
()
:
0
;
product
.
setAmount
(
product
.
getAmount
()
+
materialGoods
.
getAmount
().
intValue
()
+
materialCurrentCouponDiscount
);
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 @
84454917
...
...
@@ -140,6 +140,14 @@ public class CalculationCommonService {
}
else
{
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
());
}
originPrice
+=
choice
.
getFinalPrice
()
*
choice
.
getQty
()*
cartGoods
.
getQty
();
...
...
@@ -158,6 +166,14 @@ public class CalculationCommonService {
for
(
CartGoods
.
MaterialGoods
mg
:
cartGoods
.
getProductMaterialList
())
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
sm
=
sChoices
.
get
(
mg
.
getSpuId
());
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
());
}
...
...
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