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
82e65da2
Commit
82e65da2
authored
Feb 02, 2021
by
yu.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sunyu::fixbug::修复移除不满足门槛商品券后,价格未更新的bug
parent
d4c883dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+34
-7
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
82e65da2
...
...
@@ -79,14 +79,28 @@ public class CouponDiscountCalculation {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))))){
//订单级别优惠为空,则清除商品券信息,并且移除用券商品,更新商品价格
if
(
null
!=
calculationDiscountResult
&&
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())){
Boolean
removeCouponProduct
=
false
;
Iterator
<
CartGoods
>
cartGoodsIterator
=
cartGoodsList
.
iterator
();
while
(
cartGoodsIterator
.
hasNext
()){
if
(
StringUtils
.
isNotEmpty
(
cartGoodsIterator
.
next
().
getCouponCode
()))
{
cartGoodsIterator
.
remove
();
removeCouponProduct
=
true
;
break
;
}
}
Iterator
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
couponProduct
=
calculationDiscountResult
.
getGoods
().
iterator
();
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
while
(
removeCouponProduct
&&
couponProduct
.
hasNext
()){
if
(
couponProduct
.
next
().
getCartGoodsUid
().
equals
(
cartGoods
.
getCartGoodsUid
())){
calculationDiscountResult
.
setTotalAmount
(
calculationDiscountResult
.
getTotalAmount
()
-
couponProduct
.
next
().
getRealAmount
());
calculationDiscountResult
.
setOriginalTotalAmount
(
calculationDiscountResult
.
getOriginalTotalAmount
()
-
couponProduct
.
next
().
getOriginalPrice
());
couponProduct
.
remove
();
break
;
}
}
}
}
return
;
}
...
...
@@ -95,15 +109,28 @@ public class CouponDiscountCalculation {
return
;
}
//订单级别券优惠
//订单级别券优惠
,订单级别优惠为空,则清除商品券信息,并且移除用券商品,更新商品价格
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
calculationDiscountResult
.
getDiscounts
();
if
(
CollectionUtils
.
isEmpty
(
discounts
))
{
for
(
int
i
=
0
;
i
<
cartGoodsList
.
size
();
i
++)
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
()))
{
cartGoods
.
setCouponCode
(
""
);
cartGoods
.
setCouponName
(
""
);
cartGoodsList
.
set
(
i
,
cartGoods
);
for
(
CartGoods
cartGoods:
cartGoodsList
)
{
Boolean
removeCouponProduct
=
false
;
Iterator
<
CartGoods
>
cartGoodsIterator
=
cartGoodsList
.
iterator
();
while
(
cartGoodsIterator
.
hasNext
()){
if
(
StringUtils
.
isNotEmpty
(
cartGoodsIterator
.
next
().
getCouponCode
()))
{
cartGoodsIterator
.
remove
();
removeCouponProduct
=
true
;
break
;
}
}
Iterator
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
couponProduct
=
calculationDiscountResult
.
getGoods
().
iterator
();
while
(
removeCouponProduct
&&
couponProduct
.
hasNext
()){
if
(
couponProduct
.
next
().
getCartGoodsUid
().
equals
(
cartGoods
.
getCartGoodsUid
())){
calculationDiscountResult
.
setTotalAmount
(
calculationDiscountResult
.
getTotalAmount
()
-
couponProduct
.
next
().
getRealAmount
());
calculationDiscountResult
.
setOriginalTotalAmount
(
calculationDiscountResult
.
getOriginalTotalAmount
()
-
couponProduct
.
next
().
getOriginalPrice
());
couponProduct
.
remove
();
break
;
}
}
}
return
;
...
...
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