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
e4053a11
Commit
e4053a11
authored
Dec 07, 2020
by
缪晖
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2.0.1-collageOrder-刘鹏飞' into 'develop'
限时特价及组合优惠修改 See merge request
!55
parents
89ba45af
9ce4acdf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/SetMealServiceImpl.java
+5
-5
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/TimeSalePromotionService.java
+2
-2
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/SetMealServiceImpl.java
View file @
e4053a11
...
@@ -50,7 +50,7 @@ public class SetMealServiceImpl implements IPromotionService {
...
@@ -50,7 +50,7 @@ public class SetMealServiceImpl implements IPromotionService {
Map
<
String
,
Integer
>
numberMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
numberMap
=
new
HashMap
<>();
// 当前商品行现价
// 当前商品行现价
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
=
calculationDiscountResult
.
getGoods
().
parallelStream
()
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
=
calculationDiscountResult
.
getGoods
().
parallelStream
()
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
get
GoodsI
d
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
get
CartGoodsUi
d
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
// 设置商品原价与商品现价的初始值
// 设置商品原价与商品现价的初始值
for
(
CartGoods
cartGoods
:
setMealProducts
)
{
for
(
CartGoods
cartGoods
:
setMealProducts
)
{
...
@@ -139,19 +139,19 @@ public class SetMealServiceImpl implements IPromotionService {
...
@@ -139,19 +139,19 @@ public class SetMealServiceImpl implements IPromotionService {
*/
*/
private
String
getTotalAmount
(
CartGoods
cartGoods
,
long
productGroupAmount
,
Map
<
String
,
Integer
>
numberMap
,
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
)
{
private
String
getTotalAmount
(
CartGoods
cartGoods
,
long
productGroupAmount
,
Map
<
String
,
Integer
>
numberMap
,
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
)
{
if
(
goodsMap
.
isEmpty
()||
goodsMap
.
get
(
cartGoods
.
get
GoodsI
d
()).
getDiscountAmount
()
==
0
)
{
if
(
goodsMap
.
isEmpty
()||
goodsMap
.
get
(
cartGoods
.
get
CartGoodsUi
d
()).
getDiscountAmount
()
==
0
)
{
cartGoods
.
setAmount
((
cartGoods
.
getFinalPrice
()
+
productGroupAmount
)
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
((
cartGoods
.
getFinalPrice
()
+
productGroupAmount
)
*
cartGoods
.
getQty
());
return
""
;
return
""
;
}
}
if
(
numberMap
.
get
(
cartGoods
.
getGoodsId
())
==
null
)
{
if
(
numberMap
.
get
(
cartGoods
.
getGoodsId
())
==
null
)
{
int
actualGoodsNumber
=
goodsMap
.
get
(
cartGoods
.
get
GoodsI
d
()).
getDiscounts
().
stream
().
mapToInt
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
::
getActualGoodsNumber
)
int
actualGoodsNumber
=
goodsMap
.
get
(
cartGoods
.
get
CartGoodsUi
d
()).
getDiscounts
().
stream
().
mapToInt
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
::
getActualGoodsNumber
)
.
min
().
orElse
(
goodsMap
.
get
(
cartGoods
.
get
GoodsI
d
()).
getGoodsQuantity
());
.
min
().
orElse
(
goodsMap
.
get
(
cartGoods
.
get
CartGoodsUi
d
()).
getGoodsQuantity
());
numberMap
.
put
(
cartGoods
.
getGoodsId
(),
actualGoodsNumber
);
numberMap
.
put
(
cartGoods
.
getGoodsId
(),
actualGoodsNumber
);
}
}
// 可优惠数量
// 可优惠数量
Integer
number
=
numberMap
.
get
(
cartGoods
.
getGoodsId
());
Integer
number
=
numberMap
.
get
(
cartGoods
.
getGoodsId
());
if
(
number
>
0
)
{
if
(
number
>
0
)
{
Long
nowPrice
=
goodsMap
.
get
(
cartGoods
.
get
GoodsI
d
()).
getNowPrice
();
Long
nowPrice
=
goodsMap
.
get
(
cartGoods
.
get
CartGoodsUi
d
()).
getNowPrice
();
//套餐固定商品价格
//套餐固定商品价格
long
productComboxAmount
=
cartGoods
.
getQty
()
>
number
?
number
*
nowPrice
+
(
cartGoods
.
getQty
()
-
number
)
*
cartGoods
.
getFinalPrice
()
:
cartGoods
.
getQty
()
*
nowPrice
;
long
productComboxAmount
=
cartGoods
.
getQty
()
>
number
?
number
*
nowPrice
+
(
cartGoods
.
getQty
()
-
number
)
*
cartGoods
.
getFinalPrice
()
:
cartGoods
.
getQty
()
*
nowPrice
;
cartGoods
.
setAmount
(
productComboxAmount
+
productGroupAmount
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
(
productComboxAmount
+
productGroupAmount
*
cartGoods
.
getQty
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/TimeSalePromotionService.java
View file @
e4053a11
...
@@ -44,14 +44,14 @@ public class TimeSalePromotionService implements IPromotionService {
...
@@ -44,14 +44,14 @@ public class TimeSalePromotionService implements IPromotionService {
}
}
String
toastMsg
=
null
;
String
toastMsg
=
null
;
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
=
goodsList
.
parallelStream
()
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
=
goodsList
.
parallelStream
()
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
get
GoodsI
d
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
get
CartGoodsUi
d
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
// 存储当前享受限时特价折扣的商品数量,key:goodsId; value:可享受数量
// 存储当前享受限时特价折扣的商品数量,key:goodsId; value:可享受数量
Map
<
String
,
Integer
>
numberMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
numberMap
=
new
HashMap
<>();
List
<
Integer
>
discounts
=
Arrays
.
asList
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
ActivityTypeEnum
.
TYPE_21
.
getCode
());
List
<
Integer
>
discounts
=
Arrays
.
asList
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
ActivityTypeEnum
.
TYPE_21
.
getCode
());
String
uid
=
""
;
String
uid
=
""
;
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
goods
;
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
goods
;
if
((
goods
=
goodsMap
.
get
(
cartGoods
.
get
GoodsI
d
()))
==
null
)
{
if
((
goods
=
goodsMap
.
get
(
cartGoods
.
get
CartGoodsUi
d
()))
==
null
)
{
continue
;
continue
;
}
}
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
getGoodsDiscount
(
goods
.
getDiscounts
(),
discounts
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
getGoodsDiscount
(
goods
.
getDiscounts
(),
discounts
);
...
...
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