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
3520d4c1
Commit
3520d4c1
authored
Nov 03, 2020
by
huiyang.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 买三赠一,todo
parent
159f4cba
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
13 deletions
+78
-13
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/enums/SaveCouponType.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/activity/ActivityDiscountsDto.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
+17
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+41
-8
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+8
-4
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeAddGoodsRequestVo.java
+9
-0
No files found.
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/enums/SaveCouponType.java
View file @
3520d4c1
...
...
@@ -5,6 +5,7 @@ public enum SaveCouponType {
COUPON
(
1
,
"代金券"
),
FREIGHT_COUPON
(
2
,
"运费券"
),
MON_COUPON
(
3
,
"随单购月卡"
),
THREE_TO_ONE_COUPON
(
4
,
"买三赠一券"
),
;
private
Integer
code
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/activity/ActivityDiscountsDto.java
View file @
3520d4c1
...
...
@@ -23,7 +23,7 @@ public class ActivityDiscountsDto {
private
Integer
activityType
;
private
String
tenderId
;
/**
* 1-运费券 2-运费月卡券 3-月卡券 4-万能券 5-啡常月享卡 6-通用券
* 1-运费券 2-运费月卡券 3-月卡券 4-万能券 5-啡常月享卡 6-通用券
7-买三赠一券
*/
private
Integer
extendType
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
View file @
3520d4c1
...
...
@@ -97,6 +97,11 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
*/
private
String
monthlyCardCode
;
/**
* 各类券信息
*/
private
List
<
CouponType
>
couponTypeList
;
@Data
public
final
static
class
SendGoods
{
/**
...
...
@@ -126,6 +131,18 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
private
String
ruleId
;
}
@Data
public
final
static
class
CouponType
{
/**
* 券类型 1:买三赠一券
*/
private
Integer
type
;
/**
* 券code
*/
private
String
code
;
}
/**
* 运费券code
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
3520d4c1
...
...
@@ -32,6 +32,7 @@ public enum ActivityTypeEnum {
TYPE_3
(
3
,
"代金券"
),
TYPE_31
(
31
,
"折扣券"
),
TYPE_32
(
32
,
"商品券"
),
TYPE_35
(
35
,
"买三赠一券"
),
TYPE_5
(
5
,
"整单满金额折"
),
TYPE_51
(
51
,
"每满金额折"
),
TYPE_52
(
52
,
"阶梯满金额折"
),
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
3520d4c1
...
...
@@ -149,6 +149,8 @@ public class ShoppingCartMCoffeeServiceImpl {
String
receiveId
=
addShoppingCartGoodsRequestVo
.
getReceiveId
();
Integer
operationType
=
addShoppingCartGoodsRequestVo
.
getOperationType
();
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
String
threeToOneActivityCode
=
addShoppingCartGoodsRequestVo
.
getThreeToOneActivityCode
();
String
threeToOneCouponCode
=
addShoppingCartGoodsRequestVo
.
getThreeToOneCouponCode
();
String
spuId2
=
spuId
;
MCoffeeProductIdsVo
vo
=
new
MCoffeeProductIdsVo
();
...
...
@@ -187,6 +189,13 @@ public class ShoppingCartMCoffeeServiceImpl {
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
HAS_GOODS_COUPON_WHEN_ADD_SPECIAL_GOODS
);
}
if
(
StringUtils
.
isNotEmpty
(
threeToOneCouponCode
))
{
if
(
StringUtils
.
isNotEmpty
(
threeToOneActivityCode
)){
threeToOneCouponCode
=
threeToOneCouponCode
+
","
+
threeToOneActivityCode
;
}
assortmentSdkService
.
setShoppingCartCouponCode
(
partnerId
,
storeId
,
userId
,
threeToOneCouponCode
,
shoppingCartBaseService
,
SaveCouponType
.
THREE_TO_ONE_COUPON
.
getCode
());
}
// 购物车数据更新(保存商品原价)
List
<
CartGoods
>
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
...
...
@@ -310,7 +319,7 @@ public class ShoppingCartMCoffeeServiceImpl {
String
freightCouponCode
=
assortmentSdkService
.
getShoppingCartCoupon
(
partnerId
,
storeId
,
userId
,
shoppingCartBaseService
,
SaveCouponType
.
FREIGHT_COUPON
.
getCode
());
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
freightCouponCode
,
null
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
freightCouponCode
,
null
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
couponCode
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
...
...
@@ -351,6 +360,8 @@ public class ShoppingCartMCoffeeServiceImpl {
log
.
info
(
"cartGoodsList: {}"
,
JSONObject
.
toJSONString
(
cartGoodsList
));
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// todo 合并相同商品数据
cartGoodsList
=
mergeProductList
(
cartGoodsList
);
// check购物车中所有商品
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 重新存储最新购物车
...
...
@@ -379,6 +390,8 @@ public class ShoppingCartMCoffeeServiceImpl {
assortmentSdkService
.
setShoppingCartCouponCode
(
partnerId
,
storeId
,
userId
,
freightCouponCode
,
shoppingCartBaseService
,
SaveCouponType
.
FREIGHT_COUPON
.
getCode
());
}
String
threeToOneCouponCode
=
assortmentSdkService
.
getShoppingCartCoupon
(
partnerId
,
storeId
,
userId
,
shoppingCartBaseService
,
SaveCouponType
.
THREE_TO_ONE_COUPON
.
getCode
());
//放到参数里
if
(
StringUtils
.
isNotEmpty
(
couponCode
)
)
{
shoppingCartInfoRequestVo
.
setCouponCode
(
couponCode
);
...
...
@@ -402,7 +415,7 @@ public class ShoppingCartMCoffeeServiceImpl {
assortmentSdkService
.
setShoppingCartCouponCode
(
partnerId
,
storeId
,
userId
,
code
,
shoppingCartBaseService
,
SaveCouponType
.
MON_COUPON
.
getCode
());
}
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
shoppingCartInfoRequestVo
.
getFreightCouponCode
(),
code
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
shoppingCartInfoRequestVo
.
getFreightCouponCode
(),
code
,
threeToOneCouponCode
,
shoppingCartInfoRequestVo
.
getCouponTypeList
()
);
// 促销活动的优惠金额计算
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
...
...
@@ -436,6 +449,10 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
public
List
<
CartGoods
>
mergeProductList
(
List
<
CartGoods
>
cartGoodsList
){
return
null
;
}
/**
* 券码用-查询购物车最新信息,计算优惠
...
...
@@ -454,7 +471,7 @@ public class ShoppingCartMCoffeeServiceImpl {
payCardPrice
=
Long
.
valueOf
(
payCardFee
);
}
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
null
,
null
,
cartGoodsList
,
null
,
buyMonthlyCard
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
null
,
null
,
cartGoodsList
,
null
,
buyMonthlyCard
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
(),
requestVo
.
getUserId
(),
requestVo
.
getAppId
(),
requestVo
.
getOrderType
(),
assortmentCustomerInfoVo
.
isMemberPaid
(),
requestVo
.
getMenuType
(),
requestVo
.
getReceiveId
(),
null
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
payCardPrice
);
...
...
@@ -618,7 +635,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
shoppingCartInfoRequestVo
.
getFreightCouponCode
(),
code
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
shoppingCartInfoRequestVo
.
getFreightCouponCode
(),
code
,
null
,
null
);
//加价购商品
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
=
shoppingCartInfoRequestVo
.
getSendGoods
();
...
...
@@ -689,7 +706,7 @@ public class ShoppingCartMCoffeeServiceImpl {
//清空商品券商品
clearCartCouponGoods
(
partnerId
,
toStoreId
,
userId
,
sessionId
,
cartGoodsList
);
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
toStoreId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
...
...
@@ -706,7 +723,7 @@ public class ShoppingCartMCoffeeServiceImpl {
//清空商品券商品
clearCartCouponGoods
(
partnerId
,
toStoreId
,
userId
,
sessionId
,
cartGoodsList
);
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
toStoreId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
...
...
@@ -1393,7 +1410,8 @@ public class ShoppingCartMCoffeeServiceImpl {
return
checkCartRequest
;
}
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
getCoupon
(
String
couponCode
,
String
activityCode
,
List
<
CartGoods
>
cartGoodsList
,
String
freightCouponCode
,
String
buyMonthlyCard
)
{
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
getCoupon
(
String
couponCode
,
String
activityCode
,
List
<
CartGoods
>
cartGoodsList
,
String
freightCouponCode
,
String
buyMonthlyCard
,
String
threeToOneCouponCode
,
List
<
ShoppingCartInfoRequestVo
.
CouponType
>
couponTypeList
)
{
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
...
...
@@ -1413,6 +1431,21 @@ public class ShoppingCartMCoffeeServiceImpl {
coupon
.
setActivityCode
(
activityCode
);
coupons
.
add
(
coupon
);
}
if
(
StringUtils
.
isNotEmpty
(
threeToOneCouponCode
))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
List
<
String
>
split
=
Arrays
.
asList
(
threeToOneCouponCode
.
split
(
","
));
coupon
.
setCode
(
split
.
get
(
0
));
if
(
split
.
size
()
>
1
)
coupon
.
setActivityCode
(
split
.
get
(
1
));
coupons
.
add
(
coupon
);
}
if
(
CollectionUtils
.
isNotEmpty
(
couponTypeList
))
{
for
(
ShoppingCartInfoRequestVo
.
CouponType
couponType:
couponTypeList
)
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
couponType
.
getCode
());
coupons
.
add
(
coupon
);
}
}
//购物车商品券
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
...
...
@@ -1650,7 +1683,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
3520d4c1
...
...
@@ -78,7 +78,8 @@ public class CouponDiscountCalculation {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
)))
{
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
()))
)))
{
return
;
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
...
...
@@ -92,7 +93,7 @@ public class CouponDiscountCalculation {
return
;
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponDiscounts
=
discounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())))).
collect
(
Collectors
.
toList
());
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
()))
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
couponDiscounts
))
{
return
;
}
...
...
@@ -130,6 +131,8 @@ public class CouponDiscountCalculation {
cartGoods
.
setCouponName
(
goodsDiscount
.
getActivityName
());
}
}
}
// 当couponCode不为空时,需计算优惠价格
...
...
@@ -149,7 +152,8 @@ public class CouponDiscountCalculation {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
)))
{
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
())))))
{
return
;
}
//订单级别券优惠
...
...
@@ -158,7 +162,7 @@ public class CouponDiscountCalculation {
return
;
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
couponDiscounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())))).
collect
(
Collectors
.
toList
());
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
()))
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
discounts
))
{
return
;
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeAddGoodsRequestVo.java
View file @
3520d4c1
...
...
@@ -133,4 +133,13 @@ public class MCoffeeAddGoodsRequestVo {
*/
private
String
groupName
;
/**
* 买三赠一券code
*/
private
String
threeToOneCouponCode
;
/**
* 买三赠一券活动号
*/
private
String
threeToOneActivityCode
;
}
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