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
71c0bcd5
Commit
71c0bcd5
authored
Jun 11, 2021
by
徐康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
买3赠1券
parent
91b6c184
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
235 additions
and
56 deletions
+235
-56
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
+9
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/B3S1CouponGoodsInfoVo.java
+39
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+9
-1
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ClearCouponCodeRequestVo.java
+7
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
+6
-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
+108
-35
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+1
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+47
-9
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/BatchGoodsInfoVo.java
+2
-9
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeAddGoodsRequestVo.java
+6
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
View file @
71c0bcd5
...
@@ -81,6 +81,15 @@ public class MCoffeeShoppingCartController {
...
@@ -81,6 +81,15 @@ public class MCoffeeShoppingCartController {
return
shoppingCartMCoffeeService
.
batchUpdateGoodsQty
(
request
);
return
shoppingCartMCoffeeService
.
batchUpdateGoodsQty
(
request
);
}
}
/**
* 向购物车中添加商品
*/
@ApiAnnotation
(
logMessage
=
"removeB3S1Coupon"
)
@PostMapping
(
value
=
"/removeB3S1Coupon"
)
public
BaseResponse
deleteB3S1Coupon
(
@Validated
@LogParams
@RequestBody
MCoffeeAddGoodsRequestVo
request
)
{
return
shoppingCartMCoffeeService
.
addGoods
(
request
);
}
@ApiAnnotation
(
logMessage
=
"getCartInfoByUser"
)
@ApiAnnotation
(
logMessage
=
"getCartInfoByUser"
)
@PostMapping
(
value
=
"/getCartInfoByUser"
)
@PostMapping
(
value
=
"/getCartInfoByUser"
)
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/B3S1CouponGoodsInfoVo.java
0 → 100644
View file @
71c0bcd5
package
cn
.
freemud
.
entities
.
vo
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
import
java.util.Set
;
/**
* All rights Reserved, Designed By sunary.site
*
* @version v1.0
* @Title: IntelliJ IDEA
* @Package cn.freemud.entities.vo
* @Description: 请简单描述下这个类是做什么用的
* @author: yu.sun
* @date: 2021-01-11 15:18:36
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
*/
@Data
@NoArgsConstructor
public
class
B3S1CouponGoodsInfoVo
{
/**
* 卡号
*/
private
String
cardNo
;
/**
* 券号
*/
private
String
cardCode
;
/**
* 券号
*/
private
Set
<
String
>
cardCodeSet
;
private
Integer
useTimes
;
private
int
isUseB3S1Coupon
=
1
;
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
71c0bcd5
...
@@ -240,11 +240,15 @@ public class CartGoods {
...
@@ -240,11 +240,15 @@ public class CartGoods {
*/
*/
private
int
isMonthCard
=
0
;
private
int
isMonthCard
=
0
;
/**
/**
* 是否是买3赠1券商品
*/
private
int
isB3S1Coupon
=
0
;
/**
* 是否是太阳蛋商品
* 是否是太阳蛋商品
*/
*/
private
int
isSunnyCoupon
=
0
;
private
int
isSunnyCoupon
=
0
;
/**
/**
* 是否为
月享卡
商品 1:是;0:否
* 是否为
可以使用买月享卡的
商品 1:是;0:否
*/
*/
private
int
isMonthCardGoods
=
0
;
private
int
isMonthCardGoods
=
0
;
/**
/**
...
@@ -252,6 +256,10 @@ public class CartGoods {
...
@@ -252,6 +256,10 @@ public class CartGoods {
*/
*/
private
MonthCardVo
monthCardInfo
;
private
MonthCardVo
monthCardInfo
;
/**
/**
* 买3赠1券信息
*/
private
B3S1CouponGoodsInfoVo
b3S1CouponGoodsInfo
;
/**
* 第三方商品编码
* 第三方商品编码
*/
*/
private
String
customerCode
;
private
String
customerCode
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ClearCouponCodeRequestVo.java
View file @
71c0bcd5
...
@@ -15,4 +15,11 @@ public class ClearCouponCodeRequestVo extends BaseRequestVo {
...
@@ -15,4 +15,11 @@ public class ClearCouponCodeRequestVo extends BaseRequestVo {
* 0 否
* 0 否
*/
*/
private
int
isUseMonthCard
;
private
int
isUseMonthCard
;
/**
* 是否使用
* 1 是
* 0 否
*/
private
int
isUseB3S1Coupon
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
View file @
71c0bcd5
...
@@ -78,6 +78,12 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
...
@@ -78,6 +78,12 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
*/
*/
private
Integer
isUseMonthCard
=
1
;
private
Integer
isUseMonthCard
=
1
;
/**
/**
* 是否使用
* 1 是
* 0 否
*/
private
Integer
isUseB3S3Coupon
=
1
;
/**
* 优惠券对应的活动号
* 优惠券对应的活动号
*/
*/
private
String
activityCode
;
private
String
activityCode
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
71c0bcd5
...
@@ -36,6 +36,7 @@ public enum ActivityTypeEnum {
...
@@ -36,6 +36,7 @@ public enum ActivityTypeEnum {
TYPE_32
(
32
,
"商品券"
),
TYPE_32
(
32
,
"商品券"
),
TYPE_33
(
33
,
"换购券"
),
TYPE_33
(
33
,
"换购券"
),
TYPE_37
(
37
,
"月享卡种子券"
),
TYPE_37
(
37
,
"月享卡种子券"
),
TYPE_35
(
35
,
"买3赠1券"
),
TYPE_38
(
38
,
"月享卡2.0"
),
TYPE_38
(
38
,
"月享卡2.0"
),
TYPE_39
(
39
,
"EVM券"
),
TYPE_39
(
39
,
"EVM券"
),
TYPE_5
(
5
,
"整单满金额折"
),
TYPE_5
(
5
,
"整单满金额折"
),
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
71c0bcd5
...
@@ -152,13 +152,12 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -152,13 +152,12 @@ public class ShoppingCartMCoffeeServiceImpl {
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
String
spuId2
=
spuId
;
String
spuId2
=
spuId
;
MCoffeeProductIdsVo
vo
=
new
MCoffeeProductIdsVo
();
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
productIds
=
new
ArrayList
<>();
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
null
;
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
null
;
// 获取添加商品的详细信息
// 获取添加商品的详细信息
if
(!
StringUtils
.
equals
(
"9999"
,
addShoppingCartGoodsRequestVo
.
getSkuId
()))
{
if
(!
StringUtils
.
equals
(
"9999"
,
addShoppingCartGoodsRequestVo
.
getSkuId
())
&&
!
StringUtils
.
equals
(
"9998"
,
addShoppingCartGoodsRequestVo
.
getSkuId
())
)
{
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
menuType
,
this
.
shoppingCartBaseService
);
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
menuType
,
this
.
shoppingCartBaseService
);
}
}
...
@@ -172,6 +171,9 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -172,6 +171,9 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
1
==
addShoppingCartGoodsRequestVo
.
getIsMonthCard
())
{
if
(
1
==
addShoppingCartGoodsRequestVo
.
getIsMonthCard
())
{
seedCouponGoodsValidate
(
addShoppingCartGoodsRequestVo
,
oldCartGoodsList
);
seedCouponGoodsValidate
(
addShoppingCartGoodsRequestVo
,
oldCartGoodsList
);
}
}
if
(
1
==
addShoppingCartGoodsRequestVo
.
getIsB3S1Coupon
())
{
seedB3S1CouponGoodsValidate
(
addShoppingCartGoodsRequestVo
,
oldCartGoodsList
);
}
//加锁,防止重复请求导致的加购数量错误
//加锁,防止重复请求导致的加购数量错误
synchronized
(
oldCartGoodsList
)
{
synchronized
(
oldCartGoodsList
)
{
...
@@ -189,7 +191,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -189,7 +191,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
}
}
CartGoods
addCartGoods
=
convent2CartGoods
(
addShoppingCartGoodsRequestVo
,
goodsId
,
vo
);
CartGoods
addCartGoods
=
convent2CartGoods
(
addShoppingCartGoodsRequestVo
,
goodsId
);
//商品券已添加情况校验
//商品券已添加情况校验
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
,
goodsId
,
addCartGoods
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
,
goodsId
,
addCartGoods
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
...
@@ -204,7 +206,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -204,7 +206,7 @@ public class ShoppingCartMCoffeeServiceImpl {
couponName
=
getCouponNameByCode
(
couponCode
,
assortmentCustomerInfoVo
,
couponName
=
getCouponNameByCode
(
couponCode
,
assortmentCustomerInfoVo
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
storeId
);
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
storeId
);
//月享卡2.0之后不在显示月享卡券的名称 与普通商品券不同,故过滤掉月享卡券名称查询
//月享卡2.0之后不在显示月享卡券的名称 与普通商品券不同,故过滤掉月享卡券名称查询
if
(!(
"9999"
).
equals
(
addCartGoods
.
getSpuId
())
&&
!(
"9999"
).
equals
(
addCartGoods
.
getSkuId
())
){
if
(!(
"9999"
).
equals
(
addCartGoods
.
getSpuId
())){
addCartGoods
.
setCouponName
(
couponName
);
addCartGoods
.
setCouponName
(
couponName
);
}
else
{
}
else
{
//将卡券名称赋值给 虚拟商品作为 月享卡2.0的优惠项展示
//将卡券名称赋值给 虚拟商品作为 月享卡2.0的优惠项展示
...
@@ -221,7 +223,32 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -221,7 +223,32 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
List
<
CartGoods
>
newCartGoods
=
null
;
List
<
CartGoods
>
newCartGoods
=
null
;
if
(!
StringUtils
.
equals
(
"9999"
,
skuId
))
{
if
(
StringUtils
.
equals
(
"9999"
,
skuId
))
{
// 将月享卡2.0的虚拟商品保存到购物车中
oldCartGoodsList
.
add
(
addCartGoods
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
couponCode
,
oldCartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
oldCartGoodsList
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
newCartGoods
=
oldCartGoodsList
;
}
else
if
(
StringUtils
.
equals
(
"9998"
,
skuId
)){
Optional
<
CartGoods
>
cartGoods
=
oldCartGoodsList
.
stream
().
filter
(
o
->
"9998"
.
equals
(
skuId
)
&&
o
.
getIsB3S1Coupon
()
==
1
).
findFirst
();
if
(
cartGoods
.
isPresent
())
{
cartGoods
.
get
().
getB3S1CouponGoodsInfo
().
getCardCodeSet
().
add
(
addCartGoods
.
getCouponCode
());
}
else
{
B3S1CouponGoodsInfoVo
b3S1CouponGoodsInfoVo
=
new
B3S1CouponGoodsInfoVo
();
Set
<
String
>
set
=
new
HashSet
<>();
b3S1CouponGoodsInfoVo
.
setCardCodeSet
(
set
);
addCartGoods
.
setB3S1CouponGoodsInfo
(
b3S1CouponGoodsInfoVo
);
set
.
add
(
addCartGoods
.
getCouponCode
());
oldCartGoodsList
.
add
(
addCartGoods
);
}
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
couponCode
,
oldCartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
oldCartGoodsList
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
newCartGoods
=
oldCartGoodsList
;
}
else
{
ApiLog
.
debug
(
"【addGoodsList】:{} ,【addGoodsRequestVo】:{}"
,
JSONObject
.
toJSONString
(
oldCartGoodsList
),
JSONObject
.
toJSONString
(
addCartGoods
));
ApiLog
.
debug
(
"【addGoodsList】:{} ,【addGoodsRequestVo】:{}"
,
JSONObject
.
toJSONString
(
oldCartGoodsList
),
JSONObject
.
toJSONString
(
addCartGoods
));
// 购物车数据更新(保存商品原价)
// 购物车数据更新(保存商品原价)
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
...
@@ -231,14 +258,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -231,14 +258,6 @@ public class ShoppingCartMCoffeeServiceImpl {
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
// 重新保存购物车数据
// 重新保存购物车数据
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
newCartGoods
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
newCartGoods
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
}
else
{
// 将月享卡2.0的虚拟商品保存到购物车中
oldCartGoodsList
.
add
(
addCartGoods
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
couponCode
,
oldCartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
oldCartGoodsList
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
newCartGoods
=
oldCartGoodsList
;
}
}
// 返回购物车数据
// 返回购物车数据
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
newCartGoods
,
null
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
newCartGoods
,
null
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
...
@@ -261,22 +280,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -261,22 +280,6 @@ public class ShoppingCartMCoffeeServiceImpl {
return
baseResponse
;
return
baseResponse
;
}
}
private
MCoffeeProductIdsVo
validCoupon
(
String
partnerId
,
String
storeId
,
String
spuId
,
List
<
Long
>
productIds
,
String
menuType
)
{
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
()),
menuType
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
CheckSpqInfoResponseDto
checkSpqInfoResponseDto
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
);
if
(
checkSpqInfoResponseDto
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
}
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
String
skuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
String
spuId2
=
checkSpqInfoResponseDto
.
getSpuId
();
MCoffeeProductIdsVo
vo
=
new
MCoffeeProductIdsVo
();
vo
.
setSkuId
(
skuId2
);
vo
.
setSpuId
(
spuId2
);
return
vo
;
}
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
checkGoodsCoupon
(
List
<
CartGoods
>
oldCartGoodsList
,
Integer
operationType
,
String
couponCode
,
String
goodsId
,
CartGoods
addShoppingCartGoodsRequestVo
)
{
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
checkGoodsCoupon
(
List
<
CartGoods
>
oldCartGoodsList
,
Integer
operationType
,
String
couponCode
,
String
goodsId
,
CartGoods
addShoppingCartGoodsRequestVo
)
{
if
(
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isBlank
(
couponCode
))
{
if
(
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isBlank
(
couponCode
))
{
...
@@ -294,6 +297,18 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -294,6 +297,18 @@ public class ShoppingCartMCoffeeServiceImpl {
calculationDiscountCoupon
.
setCode
(
addShoppingCartGoodsRequestVo
.
getMonthCardInfo
().
getCardCode
());
calculationDiscountCoupon
.
setCode
(
addShoppingCartGoodsRequestVo
.
getMonthCardInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
coupons
.
add
(
calculationDiscountCoupon
);
}
}
if
(
null
!=
addShoppingCartGoodsRequestVo
&&
null
!=
addShoppingCartGoodsRequestVo
.
getB3S1CouponGoodsInfo
()
&&
StringUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getB3S1CouponGoodsInfo
().
getCardCode
())){
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
addShoppingCartGoodsRequestVo
.
getB3S1CouponGoodsInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
null
!=
addShoppingCartGoodsRequestVo
&&
"9998"
.
equals
(
addShoppingCartGoodsRequestVo
.
getSkuId
()))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
CollectionUtils
.
isNotEmpty
(
oldCartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
oldCartGoodsList
))
{
Boolean
isContinue
=
true
;
Boolean
isContinue
=
true
;
...
@@ -313,6 +328,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -313,6 +328,20 @@ public class ShoppingCartMCoffeeServiceImpl {
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getMonthCardInfo
().
getCardCode
());
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getMonthCardInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
coupons
.
add
(
calculationDiscountCoupon
);
}
}
if
(
null
!=
cartGoods
&&
null
!=
cartGoods
.
getB3S1CouponGoodsInfo
()
&&
StringUtils
.
isNotEmpty
(
cartGoods
.
getB3S1CouponGoodsInfo
().
getCardCode
())
&&
1
==
cartGoods
.
getB3S1CouponGoodsInfo
().
getIsUseB3S1Coupon
()){
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getB3S1CouponGoodsInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
null
!=
cartGoods
&&
"9998"
.
equals
(
cartGoods
.
getSkuId
()))
{
for
(
String
code
:
cartGoods
.
getB3S1CouponGoodsInfo
().
getCardCodeSet
())
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
code
);
coupons
.
add
(
calculationDiscountCoupon
);
}
}
//使用券的是,如果购物车已经存在这个券,先清除,再添加
//使用券的是,如果购物车已经存在这个券,先清除,再添加
//过滤月享卡种子券
//过滤月享卡种子券
...
@@ -657,6 +686,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -657,6 +686,7 @@ public class ShoppingCartMCoffeeServiceImpl {
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
ApiLog
.
debug
(
"cartGoodsList: {}"
,
JSONObject
.
toJSONString
(
cartGoodsList
));
ApiLog
.
debug
(
"cartGoodsList: {}"
,
JSONObject
.
toJSONString
(
cartGoodsList
));
CartGoods
monthCardProduct
=
null
;
CartGoods
monthCardProduct
=
null
;
CartGoods
B3S1CouponProduct
=
null
;
// 如果购物车商品不为空, 则check购物车中所有商品
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
// check购物车中所有商品
...
@@ -665,22 +695,42 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -665,22 +695,42 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
()
!=
null
&&
goods
.
getMonthCardInfo
()
!=
null
)
{
if
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
()
!=
null
&&
goods
.
getMonthCardInfo
()
!=
null
)
{
goods
.
getMonthCardInfo
().
setIsUseMonthCard
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
());
goods
.
getMonthCardInfo
().
setIsUseMonthCard
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
());
}
}
if
(
shoppingCartInfoRequestVo
.
getIsUseB3S3Coupon
()
!=
null
&&
goods
.
getB3S1CouponGoodsInfo
()
!=
null
)
{
goods
.
getMonthCardInfo
().
setIsUseMonthCard
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
());
}
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9999"
)){
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9999"
)){
monthCardProduct
=
goods
;
monthCardProduct
=
goods
;
continue
;
continue
;
}
}
temList
.
addAll
(
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
goods
),
sessionId
));
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9998"
)){
B3S1CouponProduct
=
goods
;
continue
;
}
temList
.
add
(
goods
);
}
}
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
temList
,
sessionId
);
if
(
null
!=
monthCardProduct
)
{
if
(
null
!=
monthCardProduct
)
{
temList
.
add
(
monthCardProduct
);
cartGoodsList
.
add
(
monthCardProduct
);
}
if
(
null
!=
B3S1CouponProduct
)
{
cartGoodsList
.
add
(
B3S1CouponProduct
);
}
}
cartGoodsList
=
temList
;
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
int
size
=
cartGoodsList
.
size
();
int
size
=
cartGoodsList
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
//先把月卡放到最后
//先把月卡放到最后
if
(
null
!=
cartGoodsList
.
get
(
i
)
&&
Objects
.
equals
(
1
,
cartGoodsList
.
get
(
i
).
getIsB3S1Coupon
()))
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
i
!=
size
-
1
)
{
cartGoodsList
.
remove
(
i
);
cartGoodsList
.
add
(
cartGoods
);
break
;
}
}
}
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
//先把月卡放到最后
if
(
null
!=
cartGoodsList
.
get
(
i
)
&&
Objects
.
equals
(
1
,
cartGoodsList
.
get
(
i
).
getIsMonthCard
()))
{
if
(
null
!=
cartGoodsList
.
get
(
i
)
&&
Objects
.
equals
(
1
,
cartGoodsList
.
get
(
i
).
getIsMonthCard
()))
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
i
!=
size
-
1
)
{
if
(
i
!=
size
-
1
)
{
...
@@ -1687,7 +1737,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1687,7 +1737,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
public
static
CartGoods
convent2CartGoods
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
,
String
goodsId
,
MCoffeeProductIdsVo
mCoffeeProductIdsVo
)
{
public
static
CartGoods
convent2CartGoods
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
,
String
goodsId
)
{
String
spuId
=
addShoppingCartGoodsRequestVo
.
getSpuId
();
String
spuId
=
addShoppingCartGoodsRequestVo
.
getSpuId
();
String
skuId
=
addShoppingCartGoodsRequestVo
.
getSkuId
();
String
skuId
=
addShoppingCartGoodsRequestVo
.
getSkuId
();
// String goodsId = StringUtils.isEmpty(skuId) ? spuId : skuId;
// String goodsId = StringUtils.isEmpty(skuId) ? spuId : skuId;
...
@@ -1698,6 +1748,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1698,6 +1748,7 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setSkuId
(
skuId
);
cartGoods
.
setSkuId
(
skuId
);
cartGoods
.
setQty
(
qty
);
cartGoods
.
setQty
(
qty
);
cartGoods
.
setIsMonthCard
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
());
cartGoods
.
setIsMonthCard
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
());
cartGoods
.
setIsB3S1Coupon
(
addShoppingCartGoodsRequestVo
.
getIsB3S1Coupon
());
cartGoods
.
setIsMonthCardGoods
(
addShoppingCartGoodsRequestVo
.
getIsMonthCardGoods
());
cartGoods
.
setIsMonthCardGoods
(
addShoppingCartGoodsRequestVo
.
getIsMonthCardGoods
());
cartGoods
.
setCouponCode
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
cartGoods
.
setCouponCode
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
...
@@ -1705,7 +1756,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1705,7 +1756,7 @@ public class ShoppingCartMCoffeeServiceImpl {
goodsType
=
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
();
goodsType
=
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
();
}
else
if
(
CommonsConstant
.
COUPON_TYPE
.
equals
(
addShoppingCartGoodsRequestVo
.
getCouponType
())){
}
else
if
(
CommonsConstant
.
COUPON_TYPE
.
equals
(
addShoppingCartGoodsRequestVo
.
getCouponType
())){
goodsType
=
GoodsTypeEnum
.
ALL_COUPON_GOODS
.
getGoodsType
();
goodsType
=
GoodsTypeEnum
.
ALL_COUPON_GOODS
.
getGoodsType
();
}
else
if
(
Objects
.
equals
(
1
,
addShoppingCartGoodsRequestVo
.
getIsMonthCard
())){
}
else
if
(
Objects
.
equals
(
1
,
addShoppingCartGoodsRequestVo
.
getIsMonthCard
())
||
Objects
.
equals
(
1
,
addShoppingCartGoodsRequestVo
.
getIsB3S1Coupon
())){
goodsType
=
GoodsTypeEnum
.
VIRTUAL_GOODS
.
getGoodsType
();
goodsType
=
GoodsTypeEnum
.
VIRTUAL_GOODS
.
getGoodsType
();
}
}
...
@@ -1927,6 +1978,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1927,6 +1978,20 @@ public class ShoppingCartMCoffeeServiceImpl {
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getMonthCardInfo
().
getCardCode
());
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getMonthCardInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
coupons
.
add
(
calculationDiscountCoupon
);
}
}
if
(
null
!=
cartGoods
.
getB3S1CouponGoodsInfo
()
&&
StringUtils
.
isNotEmpty
(
cartGoods
.
getB3S1CouponGoodsInfo
().
getCardCode
())
&&
1
==
cartGoods
.
getB3S1CouponGoodsInfo
().
getIsUseB3S1Coupon
())
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getB3S1CouponGoodsInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
null
!=
cartGoods
&&
"9998"
.
equals
(
cartGoods
.
getSkuId
()))
{
for
(
String
code
:
cartGoods
.
getB3S1CouponGoodsInfo
().
getCardCodeSet
())
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
code
);
coupons
.
add
(
calculationDiscountCoupon
);
}
}
}
}
}
}
}
}
...
@@ -2294,6 +2359,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -2294,6 +2359,7 @@ public class ShoppingCartMCoffeeServiceImpl {
mCoffeeAddGoodsRequestVo
.
setCouponCode
(
goodsInfo
.
getCouponCode
());
mCoffeeAddGoodsRequestVo
.
setCouponCode
(
goodsInfo
.
getCouponCode
());
mCoffeeAddGoodsRequestVo
.
setGroupName
(
goodsInfo
.
getGroupName
());
mCoffeeAddGoodsRequestVo
.
setGroupName
(
goodsInfo
.
getGroupName
());
mCoffeeAddGoodsRequestVo
.
setIsMonthCard
(
goodsInfo
.
getIsMonthCard
());
mCoffeeAddGoodsRequestVo
.
setIsMonthCard
(
goodsInfo
.
getIsMonthCard
());
mCoffeeAddGoodsRequestVo
.
setIsB3S1Coupon
(
goodsInfo
.
getIsB3S1Coupon
());
mCoffeeAddGoodsRequestVo
.
setIsMonthCardGoods
(
goodsInfo
.
getIsMonthCardGoods
());
mCoffeeAddGoodsRequestVo
.
setIsMonthCardGoods
(
goodsInfo
.
getIsMonthCardGoods
());
mCoffeeAddGoodsRequestVo
.
setMonthCardInfo
(
goodsInfo
.
getMonthCardInfo
());
mCoffeeAddGoodsRequestVo
.
setMonthCardInfo
(
goodsInfo
.
getMonthCardInfo
());
return
mCoffeeAddGoodsRequestVo
;
return
mCoffeeAddGoodsRequestVo
;
...
@@ -2352,6 +2418,13 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -2352,6 +2418,13 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
}
}
private
void
seedB3S1CouponGoodsValidate
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
CartGoods
>
oldCartGoodsList
){
//若加购种子券商品,则券号不可为空
if
(
null
==
addShoppingCartGoodsRequestVo
.
getB3S1CouponGoodsInfo
()
||
StringUtils
.
isBlank
(
addShoppingCartGoodsRequestVo
.
getB3S1CouponGoodsInfo
().
getCardCode
())){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_ADD_ERROR
);
}
}
/**
/**
* 清除购物车商品使用月卡信息
* 清除购物车商品使用月卡信息
* @param cartGoods
* @param cartGoods
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
71c0bcd5
...
@@ -108,8 +108,7 @@ public class CalculationServiceImpl {
...
@@ -108,8 +108,7 @@ public class CalculationServiceImpl {
timeSaleCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
timeSaleCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
//优惠券
//优惠券
CouponPromotionVO
couponPromotionVO
=
couponDiscountCalculation
.
getCouponPromotionVO
(
partnerId
,
storeId
,
userId
,
couponCode
,
orderType
);
couponDiscountCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
couponDiscountCalculation
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
//套餐
//套餐
setMealCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
setMealCalculation
.
updateShoppingCartGoodsDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
71c0bcd5
...
@@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -74,12 +75,16 @@ public class CouponDiscountCalculation {
...
@@ -74,12 +75,16 @@ public class CouponDiscountCalculation {
/**
/**
* 优惠计算
* 优惠计算
*/
*/
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
public
void
updateShoppingCartGoodsDiscount
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
!
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_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))))){
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
discount
.
getType
()))))){
return
;
return
;
}
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
...
@@ -91,9 +96,14 @@ public class CouponDiscountCalculation {
...
@@ -91,9 +96,14 @@ public class CouponDiscountCalculation {
if
(
CollectionUtils
.
isEmpty
(
discounts
))
{
if
(
CollectionUtils
.
isEmpty
(
discounts
))
{
return
;
return
;
}
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponDiscounts
=
discounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponDiscounts
=
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
discounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
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
()))
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
discount
.
getType
())))).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
couponDiscounts
))
{
if
(
CollectionUtils
.
isEmpty
(
couponDiscounts
))
{
return
;
return
;
}
}
...
@@ -154,22 +164,29 @@ public class CouponDiscountCalculation {
...
@@ -154,22 +164,29 @@ public class CouponDiscountCalculation {
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
List
<
CartGoods
>
newCartGoodsList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
cartGoodsList
.
size
();
i
++)
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
"9998"
.
equals
(
cartGoods
.
getSkuId
()))
{
continue
;
}
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
continue
;
continue
;
}
}
//商品券商品
//商品券商品
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
discountsNew
=
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getDiscounts
();
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
())
||
discountMon
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
())
||
discountMon
!=
null
)
{
//先将商品券商品最终售价设置为 原价
//先将商品券商品最终售价设置为 原价
if
(!
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())){
if
(!
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())){
cartGoods
.
setAmount
(
cartGoods
.
getOriginalAmount
());
cartGoods
.
setAmount
(
cartGoods
.
getOriginalAmount
());
}
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
discountsNew
=
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getDiscounts
();
if
(
CollectionUtils
.
isNotEmpty
(
discountsNew
))
{
if
(
CollectionUtils
.
isNotEmpty
(
discountsNew
))
{
ApiLog
.
debug
(
"couponDiscountCalculation:{}"
,
discountsNew
);
ApiLog
.
debug
(
"couponDiscountCalculation:{}"
,
discountsNew
);
//这里过滤掉了 月享卡2.0,因为月享卡2.0商品不用展示划线价,故显示原价
//这里过滤掉了 月享卡2.0,因为月享卡2.0商品不用展示划线价,故显示原价
Optional
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
targetDiscount
=
discountsNew
.
stream
()
Optional
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
targetDiscount
=
discountsNew
.
stream
()
.
filter
(
t
->
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
t
.
getType
())).
findFirst
();
.
filter
(
t
->
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
t
.
getType
())).
findFirst
();
if
(
null
!=
targetDiscount
&&
targetDiscount
.
isPresent
())
{
if
(
null
!=
targetDiscount
&&
targetDiscount
.
isPresent
())
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
targetDiscount
.
get
();
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
targetDiscount
.
get
();
cartGoods
.
setCouponName
(
goodsDiscount
.
getActivityName
());
cartGoods
.
setCouponName
(
goodsDiscount
.
getActivityName
());
...
@@ -178,7 +195,26 @@ public class CouponDiscountCalculation {
...
@@ -178,7 +195,26 @@ public class CouponDiscountCalculation {
}
}
}
}
}
}
Optional
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
b3S1DiscountOptional
=
discountsNew
.
stream
()
.
filter
(
t
->
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
t
.
getType
())).
findFirst
();
if
(
b3S1DiscountOptional
.
isPresent
())
{
if
(
cartGoods
.
getQty
()
>
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
())
{
int
newNum
=
cartGoods
.
getQty
()
-
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
();
cartGoods
.
setQty
(
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
());
cartGoods
.
setCouponName
(
b3S1DiscountOptional
.
get
().
getActivityName
());
cartGoods
.
setCouponCode
(
b3S1DiscountOptional
.
get
().
getActivityCode
());
CartGoods
cartGoodsNew
=
new
CartGoods
();
BeanUtils
.
copyProperties
(
cartGoods
,
cartGoodsNew
);
cartGoodsNew
.
setCartGoodsUid
(
UUID
.
randomUUID
().
toString
());
cartGoodsNew
.
setQty
(
newNum
);
cartGoodsNew
.
setAmount
(
cartGoods
.
getAmount
());
cartGoods
.
setAmount
(
0
l
);
newCartGoodsList
.
add
(
cartGoodsNew
);
}
}
}
}
cartGoodsList
.
addAll
(
newCartGoodsList
);
// 当couponCode不为空时,需计算优惠价格
// 当couponCode不为空时,需计算优惠价格
long
couponDiscount
=
0
;
long
couponDiscount
=
0
;
...
@@ -201,6 +237,7 @@ public class CouponDiscountCalculation {
...
@@ -201,6 +237,7 @@ public class CouponDiscountCalculation {
discount
->
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
discount
->
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
discount
.
getType
())))
{
||
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
discount
.
getType
())))
{
...
@@ -218,6 +255,7 @@ public class CouponDiscountCalculation {
...
@@ -218,6 +255,7 @@ public class CouponDiscountCalculation {
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
())
||
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
discount
.
getType
()))).
collect
(
Collectors
.
toList
());
||
ActivityTypeEnum
.
TYPE_39
.
getCode
().
equals
(
discount
.
getType
()))).
collect
(
Collectors
.
toList
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/BatchGoodsInfoVo.java
View file @
71c0bcd5
...
@@ -92,18 +92,11 @@ public class BatchGoodsInfoVo {
...
@@ -92,18 +92,11 @@ public class BatchGoodsInfoVo {
private
String
couponCode
;
private
String
couponCode
;
/**
/**
* 买三赠一券code
*/
private
String
buyThreeGiveOneCouponCode
;
/**
* 买三赠一券活动号
*/
private
String
buyThreeGiveOneActivityCode
;
/**
* 当前商品是否为月享卡,0:否,1:是
* 当前商品是否为月享卡,0:否,1:是
*/
*/
private
int
isMonthCard
;
private
int
isMonthCard
;
private
int
isB3S1Coupon
;
/**
/**
* 是否为月享卡商品
* 是否为月享卡商品
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeAddGoodsRequestVo.java
View file @
71c0bcd5
...
@@ -148,9 +148,15 @@ public class MCoffeeAddGoodsRequestVo {
...
@@ -148,9 +148,15 @@ public class MCoffeeAddGoodsRequestVo {
* 是否为月享卡商品
* 是否为月享卡商品
*/
*/
private
int
isMonthCardGoods
;
private
int
isMonthCardGoods
;
private
int
isB3S1Coupon
;
/**
/**
* 月享卡加购信息
* 月享卡加购信息
*/
*/
private
MonthCardVo
monthCardInfo
;
private
MonthCardVo
monthCardInfo
;
/**
* 买3赠1券商品信息
*/
private
B3S1CouponGoodsInfoVo
b3S1CouponGoodsInfo
;
}
}
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