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
f16d9b9c
Commit
f16d9b9c
authored
Mar 31, 2021
by
胡敬轩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结算页可用券列表改造
parent
c6cd445c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ActivityAdapter.java
+16
-8
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ActivityAdapter.java
View file @
f16d9b9c
...
...
@@ -350,6 +350,8 @@ public class ActivityAdapter {
couponAvailableCartInfo
.
setChannelIdList
(
orgCodes
);
Long
totalMealDiscountAmount
=
0L
;
//套餐优惠不算在内
Long
sendDiscountAmount
=
0L
;
//赠送和换购商品优惠不算在内
Long
sendRealAmount
=
0L
;
//赠送和换购商品实付不算在内
if
(
discountResult
!=
null
){
//已使用券
if
(
CollectionUtils
.
isNotEmpty
(
discountResult
.
getDiscounts
())){
...
...
@@ -365,11 +367,17 @@ public class ActivityAdapter {
if
(
CollectionUtils
.
isNotEmpty
(
discountResult
.
getGoods
())){
List
<
CartProduct
>
goods
=
new
ArrayList
<>();
for
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
discountGood
:
discountResult
.
getGoods
()){
//小料和可选搭配金额
Pair
<
Long
,
Long
>
pair
=
getSmallMaterialAmountSharing
(
discountGood
.
getSmallMaterial
());
//value1=总实付 value2=总优惠
if
(
Objects
.
equals
(
CalculationGoodsType
.
TYPE_1
.
getType
(),
discountGood
.
getCartGoodType
())
||
Objects
.
equals
(
CalculationGoodsType
.
TYPE_2
.
getType
(),
discountGood
.
getCartGoodType
())){
sendRealAmount
+=
discountGood
.
getRealAmount
()
+
pair
.
getFirst
();
sendDiscountAmount
+=
discountGood
.
getDiscountAmount
()
+
pair
.
getSecond
();
continue
;
}
CartProduct
cartProduct
=
new
CartProduct
();
cartProduct
.
setProductId
(
discountGood
.
getGoodsId
());
cartProduct
.
setQuantity
(
discountGood
.
getGoodsQuantity
());
//小料和可选搭配金额
Pair
<
Long
,
Long
>
pair
=
getSmallMaterialAmountSharing
(
discountGood
.
getSmallMaterial
());
//value1=总实付 value2=总优惠
Long
mealDiscountAmount
=
0L
;
//套餐优惠不算在内
if
(
CollectionUtils
.
isNotEmpty
(
discountGood
.
getDiscounts
())){
Optional
<
String
>
goodCoupon
=
discountGood
.
getDiscounts
().
stream
().
filter
(
goodsDiscount
->
Objects
.
equals
(
goodsDiscount
.
getType
(),
ActivityTypeEnum
.
TYPE_32
.
getCode
())
...
...
@@ -378,16 +386,16 @@ public class ActivityAdapter {
mealDiscountAmount
=
discountGood
.
getDiscounts
().
stream
().
filter
(
goodsDiscount
->
Objects
.
equals
(
goodsDiscount
.
getType
(),
ActivityTypeEnum
.
TYPE_310
.
getCode
())).
mapToLong
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
::
getDiscount
).
sum
();
}
cartProduct
.
setOriginalTotalAmount
(
discountGood
.
getRealAmount
()+
discountGood
.
getDiscountAmount
()
+
pair
.
getFirst
()
+
pair
.
getSecond
()
-
mealDiscountAmount
);
cartProduct
.
setRealAmount
(
discountGood
.
getRealAmount
()
+
pair
.
getFirst
());
cartProduct
.
setDiscountAmount
(
discountGood
.
getDiscountAmount
()+
pair
.
getSecond
()
-
mealDiscountAmount
);
cartProduct
.
setOriginalTotalAmount
(
discountGood
.
getRealAmount
()+
discountGood
.
getDiscountAmount
()
+
pair
.
getFirst
()
+
pair
.
getSecond
()
-
mealDiscountAmount
);
cartProduct
.
setRealAmount
(
discountGood
.
getRealAmount
()
+
pair
.
getFirst
());
cartProduct
.
setDiscountAmount
(
discountGood
.
getDiscountAmount
()+
pair
.
getSecond
()
-
mealDiscountAmount
);
goods
.
add
(
cartProduct
);
}
couponAvailableCartInfo
.
setProductList
(
goods
);
}
couponAvailableCartInfo
.
setOriginalTotalAmount
(
discountResult
.
getOriginalTotalAmount
()
-
totalMealDiscountAmount
);
couponAvailableCartInfo
.
setRealAmount
(
discountResult
.
getTotalAmount
());
couponAvailableCartInfo
.
setDiscountAmount
(
discountResult
.
getTotalDiscountAmount
()
-
totalMealDiscountAmount
);
couponAvailableCartInfo
.
setOriginalTotalAmount
(
discountResult
.
getOriginalTotalAmount
()
-
totalMealDiscountAmount
-
sendRealAmount
-
sendDiscountAmount
);
couponAvailableCartInfo
.
setRealAmount
(
discountResult
.
getTotalAmount
()
-
sendRealAmount
);
couponAvailableCartInfo
.
setDiscountAmount
(
discountResult
.
getTotalDiscountAmount
()
-
totalMealDiscountAmount
-
sendDiscountAmount
);
}
else
{
couponAvailableCartInfo
.
setProductList
(
new
ArrayList
<>());
couponAvailableCartInfo
.
setOriginalTotalAmount
(
0L
);
...
...
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