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
ba65bb08
Commit
ba65bb08
authored
Jun 13, 2022
by
查志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
套餐无固搭购物车均摊优惠支持
parent
8b57fa97
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletions
+24
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+24
-1
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
ba65bb08
...
...
@@ -464,7 +464,8 @@ public class CalculationCommonService {
}
//设置行优惠
List
<
ActivityDiscountsDto
>
activityDiscountsDtoList
=
new
ArrayList
<>();
if
(
calculationGoods
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationGoods
.
getDiscounts
()))
{
if
(
null
!=
calculationGoods
)
{
if
(
CollectionUtils
.
isNotEmpty
(
calculationGoods
.
getDiscounts
())){
for
(
GoodsDiscount
discount
:
calculationGoods
.
getDiscounts
())
{
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
activityDiscountsDto
.
setActivityCode
(
discount
.
getActivityCode
());
...
...
@@ -474,6 +475,28 @@ public class CalculationCommonService {
activityDiscountsDto
.
setActualActivityGoodsNumber
(
discount
.
getActualGoodsNumber
());
activityDiscountsDtoList
.
add
(
activityDiscountsDto
);
}
}
else
if
(
CollectionUtils
.
isNotEmpty
(
calculationGoods
.
getSmallMaterial
()))
{
// fix 若套餐无固定搭配, 促销返回的均摊在父商品上是空的,这时需要把子商品的优惠放到父商品里
Map
<
Integer
,
ActivityDiscountsDto
>
map
=
new
HashMap
<>();
calculationGoods
.
getSmallMaterial
().
forEach
(
sm
->
{
if
(
CollectionUtils
.
isNotEmpty
(
sm
.
getDiscounts
()))
{
sm
.
getDiscounts
().
forEach
(
discount
->
{
Integer
type
=
this
.
convertType
(
discount
.
getType
());
ActivityDiscountsDto
dto
=
map
.
getOrDefault
(
type
,
new
ActivityDiscountsDto
());
dto
.
setActivityCode
(
discount
.
getActivityCode
());
dto
.
setActivityName
(
this
.
convertName
(
discount
.
getType
(),
discount
.
getActivityName
()));
dto
.
setActivityType
(
this
.
convertType
(
discount
.
getType
()));
dto
.
setDiscountAmount
(
Optional
.
ofNullable
(
dto
.
getDiscountAmount
()).
orElse
(
0
)
+
discount
.
getDiscount
().
intValue
());
dto
.
setActualActivityGoodsNumber
(
Optional
.
ofNullable
(
dto
.
getActualActivityGoodsNumber
()).
orElse
(
0
)
+
discount
.
getActualGoodsNumber
());
map
.
put
(
type
,
dto
);
});
}
});
//存到商品优惠里
map
.
forEach
((
type
,
dto
)
->
{
activityDiscountsDtoList
.
add
(
dto
);
});
}
}
cartGoodsDetailDto
.
setActivityDiscountsDtos
(
activityDiscountsDtoList
);
...
...
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