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
4ba1667c
Commit
4ba1667c
authored
Dec 13, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/feature/coco-payGift-刘鹏飞' into qa
parents
9bbd71c9
24adb33c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
43 deletions
+53
-43
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
+53
-43
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
View file @
4ba1667c
...
...
@@ -94,49 +94,11 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
});
if
(!
Objects
.
equals
(
flag
,
1
)){
// 非结算页
if
(!
Objects
.
equals
(
flag
,
1
)){
// 非结算页
orderingFoodPage
(
products
,
halfDiscountsMap
,
goodsDiscountsMap
,
gifeProductIds
,
shoppingCartGoodsResponseVo
);
}
else
{
// 结算页
// 第二件优惠活动(单品优惠)要把一行商品分成多行,且每行商品数量是1,同时要有两行是打活动标的
List
<
CartGoods
>
newProducts
=
new
ArrayList
<>();
if
(
products
==
null
||
products
.
isEmpty
()){
return
;
}
List
<
CartGoods
>
halfProduct
=
new
ArrayList
<>();
for
(
int
x
=
0
;
x
<
products
.
size
()
;
x
++){
CartGoods
product
=
products
.
get
(
x
);
// 这一行的商品参加了第二件优惠活动(单品优惠)
if
(
halfDiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
// 行商品数量
Integer
num
=
product
.
getQty
();
for
(
int
i
=
0
;
i
<
num
;
i
++){
// 构建半价行
CartGoods
cartGoods
=
new
CartGoods
();
if
(
i
<
2
){
cartGoods
=
buildNewLine
(
product
,
ActivityTypeEnum
.
TYPE_53
.
getCode
(),
1
,
product
.
getFinalPrice
(),
product
.
getGoodsId
());
}
else
{
cartGoods
=
buildNewLine
(
product
,
ActivityTypeEnum
.
TYPE_53
.
getCode
(),
1
,
product
.
getFinalPrice
(),
null
);
}
newProducts
.
add
(
cartGoods
);
}
continue
;
}
// 限时特检的现单价获取促销的现单价
// 商品是否参加特价
boolean
cutFlag
=
hashCutActive
(
goodsDiscountsMap
,
product
);
if
(
cutFlag
){
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
}
newProducts
.
add
(
product
);
}
shoppingCartGoodsResponseVo
.
setProducts
(
newProducts
);
settlementPage
(
products
,
halfDiscountsMap
,
goodsDiscountsMap
,
shoppingCartGoodsResponseVo
);
}
}
...
...
@@ -228,8 +190,55 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
return
newCartGoods
;
}
public
void
settlementPage
(){
/**
* 结算页
* @param products
* @param halfDiscountsMap
* @param goodsDiscountsMap
* @param shoppingCartGoodsResponseVo
*/
public
void
settlementPage
(
List
<
CartGoods
>
products
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
halfDiscountsMap
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscountsMap
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
){
// 第二件优惠活动(单品优惠)要把一行商品分成多行,且每行商品数量是1,同时要有两行是打活动标的
List
<
CartGoods
>
newProducts
=
new
ArrayList
<>();
if
(
products
==
null
||
products
.
isEmpty
()){
return
;
}
for
(
int
x
=
0
;
x
<
products
.
size
()
;
x
++){
CartGoods
product
=
products
.
get
(
x
);
// 这一行的商品参加了第二件优惠活动(单品优惠)
if
(
halfDiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
// 行商品数量
Integer
num
=
product
.
getQty
();
for
(
int
i
=
0
;
i
<
num
;
i
++){
// 构建半价行
CartGoods
cartGoods
=
new
CartGoods
();
if
(
i
<
2
){
cartGoods
=
buildNewLine
(
product
,
ActivityTypeEnum
.
TYPE_53
.
getCode
(),
1
,
product
.
getFinalPrice
(),
product
.
getGoodsId
());
}
else
{
cartGoods
=
buildNewLine
(
product
,
ActivityTypeEnum
.
TYPE_53
.
getCode
(),
1
,
product
.
getFinalPrice
(),
null
);
}
newProducts
.
add
(
cartGoods
);
}
continue
;
}
// 限时特检的现单价获取促销的现单价
// 商品是否参加特价
boolean
cutFlag
=
hashCutActive
(
goodsDiscountsMap
,
product
);
if
(
cutFlag
){
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
}
newProducts
.
add
(
product
);
}
shoppingCartGoodsResponseVo
.
setProducts
(
newProducts
);
}
/**
...
...
@@ -240,7 +249,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
* @param gifeProductIds
* @param shoppingCartGoodsResponseVo
*/
public
void
orderingFoodPage
(
List
<
CartGoods
>
products
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
halfDiscountsMap
,
public
void
orderingFoodPage
(
List
<
CartGoods
>
products
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
halfDiscountsMap
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscountsMap
,
List
<
String
>
gifeProductIds
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
){
...
...
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