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
71cbb5c8
Commit
71cbb5c8
authored
Sep 07, 2021
by
胡敬轩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
券码可用券列表查询->购物车->促销新算价 小料活动优惠
parent
68471529
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ActivityAdapter.java
+24
-4
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ActivityAdapter.java
View file @
71cbb5c8
...
...
@@ -276,7 +276,7 @@ public class ActivityAdapter {
cartProduct
.
setRealAmount
(
discountGood
.
getRealAmount
()
+
triple
.
getLeft
());
cartProduct
.
setDiscountAmount
(
discountGood
.
getDiscountAmount
()+
triple
.
getMiddle
()
-
mealDiscountAmount
);
if
(
newCalculation
){
buildGoodDiscount
(
cartProduct
,
discountGood
.
getDiscounts
()
,
discountResult
.
getCouponSharedExclusive
());
buildGoodDiscount
(
cartProduct
,
discountGood
,
discountResult
.
getCouponSharedExclusive
());
}
goods
.
add
(
cartProduct
);
}
...
...
@@ -386,8 +386,8 @@ public class ActivityAdapter {
return
Pair
.
of
(
realAmount
,
discountAmount
);
}
private
void
buildGoodDiscount
(
CartProduct
cartProduct
,
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
discounts
,
Set
<
ActivityTypeSharedExclusive
>
couponSharedExclusive
){
if
(
CollectionUtils
.
isEmpty
(
discount
s
)){
private
void
buildGoodDiscount
(
CartProduct
cartProduct
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
discountGood
,
Set
<
ActivityTypeSharedExclusive
>
couponSharedExclusive
){
if
(
CollectionUtils
.
isEmpty
(
discount
Good
.
getDiscounts
()
)){
return
;
}
HashMap
<
Integer
,
Integer
>
cashExclusiveMap
=
new
HashMap
<>();
...
...
@@ -406,7 +406,7 @@ public class ActivityAdapter {
}
List
<
CartProduct
.
Discount
>
cartProductDiscountList
=
new
ArrayList
<>();
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
:
discount
s
){
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
:
discount
Good
.
getDiscounts
()
){
if
(
Objects
.
equals
(
discount
.
getType
(),
ActivityTypeEnum
.
TYPE_310
.
getCode
())){
continue
;
}
...
...
@@ -414,6 +414,10 @@ public class ActivityAdapter {
BeanUtils
.
copyProperties
(
discount
,
cartProductDiscount
);
cartProductDiscount
.
setActualGoodsNumber
(
discount
.
getAddOnQuantity
());
//小料或者可选搭配的优惠金额合并至主商品
long
smallDiscountAmount
=
getSmallActivityDiscountAmount
(
discountGood
.
getSmallMaterial
(),
discount
.
getType
());
cartProductDiscount
.
setDiscount
(
cartProductDiscount
.
getDiscount
()
+
smallDiscountAmount
);
//是否与代金券互斥
boolean
cashExclusive
=
Objects
.
equals
(
cashExclusiveMap
.
get
(
discount
.
getType
()),
YesOrNoEnum
.
NO
.
getCode
());
cartProductDiscount
.
setCashExclusive
(
cashExclusive
);
...
...
@@ -482,4 +486,20 @@ public class ActivityAdapter {
}
couponAvailableCartInfo
.
setDiscounts
(
cartDiscountList
);
}
private
Long
getSmallActivityDiscountAmount
(
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
smallMaterial
,
Integer
activityType
){
long
discountAmount
=
0
;
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
smallMaterial
)){
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
small
:
smallMaterial
){
if
(
CollectionUtils
.
isNotEmpty
(
small
.
getDiscounts
())){
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
smallDiscount
:
small
.
getDiscounts
()){
if
(
Objects
.
equals
(
smallDiscount
.
getType
(),
activityType
)){
discountAmount
+=
smallDiscount
.
getDiscount
();
}
}
}
}
}
return
discountAmount
;
}
}
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