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
0ab36dcf
Commit
0ab36dcf
authored
Jun 15, 2021
by
hanghang.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/qa' into qa
parents
8580f247
a6112353
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
473 additions
and
48 deletions
+473
-48
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+3
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OldOrderAccountType.java
+1
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/QueryOrderAccountType.java
+1
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
+35
-0
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+3
-0
order-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
+0
-2
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
+9
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.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/BatchOperateCartGoodsRequestVo.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+13
-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
+282
-24
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
+49
-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.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
0ab36dcf
...
@@ -1444,6 +1444,9 @@ public class OrderSdkAdapter {
...
@@ -1444,6 +1444,9 @@ public class OrderSdkAdapter {
case
"COUPON"
:
case
"COUPON"
:
type
=
10
;
type
=
10
;
break
;
break
;
case
"B3S1_COUPON"
:
type
=
35
;
break
;
case
"FREIGHT_COUPON"
:
case
"FREIGHT_COUPON"
:
type
=
99
;
type
=
99
;
break
;
break
;
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OldOrderAccountType.java
View file @
0ab36dcf
...
@@ -22,6 +22,7 @@ public enum OldOrderAccountType {
...
@@ -22,6 +22,7 @@ public enum OldOrderAccountType {
PACK_AMOUNT
(
3
,
"包装费"
,
"PACK_AMOUNT"
),
PACK_AMOUNT
(
3
,
"包装费"
,
"PACK_AMOUNT"
),
COUPON
(
5
,
"代金券"
,
"COUPON"
),
COUPON
(
5
,
"代金券"
,
"COUPON"
),
PRODUCT_COUPON
(
6
,
"商品券"
,
"PRODUCT_COUPON"
),
PRODUCT_COUPON
(
6
,
"商品券"
,
"PRODUCT_COUPON"
),
B3S1_COUPON
(
35
,
"买3赠1券"
,
"B3S1_COUPON"
),
SEED_PRODUCT_COUPON
(
37
,
"种子券"
,
"SEED_PRODUCT_COUPON"
),
SEED_PRODUCT_COUPON
(
37
,
"种子券"
,
"SEED_PRODUCT_COUPON"
),
EVM_PRODUCT_COUPON
(
39
,
"EVM券"
,
"EVM_PRODUCT_COUPON"
),
EVM_PRODUCT_COUPON
(
39
,
"EVM券"
,
"EVM_PRODUCT_COUPON"
),
DISCOUNT_COUPON
(
7
,
"折扣券"
,
"DISCOUNT_COUPON"
),
DISCOUNT_COUPON
(
7
,
"折扣券"
,
"DISCOUNT_COUPON"
),
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/QueryOrderAccountType.java
View file @
0ab36dcf
...
@@ -22,6 +22,7 @@ public enum QueryOrderAccountType {
...
@@ -22,6 +22,7 @@ public enum QueryOrderAccountType {
BUY_DISCOUNT
(
"BUY_DISCOUNT"
,
"满减优惠"
),
BUY_DISCOUNT
(
"BUY_DISCOUNT"
,
"满减优惠"
),
PACK_AMOUNT
(
"PACK_AMOUNT"
,
"包装费"
),
PACK_AMOUNT
(
"PACK_AMOUNT"
,
"包装费"
),
COUPON
(
"COUPON"
,
"代金券"
),
COUPON
(
"COUPON"
,
"代金券"
),
B3S1_COUPON
(
"B3S1_COUPON"
,
"买3赠1券"
),
FREIGHT_COUPON
(
"FREIGHT_COUPON"
,
"运费券"
),
FREIGHT_COUPON
(
"FREIGHT_COUPON"
,
"运费券"
),
PRODUCT_COUPON
(
"PRODUCT_COUPON"
,
"商品券"
),
PRODUCT_COUPON
(
"PRODUCT_COUPON"
,
"商品券"
),
SEED_PRODUCT_COUPON
(
"SEED_PRODUCT_COUPON"
,
"种子券"
),
SEED_PRODUCT_COUPON
(
"SEED_PRODUCT_COUPON"
,
"种子券"
),
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
View file @
0ab36dcf
...
@@ -18,6 +18,7 @@ import lombok.NoArgsConstructor;
...
@@ -18,6 +18,7 @@ import lombok.NoArgsConstructor;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.UUID
;
@Data
@Data
...
@@ -104,6 +105,18 @@ public class CartGoods {
...
@@ -104,6 +105,18 @@ public class CartGoods {
*/
*/
private
MonthCardVo
monthCardInfo
;
private
MonthCardVo
monthCardInfo
;
/**
/**
* 是否是买3赠1券商品
*/
private
int
isB3S1Coupon
=
0
;
/**
* 是否使用了买3赠1券
*/
private
int
isB3S1CouponGoods
=
0
;
/**
* 买3赠1券信息
*/
private
B3S1CouponGoodsInfoVo
b3S1CouponGoodsInfo
;
/**
* 商品券名称
* 商品券名称
*/
*/
private
String
couponName
;
private
String
couponName
;
...
@@ -329,6 +342,28 @@ public class CartGoods {
...
@@ -329,6 +342,28 @@ public class CartGoods {
}
}
@Data
@Data
@NoArgsConstructor
public
static
class
B3S1CouponGoodsInfoVo
{
/**
* 卡号
*/
private
String
cardNo
;
/**
* 券号
*/
private
String
cardCode
;
/**
* 券号
*/
private
Set
<
String
>
cardCodeSet
;
private
Integer
useTimes
;
private
int
isUseB3S1Coupon
=
1
;
}
@Data
public
final
static
class
ComboxGoods
{
public
final
static
class
ComboxGoods
{
/**
/**
* 单规格spuId,多规格skuId
* 单规格spuId,多规格skuId
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
0ab36dcf
...
@@ -2828,6 +2828,9 @@ public class OrderAdapter {
...
@@ -2828,6 +2828,9 @@ public class OrderAdapter {
if
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
activityType
))
{
if
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
activityType
))
{
return
OldOrderAccountType
.
PRODUCT_COUPON
;
return
OldOrderAccountType
.
PRODUCT_COUPON
;
}
}
if
(
ActivityTypeEnum
.
TYPE_35
.
getCode
().
equals
(
activityType
))
{
return
OldOrderAccountType
.
PRODUCT_COUPON
;
}
if
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
activityType
))
{
if
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
activityType
))
{
return
OldOrderAccountType
.
PRODUCT_COUPON
;
return
OldOrderAccountType
.
PRODUCT_COUPON
;
}
}
...
...
order-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
0ab36dcf
...
@@ -32,7 +32,7 @@ public enum ActivityTypeEnum {
...
@@ -32,7 +32,7 @@ public enum ActivityTypeEnum {
TYPE_31
(
31
,
"折扣券"
),
TYPE_31
(
31
,
"折扣券"
),
TYPE_32
(
32
,
"商品券"
),
TYPE_32
(
32
,
"商品券"
),
TYPE_34
(
34
,
"运费券"
),
TYPE_34
(
34
,
"运费券"
),
TYPE_35
(
35
,
"买
1赠3
券"
),
TYPE_35
(
35
,
"买
3赠1
券"
),
TYPE_37
(
37
,
"种子券"
),
TYPE_37
(
37
,
"种子券"
),
TYPE_38
(
38
,
"月享卡2.0"
),
TYPE_38
(
38
,
"月享卡2.0"
),
TYPE_39
(
39
,
"EVM券"
),
TYPE_39
(
39
,
"EVM券"
),
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
View file @
0ab36dcf
...
@@ -175,8 +175,6 @@ public class ShoppingCartMccafeAdapter {
...
@@ -175,8 +175,6 @@ public class ShoppingCartMccafeAdapter {
cartGoodsDetailDto
.
setProductType
(
ProductType
.
SETMEAL
.
getCode
());
cartGoodsDetailDto
.
setProductType
(
ProductType
.
SETMEAL
.
getCode
());
}
else
if
(
GoodsTypeEnum
.
VIRTUAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())){
}
else
if
(
GoodsTypeEnum
.
VIRTUAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())){
cartGoodsDetailDto
.
setProductType
(
ProductType
.
VIRTUAL_PRODUCT
.
getCode
());
cartGoodsDetailDto
.
setProductType
(
ProductType
.
VIRTUAL_PRODUCT
.
getCode
());
}
else
if
(
cartGoods
.
isWeightType
())
{
cartGoodsDetailDto
.
setProductType
(
ProductType
.
WEIGHT_PRODUCT
.
getCode
());
}
}
//小料
//小料
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
View file @
0ab36dcf
...
@@ -90,6 +90,15 @@ public class MCoffeeShoppingCartController {
...
@@ -90,6 +90,15 @@ public class MCoffeeShoppingCartController {
return
shoppingCartMCoffeeService
.
batchUpdateGoodsQty
(
request
);
return
shoppingCartMCoffeeService
.
batchUpdateGoodsQty
(
request
);
}
}
/**
* 向购物车中添加商品
*/
@ApiAnnotation
(
logMessage
=
"removeB3S1Coupon"
)
@PostMapping
(
value
=
"/removeB3S1Coupon"
)
public
BaseResponse
removeB3S1Coupon
(
@Validated
@LogParams
@RequestBody
MCoffeeAddGoodsRequestVo
request
)
{
return
shoppingCartMCoffeeService
.
removeB3S1Coupon
(
request
);
}
@ApiAnnotation
(
logMessage
=
"getCartInfoByUser"
)
@ApiAnnotation
(
logMessage
=
"getCartInfoByUser"
)
@PostMapping
(
value
=
"/getCartInfoByUser"
)
@PostMapping
(
value
=
"/getCartInfoByUser"
)
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
View file @
0ab36dcf
...
@@ -4,6 +4,7 @@ import cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto;
...
@@ -4,6 +4,7 @@ import cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto;
import
cn.freemud.entities.dto.OrderProductAddInfo
;
import
cn.freemud.entities.dto.OrderProductAddInfo
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ShareDiscountActivityDto
;
import
cn.freemud.entities.dto.activity.ShareDiscountActivityDto
;
import
cn.freemud.entities.vo.B3S1CouponGoodsInfoVo
;
import
cn.freemud.entities.vo.CartGoods
;
import
cn.freemud.entities.vo.CartGoods
;
import
cn.freemud.entities.vo.MonthCardVo
;
import
cn.freemud.entities.vo.MonthCardVo
;
import
cn.freemud.entities.vo.SubtractStockVO
;
import
cn.freemud.entities.vo.SubtractStockVO
;
...
@@ -274,6 +275,10 @@ public class ShoppingCartGoodsDto {
...
@@ -274,6 +275,10 @@ public class ShoppingCartGoodsDto {
*/
*/
private
int
isMonthCard
;
private
int
isMonthCard
;
/**
/**
* 是否是买3赠1券商品
*/
private
int
isB3S1Coupon
=
0
;
/**
* 是否为种子券商品 1:是;0:否
* 是否为种子券商品 1:是;0:否
*/
*/
private
int
isSeedCouponGoods
;
private
int
isSeedCouponGoods
;
...
@@ -282,6 +287,10 @@ public class ShoppingCartGoodsDto {
...
@@ -282,6 +287,10 @@ public class ShoppingCartGoodsDto {
*/
*/
private
MonthCardVo
monthCardInfo
;
private
MonthCardVo
monthCardInfo
;
/**
/**
* 买3赠1券信息
*/
private
B3S1CouponGoodsInfoVo
b3S1CouponGoodsInfo
;
/**
* 商品货号
* 商品货号
*/
*/
private
String
productCode
;
private
String
productCode
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/B3S1CouponGoodsInfoVo.java
0 → 100644
View file @
0ab36dcf
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/BatchOperateCartGoodsRequestVo.java
View file @
0ab36dcf
...
@@ -49,6 +49,11 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
...
@@ -49,6 +49,11 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
private
String
redundancyCouponCode
;
private
String
redundancyCouponCode
;
/**
/**
* 根据券号清除当前购物车中月卡及商品信息
*/
private
String
redundancyB3S1CouponCode
;
/**
* 是否使用月享卡2.0
* 是否使用月享卡2.0
* 1 是
* 1 是
* 0 否
* 0 否
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
0ab36dcf
...
@@ -240,11 +240,19 @@ public class CartGoods {
...
@@ -240,11 +240,19 @@ public class CartGoods {
*/
*/
private
int
isMonthCard
=
0
;
private
int
isMonthCard
=
0
;
/**
/**
* 是否是买3赠1券商品
*/
private
int
isB3S1Coupon
=
0
;
/**
* 是否使用了买3赠1券
*/
private
int
isB3S1CouponGoods
=
0
;
/**
* 是否是太阳蛋商品
* 是否是太阳蛋商品
*/
*/
private
int
isSunnyCoupon
=
0
;
private
int
isSunnyCoupon
=
0
;
/**
/**
* 是否为
月享卡
商品 1:是;0:否
* 是否为
可以使用买月享卡的
商品 1:是;0:否
*/
*/
private
int
isMonthCardGoods
=
0
;
private
int
isMonthCardGoods
=
0
;
/**
/**
...
@@ -252,6 +260,10 @@ public class CartGoods {
...
@@ -252,6 +260,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 @
0ab36dcf
...
@@ -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 @
0ab36dcf
...
@@ -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
isUseB3S1Coupon
=
1
;
/**
* 优惠券对应的活动号
* 优惠券对应的活动号
*/
*/
private
String
activityCode
;
private
String
activityCode
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
0ab36dcf
...
@@ -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 @
0ab36dcf
...
@@ -160,7 +160,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -160,7 +160,7 @@ public class ShoppingCartMCoffeeServiceImpl {
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
);
}
}
...
@@ -174,6 +174,9 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -174,6 +174,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
)
{
...
@@ -206,7 +209,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -206,7 +209,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的优惠项展示
...
@@ -223,7 +226,32 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -223,7 +226,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
,
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
();
addCartGoods
.
setB3S1CouponGoodsInfo
(
b3S1CouponGoodsInfoVo
);
Set
<
String
>
set
=
new
HashSet
<>();
b3S1CouponGoodsInfoVo
.
setCardCodeSet
(
set
);
set
.
add
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
oldCartGoodsList
.
add
(
addCartGoods
);
}
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
couponCode
,
oldCartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
,
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
);
...
@@ -233,14 +261,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -233,14 +261,6 @@ public class ShoppingCartMCoffeeServiceImpl {
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
,
null
);
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
,
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
,
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
);
...
@@ -378,6 +398,18 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -378,6 +398,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
;
...
@@ -397,6 +429,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -397,6 +429,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
);
}
}
//使用券的是,如果购物车已经存在这个券,先清除,再添加
//使用券的是,如果购物车已经存在这个券,先清除,再添加
//过滤月享卡种子券
//过滤月享卡种子券
...
@@ -483,6 +529,16 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -483,6 +529,16 @@ public class ShoppingCartMCoffeeServiceImpl {
clearCouponCodeRequestVo
.
setIsUseMonthCard
(
requestVo
.
getIsUseMonthCard
());
clearCouponCodeRequestVo
.
setIsUseMonthCard
(
requestVo
.
getIsUseMonthCard
());
baseResponse
=
clearCouponInfoByCode
(
clearCouponCodeRequestVo
);
baseResponse
=
clearCouponInfoByCode
(
clearCouponCodeRequestVo
);
}
}
if
(
StringUtils
.
isNotEmpty
(
requestVo
.
getRedundancyB3S1CouponCode
())){
MCoffeeAddGoodsRequestVo
clearCouponCodeRequestVo
=
new
MCoffeeAddGoodsRequestVo
();
clearCouponCodeRequestVo
.
setCouponCode
(
requestVo
.
getRedundancyB3S1CouponCode
());
clearCouponCodeRequestVo
.
setSessionId
(
requestVo
.
getSessionId
());
clearCouponCodeRequestVo
.
setPartnerId
(
requestVo
.
getPartnerId
());
clearCouponCodeRequestVo
.
setShopId
(
requestVo
.
getShopId
());
clearCouponCodeRequestVo
.
setOrderType
(
requestVo
.
getOrderType
());
clearCouponCodeRequestVo
.
setChannelType
(
requestVo
.
getChannelType
());
baseResponse
=
removeB3S1Coupon
(
clearCouponCodeRequestVo
);
}
if
(
CollectionUtils
.
isNotEmpty
(
requestVo
.
getQtyInfoList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
requestVo
.
getQtyInfoList
()))
{
BatchUpdateGoodsQtyRequestVo
updateGoodsQtyRequestVo
=
new
BatchUpdateGoodsQtyRequestVo
();
BatchUpdateGoodsQtyRequestVo
updateGoodsQtyRequestVo
=
new
BatchUpdateGoodsQtyRequestVo
();
...
@@ -555,6 +611,132 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -555,6 +611,132 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
/**
/**
* 批量更新购物车商品数量
* @param addShoppingCartGoodsRequestVo
* @return
*/
public
BaseResponse
removeB3S1Coupon
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
){
if
(
StringUtils
.
isEmpty
(
addShoppingCartGoodsRequestVo
.
getShopId
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
if
(
StringUtils
.
isEmpty
(
addShoppingCartGoodsRequestVo
.
getCouponCode
())){
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_UPDATE_ERROR
,
"买3赠1券号不能为空"
);
}
String
sessionId
=
addShoppingCartGoodsRequestVo
.
getSessionId
();
// 获取用户信息
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
sessionId
);
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
partnerId
=
addShoppingCartGoodsRequestVo
.
getPartnerId
();
String
storeId
=
addShoppingCartGoodsRequestVo
.
getShopId
();
String
appId
=
addShoppingCartGoodsRequestVo
.
getAppId
();
String
spuId
=
addShoppingCartGoodsRequestVo
.
getSpuId
();
String
skuId
=
StringUtils
.
isNotBlank
(
addShoppingCartGoodsRequestVo
.
getSkuId
())
?
addShoppingCartGoodsRequestVo
.
getSkuId
()
:
""
;
String
goodsId
=
StringUtils
.
isEmpty
(
skuId
)
?
spuId
:
skuId
;
String
tableNumber
=
addShoppingCartGoodsRequestVo
.
getTableNumber
();
String
menuType
=
addShoppingCartGoodsRequestVo
.
getMenuType
();
Integer
orderType
=
addShoppingCartGoodsRequestVo
.
getOrderType
();
String
receiveId
=
addShoppingCartGoodsRequestVo
.
getReceiveId
();
Integer
operationType
=
addShoppingCartGoodsRequestVo
.
getOperationType
();
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
// 查询购物车缓存
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
null
,
shoppingCartBaseService
);
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
))
{
cartGoodsList
=
new
ArrayList
<>();
}
cartGoodsList
=
clearB3S1CouponInfo
(
cartGoodsList
,
couponCode
);
Optional
<
CartGoods
>
cartGoods9998
=
cartGoodsList
.
stream
().
filter
(
o
->
"9998"
.
equals
(
skuId
)
&&
o
.
getIsB3S1Coupon
()
==
1
).
findFirst
();
if
(
cartGoods9998
.
isPresent
())
{
cartGoods9998
.
get
().
getB3S1CouponGoodsInfo
().
getCardCodeSet
().
remove
(
couponCode
);
}
CartGoods
monthCardProduct
=
null
;
CartGoods
B3S1CouponProduct
=
null
;
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
for
(
CartGoods
goods
:
cartGoodsList
)
{
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9999"
)){
monthCardProduct
=
goods
;
continue
;
}
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9998"
)){
B3S1CouponProduct
=
goods
;
continue
;
}
temList
.
add
(
goods
);
}
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
temList
,
sessionId
);
if
(
null
!=
monthCardProduct
)
{
cartGoodsList
.
add
(
monthCardProduct
);
}
if
(
null
!=
B3S1CouponProduct
)
{
cartGoodsList
.
add
(
B3S1CouponProduct
);
}
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
int
size
=
cartGoodsList
.
size
();
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
()))
{
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
)
&&
cartGoodsList
.
get
(
i
).
getSkuId
().
equals
(
mcCafeTablewareSkuId
))
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
cartGoods
.
setIsTableware
(
true
);
if
(
i
!=
size
-
1
)
{
cartGoodsList
.
remove
(
i
);
cartGoodsList
.
add
(
cartGoods
);
break
;
}
}
}
}
}
String
productCouponCode
=
assortmentSdkService
.
getShoppingCartCoupon
(
partnerId
,
storeId
,
userId
,
shoppingCartBaseService
,
SaveCouponType
.
COUPON
.
getCode
());
String
freightCouponCode
=
assortmentSdkService
.
getShoppingCartCoupon
(
partnerId
,
storeId
,
userId
,
shoppingCartBaseService
,
SaveCouponType
.
FREIGHT_COUPON
.
getCode
());
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
productCouponCode
,
null
,
cartGoodsList
,
freightCouponCode
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
couponCode
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
,
null
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
null
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
/**
* 根据券号清除券信息
* 根据券号清除券信息
* @param requestVo
* @param requestVo
* @return
* @return
...
@@ -625,10 +807,13 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -625,10 +807,13 @@ public class ShoppingCartMCoffeeServiceImpl {
CartGoods
cartGoods
=
null
;
CartGoods
cartGoods
=
null
;
String
skuId
=
""
;
String
skuId
=
""
;
Integer
finalQty
=
qty
;
Integer
finalQty
=
qty
;
boolean
isB3S1Coupon
=
false
;
String
b3S1CouponCode
=
""
;
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
for
(
CartGoods
cartGoods_
:
cartGoodsList
)
{
for
(
CartGoods
cartGoods_
:
cartGoodsList
)
{
//如果菜单购月卡数量大于10,则不作数量修改,直接算价并返回之前购物车信息
//如果菜单购月卡数量大于10,则不作数量修改,直接算价并返回之前购物车信息
if
(
Objects
.
equals
(
1
,
cartGoods_
.
getIsMonthCard
())
if
(
Objects
.
equals
(
1
,
cartGoods_
.
getIsMonthCard
())
&&
cartGoods_
.
getCartGoodsUid
().
equals
(
updateShoppingCartGoodsQtyRequestVo
.
getCartGoodsUid
()
)
&&
cartGoods_
.
getCartGoodsUid
().
equals
(
cartGoodsUid
)
&&
updateShoppingCartGoodsQtyRequestVo
.
getQty
()>
10
)
{
&&
updateShoppingCartGoodsQtyRequestVo
.
getQty
()>
10
)
{
shoppingCartGoodsResponseVo
.
setChanged
(
true
);
shoppingCartGoodsResponseVo
.
setChanged
(
true
);
shoppingCartGoodsResponseVo
.
setToastMsg
(
ResponseResult
.
SHOPPING_CART_QTY_LIMIT_ERR
.
getMessage
());
shoppingCartGoodsResponseVo
.
setToastMsg
(
ResponseResult
.
SHOPPING_CART_QTY_LIMIT_ERR
.
getMessage
());
...
@@ -648,12 +833,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -648,12 +833,20 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
cartGoods_
.
getIsMonthCard
()
==
1
&&
cartGoods_
.
getMonthCardInfo
()
!=
null
&&
qty
!=
null
&&
qty
==
0
){
if
(
cartGoods_
.
getIsMonthCard
()
==
1
&&
cartGoods_
.
getMonthCardInfo
()
!=
null
&&
qty
!=
null
&&
qty
==
0
){
cartGoodsList
=
clearMonthCouponInfo
(
cartGoodsList
,
cartGoods_
.
getMonthCardInfo
().
getCardCode
(),
cartGoodsUid
);
cartGoodsList
=
clearMonthCouponInfo
(
cartGoodsList
,
cartGoods_
.
getMonthCardInfo
().
getCardCode
(),
cartGoodsUid
);
}
}
if
(
cartGoods_
.
getIsB3S1Coupon
()
==
1
&&
cartGoods_
.
getB3S1CouponGoodsInfo
()
!=
null
&&
qty
!=
null
&&
qty
==
0
){
isB3S1Coupon
=
true
;
b3S1CouponCode
=
cartGoods_
.
getB3S1CouponGoodsInfo
().
getCardCode
();
}
cartGoods
=
cartGoods_
;
cartGoods
=
cartGoods_
;
cartGoods_
.
setQty
(
qty
);
cartGoods_
.
setQty
(
qty
);
skuId
=
cartGoods_
.
getSkuId
();
skuId
=
cartGoods_
.
getSkuId
();
finalQty
=
cartGoods_
.
getQty
();
finalQty
=
cartGoods_
.
getQty
();
break
;
break
;
}
}
temList
.
add
(
cartGoods_
);
}
if
(
isB3S1Coupon
)
{
cartGoodsList
=
clearB3S1CouponInfo
(
cartGoodsList
,
b3S1CouponCode
);
}
}
if
(!
mcCafeTablewareSkuId
.
equals
(
skuId
)
&&
finalQty
==
0
&&
CollectionUtils
.
isNotEmpty
(
cartGoodsList
)
&&
cartGoodsList
.
size
()
==
2
)
{
if
(!
mcCafeTablewareSkuId
.
equals
(
skuId
)
&&
finalQty
==
0
&&
CollectionUtils
.
isNotEmpty
(
cartGoodsList
)
&&
cartGoodsList
.
size
()
==
2
)
{
...
@@ -673,16 +866,13 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -673,16 +866,13 @@ public class ShoppingCartMCoffeeServiceImpl {
throw
new
ServiceException
(
ResponseResult
.
NOT_SUPPORTED
);
throw
new
ServiceException
(
ResponseResult
.
NOT_SUPPORTED
);
}
}
// 检查购物车商品库存数量
// checkUpdateStock(partnerId, storeId, menuType, qty, cartGoods);
// check购物车中所有商品
// check购物车中所有商品
// cartGoodsList = checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, cartGoodsList
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
temList
,
sessionId
);
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
//
List<CartGoods> temList = new ArrayList<>();
for
(
CartGoods
goods
:
cartGoodsList
)
{
//
for (CartGoods goods : cartGoodsList) {
temList
.
addAll
(
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
goods
),
sessionId
));
//
temList.addAll(checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, Arrays.asList(goods), sessionId));
}
//
}
cartGoodsList
=
temList
;
//
cartGoodsList = temList;
// 重新存储最新购物车
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
...
@@ -750,6 +940,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -750,6 +940,7 @@ public class ShoppingCartMCoffeeServiceImpl {
List
<
CartGoods
>
cartSendGoodsList
=
assortmentSdkService
.
getShoppingCartSendGoods
(
partnerId
,
storeId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
List
<
CartGoods
>
cartSendGoodsList
=
assortmentSdkService
.
getShoppingCartSendGoods
(
partnerId
,
storeId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
ApiLog
.
debug
(
"cartSendGoodsList: {}"
,
JSONObject
.
toJSONString
(
cartSendGoodsList
));
ApiLog
.
debug
(
"cartSendGoodsList: {}"
,
JSONObject
.
toJSONString
(
cartSendGoodsList
));
CartGoods
monthCardProduct
=
null
;
CartGoods
monthCardProduct
=
null
;
CartGoods
B3S1CouponProduct
=
null
;
// 如果购物车商品不为空, 则check购物车中所有商品
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
// check购物车中所有商品
...
@@ -758,21 +949,42 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -758,21 +949,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
.
getIsUseB3S1Coupon
()
!=
null
&&
goods
.
getB3S1CouponGoodsInfo
()
!=
null
)
{
goods
.
getB3S1CouponGoodsInfo
().
setIsUseB3S1Coupon
(
shoppingCartInfoRequestVo
.
getIsUseB3S1Coupon
());
}
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9999"
)){
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9999"
)){
monthCardProduct
=
goods
;
monthCardProduct
=
goods
;
continue
;
continue
;
}
}
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9998"
)){
B3S1CouponProduct
=
goods
;
continue
;
}
temList
.
add
(
goods
);
temList
.
add
(
goods
);
}
}
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
temList
,
sessionId
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
temList
,
sessionId
);
if
(
null
!=
monthCardProduct
)
{
if
(
null
!=
monthCardProduct
)
{
cartGoodsList
.
add
(
monthCardProduct
);
cartGoodsList
.
add
(
monthCardProduct
);
}
}
if
(
null
!=
B3S1CouponProduct
)
{
cartGoodsList
.
add
(
B3S1CouponProduct
);
}
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
)
{
...
@@ -1523,6 +1735,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1523,6 +1735,7 @@ public class ShoppingCartMCoffeeServiceImpl {
*/
*/
public
List
<
CartGoods
>
updateCartGoodsLegal
(
String
partnerId
,
String
storeId
,
Integer
orderType
,
String
tableNumber
,
String
menuType
,
String
sessionId
,
public
List
<
CartGoods
>
updateCartGoodsLegal
(
String
partnerId
,
String
storeId
,
Integer
orderType
,
String
tableNumber
,
String
menuType
,
String
sessionId
,
CartGoods
addCartGoods
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
oldCartGoodsList
)
{
CartGoods
addCartGoods
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
oldCartGoodsList
)
{
oldCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
,
sessionId
);
oldCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
,
sessionId
);
List
<
CartGoods
>
newCartGoods
=
new
ArrayList
<>();
List
<
CartGoods
>
newCartGoods
=
new
ArrayList
<>();
newCartGoods
.
add
(
addCartGoods
);
newCartGoods
.
add
(
addCartGoods
);
...
@@ -1751,6 +1964,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1751,6 +1964,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
();
...
@@ -1758,7 +1972,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1758,7 +1972,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
();
}
}
...
@@ -1872,10 +2086,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1872,10 +2086,20 @@ public class ShoppingCartMCoffeeServiceImpl {
//超值加购活动商品
//超值加购活动商品
List
<
CartGoods
>
reduceGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
==
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
List
<
CartGoods
>
reduceGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
==
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
CartGoods
b3S1CartGoods
=
null
;
for
(
CartGoods
cartGoods
:
checkGoods
)
{
if
(
"9998"
.
equals
(
cartGoods
.
getSkuId
()))
{
b3S1CartGoods
=
cartGoods
;
}
else
{
temList
.
add
(
cartGoods
);
}
}
List
<
CartGoods
>
allCartGoodsList
=
new
ArrayList
<>();
List
<
CartGoods
>
allCartGoodsList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
checkGoods
))
{
if
(
CollectionUtils
.
isNotEmpty
(
temList
))
{
//当商品全部添加完毕,校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
//当商品全部添加完毕,校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
CheckCartRequest
checkCartRequest
=
checkShoppingCartSdkForMCoffee
(
checkGoods
,
partnerId
,
CheckCartRequest
checkCartRequest
=
checkShoppingCartSdkForMCoffee
(
temList
,
partnerId
,
storeId
,
shoppingCartGoodsResponseVo
,
orderType
,
sessionId
,
menuType
,
shoppingCartBaseService
);
storeId
,
shoppingCartGoodsResponseVo
,
orderType
,
sessionId
,
menuType
,
shoppingCartBaseService
);
if
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
()
!=
null
)
{
if
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
()
!=
null
)
{
shoppingCartGoodsResponseVo
.
setToastMsg
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getToastMsg
());
shoppingCartGoodsResponseVo
.
setToastMsg
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getToastMsg
());
...
@@ -1884,6 +2108,9 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1884,6 +2108,9 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
allCartGoodsList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
checkCartRequest
.
getCartGoodsList
()),
CartGoods
.
class
);
allCartGoodsList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
checkCartRequest
.
getCartGoodsList
()),
CartGoods
.
class
);
}
}
if
(
null
!=
b3S1CartGoods
)
{
allCartGoodsList
.
add
(
b3S1CartGoods
);
}
//添加商品为超值加购活动商品
//添加商品为超值加购活动商品
if
(
CollectionUtils
.
isNotEmpty
(
reduceGoods
))
{
if
(
CollectionUtils
.
isNotEmpty
(
reduceGoods
))
{
...
@@ -1981,6 +2208,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1981,6 +2208,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
);
}
}
}
}
}
}
}
}
...
@@ -2355,6 +2596,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -2355,6 +2596,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
;
...
@@ -2413,6 +2655,13 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -2413,6 +2655,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
...
@@ -2427,4 +2676,13 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -2427,4 +2676,13 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
return
cartGoods
.
stream
().
filter
(
t
->
!
StringUtils
.
equals
(
"9999"
,
t
.
getSkuId
())
&&
!
t
.
getCartGoodsUid
().
equals
(
cartGoodsUid
)).
collect
(
Collectors
.
toList
());
return
cartGoods
.
stream
().
filter
(
t
->
!
StringUtils
.
equals
(
"9999"
,
t
.
getSkuId
())
&&
!
t
.
getCartGoodsUid
().
equals
(
cartGoodsUid
)).
collect
(
Collectors
.
toList
());
}
}
/**
* 清除购物车商品使用买3赠1券信息
* @param couponCode
*/
private
List
<
CartGoods
>
clearB3S1CouponInfo
(
List
<
CartGoods
>
cartGoodsList
,
String
couponCode
){
cartGoodsList
.
removeIf
(
o
->
couponCode
.
equals
(
o
.
getCouponCode
()));
return
cartGoodsList
;
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
0ab36dcf
...
@@ -114,8 +114,7 @@ public class CalculationServiceImpl {
...
@@ -114,8 +114,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 @
0ab36dcf
...
@@ -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,30 @@ public class CouponDiscountCalculation {
...
@@ -154,22 +164,30 @@ 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
);
cartGoods
.
setIsB3S1CouponGoods
(
0
);
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 +196,27 @@ public class CouponDiscountCalculation {
...
@@ -178,7 +196,27 @@ 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
.
setIsB3S1Coupon
(
1
);
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 +239,7 @@ public class CouponDiscountCalculation {
...
@@ -201,6 +239,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 +257,7 @@ public class CouponDiscountCalculation {
...
@@ -218,6 +257,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 @
0ab36dcf
...
@@ -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 @
0ab36dcf
...
@@ -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