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
32b33b9f
Commit
32b33b9f
authored
Dec 15, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coco结算页商品现单价添加小料的计算
parent
0270a33f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
18 deletions
+36
-18
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
+36
-18
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/shoppingCart/impl/CocoShoppingCartRelationServiceImpl.java
View file @
32b33b9f
...
@@ -99,7 +99,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -99,7 +99,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
// 非结算页
// 非结算页
orderingFoodPage
(
products
,
halfDiscountsMap
,
goodsDiscountsMap
,
gifeProductIds
,
shoppingCartGoodsResponseVo
);
orderingFoodPage
(
products
,
halfDiscountsMap
,
goodsDiscountsMap
,
gifeProductIds
,
shoppingCartGoodsResponseVo
);
}
else
{
// 结算页
}
else
{
// 结算页
settlementPage
(
products
,
halfDiscountsMap
,
goodsDiscountsMap
,
shoppingCartGoodsResponseVo
);
settlementPage
(
products
,
halfDiscountsMap
,
goodsDiscountsMap
,
shoppingCartGoodsResponseVo
,
gifeProductIds
);
}
}
}
}
...
@@ -202,7 +202,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -202,7 +202,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
public
void
settlementPage
(
List
<
CartGoods
>
products
,
public
void
settlementPage
(
List
<
CartGoods
>
products
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
halfDiscountsMap
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
halfDiscountsMap
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscountsMap
,
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsDiscountsMap
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
){
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
List
<
String
>
gifeProductIds
){
// 第二件优惠活动(单品优惠)要把一行商品分成多行,且每行商品数量是1,同时要有两行是打活动标的
// 第二件优惠活动(单品优惠)要把一行商品分成多行,且每行商品数量是1,同时要有两行是打活动标的
List
<
CartGoods
>
newProducts
=
new
ArrayList
<>();
List
<
CartGoods
>
newProducts
=
new
ArrayList
<>();
...
@@ -212,6 +213,28 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -212,6 +213,28 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
for
(
int
x
=
0
;
x
<
products
.
size
()
;
x
++){
for
(
int
x
=
0
;
x
<
products
.
size
()
;
x
++){
CartGoods
product
=
products
.
get
(
x
);
CartGoods
product
=
products
.
get
(
x
);
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
smallMaterial
=
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getSmallMaterial
();
Integer
smallMaterialOriTotal
=
0
;
Long
halfSmallMaterialOriTotal
=
0L
;
if
(
smallMaterial
!=
null
&&
!
smallMaterial
.
isEmpty
()){
for
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
sm
:
smallMaterial
){
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
smDiscounts
=
sm
.
getDiscounts
();
if
(
smDiscounts
!=
null
&&
!
smDiscounts
.
isEmpty
()){
for
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
smDiscount
:
smDiscounts
){
if
(
ObjectUtils
.
equals
(
smDiscount
.
getType
(),
ActivityTypeEnum
.
TYPE_53
.
getCode
())){
halfSmallMaterialOriTotal
=
halfSmallMaterialOriTotal
+
smDiscount
.
getSignleDiscount
();
}
}
}
smallMaterialOriTotal
=
smallMaterialOriTotal
+
sm
.
getOriginalPrice
();
}
}
// 商品的单价 = 商品单价+小料单价
Long
originalPrice
=
(
new
Long
(
smallMaterialOriTotal
)
+
product
.
getOriginalPrice
());
// 这一行的商品参加了第二件优惠活动(单品优惠)
// 这一行的商品参加了第二件优惠活动(单品优惠)
if
(
halfDiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
if
(
halfDiscountsMap
.
get
(
product
.
getCartGoodsUid
()
+
"-"
+
product
.
getGoodsId
())
!=
null
){
// 行商品数量
// 行商品数量
...
@@ -231,26 +254,21 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -231,26 +254,21 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
continue
;
continue
;
}
}
// 限时
特检
的现单价获取促销的现单价
// 限时
立减
的现单价获取促销的现单价
// 商品是否参加
特价
// 商品是否参加
单品立减
boolean
cutFlag
=
hashCutActive
(
goodsDiscountsMap
,
product
);
boolean
cutFlag
=
hashCutActive
(
goodsDiscountsMap
,
product
);
if
(
cutFlag
){
if
(
cutFlag
){
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
}
}
// 小料信息
// 如果是赠品行,这行的价格就不用算了
if
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
())
==
null
){
if
(!
gifeProductIds
.
contains
(
product
.
getGoodsId
())
&&
product
.
getActivityType
()
==
null
){
continue
;
// 商品的单价 = 商品单价+小料单价
product
.
setOriginalPrice
(
originalPrice
);
// 商品现单价 = 商品现单价+小料现单价
smallMaterialOriTotal
=
smallMaterialOriTotal
==
null
?
0
:
smallMaterialOriTotal
;
product
.
setFinalPrice
(
new
Long
(
smallMaterialOriTotal
)
+
(
product
.
getFinalPrice
()
==
null
?
0L
:
product
.
getFinalPrice
()));
}
}
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
smallMaterial
=
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getSmallMaterial
();
Integer
smallMaterialOriTotal
=
0
;
for
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
sm
:
smallMaterial
){
smallMaterialOriTotal
=
smallMaterialOriTotal
+
sm
.
getOriginalPrice
();
}
// 商品的单价 = 商品单价+小料单价
product
.
setOriginalPrice
(
new
Long
(
smallMaterialOriTotal
)
+
product
.
getOriginalPrice
());
product
.
setFinalPrice
(
new
Long
(
smallMaterialOriTotal
)
+
product
.
getFinalPrice
());
newProducts
.
add
(
product
);
newProducts
.
add
(
product
);
}
}
...
@@ -335,7 +353,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -335,7 +353,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
product
.
setQty
(
newQty
);
product
.
setQty
(
newQty
);
// 商品是否参加
特价
// 商品是否参加
立减
boolean
cutFlag
=
hashCutActive
(
goodsDiscountsMap
,
product
);
boolean
cutFlag
=
hashCutActive
(
goodsDiscountsMap
,
product
);
if
(
cutFlag
){
if
(
cutFlag
){
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
product
.
setFinalPrice
(
goodsDiscountsMap
.
get
(
product
.
getCartGoodsUid
()).
getNowPrice
());
...
@@ -377,7 +395,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
...
@@ -377,7 +395,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
}
}
/**
/**
* 判断商品是否参加了
限时特价
* 判断商品是否参加了
立减
* @param goodsDiscountsMap
* @param goodsDiscountsMap
* @param product
* @param product
* @return
* @return
...
...
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