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
0f13bc7c
Commit
0f13bc7c
authored
Dec 08, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/feature/coco-payGift-刘鹏飞' into qa
parents
a25c77a1
cfce4c7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
9 deletions
+24
-9
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
+24
-9
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
View file @
0f13bc7c
...
...
@@ -25,6 +25,7 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
(
"cocoShoppingCartRelationService"
)
public
class
CocoShoppingCartRelationServiceImpl
implements
ShoppingCartRelationService
{
...
...
@@ -53,6 +54,16 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
shoppingCartGoodsResponseVo
.
setDiscounts
(
discounts
);
shoppingCartGoodsResponseVo
.
setGoods
(
discountResult
.
getGoods
());
List
<
CartGoods
>
products
=
shoppingCartGoodsResponseVo
.
getProducts
();
List
<
String
>
gifeProductIds
=
new
ArrayList
<>();
if
(
products
!=
null
&&
!
products
.
isEmpty
()){
// 获取赠品的商品id
gifeProductIds
=
products
.
stream
().
filter
(
product
->
Objects
.
equals
(
product
.
getActivityType
(),
ActivityTypeEnum
.
TYPE_63
)).
map
(
CartGoods:
:
getGoodsId
).
collect
(
Collectors
.
toList
());
}
// 第二件优惠活动,在点餐页需要给优惠商品单独显示一行
// 第二件优惠活动Map
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
goodsDiscountsMap
=
new
HashMap
<>();
...
...
@@ -76,14 +87,16 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
});
List
<
CartGoods
>
newProducts
=
new
ArrayList
<>();
List
<
CartGoods
>
products
=
shoppingCartGoodsResponseVo
.
getProducts
();
if
(!
Objects
.
equals
(
flag
,
1
)){
// 非结算页
if
(
products
==
null
||
products
.
isEmpty
()){
return
;
}
List
<
CartGoods
>
halfProduct
=
new
ArrayList
<>();
products
.
forEach
(
product
->
{
for
(
int
x
=
0
;
x
<
products
.
size
()
;
x
++){
CartGoods
product
=
products
.
get
(
x
);
// 要添加的半价行数量,该字段从促销返回
Integer
num
=
0
;
// 商品优惠的金额
...
...
@@ -109,16 +122,15 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
product
.
setAmount
(
product
.
getAmount
()
-
discountAmount
*
num
);
product
.
setOriginalAmount
(
product
.
getOriginalAmount
()
-
product
.
getOriginalPrice
()
*
num
);
product
.
setQty
(
newQty
);
// num不为0,全价行的活动类型就要设置成null
// 前端用这个字段控制能否加减
if
(!
Objects
.
equals
(
num
,
0
)){
product
.
setActivityType
(
null
);
if
(
gifeProductIds
.
contains
(
product
.
getGoodsId
())){
product
.
setGoodsId
(
null
);
}
newProducts
.
add
(
product
);
}
newProducts
.
addAll
(
halfProduct
);
});
}
shoppingCartGoodsResponseVo
.
setProducts
(
newProducts
);
}
...
...
@@ -134,6 +146,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
// 这个地方不要放置商品id,因为半价行的商品不打活动标签
// 前端会根据这个活动检索
newCartGoods
.
setGoodsType
(
cgs
.
getGoodsType
());
newCartGoods
.
setGoodsId
(
cgs
.
getGoodsId
());
newCartGoods
.
setSpuId
(
cgs
.
getSpuId
());
newCartGoods
.
setSkuId
(
cgs
.
getSkuId
());
newCartGoods
.
setSpecProductId
(
cgs
.
getSpecProductId
());
...
...
@@ -169,7 +182,9 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
newCartGoods
.
setSkuName
(
cgs
.
getSkuName
());
newCartGoods
.
setClassificationId
(
cgs
.
getClassificationId
());
newCartGoods
.
setClassificationName
(
cgs
.
getClassificationName
());
newCartGoods
.
setActivityType
(
activityType
);
// 所以这个字段设置为空
// 前端用这个字段控制能否加减
newCartGoods
.
setActivityType
(
null
);
newCartGoods
.
setQty
(
qty
);
return
newCartGoods
;
...
...
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