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
809cde27
Commit
809cde27
authored
Dec 09, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/feature/coco-payGift-刘鹏飞' into qa
parents
91ec3d82
f12264c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
+13
-7
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
View file @
809cde27
...
...
@@ -22,6 +22,7 @@ import com.freemud.application.sdk.api.log.ApiLog;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
...
...
@@ -61,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
());
}
// 第二件优惠活动,在点餐页需要给优惠商品单独显示一行
// 第二件优惠活动Map
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
goods
DiscountsMap
=
new
HashMap
<>();
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscountsMap
=
new
HashMap
<>();
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
half
DiscountsMap
=
new
HashMap
<>();
// 商品优惠信息
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscounts
=
discountResult
.
getGoods
();
if
(
goodsDiscounts
==
null
||
goodsDiscounts
.
isEmpty
()){
return
;
}
goodsDiscountsMap
=
goodsDiscounts
.
stream
().
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getCartGoodsUid
,
g
->
g
,(
k1
,
k2
)->
k1
));
goodsDiscounts
.
forEach
(
goodsDiscount
->{
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
oneGoodsDiscounts
=
goodsDiscount
.
getDiscounts
();
if
(
oneGoodsDiscounts
==
null
||
oneGoodsDiscounts
.
isEmpty
()){
...
...
@@ -77,7 +80,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
}
oneGoodsDiscounts
.
forEach
(
discount
->
{
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
);
}
});
...
...
@@ -98,13 +101,14 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
Integer
num
=
0
;
// 商品优惠的金额
Long
discountAmount
=
0L
;
if
(
goods
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
=
goods
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
());
if
(
half
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
=
half
DiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
());
if
(
discount
==
null
){
return
;
}
num
=
discount
.
getActualGoodsNumber
();
for
(
int
i
=
0
;
i
<
num
;
i
++){
// 第二件优惠活动,在点餐页需要给优惠商品单独显示一行
// 复制商品加到购物车
discountAmount
=
discount
.
getDiscount
();
Long
newPrice
=
product
.
getOriginalPrice
()
-
discountAmount
;
...
...
@@ -125,7 +129,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
// 只要符合条件就需要设置为空
// 因为前端指挥在半价行、赠品行上打标
// 前端是从商品活动信息中查找活动,在商品列表中找商品
if
(
gifeProductIds
.
contains
(
product
.
getGoodsId
(
))
||
!
Objects
.
equals
(
num
,
0
)){
if
(
(
gifeProductIds
.
contains
(
product
.
getGoodsId
())
&&
ObjectUtils
.
equals
(
product
.
getActivityType
(),
ActivityTypeEnum
.
TYPE_63
))
||
!
Objects
.
equals
(
num
,
0
)){
product
.
setGoodsId
(
null
);
}
...
...
@@ -136,6 +140,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
product
.
setActivityType
(
null
);
}
// 商品的现单价使用促销返回的现单价
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
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