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
f12264c0
Commit
f12264c0
authored
Dec 09, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coco商品现单价使用促销返回的价格
parent
10eceb87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
+11
-6
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
View file @
f12264c0
...
@@ -62,15 +62,17 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -62,15 +62,17 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
gifeProductIds
=
products
.
stream
().
filter
(
product
->
Objects
.
equals
(
product
.
getActivityType
(),
ActivityTypeEnum
.
TYPE_63
.
getCode
())).
map
(
CartGoods:
:
getGoodsId
).
collect
(
Collectors
.
toList
());
gifeProductIds
=
products
.
stream
().
filter
(
product
->
Objects
.
equals
(
product
.
getActivityType
(),
ActivityTypeEnum
.
TYPE_63
.
getCode
())).
map
(
CartGoods:
:
getGoodsId
).
collect
(
Collectors
.
toList
());
}
}
// 第二件优惠活动,在点餐页需要给优惠商品单独显示一行
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscountsMap
=
new
HashMap
<>();
// 第二件优惠活动Map
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
goods
DiscountsMap
=
new
HashMap
<>();
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
half
DiscountsMap
=
new
HashMap
<>();
// 商品优惠信息
// 商品优惠信息
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscounts
=
discountResult
.
getGoods
();
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscounts
=
discountResult
.
getGoods
();
if
(
goodsDiscounts
==
null
||
goodsDiscounts
.
isEmpty
()){
if
(
goodsDiscounts
==
null
||
goodsDiscounts
.
isEmpty
()){
return
;
return
;
}
}
goodsDiscountsMap
=
goodsDiscounts
.
stream
().
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getCartGoodsUid
,
g
->
g
,(
k1
,
k2
)->
k1
));
goodsDiscounts
.
forEach
(
goodsDiscount
->{
goodsDiscounts
.
forEach
(
goodsDiscount
->{
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
oneGoodsDiscounts
=
goodsDiscount
.
getDiscounts
();
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
oneGoodsDiscounts
=
goodsDiscount
.
getDiscounts
();
if
(
oneGoodsDiscounts
==
null
||
oneGoodsDiscounts
.
isEmpty
()){
if
(
oneGoodsDiscounts
==
null
||
oneGoodsDiscounts
.
isEmpty
()){
...
@@ -78,7 +80,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -78,7 +80,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
}
}
oneGoodsDiscounts
.
forEach
(
discount
->
{
oneGoodsDiscounts
.
forEach
(
discount
->
{
if
(
Objects
.
equals
(
discount
.
getType
(),
ActivityTypeEnum
.
TYPE_53
.
getCode
())){
if
(
Objects
.
equals
(
discount
.
getType
(),
ActivityTypeEnum
.
TYPE_53
.
getCode
())){
goods
DiscountsMap
.
put
(
goodsDiscount
.
getCartGoodsUid
()
+
"-"
+
discount
.
getGoodsId
(),
discount
);
half
DiscountsMap
.
put
(
goodsDiscount
.
getCartGoodsUid
()
+
"-"
+
discount
.
getGoodsId
(),
discount
);
}
}
});
});
...
@@ -99,13 +101,14 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -99,13 +101,14 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
Integer
num
=
0
;
Integer
num
=
0
;
// 商品优惠的金额
// 商品优惠的金额
Long
discountAmount
=
0L
;
Long
discountAmount
=
0L
;
if
(
goods
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
if
(
half
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
=
goods
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
());
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
=
half
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
());
if
(
discount
==
null
){
if
(
discount
==
null
){
return
;
return
;
}
}
num
=
discount
.
getActualGoodsNumber
();
num
=
discount
.
getActualGoodsNumber
();
for
(
int
i
=
0
;
i
<
num
;
i
++){
for
(
int
i
=
0
;
i
<
num
;
i
++){
// 第二件优惠活动,在点餐页需要给优惠商品单独显示一行
// 复制商品加到购物车
// 复制商品加到购物车
discountAmount
=
discount
.
getDiscount
();
discountAmount
=
discount
.
getDiscount
();
Long
newPrice
=
product
.
getOriginalPrice
()
-
discountAmount
;
Long
newPrice
=
product
.
getOriginalPrice
()
-
discountAmount
;
...
@@ -137,6 +140,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -137,6 +140,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
product
.
setActivityType
(
null
);
product
.
setActivityType
(
null
);
}
}
// 商品的现单价使用促销返回的现单价
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
newProducts
.
add
(
product
);
newProducts
.
add
(
product
);
}
}
...
...
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