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
1da9d9d8
Commit
1da9d9d8
authored
Jun 20, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210609-v2.0.34-购物车支持配送券ID1030707-周晓航' into qa
parents
0ec08f17
b4bc2d76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
shopping-cart-application-service/src/main/java/cn/freemud/constant/ApplicationConstant.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+41
-5
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/constant/ApplicationConstant.java
View file @
1da9d9d8
...
@@ -21,4 +21,5 @@ public class ApplicationConstant {
...
@@ -21,4 +21,5 @@ public class ApplicationConstant {
public
final
static
String
DELIVERY_DISCOUNT_DESC1
=
"订单满%s元减%s元配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC1
=
"订单满%s元减%s元配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC2
=
"订单满%s元免配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC2
=
"订单满%s元免配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC3
=
"另需配送费%s元"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC3
=
"另需配送费%s元"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC4
=
" 选择了配送券"
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
1da9d9d8
...
@@ -1705,11 +1705,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1705,11 +1705,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
couponPromotionVO
!=
null
)
{
if
(
couponPromotionVO
!=
null
)
{
couponPromotionVO
.
setDeliveryAmount
(
deliveryAmount
);
couponPromotionVO
.
setDeliveryAmount
(
deliveryAmount
);
}
}
//默认计算优惠
//默认计算优惠
设置包装费 原价 现价 优惠金额
DefaultPromotionService
defaultPromotionService
=
(
DefaultPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
DEFAULT_PROMOTION
);
DefaultPromotionService
defaultPromotionService
=
(
DefaultPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
DEFAULT_PROMOTION
);
defaultPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
defaultPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
// 优惠券
// 优惠券
这里设置了优惠券的优惠金额 setCouponDiscount(couponDiscount);
CouponPromotionService
couponPromotionService
=
(
CouponPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
COUPON_DISCOUNT
);
CouponPromotionService
couponPromotionService
=
(
CouponPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
COUPON_DISCOUNT
);
couponPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
couponPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
...
@@ -1781,7 +1781,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1781,7 +1781,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
memberDiscountService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
memberDiscountService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
/**
/**
* 满额减配送费
* 满额减配送费
优选活动 再配送券
*/
*/
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
DecimalFormat
df
=
new
DecimalFormat
(
"###.##"
);
DecimalFormat
df
=
new
DecimalFormat
(
"###.##"
);
...
@@ -1815,10 +1815,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1815,10 +1815,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
desc
=
DELIVERY_DISCOUNT_DESC1
;
String
desc
=
DELIVERY_DISCOUNT_DESC1
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
beanDto
.
getThresholdAmount
().
doubleValue
()
/
100
)
,
df
.
format
(
beanDto
.
getDiscountAmount
().
doubleValue
()
/
100
)));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
beanDto
.
getThresholdAmount
().
doubleValue
()
/
100
)
,
df
.
format
(
beanDto
.
getDiscountAmount
().
doubleValue
()
/
100
)));
}
}
boolean
isType34
=
verifyActivity
(
calculationDiscountResult
);
if
(
isType34
)
{
String
desc
=
shoppingCartGoodsResponseVo
.
getDeliveryDiscountDesc
();
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
desc
+
","
+
DELIVERY_DISCOUNT_DESC4
);
}
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
());
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setThresholdAmount
(
discount
.
getThresholdAmount
());
shoppingCartGoodsResponseVo
.
setThresholdAmount
(
discount
.
getThresholdAmount
());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
true
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
true
);
// fisherman 促销优惠先 剩余的 配送费 怎么处理的? 需要沟通问一下
}
else
{
}
else
{
if
(
activityResponse
!=
null
)
{
if
(
activityResponse
!=
null
)
{
...
@@ -1833,11 +1840,18 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1833,11 +1840,18 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
// 增加配送券之后的逻辑
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
// fisherman 有活动 并且使用了优惠券
boolean
isType34
=
verifyActivity
(
calculationDiscountResult
);
if
(
isType34
)
{
// 使用了优惠券
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
String
deliveryDiscountDesc
=
shoppingCartGoodsResponseVo
.
getDeliveryDiscountDesc
();
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
deliveryDiscountDesc
+
","
+
DELIVERY_DISCOUNT_DESC4
);
}
}
else
{
}
else
{
// 这里需要看看 选择了 配送券 calculationDiscountResult.getDistributionFee() 这个值是多少
String
desc
=
DELIVERY_DISCOUNT_DESC3
;
String
desc
=
DELIVERY_DISCOUNT_DESC3
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
deliveryAmount
.
doubleValue
()
/
100
)));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
deliveryAmount
.
doubleValue
()
/
100
)));
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
...
@@ -1845,6 +1859,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1845,6 +1859,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 增加配送券之后的逻辑
// 增加配送券之后的逻辑
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
// fisherman 确认是否 使用了优惠券
boolean
isType34
=
verifyActivity
(
calculationDiscountResult
);
if
(
isType34
)
{
// 使用了优惠券
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
String
deliveryDiscountDesc
=
shoppingCartGoodsResponseVo
.
getDeliveryDiscountDesc
();
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
deliveryDiscountDesc
+
","
+
DELIVERY_DISCOUNT_DESC4
);
}
}
}
}
}
LogUtil
.
info
(
"fisherman 满额减配送算价格"
,
discount
,
shoppingCartGoodsResponseVo
);
LogUtil
.
info
(
"fisherman 满额减配送算价格"
,
discount
,
shoppingCartGoodsResponseVo
);
...
@@ -1860,6 +1882,20 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1860,6 +1882,20 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
/**
/**
* 检验是否使用的 配送券
* @param calculationDiscountResult
* @return
*/
private
boolean
verifyActivity
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
)
{
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getCouponDiscounts
()))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
type34
=
calculationDiscountResult
.
getCouponDiscounts
().
stream
().
filter
(
couponResults
->
couponResults
.
getActivityType
()
!=
null
&&
couponResults
.
getActivityType
().
compareTo
(
ActivityTypeEnum
.
TYPE_34
.
getCode
())
==
0
).
findFirst
().
orElse
(
null
);
return
type34
!=
null
;
}
return
false
;
}
/**
* 促销均摊计算
* 促销均摊计算
*
*
* @param shoppingCartGoodsResponseVo
* @param 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