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
11208477
Commit
11208477
authored
Apr 15, 2021
by
ping.wu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
d7cc97ec
767e22ae
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
647 additions
and
271 deletions
+647
-271
assortment-ordercenter-sdk/pom.xml
+2
-2
assortment-ordercenter-sdk/readme.md
+3
-2
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+7
-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-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/response/order/QueryOrdersResponse.java
+2
-0
assortment-shoppingcart-sdk/pom.xml
+1
-1
assortment-shoppingcart-sdk/readme.md
+2
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
+13
-1
order-application-service/pom.xml
+1
-1
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+35
-14
order-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
+29
-0
order-application-service/src/main/java/cn/freemud/entities/vo/QueryOrderResponseVo.java
+8
-0
order-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
+2
-0
order-application-service/src/main/java/cn/freemud/service/impl/CheckMCCafeOrder.java
+13
-19
order-application-service/src/main/java/cn/freemud/service/impl/MCCafeOrderServiceImpl.java
+114
-3
ordercenter-sdk/pom.xml
+1
-1
ordercenter-sdk/readme.md
+3
-2
ordercenter-sdk/src/main/java/com/freemud/application/sdk/api/ordercenter/constant/InterfaceAddressConstant.java
+1
-0
ordercenter-sdk/src/main/java/com/freemud/application/sdk/api/ordercenter/service/OrderSdkService.java
+13
-0
shopping-cart-application-service/pom.xml
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
+5
-2
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountRequestDto.java
+0
-4
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountResponseDto.java
+30
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
+7
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/BatchOperateCartGoodsRequestVo.java
+14
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+3
-3
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ClearCouponCodeRequestVo.java
+18
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/MonthCardVo.java
+6
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
+7
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+0
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+212
-155
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+7
-4
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+80
-49
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/BatchGoodsInfoVo.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeAddGoodsRequestVo.java
+2
-2
No files found.
assortment-ordercenter-sdk/pom.xml
View file @
11208477
...
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.1.4
8
-RELEASE
</version>
<version>
2.1.4
9
-RELEASE
</version>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -38,7 +38,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
ordercenter-sdk
</artifactId>
<version>
1.3.4
4
.RELEASE
</version>
<version>
1.3.4
5
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
assortment-ordercenter-sdk/readme.md
View file @
11208477
...
...
@@ -122,4 +122,5 @@
| 2.1.45-RELEASE | ordercentersdk 升级 | 王航航 | 2021-04-07 |
| 2.1.46-RELEASE | 单品立减平台化 | 梁崇福 | 2021-04-08 |
| 2.1.47-RELEASE | 赠品落库 | 梁崇福 | 2021-04-08 |
| 2.1.48-RELEASE | 小程序外卖单,接单,配送自动扭转时间为空设置默认值 | 伍平 | 2021-04-12 |
\ No newline at end of file
| 2.1.48-RELEASE | 小程序外卖单,接单,配送自动扭转时间为空设置默认值 | 伍平 | 2021-04-12 |
| 2.1.49-RELEASE | 月享卡2.0 | 徐康 | 2021-04-15 |
\ No newline at end of file
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
11208477
...
...
@@ -968,6 +968,7 @@ public class OrderSdkAdapter {
productDiscount
.
setCustomerCode
(
""
);
productDiscount
.
setAddInfo
(
orderSettlementResp
.
getExtInfo
());
productDiscount
.
setProductId
(
orderSettlementResp
.
getProductId
());
productDiscount
.
setExtInfo
(
orderSettlementResp
.
getExtInfo
());
discountList
.
add
(
productDiscount
);
}
}
...
...
@@ -1416,6 +1417,9 @@ public class OrderSdkAdapter {
case
"FULL_BUYM_SENDN"
:
type
=
230
;
break
;
case
"MONTH_CARD_TOTAL_DISCOUNT"
:
type
=
231
;
break
;
case
"SINGLE_PRODUCT_REDUCTION"
:
type
=
22
;
break
;
...
...
@@ -2035,6 +2039,9 @@ public class OrderSdkAdapter {
case
230
:
newOrderAccountType
=
OldOrderAccountType
.
FULL_BUYM_SENDN
.
getCode
();
break
;
case
231
:
newOrderAccountType
=
OldOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
.
getCode
();
break
;
case
22
:
newOrderAccountType
=
OldOrderAccountType
.
SINGLE_PRODUCT_REDUCTION
.
getCode
();
break
;
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OldOrderAccountType.java
View file @
11208477
...
...
@@ -43,6 +43,7 @@ public enum OldOrderAccountType {
NEW_USER_DISCOUNT
(
101
,
"新用户立减"
,
"NEW_USER_DISCOUNT"
),
PRICE_DEDUCTION_COUPON
(
103
,
"抵价券"
,
"PRICE_DEDUCTION_COUPON"
),
TOTAL_DISCOUNT
(
205
,
"优惠总金额"
,
"TOTAL_DISCOUNT"
),
MONTH_CARD_TOTAL_DISCOUNT
(
231
,
"月享卡优惠总金额"
,
"MONTH_CARD_TOTAL_DISCOUNT"
),
GATHER_SPOT
(
221
,
"集点活动"
,
"GATHER_SPOT"
),
MEMBER_PRICE_DISCOUNT
(
220
,
"会员价优惠"
,
"MEMBER_PRICE_DISCOUNT"
),
COCO_PRODUCT_CASH_COUPON
(
36
,
"coco商品代金券"
,
"COCO_PRODUCT_CASH_COUPON"
),
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/QueryOrderAccountType.java
View file @
11208477
...
...
@@ -37,6 +37,7 @@ public enum QueryOrderAccountType {
CARD_DISCOUNT_AMOUNT
(
"CARD_DISCOUNT_AMOUNT"
,
"会员卡优惠金额"
),
XY_DISCOUNT
(
"XY_DISCOUNT"
,
"x件y折"
),
TOTAL_DISCOUNT
(
"TOTAL_DISCOUNT"
,
"优惠总金额"
),
MONTH_CARD_TOTAL_DISCOUNT
(
"MONTH_CARD_TOTAL_DISCOUNT"
,
"月享卡优惠总金额"
),
ONLINE_PAY
(
"ONLINE_PAY"
,
"线上支付"
),
FULL_DISTRIBUTION_FEE
(
"FULL_DISTRIBUTION_FEE"
,
"满减配送费"
),
OFFLINE_PAY
(
"OFFLINE_PAY"
,
"线下支付"
),
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/response/order/QueryOrdersResponse.java
View file @
11208477
...
...
@@ -716,6 +716,8 @@ public class QueryOrdersResponse {
private
String
addInfo
;
private
String
productId
;
private
String
extInfo
;
}
@NoArgsConstructor
...
...
assortment-shoppingcart-sdk/pom.xml
View file @
11208477
...
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.2.
6
.RELEASE
</version>
<version>
1.2.
7
.RELEASE
</version>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
assortment-shoppingcart-sdk/readme.md
View file @
11208477
...
...
@@ -15,4 +15,5 @@
| 1.2.3.RELEASE| 麦咖啡商品券门槛金额字段| 孙昱 | 2021-02-04 |
| 1.2.4.RELEASE| 多小料| 刘鹏飞 | 2021-03-03 |
| 1.2.5.RELEASE| 频次券| 梁崇福 | 2021-03-09 |
| 1.2.6.RELEASE| 多规格加料校验| 梁崇福 | 2021-03-25 |
\ No newline at end of file
| 1.2.6.RELEASE| 多规格加料校验| 梁崇福 | 2021-03-25 |
| 1.2.7.RELEASE| 麦咖啡月享卡2.0| 孙昱 | 2021-04-15 |
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
View file @
11208477
...
...
@@ -80,7 +80,13 @@ public class CartGoods {
/**
* 是否为种子券商品 1:是;0:否
*/
private
int
isSeedCouponGoods
;
private
int
isMonthCardGoods
;
/**
* 是否使用月享卡2.0
* 1 是
* 0 否
*/
private
int
isUseMonthCard
;
/**
* 是否是太阳蛋商品
*/
...
...
@@ -314,6 +320,12 @@ public class CartGoods {
* 月享卡类型:1.月享卡(单商品购买);2.月享卡(多商品购买);3.普通月卡
*/
private
Integer
type
;
/**
* 是否使用月享卡2.0
* 1 是
* 0 否
*/
private
int
isUseMonthCard
;
}
@Data
...
...
order-application-service/pom.xml
View file @
11208477
...
...
@@ -46,7 +46,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.1.4
8
-RELEASE
</version>
<version>
2.1.4
9
-RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
11208477
...
...
@@ -243,7 +243,8 @@ public class OrderAdapter {
if
(
ActivityTypeEnum
.
TYPE_11
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
())
||
ActivityTypeEnum
.
TYPE_12
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
())
||
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
()))
{
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
()))
{
jsonObject
.
put
(
"tenderId"
,
activityDiscountsDto
.
getTenderId
());
}
else
if
(
ActivityTypeEnum
.
TYPE_34
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
()))
{
jsonObject
.
put
(
"customerCode"
,
activityDiscountsDto
.
getTenderId
());
...
...
@@ -317,6 +318,16 @@ public class OrderAdapter {
.
build
();
orderAccountDtos
.
add
(
createOrderAccountDto
);
}
if
(
shoppingCartGoodsDto
.
getMonthCardDiscount
()
!=
null
&&
shoppingCartGoodsDto
.
getMonthCardDiscount
().
getDiscountAmount
()
!=
0
)
{
CreateOrderAccountRequest
createOrderAccountDto
=
CreateOrderAccountRequest
.
builder
()
.
accountId
(
""
)
.
name
(
shoppingCartGoodsDto
.
getMonthCardDiscount
().
getDiscountDesc
())
.
price
(
shoppingCartGoodsDto
.
getMonthCardDiscount
().
getDiscountAmount
())
.
accountType
(
QueryOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
)
.
sequence
(
orderAccountIndex
++)
.
build
();
orderAccountDtos
.
add
(
createOrderAccountDto
);
}
createOrderDto
.
setAccounts
(
CollectionUtils
.
isNotEmpty
(
orderAccountDtos
)
?
orderAccountDtos
:
Collections
.
emptyList
());
// update by miaohui 20201030 for 【ID1018638】【C端服务端】活动库存接口调整对接
...
...
@@ -442,7 +453,8 @@ public class OrderAdapter {
.
build
();
JSONObject
jsonObject
=
new
JSONObject
();
if
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
()))
{
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
activityDiscountsDto
.
getActivityType
()))
{
jsonObject
.
put
(
"tenderId"
,
activityDiscountsDto
.
getTenderId
());
}
if
(
null
!=
activityDiscountsDto
.
getExtendType
())
{
...
...
@@ -1356,7 +1368,7 @@ public class OrderAdapter {
String
customerScorePrompt
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
ordersBean
.
getAccountList
()))
{
for
(
QueryOrdersResponse
.
DataBean
.
OrderBean
.
AccountBean
accountBean
:
ordersBean
.
getAccountList
())
{
if
(
accountBean
.
getPrice
()
<
0
)
{
if
(
accountBean
.
getPrice
()
<
0
&&
!
OldOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
.
getCode
().
equals
(
accountBean
.
getType
())
)
{
discountTotalAmount
=
discountTotalAmount
+
(
0
-
accountBean
.
getPrice
());
}
if
(
OrderAccountType
.
BUY_DISCOUNT
.
getCode
().
equals
(
accountBean
.
getType
()))
{
...
...
@@ -1394,7 +1406,11 @@ public class OrderAdapter {
customerScorePrompt
=
decimalFormat
.
format
(
customerScoreAmount
/
100.0
);
// customerScorePrompt = "积分抵扣-¥" + customerScoreAmountStr;
}
if
(
Integer
.
valueOf
(
99
).
equals
(
accountBean
.
getType
()))
{
if
(
OldOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
.
getCode
().
equals
(
accountBean
.
getType
()))
{
responseVo
.
setMonthCardTotalDiscount
(
accountBean
.
getPrice
());
responseVo
.
setMonthCardTotalDiscountName
(
accountBean
.
getName
());
}
if
(
OldOrderAccountType
.
FREIGHT_COUPON
.
getCode
().
equals
(
accountBean
.
getType
()))
{
responseVo
.
setFreightCouponName
(
accountBean
.
getName
());
}
}
...
...
@@ -2175,16 +2191,15 @@ public class OrderAdapter {
discountTotalAmount
=
discountTotalAmount
+
productDiscount
.
getDiscountAmount
()*
productDiscount
.
getDiscountQty
();
if
(
OrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
productDiscount
.
getDiscountType
()))
{
hasProductCoupon
=
true
;
productVo
.
setCouponName
(
productDiscount
.
getDiscountDesc
());
// Integer extendType = StringUtils.isBlank(productDiscount.getAddInfo())?null:JSON.parseObject(productDiscount.getAddInfo()).getInteger("extendType");
// if(null != extendType && (3 == extendType || 4 == extendType || 5 == extendType)) {
// productVo.setCouponName(productDiscount.getDiscountDesc());
// } else {
// productVo.setName(productDiscount.getDiscountDesc());
// productVo.setSpuName(productDiscount.getDiscountDesc());
// productVo.setExtras("");
// productVo.setSpecification("");
// }
if
(
StringUtils
.
isNotBlank
(
productDiscount
.
getExtInfo
()))
{
JSONObject
productDiscountExtInfo
=
JSON
.
parseObject
(
productDiscount
.
getExtInfo
());
Integer
extendType
=
productDiscountExtInfo
.
getInteger
(
"extendType"
);
if
(
null
==
extendType
||
extendType
!=
12
)
{
productVo
.
setCouponName
(
productDiscount
.
getDiscountDesc
());
}
else
{
productVo
.
setFinalPrice
(
productVo
.
getOriginalPrice
());
}
}
}
if
(
OrderAccountType
.
BUYM_SENDN
.
getCode
().
equals
(
productDiscount
.
getDiscountType
()))
{
activityType
=
ActivityTypeEnum
.
TYPE_61
.
getCode
();
...
...
@@ -2634,6 +2649,9 @@ public class OrderAdapter {
if
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
activityType
))
{
return
OldOrderAccountType
.
PRODUCT_COUPON
;
}
if
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
activityType
))
{
return
OldOrderAccountType
.
PRODUCT_COUPON
;
}
if
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
activityType
))
{
return
OldOrderAccountType
.
SEED_PRODUCT_COUPON
;
}
...
...
@@ -2687,6 +2705,9 @@ public class OrderAdapter {
if
(
ActivityTypeEnum
.
TYPE_230
.
getCode
().
equals
(
activityType
)){
return
OldOrderAccountType
.
FULL_BUYM_SENDN
;
}
if
(
ActivityTypeEnum
.
TYPE_231
.
getCode
().
equals
(
activityType
)){
return
OldOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
;
}
return
OldOrderAccountType
.
BUYM_SENDN
;
}
...
...
order-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
View file @
11208477
...
...
@@ -107,6 +107,11 @@ public class ShoppingCartGoodsDto {
*/
private
Long
payCardFee
;
/**
* 月享卡总优惠金额
*/
private
MonthCardDiscount
monthCardDiscount
;
@Data
public
static
class
CartGoodsDetailDto
{
/**
...
...
@@ -356,4 +361,28 @@ public class ShoppingCartGoodsDto {
private
Integer
type
;
}
@Data
public
static
class
MonthCardDiscount
{
/**
* 月享卡2.0优惠总额
*/
private
Long
discountAmount
;
/**
* 月享卡券号
*/
private
String
couponCode
;
/**
* 券标识
*/
private
String
couponLogo
;
/**
* 优惠标识
*/
private
String
discountLogo
;
/**
* 优惠描述
*/
private
String
discountDesc
;
}
}
order-application-service/src/main/java/cn/freemud/entities/vo/QueryOrderResponseVo.java
View file @
11208477
...
...
@@ -114,6 +114,14 @@ public class QueryOrderResponseVo {
*/
private
String
freightCouponName
;
/**
* 月享卡优惠总金额
*/
private
Long
monthCardTotalDiscount
;
/**
* 月享卡优惠总金额
*/
private
String
monthCardTotalDiscountName
;
/**
* 限时折扣优惠金额
*/
private
Long
discountLimitAmount
;
...
...
order-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
11208477
...
...
@@ -34,6 +34,7 @@ public enum ActivityTypeEnum {
TYPE_34
(
34
,
"运费券"
),
TYPE_35
(
35
,
"买1赠3券"
),
TYPE_37
(
37
,
"种子券"
),
TYPE_38
(
38
,
"月享卡2.0"
),
TYPE_5
(
5
,
"整单满金额折"
),
TYPE_51
(
51
,
"每满金额折"
),
TYPE_52
(
52
,
"阶梯满金额折"
),
...
...
@@ -42,6 +43,7 @@ public enum ActivityTypeEnum {
TYPE_61
(
61
,
"单品买M赠N"
),
TYPE_7
(
7
,
"满额赠券"
),
TYPE_8
(
8
,
"满N件换购"
),
TYPE_231
(
231
,
"月享卡总优惠"
),
/**
* 加价购
*/
...
...
order-application-service/src/main/java/cn/freemud/service/impl/CheckMCCafeOrder.java
View file @
11208477
...
...
@@ -80,15 +80,8 @@ import java.util.stream.Collectors;
public
class
CheckMCCafeOrder
{
@Autowired
private
StoreTableNumberManager
storeTableNumberManager
;
@Autowired
private
AssortmentOpenPlatformIappWxappConfigManager
openPlatformIappWxappConfigManager
;
@Autowired
private
AssortmentOpenPlatformPartnerStoreDeliveryConfigManager
deliveryConfigManager
;
// 缓存取用户数据用
// @Autowired
// private UserServiceImpl userService;
@Autowired
private
AssortmentCustomerInfoManager
customerInfoManager
;
//门店SDK
@Autowired
...
...
@@ -101,23 +94,15 @@ public class CheckMCCafeOrder {
private
MemberPropertyService
memberPropertyService
;
@Autowired
private
ShoppingCartClient
shoppingCartClient
;
// @Autowired
// private OrderAdapter orderAdapter;
@Autowired
private
StoreServiceImpl
storeService
;
@Autowired
private
StockClient
stockClient
;
@Autowired
private
ItemServiceImpl
itemService
;
@Autowired
private
CouponService
couponService
;
@Autowired
private
CouponClientService
couponClientService
;
@Autowired
private
DeliveryFeiginMCCafeClient
deliveryFeiginMCCafeClient
;
@Autowired
private
DeliveryServiceFeiginMCCafeClient
deliveryServiceFeiginMCCafeClient
;
@Value
(
"${mcCafe.withOrderBuy.cardId}"
)
private
String
withOrderBuyCardId
;
@Value
(
"${mccafe.universal.coupon.code}"
)
private
String
withOrderBuyCouponCode
;
...
...
@@ -563,8 +548,17 @@ public class CheckMCCafeOrder {
}
List
<
MCCafeCouponVo
>
mcCafeCouponVos
=
new
ArrayList
<>();
Map
<
String
,
String
>
mcCafeUsedCoupon
=
new
HashMap
<>();
List
<
String
>
seedCardList
=
shoppingCartGoodsDto
.
getProducts
().
stream
().
filter
(
o
->
ProductTypeEnum
.
getVirtualProductType
().
contains
(
o
.
getProductType
()))
.
map
(
o
->
o
.
getMonthCardInfo
().
getCardCode
()).
collect
(
Collectors
.
toList
());
List
<
String
>
seedCardList
=
new
ArrayList
<>();
shoppingCartGoodsDto
.
getProducts
().
stream
().
filter
(
o
->
ProductTypeEnum
.
getVirtualProductType
().
contains
(
o
.
getProductType
()))
.
forEach
(
o
->
{
if
(
o
.
getMonthCardInfo
()
==
null
)
{
ShoppingCartGoodsDto
.
MonthCardVo
monthCardVo
=
new
ShoppingCartGoodsDto
.
MonthCardVo
();
monthCardVo
.
setCardCode
(
withOrderBuyCouponCode
);
monthCardVo
.
setCardNo
(
withOrderBuyCardId
);
o
.
setMonthCardInfo
(
monthCardVo
);
}
seedCardList
.
add
(
o
.
getMonthCardInfo
().
getCardCode
());
});
seedCardList
.
add
(
withOrderBuyCouponCode
);
if
(
CollectionUtils
.
isNotEmpty
(
shoppingCartGoodsDto
.
getActivityDiscountsDtos
()))
{
shoppingCartGoodsDto
.
getActivityDiscountsDtos
().
forEach
(
o
->
{
...
...
order-application-service/src/main/java/cn/freemud/service/impl/MCCafeOrderServiceImpl.java
View file @
11208477
...
...
@@ -593,8 +593,8 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
*/
public
CreateOrderResponse
createOrder
(
CreateOrderVo
createOrderVo
,
StoreResponse
.
BizVO
storeResponseDto
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
,
OrderExtendedReq
orderExtendedReq
,
OrderClientType
orderClient
,
String
appId
)
{
processRepeatGoodsWithSeedCoupon
(
shoppingCartGoodsDto
);
log
.
info
(
"购物车拆行:"
+
JSON
.
toJSONString
(
shoppingCartGoodsDto
));
//
processRepeatGoodsWithSeedCoupon(shoppingCartGoodsDto);
//
log.info("购物车拆行:"+JSON.toJSONString(shoppingCartGoodsDto));
BaseCreateOrderRequest
baseCreateOrderRequest
=
orderAdapter
.
convent2CreateOrderDto
(
createOrderVo
,
shoppingCartGoodsDto
,
storeResponseDto
);
//查询第三方商品编号
baseCreateOrderRequest
=
getProductCustomerCode
(
baseCreateOrderRequest
);
...
...
@@ -903,7 +903,7 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
// }
//麦咖啡随单购咖啡月卡
if
(
withOrderBuyCoupon
(
orderBean
,
orderExtInfoDto
.
getThirdPartyMemberId
()))
{
if
(
withOrderBuyCoupon
2
(
orderBean
,
orderExtInfoDto
.
getThirdPartyMemberId
()))
{
orderBean
=
getOrderBean
(
confirmOrderDto
);
}
...
...
@@ -1739,4 +1739,115 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
return
true
;
}
/**
* 月享卡2.0发券
* @param orderBean
*/
public
boolean
withOrderBuyCoupon2
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
String
thirdPartyMemberId
){
LogUtil
.
info
(
"发券入参:"
,
thirdPartyMemberId
,
JSON
.
toJSONString
(
orderBean
));
try
{
List
<
String
>
cardIds
=
new
ArrayList
<>();
List
<
String
>
defaultCardCodes
=
new
ArrayList
<>();
for
(
OrderBean
.
ProductBean
productBean
:
orderBean
.
getProductList
()){
if
(
ProductTypeEnum
.
getVirtualProductType
().
contains
(
productBean
.
getProductType
()))
{
OrderProductAddInfoDto
extInfo
=
JSON
.
parseObject
(
productBean
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
for
(
int
i
=
0
;
i
<
productBean
.
getNumber
();
i
++)
{
cardIds
.
add
(
extInfo
.
getCardId
());
}
defaultCardCodes
.
add
(
extInfo
.
getCardCode
());
}
}
if
(
CollectionUtils
.
isEmpty
(
cardIds
)){
return
false
;
}
SendCouponForqujiaRequestDto
request
=
new
SendCouponForqujiaRequestDto
();
request
.
setReceivedId
(
orderBean
.
getOid
());
request
.
setCardIds
(
cardIds
);
request
.
setThirdPartyMemberId
(
thirdPartyMemberId
);
SendCouponForqujiaDtoResponseDto
responseDto
=
customerExtendClient
.
sendCouponForqujia
(
request
);
if
(!
Objects
.
equals
(
responseDto
.
getCode
(),
ResponseResult
.
SUCCESS
.
getCode
())){
LogUtil
.
error
(
"sendCouponForqujia"
,
JSON
.
toJSONString
(
request
),
JSON
.
toJSONString
(
responseDto
));
return
false
;
}
if
(
responseDto
.
getData
()
==
null
||
CollectionUtils
.
isEmpty
(
responseDto
.
getData
().
getCard_list
())){
return
false
;
}
List
<
SendCouponForqujiaDtoResponseDto
.
Card
>
cardList
=
responseDto
.
getData
().
getCard_list
();
MCCafeCouponRequest
mcCafeCouponRequest
=
MCCafeCouponRequest
.
builder
()
.
ver
(
88
)
.
reqtype
(
CouponReqTypeEnum
.
BATCH_QUERY
.
getCode
())
.
partnerId
(
Integer
.
parseInt
(
orderBean
.
getCompanyId
()))
.
store_id
(
orderBean
.
getShopId
())
.
station_id
(
"1"
)
.
operator_id
(
orderBean
.
getUserId
())
.
channel
(
OrderSource
.
ALIPAY
.
getSource
().
equals
(
orderBean
.
getSource
())?
MCCafeChannelEnum
.
MOCOFFEE_ZFB
.
getName
():
MCCafeChannelEnum
.
MOCOFFEE_WX
.
getName
())
.
couponlist
(
cardList
.
stream
().
map
(
o
->
new
MCCafeCouponVo
(
o
.
getCard_code
())).
collect
(
Collectors
.
toList
()))
.
sign
(
"skip"
)
.
build
();
McdNetBatchQueryResponse
mcdNetBatchQueryResponse
=
couponClientService
.
batchQuery
(
mcCafeCouponRequest
);
if
(
mcdNetBatchQueryResponse
==
null
||
!
ResponseCodeConstant
.
RESPONSE_SUCCESS
.
equals
(
mcdNetBatchQueryResponse
.
getStatusCode
())
||
CollectionUtils
.
isEmpty
(
mcdNetBatchQueryResponse
.
getCouponlist
()))
{
LogUtil
.
error
(
"获取优惠券详情失败,发券失败"
,
mcCafeCouponRequest
,
mcdNetBatchQueryResponse
);
return
false
;
}
Map
<
String
,
Integer
>
cardStatusMap
=
mcdNetBatchQueryResponse
.
getCouponlist
().
stream
()
.
collect
(
Collectors
.
toMap
(
McdNetBatchQueryResponse
.
Coupon
::
getCode
,
McdNetBatchQueryResponse
.
Coupon
::
getStatusCode
,
(
k1
,
k2
)
->
k1
));
Map
<
String
,
String
>
cardMap
=
new
HashMap
<>();
UpdateCouponCodeReq
req
=
new
UpdateCouponCodeReq
();
req
.
setOrderCode
(
orderBean
.
getOid
());
req
.
setPartnerId
(
orderBean
.
getCompanyId
());
req
.
setCouponReceiveInfoList
(
new
ArrayList
<>());
req
.
setCouponUpdateInfoList
(
new
ArrayList
<>());
LogUtil
.
info
(
"准备开始生成参数:"
,
orderBean
,
null
);
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
productBean
:
orderBean
.
getProductList
())
{
if
(
ProductTypeEnum
.
getVirtualProductType
().
contains
(
productBean
.
getProductType
()))
{
UpdateCouponCodeReq
.
CouponReceiveInfo
couponReceiveInfo
=
new
UpdateCouponCodeReq
.
CouponReceiveInfo
();
couponReceiveInfo
.
setGoodsId
(
productBean
.
getSpecification
());
couponReceiveInfo
.
setProductSeq
(
productBean
.
getSequence
());
OrderProductAddInfoDto
extInfo
=
JSON
.
parseObject
(
productBean
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
String
cardCodeStr
=
""
;
numberFor:
for
(
int
j
=
0
;
j
<
productBean
.
getNumber
();
j
++)
{
cardFor:
for
(
int
i
=
0
;
i
<
cardList
.
size
();
i
++)
{
if
(
cardList
.
get
(
i
).
getCard_id
().
equals
(
extInfo
.
getCardId
()))
{
String
couponCode
=
cardList
.
get
(
i
).
getCard_code
();
cardCodeStr
+=
couponCode
+
"/"
;
if
(
ResponseCodeConstant
.
RESPONSE_SUCCESS
.
equals
(
cardStatusMap
.
get
(
couponCode
)))
{
if
(
cardMap
.
get
(
extInfo
.
getCardCode
())
==
null
)
{
UpdateCouponCodeReq
.
CouponUpdateInfo
couponUpdateInfo
=
new
UpdateCouponCodeReq
.
CouponUpdateInfo
();
couponUpdateInfo
.
setOldCouponCode
(
extInfo
.
getCardCode
());
couponUpdateInfo
.
setCouponCode
(
couponCode
);
req
.
getCouponUpdateInfoList
().
add
(
couponUpdateInfo
);
cardMap
.
put
(
extInfo
.
getCardCode
(),
couponCode
);
}
}
cardList
.
remove
(
i
);
break
cardFor
;
}
}
}
couponReceiveInfo
.
setCouponCode
(
cardCodeStr
.
substring
(
0
,
cardCodeStr
.
length
()-
1
));
req
.
getCouponReceiveInfoList
().
add
(
couponReceiveInfo
);
}
}
LogUtil
.
info
(
"生成参数完成:"
,
req
,
null
);
orderSdkService
.
updateCostCouponCodeNew
(
req
,
LogTreadLocal
.
getTrackingNo
());
return
true
;
}
catch
(
Exception
e
){
LogUtil
.
error
(
"发券异常"
,
null
,
null
,
e
);
}
return
true
;
}
}
ordercenter-sdk/pom.xml
View file @
11208477
...
...
@@ -8,7 +8,7 @@
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<version>
1.3.4
4
.RELEASE
</version>
<version>
1.3.4
5
.RELEASE
</version>
<artifactId>
ordercenter-sdk
</artifactId>
<dependencies>
...
...
ordercenter-sdk/readme.md
View file @
11208477
...
...
@@ -75,4 +75,5 @@
| 1.3.41.RELEASE | 美业 | 刘鹏飞 | 2021-03-12 |
| 1.3.42.RELEASE | 三方展示活动信息 | 张志恒 | 2021-03-22 |
| 1.3.43.RELEASE | 小助手刷卡支付 | 王航航 | 2021-03-31 |
| 1.3.44.RELEASE | 新增支付号升级SDK | 王航航 | 2021-04-06 |
\ No newline at end of file
| 1.3.44.RELEASE | 新增支付号升级SDK | 王航航 | 2021-04-06 |
| 1.3.45.RELEASE | 月享卡2.0 | 徐康 | 2021-04-15 |
\ No newline at end of file
ordercenter-sdk/src/main/java/com/freemud/application/sdk/api/ordercenter/constant/InterfaceAddressConstant.java
View file @
11208477
...
...
@@ -229,6 +229,7 @@ public class InterfaceAddressConstant {
* 修改费用表购买的优惠券和优惠表使用的优惠券
*/
public
static
final
String
UPDATE_COST_COUPONCODE
=
"/order/v2/mcCafe/updateCostCouponCode"
;
public
static
final
String
UPDATE_COST_COUPONCODE_NEW
=
"/order/v2/mcCafe/updateCostCouponCodeNew"
;
/**
* 查询使用了优惠券的订单数量
...
...
ordercenter-sdk/src/main/java/com/freemud/application/sdk/api/ordercenter/service/OrderSdkService.java
View file @
11208477
...
...
@@ -902,6 +902,19 @@ public class OrderSdkService {
}
/**
* 修改费用表购买的优惠券和优惠表使用的优惠券
* @param request
* @param trackingNo
* @return
*/
public
BaseResponse
updateCostCouponCodeNew
(
UpdateCouponCodeReq
request
,
String
trackingNo
)
{
OrderBaseResp
responseDTO
=
RequestThirdPartyUtils
.
httpJsonReqComplexNew
(
restTemplate
,
UPDATE_COST_COUPONCODE_NEW
,
createBaseRequest
(
request
,
trackingNo
),
new
ParameterizedTypeReference
<
OrderBaseResp
>()
{
});
return
responseHandle
(
responseDTO
);
}
/**
* 查询使用了特定优惠券的订单数量
* @param request
* @param trackingNo
...
...
shopping-cart-application-service/pom.xml
View file @
11208477
...
...
@@ -45,7 +45,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.2.
6
.RELEASE
</version>
<version>
1.2.
7
.RELEASE
</version>
</dependency>
<!-- 再来一单查询订单信息 -->
<dependency>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
View file @
11208477
...
...
@@ -331,8 +331,11 @@ public class ShoppingCartMccafeAdapter {
* 1. 商品券:cartGoodsDetailDto.couponCode非空,保留ApportionGoods#ApportionDetails#apportionType中32的
* 2. 普通商品:cartGoodsDetailDto.couponCode空,去掉32的
*/
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
ApportionDetails
>
apportionDetails
=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
detail
->
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_32
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_104
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_2
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_21
.
getCode
())).
collect
(
Collectors
.
toList
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
ApportionDetails
>
apportionDetails
=
apportionGoods
.
getApportionDetails
().
stream
()
.
filter
(
detail
->
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_32
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_37
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_38
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_104
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_2
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_21
.
getCode
())).
collect
(
Collectors
.
toList
());
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
ApportionDetails
detail
:
apportionDetails
)
{
List
<
ActivityDiscountsDto
>
currentDiscount
=
activityDiscountsDtoList
.
stream
().
filter
(
discount
->
ObjectUtils
.
equals
(
discount
.
getActivityCode
(),
detail
.
getActivityCode
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
currentDiscount
))
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountRequestDto.java
View file @
11208477
...
...
@@ -88,10 +88,6 @@ public class ActivityCalculationDiscountRequestDto {
*/
private
String
activityCode
;
/**
* 是否为种子券商品
*/
private
Integer
isSeedCouponGoods
;
/**
* 购物车商品行uid(种子券商品才传)
*/
private
String
cartGoodsUid
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountResponseDto.java
View file @
11208477
...
...
@@ -57,6 +57,12 @@ public class ActivityCalculationDiscountResponseDto {
* 总的优惠信息集合
*/
private
List
<
Discount
>
discounts
;
/**
* 月享卡2.0优惠
*/
private
MonthCardDiscount
monthlyEnjoyCardDiscount
;
/**
* 商品优惠信息
*/
...
...
@@ -115,6 +121,30 @@ public class ActivityCalculationDiscountResponseDto {
private
SendPoint
sendPointVo
;
@Data
public
static
class
MonthCardDiscount
{
/**
* 月享卡2.0优惠总额
*/
private
Long
discountAmount
;
/**
* 月享卡券号
*/
private
String
couponCode
;
/**
* 券标识
*/
private
String
couponLogo
;
/**
* 优惠标识
*/
private
String
discountLogo
;
/**
* 优惠描述
*/
private
String
discountDesc
;
}
@Data
public
static
class
ActivityPrompt
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
View file @
11208477
package
cn
.
freemud
.
entities
.
dto
.
shoppingCart
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto
;
import
cn.freemud.entities.dto.OrderProductAddInfo
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ShareDiscountActivityDto
;
...
...
@@ -92,6 +93,12 @@ public class ShoppingCartGoodsDto {
* 订单享受的促销活动
*/
private
List
<
ActivityDiscountsDto
>
activityDiscountsDtos
;
/**
* 月享卡2.0优惠集合
*/
private
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
MonthCardDiscount
monthCardDiscount
;
/**
* 扣减库存
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/BatchOperateCartGoodsRequestVo.java
View file @
11208477
...
...
@@ -41,4 +41,17 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
*/
private
List
<
BatchGoodsInfoVo
>
goodsInfos
;
/**
* 根据券号清除当前购物车中月卡及商品信息
*/
private
String
redundancyCouponCode
;
/**
* 是否使用月享卡2.0
* 1 是
* 0 否
*/
private
int
isUseMonthCard
;
}
\ No newline at end of file
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
11208477
...
...
@@ -238,15 +238,15 @@ public class CartGoods {
/**
* 是否是月享卡商品
*/
private
int
isMonthCard
;
private
int
isMonthCard
=
0
;
/**
* 是否是太阳蛋商品
*/
private
int
isSunnyCoupon
=
0
;
/**
* 是否为
种子券
商品 1:是;0:否
* 是否为
月享卡
商品 1:是;0:否
*/
private
int
is
SeedCouponGoods
;
private
int
is
MonthCardGoods
=
0
;
/**
* 月享卡信息
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ClearCouponCodeRequestVo.java
0 → 100644
View file @
11208477
package
cn
.
freemud
.
entities
.
vo
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
@Data
public
class
ClearCouponCodeRequestVo
extends
BaseRequestVo
{
@NotEmpty
(
message
=
"券号不可为空"
)
private
String
redundancyCouponCode
;
/**
* 是否使用月享卡2.0
* 1 是
* 0 否
*/
private
int
isUseMonthCard
;
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/MonthCardVo.java
View file @
11208477
...
...
@@ -29,4 +29,10 @@ public class MonthCardVo {
* 月享卡类型:1.月享卡(单商品购买);2.月享卡(多商品购买);3.普通月卡
*/
private
Integer
type
;
/**
* 是否使用月享卡2.0
* 1 是
* 0 否
*/
private
int
isUseMonthCard
=
1
;
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
View file @
11208477
...
...
@@ -69,6 +69,13 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
* 优惠券code列表
*/
private
List
<
couponCode
>
couponCodes
;
/**
* 是否使用月享卡2.0
* 1 是
* 0 否
*/
private
Integer
isUseMonthCard
=
1
;
/**
* 优惠券对应的活动号
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
11208477
...
...
@@ -36,6 +36,7 @@ public enum ActivityTypeEnum {
TYPE_32
(
32
,
"商品券"
),
TYPE_33
(
33
,
"换购券"
),
TYPE_37
(
37
,
"月享卡种子券"
),
TYPE_38
(
38
,
"月享卡2.0"
),
TYPE_5
(
5
,
"整单满金额折"
),
TYPE_51
(
51
,
"每满金额折"
),
TYPE_52
(
52
,
"阶梯满金额折"
),
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
11208477
...
...
@@ -102,7 +102,6 @@ public enum ResponseResult {
SHOPPING_CART_BUY_ONE_SEND_GOODS_ERR
(
"44033"
,
"寄件活动商品错误"
),
SHOPPING_CART_COUPON_MIX_NOT_EXIST
(
"44034"
,
"券商品不存在"
),
SHOPPING_CART_QTY_LIMIT_ERR
(
"44035"
,
"该商品单次购买数量限制为10,请知晓"
),
SHOPPING_CART_SEED_COUPON_VALID
(
"44037"
,
"券商品数量不可大于券数量"
),
SHOPPING_CART_MATERIA_QTY_LIMIT_ERR
(
"44038"
,
"商品加料超过最大限制"
),
/**
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
11208477
...
...
@@ -31,9 +31,11 @@ import cn.freemud.service.thirdparty.CustomerApplicationClient;
import
cn.freemud.utils.BeanUtil
;
import
cn.freemud.service.thirdparty.ProductClient
;
import
cn.freemud.utils.ResponseUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.log.ApiLog
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.ordercenter.enums.ProductTypeEnum
;
...
...
@@ -162,8 +164,11 @@ public class ShoppingCartMCoffeeServiceImpl {
}
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
null
;
// 获取添加商品的详细信息
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
menuType
,
this
.
shoppingCartBaseService
);
if
(!
StringUtils
.
equals
(
"9999"
,
addShoppingCartGoodsRequestVo
.
getSkuId
()))
{
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
menuType
,
this
.
shoppingCartBaseService
);
}
// 查询购物车缓存
List
<
CartGoods
>
oldCartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
null
,
shoppingCartBaseService
);
...
...
@@ -172,25 +177,21 @@ public class ShoppingCartMCoffeeServiceImpl {
}
//种子券商品信息校验
if
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
()<
1
&&
addShoppingCartGoodsRequestVo
.
getIsSeedCouponGoods
()
>
0
)
{
if
(
1
==
addShoppingCartGoodsRequestVo
.
getIsMonthCard
()
)
{
seedCouponGoodsValidate
(
addShoppingCartGoodsRequestVo
,
oldCartGoodsList
);
}
//加锁,防止重复请求导致的加购数量错误
synchronized
(
oldCartGoodsList
)
{
//餐具和月享卡数量限制
if
(
mcCafeTablewareSkuId
.
equals
(
skuId
)
||
Objects
.
equals
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
(),
1
))
{
if
(
mcCafeTablewareSkuId
.
equals
(
skuId
)
||
StringUtils
.
equals
(
"9999"
,
skuId
))
{
for
(
CartGoods
cartGoods
:
oldCartGoodsList
)
{
if
(
mcCafeTablewareSkuId
.
equals
(
cartGoods
.
getSkuId
()))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_ADD_ERROR
.
getCode
(),
"不能重复添加餐具商品"
);
}
if
(
Objects
.
equals
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
(),
1
)
&&
cartGoods
.
getQty
()
>=
10
)
{
shoppingCartGoodsResponseVo
.
setChanged
(
true
);
shoppingCartGoodsResponseVo
.
setToastMsg
(
"该商品单次购买数量限制为10,请知晓"
);
if
(
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
()))
{
// 返回购物车数据
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
oldCartGoodsList
,
ResponseResult
.
SHOPPING_CART_ADD_ERROR
.
getMessage
(),
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
oldCartGoodsList
,
null
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
}
...
...
@@ -211,7 +212,14 @@ public class ShoppingCartMCoffeeServiceImpl {
CustomerInfoVo
userLoginInfoDto
=
getCustomerInfoVo
(
sessionId
);
couponName
=
getCouponNameByCode
(
couponCode
,
userLoginInfoDto
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
storeId
);
addCartGoods
.
setCouponName
(
couponName
);
//月享卡2.0之后不在显示月享卡券的名称 与普通商品券不同,故过滤掉月享卡券名称查询
if
(!(
"9999"
).
equals
(
addCartGoods
.
getSpuId
())
&&
!(
"9999"
).
equals
(
addCartGoods
.
getSkuId
())){
addCartGoods
.
setCouponName
(
couponName
);
}
else
{
//将卡券名称赋值给 虚拟商品作为 月享卡2.0的优惠项展示
addCartGoods
.
setSpuName
(
couponName
);
addCartGoods
.
setSkuName
(
couponName
);
}
}
// 如果购物车中有商品券,则当前添加的商品是特价商品时,需要提示“已选商品券,与其他优惠商品不同享,商品将恢复原价”
...
...
@@ -221,14 +229,26 @@ public class ShoppingCartMCoffeeServiceImpl {
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
HAS_GOODS_COUPON_WHEN_ADD_SPECIAL_GOODS
);
}
// 购物车数据更新(保存商品原价)
List
<
CartGoods
>
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
// 促销活动等价格计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
// 购物车信息到缓存中
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
newCartGoods
,
null
,
tableNumber
,
this
.
shoppingCartBaseService
);
List
<
CartGoods
>
newCartGoods
=
null
;
if
(!
StringUtils
.
equals
(
"9999"
,
skuId
))
{
log
.
info
(
"【addGoodsList】:{} ,【addGoodsRequestVo】:{}"
,
JSONObject
.
toJSONString
(
oldCartGoodsList
),
JSONObject
.
toJSONString
(
addCartGoods
));
// 购物车数据更新(保存商品原价)
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
// 促销活动等价格计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
// 重新保存购物车数据
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
);
}
...
...
@@ -275,6 +295,15 @@ public class ShoppingCartMCoffeeServiceImpl {
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"请先添加商品再使用商品券"
);
}
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
//月享卡加购时,将券号传给促销
if
(
null
!=
addShoppingCartGoodsRequestVo
&&
null
!=
addShoppingCartGoodsRequestVo
.
getMonthCardInfo
()
&&
StringUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getMonthCardInfo
().
getCardCode
())){
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
addShoppingCartGoodsRequestVo
.
getMonthCardInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
CollectionUtils
.
isNotEmpty
(
oldCartGoodsList
))
{
Boolean
isContinue
=
true
;
for
(
CartGoods
cartGoods
:
oldCartGoodsList
)
{
...
...
@@ -282,16 +311,21 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
()))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getCouponCode
());
calculationDiscountCoupon
.
setIsSeedCouponGoods
(
cartGoods
.
getIsSeedCouponGoods
());
if
(
cartGoods
.
getIsSeedCouponGoods
()>
0
)
{
calculationDiscountCoupon
.
setCartGoodsUid
(
cartGoods
.
getCartGoodsUid
());
}
coupons
.
add
(
calculationDiscountCoupon
);
}
//月享卡加购时,将券号传给促销
if
(
null
!=
cartGoods
&&
null
!=
cartGoods
.
getMonthCardInfo
()
&&
StringUtils
.
isNotEmpty
(
cartGoods
.
getMonthCardInfo
().
getCardCode
())
&&
1
==
cartGoods
.
getMonthCardInfo
().
getIsUseMonthCard
()){
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getMonthCardInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
//使用券的是,如果购物车已经存在这个券,先清除,再添加
//过滤月享卡种子券
if
(
StringUtils
.
isNotEmpty
(
couponCode
)
&&
couponCode
.
equals
(
cartGoods
.
getCouponCode
())
&&
Objects
.
equals
(
0
,
cartGoods
.
getIs
SeedCoupon
Goods
()))
{
if
(
StringUtils
.
isNotEmpty
(
couponCode
)
&&
couponCode
.
equals
(
cartGoods
.
getCouponCode
())
&&
Objects
.
equals
(
0
,
cartGoods
.
getIs
MonthCard
Goods
()))
{
cartGoods
.
setQty
(
0
);
}
if
(
StringUtils
.
isNotEmpty
(
goodsId
)
&&
StringUtils
.
isNotEmpty
(
couponCode
)
&&
isContinue
...
...
@@ -304,7 +338,7 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setQty
(
cartGoods
.
getQty
()
-
1
);
}
else
{
//如果购物车存在相同的商品,则先删除购物车商品,在新增商品券购物车行
if
(
Objects
.
equals
(
0
,
cartGoods
.
getIs
SeedCoupon
Goods
())){
if
(
Objects
.
equals
(
0
,
cartGoods
.
getIs
MonthCard
Goods
())){
cartGoods
.
setQty
(
0
);
}
}
...
...
@@ -338,13 +372,15 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
StringUtils
.
isNotBlank
(
couponCode
))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
couponCode
);
calculationDiscountCoupon
.
setIsSeedCouponGoods
(
addShoppingCartGoodsRequestVo
.
getIsSeedCouponGoods
());
if
(
addShoppingCartGoodsRequestVo
.
getIsSeedCouponGoods
()>
0
)
{
calculationDiscountCoupon
.
setCartGoodsUid
(
addShoppingCartGoodsRequestVo
.
getCartGoodsUid
());
}
//
calculationDiscountCoupon.setIsSeedCouponGoods(addShoppingCartGoodsRequestVo.getIsSeedCouponGoods());
//
if (addShoppingCartGoodsRequestVo.getIsSeedCouponGoods()>0) {
//
calculationDiscountCoupon.setCartGoodsUid(addShoppingCartGoodsRequestVo.getCartGoodsUid());
//
}
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
CollectionUtils
.
isNotEmpty
(
coupons
)){
coupons
=
coupons
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
return
coupons
;
}
...
...
@@ -358,10 +394,21 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
StringUtils
.
isEmpty
(
requestVo
.
getShopId
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
if
(
CollectionUtils
.
isEmpty
(
requestVo
.
getGoodsInfos
())
&&
CollectionUtils
.
isEmpty
(
requestVo
.
getQtyInfoList
()))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_ADD_INVAILD
);
BaseResponse
baseResponse
=
new
BaseResponse
();
//清除券信息
if
(
StringUtils
.
isNotEmpty
(
requestVo
.
getRedundancyCouponCode
())){
ClearCouponCodeRequestVo
clearCouponCodeRequestVo
=
new
ClearCouponCodeRequestVo
();
clearCouponCodeRequestVo
.
setRedundancyCouponCode
(
requestVo
.
getRedundancyCouponCode
());
clearCouponCodeRequestVo
.
setSessionId
(
requestVo
.
getSessionId
());
clearCouponCodeRequestVo
.
setPartnerId
(
requestVo
.
getPartnerId
());
clearCouponCodeRequestVo
.
setShopId
(
requestVo
.
getShopId
());
clearCouponCodeRequestVo
.
setOrderType
(
requestVo
.
getOrderType
());
clearCouponCodeRequestVo
.
setChannelType
(
requestVo
.
getChannelType
());
clearCouponCodeRequestVo
.
setIsUseMonthCard
(
requestVo
.
getIsUseMonthCard
());
baseResponse
=
clearCouponInfoByCode
(
clearCouponCodeRequestVo
);
}
BaseResponse
baseResponse
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
requestVo
.
getQtyInfoList
()))
{
BatchUpdateGoodsQtyRequestVo
updateGoodsQtyRequestVo
=
new
BatchUpdateGoodsQtyRequestVo
();
updateGoodsQtyRequestVo
.
setAppId
(
requestVo
.
getAppId
());
...
...
@@ -428,6 +475,45 @@ public class ShoppingCartMCoffeeServiceImpl {
}
/**
* 根据券号清除券信息
* @param requestVo
* @return
*/
public
BaseResponse
clearCouponInfoByCode
(
ClearCouponCodeRequestVo
requestVo
){
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
if
(
StringUtils
.
isEmpty
(
requestVo
.
getShopId
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
String
sessionId
=
requestVo
.
getSessionId
();
// 获取用户信息
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
sessionId
);
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
partnerId
=
requestVo
.
getPartnerId
();
String
storeId
=
requestVo
.
getShopId
();
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
StringUtils
.
equals
(
cartGoods
.
getCouponCode
(),
requestVo
.
getRedundancyCouponCode
())){
cartGoods
.
setCouponCode
(
null
);
cartGoods
.
setIsMonthCardGoods
(
0
);
}
/**
* 是否继续使用月享卡优惠
*/
if
(
null
!=
cartGoods
.
getMonthCardInfo
()){
cartGoods
.
getMonthCardInfo
().
setIsUseMonthCard
(
requestVo
.
getIsUseMonthCard
());
ApiLog
.
info
(
"【清除券信息】是否使用月享卡优惠:{},月享卡实体:{}"
,
requestVo
.
getIsUseMonthCard
(),
JSONObject
.
toJSONString
(
cartGoods
));
}
}
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
!
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())).
collect
(
Collectors
.
toList
());
//重新保存购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
null
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
/**
* 更新商品数量
*/
public
BaseResponse
updateGoodsQty
(
UpdateShoppingCartGoodsQtyRequestVo
updateShoppingCartGoodsQtyRequestVo
)
{
...
...
@@ -475,6 +561,9 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
if
(
cartGoodsUid
.
equals
(
cartGoods_
.
getCartGoodsUid
()))
{
if
(
cartGoods_
.
getIsMonthCard
()
==
1
&&
qty
==
0
){
cartGoodsList
=
clearMonthCouponInfo
(
cartGoodsList
,
cartGoods_
.
getMonthCardInfo
().
getCardCode
(),
cartGoodsUid
);
}
cartGoods
=
cartGoods_
;
cartGoods_
.
setQty
(
qty
);
skuId
=
cartGoods_
.
getSkuId
();
...
...
@@ -491,34 +580,12 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
for
(
CartGoods
goods
:
cartGoodsList
)
{
if
(
Objects
.
equals
(
1
,
goods
.
getIsMonthCard
())
&&
goods
.
getCartGoodsUid
().
equals
(
updateShoppingCartGoodsQtyRequestVo
.
getCartGoodsUid
())){
if
(
updateShoppingCartGoodsQtyRequestVo
.
getQty
()
==
0
){
if
(
cartGoodsList
.
size
()>
1
)
{
Iterator
<
CartGoods
>
cartGoodsIterator
=
cartGoodsList
.
iterator
();
while
(
cartGoodsIterator
.
hasNext
())
{
String
couponCode
=
null
!=
cartGoodsIterator
.
next
()
?
cartGoodsIterator
.
next
().
getCouponCode
()
:
""
;
if
(
StringUtils
.
isNotEmpty
(
couponCode
)
&&
couponCode
.
equals
(
goods
.
getMonthCardInfo
().
getCardCode
()))
{
cartGoodsIterator
.
remove
();
break
;
}
}
}
else
{
cartGoodsList
=
new
ArrayList
<>();
}
}
}
}
if
(
cartGoods
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_UPDATE_ERROR
);
}
//商品券行商品数量不可增加
if
(
cartGoods
.
getCouponCode
()
!=
null
&&
qty
>
1
&&
cartGoods
.
getIsSeedCouponGoods
()
<
0
)
{
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
())
&&
qty
>
1
&&
cartGoods
.
getIsMonthCardGoods
()
<
1
&&
cartGoods
.
getIsMonthCard
()
<
1
)
{
throw
new
ServiceException
(
ResponseResult
.
NOT_SUPPORTED
);
}
...
...
@@ -595,19 +662,32 @@ public class ShoppingCartMCoffeeServiceImpl {
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
log
.
info
(
"cartGoodsList: {}"
,
JSONObject
.
toJSONString
(
cartGoodsList
));
CartGoods
monthCardProduct
=
null
;
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
for
(
CartGoods
goods
:
cartGoodsList
)
{
if
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
()
!=
null
&&
goods
.
getMonthCardInfo
()
!=
null
)
{
goods
.
getMonthCardInfo
().
setIsUseMonthCard
(
shoppingCartInfoRequestVo
.
getIsUseMonthCard
());
}
if
(
StringUtils
.
equals
(
goods
.
getSkuId
(),
"9999"
)){
monthCardProduct
=
goods
;
continue
;
}
temList
.
addAll
(
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
goods
)));
}
if
(
null
!=
monthCardProduct
)
{
temList
.
add
(
monthCardProduct
);
}
cartGoodsList
=
temList
;
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
int
size
=
cartGoodsList
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
//先把月卡放到最后
if
(
Objects
.
equals
(
1
,
cartGoodsList
.
get
(
i
).
getIsMonthCard
()))
{
if
(
null
!=
cartGoodsList
.
get
(
i
)
&&
Objects
.
equals
(
1
,
cartGoodsList
.
get
(
i
).
getIsMonthCard
()))
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
i
!=
size
-
1
)
{
cartGoodsList
.
remove
(
i
);
...
...
@@ -618,7 +698,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
//如果是餐具商品,则放到最后
if
(
cartGoodsList
.
get
(
i
).
getSkuId
().
equals
(
mcCafeTablewareSkuId
))
{
if
(
null
!=
cartGoodsList
.
get
(
i
)
&&
cartGoodsList
.
get
(
i
).
getSkuId
().
equals
(
mcCafeTablewareSkuId
))
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
cartGoods
.
setIsTableware
(
true
);
if
(
i
!=
size
-
1
)
{
...
...
@@ -675,6 +755,12 @@ public class ShoppingCartMCoffeeServiceImpl {
// 促销活动的优惠金额计算
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
payCardPrice
);
//如果促销返回的商品里有月享卡2.0的虚拟商品,重新保存一次购物车
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
)
&&
cartGoodsList
.
stream
().
anyMatch
(
cartGoods
->
cartGoods
.
getSkuId
().
equals
(
"9999"
))){
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
...
...
@@ -869,8 +955,6 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
CollectionUtils
.
isNotEmpty
(
reduceGoods
))
{
allCartGoodsList
.
addAll
(
reduceGoods
);
}
//恢复套餐商品空键位
// checkNewCartGoods(allCartGoodsList,2,map);
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
tableNumber
,
shoppingCartBaseService
);
...
...
@@ -892,12 +976,13 @@ public class ShoppingCartMCoffeeServiceImpl {
//加价购商品
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
=
shoppingCartInfoRequestVo
.
getSendGoods
();
// //加价购商品组装
// packgeAdditional(shoppingCartInfoRequestVo, premiumExchangeActivity);
// 促销活动的优惠金额计算
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
=
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartGoodsResponseVo
,
payCardPrice
);
//过滤月享卡2.0虚拟商品
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
goods
->
!
StringUtils
.
equals
(
"9999"
,
goods
.
getSkuId
())).
collect
(
Collectors
.
toList
());
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
...
...
@@ -954,6 +1039,7 @@ public class ShoppingCartMCoffeeServiceImpl {
// 获取原门店购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
fromStoreId
,
userId
,
sessionId
,
""
,
shoppingCartBaseService
);
log
.
info
(
"【switchCardGoods】原门店数据:{}"
,
JSONObject
.
toJSONString
(
cartGoodsList
));
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
))
{
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
...
...
@@ -965,17 +1051,9 @@ public class ShoppingCartMCoffeeServiceImpl {
break
;
}
}
//清空商品券商品
Iterator
<
CartGoods
>
cartGoodsIterator
=
cartGoodsList
.
iterator
();
while
(
cartGoodsIterator
.
hasNext
()){
if
(
StringUtils
.
isNotEmpty
(
cartGoodsIterator
.
next
().
getCouponCode
())){
cartGoodsIterator
.
remove
();
}
}
log
.
info
(
"switchCartGoods:{}"
,
JSONObject
.
toJSONString
(
cartGoodsList
));
// 重新存储门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
fromStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
clearCartCouponGoods
(
partnerId
,
fromStoreId
,
userId
,
sessionId
,
cartGoodsList
);
}
List
<
CartGoods
>
onlyCheckGoodsList
=
new
ArrayList
<>();
...
...
@@ -984,61 +1062,30 @@ public class ShoppingCartMCoffeeServiceImpl {
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
onlyCheckGoodsList
.
addAll
(
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
cartGoods
)));
}
}
else
{
// 新门店check购物车中所有商品
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
for
(
CartGoods
goods
:
cartGoodsList
)
{
temList
.
addAll
(
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
goods
)));
}
cartGoodsList
=
temList
;
}
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
CHECK
.
getCode
())
{
if
(
StringUtils
.
isNotEmpty
(
shoppingCartGoodsResponseVo
.
getToastMsg
())){
//设置更新响应信息,校验失败只弹框提示消息,不切换门店,故将门店id重置为原来门店
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
shoppingCartInfoRequestVo
.
setShopId
(
requestVo
.
getFromShopId
());
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
ADD_AND_UPDATE
,
shoppingCartInfoRequestVo
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
// 重新存储新门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
else
{
//清除当前用户的代金券缓存,防止切换门店券数据带到不适用门店
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartParamDto
cartParamDto
=
assortmentSdkService
.
getCartParamDto
(
partnerId
,
fromStoreId
,
userId
);
shoppingCartBaseService
.
clearMCCafeCouponByType
(
cartParamDto
,
SaveCouponType
.
COUPON
.
getCode
(),
LogThreadLocal
.
getTrackingNo
());
// 新门店check购物车中所有商品
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
for
(
CartGoods
goods
:
cartGoodsList
)
{
temList
.
addAll
(
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
goods
)));
}
cartGoodsList
=
temList
;
// 重新存储新门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
toStoreId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
shoppingCartGoodsResponseVo
.
setChanged
(
false
);
}
}
// 新门店check购物车中所有商品
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
CONFIRM
.
getCode
())
{
// 重新存储新门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
else
{
// 新门店check购物车中所有商品
List
<
CartGoods
>
temList
=
new
ArrayList
<>();
for
(
CartGoods
goods
:
cartGoodsList
)
{
temList
.
addAll
(
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
Arrays
.
asList
(
goods
)));
}
cartGoodsList
=
temList
;
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
,
null
,
null
);
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
toStoreId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
,
null
);
// 重新存储新门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
shoppingCartGoodsResponseVo
.
setChanged
(
false
);
...
...
@@ -1053,16 +1100,10 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
))
{
return
;
}
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
StringUtils
.
isEmpty
(
cartGoods
.
getCouponCode
())).
collect
(
Collectors
.
toList
());
//如果购物车商品剔除商品券商品后列表为空,则清空缓存信息
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
)){
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartParamDto
cartParamDto
=
assortmentSdkService
.
getCartParamDto
(
partnerId
,
storeId
,
userId
);
log
.
info
(
"clearCouponInfo:{}"
,
JSONObject
.
toJSONString
(
cartParamDto
));
shoppingCartBaseService
.
clearMCCafe
(
cartParamDto
,
LogThreadLocal
.
getTrackingNo
());
}
else
{
// 重新存储新门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
StringUtils
.
isEmpty
(
cartGoods
.
getCouponCode
())
&&
!
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())).
collect
(
Collectors
.
toList
());
// 重新存储门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
...
...
@@ -1356,6 +1397,17 @@ public class ShoppingCartMCoffeeServiceImpl {
oldCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
List
<
CartGoods
>
newCartGoods
=
new
ArrayList
<>();
newCartGoods
.
add
(
addCartGoods
);
//如果加购的商品与购物车缓存中月享卡2.0的商品goodsId相同,则给新增商品的couponCode 赋值为月享卡2.0的券号,否则会分行展示
List
<
CartGoods
>
montCardGoods
=
oldCartGoodsList
.
stream
().
filter
(
c
->
c
.
getIsMonthCardGoods
()>
0
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
montCardGoods
)){
for
(
CartGoods
montCardGood
:
montCardGoods
)
{
if
(
StringUtils
.
isEmpty
(
newCartGoods
.
get
(
0
).
getCouponCode
())
&&
newCartGoods
.
get
(
0
).
getGoodsId
().
equals
(
montCardGood
.
getGoodsId
())){
newCartGoods
.
get
(
0
).
setCouponCode
(
montCardGood
.
getCouponCode
());
}
}
}
//加购商品校验
List
<
CartGoods
>
newCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
newCartGoods
);
List
<
CartGoods
>
nowCartGoodsList
=
new
ArrayList
<>();
...
...
@@ -1363,7 +1415,7 @@ public class ShoppingCartMCoffeeServiceImpl {
nowCartGoodsList
.
addAll
(
oldCartGoodsList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
newCartGoodsList
)){
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
log
.
info
(
"【merge-before】:{} ,【newCardGoods】:{}"
,
JSONObject
.
toJSONString
(
nowCartGoodsList
),
JSONObject
.
toJSONString
(
newCartGoods
));
newCartGoodsList
.
forEach
(
newCartGood
->
{
int
index
;
if
((
index
=
nowCartGoodsList
.
indexOf
(
newCartGood
))
>=
0
)
{
...
...
@@ -1620,7 +1672,7 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setSkuId
(
skuId
);
cartGoods
.
setQty
(
qty
);
cartGoods
.
setIsMonthCard
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
());
cartGoods
.
setIs
SeedCouponGoods
(
addShoppingCartGoodsRequestVo
.
getIsSeedCoupon
Goods
());
cartGoods
.
setIs
MonthCardGoods
(
addShoppingCartGoodsRequestVo
.
getIsMonthCard
Goods
());
cartGoods
.
setCouponCode
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
...
...
@@ -1739,8 +1791,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private
List
<
CartGoods
>
checkCartGoods
(
String
partnerId
,
String
storeId
,
Integer
orderType
,
String
menuType
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
cartGoodsList
)
{
//筛选数量不为0商品
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getQty
()
!=
0
).
collect
(
Collectors
.
toList
());
//筛选数量不为0商品
&& 非月享卡2.0虚拟商品
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getQty
()
!=
0
&&
!
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())
).
collect
(
Collectors
.
toList
());
//筛选非超值加购活动商品--超值加购活动商品不校验是否在菜单,不调用validateShopProduct
List
<
CartGoods
>
checkGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
!=
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
...
...
@@ -1804,7 +1856,7 @@ public class ShoppingCartMCoffeeServiceImpl {
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
cartGoodsList
)
{
//筛选数量不为0商品
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getQty
()
!=
0
).
collect
(
Collectors
.
toList
());
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getQty
()
!=
0
&&
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())
).
collect
(
Collectors
.
toList
());
//筛选非加购商品--加价购商品不校验是否在菜单,不调用validateShopProduct
List
<
CartGoods
>
checkGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
!=
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
...
...
@@ -1842,17 +1894,25 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
//购物车已存在商品券
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
()))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getCouponCode
());
calculationDiscountCoupon
.
setIsSeedCouponGoods
(
cartGoods
.
getIsSeedCouponGoods
());
if
(
cartGoods
.
getIsSeedCouponGoods
()>
0
){
calculationDiscountCoupon
.
setCartGoodsUid
(
cartGoods
.
getCartGoodsUid
());
if
(
null
!=
cartGoods
)
{
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
()))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getCouponCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
if
(
null
!=
cartGoods
.
getMonthCardInfo
()
&&
StringUtils
.
isNotEmpty
(
cartGoods
.
getMonthCardInfo
().
getCardCode
())
&&
1
==
cartGoods
.
getMonthCardInfo
().
getIsUseMonthCard
())
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
cartGoods
.
getMonthCardInfo
().
getCardCode
());
coupons
.
add
(
calculationDiscountCoupon
);
}
coupons
.
add
(
calculationDiscountCoupon
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
coupons
)){
coupons
=
coupons
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
return
coupons
;
}
...
...
@@ -2204,7 +2264,7 @@ public class ShoppingCartMCoffeeServiceImpl {
mCoffeeAddGoodsRequestVo
.
setCouponCode
(
goodsInfo
.
getCouponCode
());
mCoffeeAddGoodsRequestVo
.
setGroupName
(
goodsInfo
.
getGroupName
());
mCoffeeAddGoodsRequestVo
.
setIsMonthCard
(
goodsInfo
.
getIsMonthCard
());
mCoffeeAddGoodsRequestVo
.
setIs
SeedCouponGoods
(
goodsInfo
.
getIsSeedCoupon
Goods
());
mCoffeeAddGoodsRequestVo
.
setIs
MonthCardGoods
(
goodsInfo
.
getIsMonthCard
Goods
());
mCoffeeAddGoodsRequestVo
.
setMonthCardInfo
(
goodsInfo
.
getMonthCardInfo
());
return
mCoffeeAddGoodsRequestVo
;
}
...
...
@@ -2257,32 +2317,29 @@ public class ShoppingCartMCoffeeServiceImpl {
*/
private
void
seedCouponGoodsValidate
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
CartGoods
>
oldCartGoodsList
){
//若加购种子券商品,则券号不可为空
if
(
StringUtils
.
isEmpty
(
addShoppingCartGoodsRequestVo
.
getCouponCode
()
)){
if
(
null
==
addShoppingCartGoodsRequestVo
.
getMonthCardInfo
(
)){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_ADD_ERROR
);
}
//加购种子券商品,购物车中必须已有月卡不可为空
if
(
CollectionUtils
.
isEmpty
(
oldCartGoodsList
))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SEED_COUPON_VALID
);
}
int
seedCouponCount
=
0
;
int
seedCouponGoodsCount
=
0
;
for
(
CartGoods
cartGoods
:
oldCartGoodsList
)
{
//1.种子券商品券信息与月卡信息一致
if
(
null
!=
cartGoods
.
getMonthCardInfo
()
&&
!
addShoppingCartGoodsRequestVo
.
getCouponCode
().
equals
(
cartGoods
.
getMonthCardInfo
().
getCardCode
())){
if
(
null
!=
cartGoods
.
getMonthCardInfo
()
&&
!
addShoppingCartGoodsRequestVo
.
getCouponCode
().
equals
(
cartGoods
.
getMonthCardInfo
().
getCardCode
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
}
if
(
cartGoods
.
getIsMonthCard
()>
0
){
seedCouponCount
=
seedCouponCount
+
cartGoods
.
getQty
();
}
if
(
cartGoods
.
getIsSeedCouponGoods
()>
0
&&
cartGoods
.
getIsMonthCard
()<
1
){
seedCouponGoodsCount
=
seedCouponGoodsCount
+
cartGoods
.
getQty
();
}
}
}
//2.种子券商品数量不可大于种子券数量
if
((
seedCouponGoodsCount
+
addShoppingCartGoodsRequestVo
.
getQty
())
>
seedCouponCount
){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SEED_COUPON_VALID
);
/**
* 清除购物车商品使用月卡信息
* @param cartGoods
* @param couponCode
*/
private
List
<
CartGoods
>
clearMonthCouponInfo
(
List
<
CartGoods
>
cartGoods
,
String
couponCode
,
String
cartGoodsUid
){
for
(
CartGoods
cartGood
:
cartGoods
)
{
if
(
StringUtils
.
equals
(
couponCode
,
cartGood
.
getCouponCode
())){
cartGood
.
setCouponCode
(
null
);
cartGood
.
setIsMonthCardGoods
(
0
);
}
}
return
cartGoods
.
stream
().
filter
(
t
->
!
StringUtils
.
equals
(
"9999"
,
t
.
getSkuId
())
&&
!
t
.
getCartGoodsUid
().
equals
(
cartGoodsUid
)).
collect
(
Collectors
.
toList
());
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
11208477
...
...
@@ -20,6 +20,7 @@ import cn.freemud.service.CommonService;
import
cn.freemud.service.impl.ItemServiceImpl
;
import
cn.freemud.service.thirdparty.ActivityClient
;
import
cn.freemud.utils.PropertyConvertUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest
;
...
...
@@ -197,7 +198,7 @@ public class CalculationServiceImpl {
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getApportionGoods
();
Map
<
String
,
String
>
duplicateGoodsMap
=
new
HashMap
<>();
cartGoodsList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
getGoodsId
,
Collectors
.
counting
())).
forEach
((
goodsId
,
count
)
->
{
cartGoodsList
.
stream
().
filter
(
cartGoods
->
!
StringUtils
.
equals
(
cartGoods
.
getSkuId
(),
"9999"
)).
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
getGoodsId
,
Collectors
.
counting
())).
forEach
((
goodsId
,
count
)
->
{
duplicateGoodsMap
.
put
(
goodsId
,
String
.
format
(
"%s,0"
,
count
));
});
for
(
int
i
=
0
,
len
=
cartGoodsList
.
size
();
i
<
len
;
i
++)
{
...
...
@@ -251,7 +252,7 @@ public class CalculationServiceImpl {
}
}
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
();
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
()
.
stream
().
filter
(
p
->
!
StringUtils
.
equals
(
"9999"
,
p
.
getSkuId
())).
collect
(
Collectors
.
toList
())
;
List
<
String
>
productIds
=
products
.
stream
().
map
(
t
->
t
.
getSkuId
()).
collect
(
Collectors
.
toList
());
//调用商品的接口获取商品键位
...
...
@@ -405,9 +406,11 @@ public class CalculationServiceImpl {
calculationDiscountGoods
.
setGoodsQuantity
(
goodsQuantity
);
calculationDiscountGoods
.
setOriginalPrice
(
originalPrice
);
calculationDiscountGoods
.
setMemberDiscount
(
memberDiscount
);
//新增咖啡月卡券券号
calculationDiscountGoods
.
setCouponCode
(
cartGoods
.
getCouponCode
());
calculationDiscountGoods
.
setCartGoodsUid
(
cartGoods
.
getCartGoodsUid
());
//新增咖啡月卡券券号,同一行商品才替换券号,防止不同商品券相同sku之间的覆盖
if
(
cartGoods
.
getCartGoodsUid
().
equals
(
calculationDiscountGoods
.
getCartGoodsUid
()))
{
calculationDiscountGoods
.
setCouponCode
(
StringUtils
.
isEmpty
(
cartGoods
.
getCouponCode
())
?
null
:
cartGoods
.
getCouponCode
());
}
ArrayList
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
.
Material
>
materials
=
new
ArrayList
<>();
//可选搭配
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
11208477
...
...
@@ -79,7 +79,7 @@ public class CouponDiscountCalculation {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))))){
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
))){
return
;
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
...
...
@@ -93,47 +93,88 @@ public class CouponDiscountCalculation {
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponDiscounts
=
discounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
)).
collect
(
Collectors
.
toList
());
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
couponDiscounts
))
{
return
;
}
/**
* 月享卡2.0 促销单独返回 月享卡优惠
*/
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
MonthCardDiscount
monthCardDiscount
=
calculationDiscountResult
.
getMonthlyEnjoyCardDiscount
();
if
(
null
!=
monthCardDiscount
){
//月享卡2.0 信息回填
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
goods
:
goodsList
)
{
Optional
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
optional
=
goods
.
getDiscounts
().
stream
().
filter
(
goodsDiscount
->
ActivityTypeEnum
.
TYPE_38
.
getCode
()
==
goodsDiscount
.
getType
()).
findFirst
();
if
(
CollectionUtils
.
isNotEmpty
(
goods
.
getDiscounts
())
&&
optional
.
isPresent
()){
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
card2Discount
=
optional
.
get
();
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
//比較商品ID 以及 商品行UID 防止篡改了其他商品券的券号
if
(
StringUtils
.
equals
(
cartGoods
.
getGoodsId
(),
card2Discount
.
getGoodsId
())
&&
goods
.
getCartGoodsUid
().
equals
(
cartGoods
.
getCartGoodsUid
())){
cartGoods
.
setIsMonthCardGoods
(
1
);
cartGoods
.
setCouponName
(
""
);
cartGoods
.
setCouponCode
(
card2Discount
.
getActivityCode
());
cartGoods
.
setActivityType
(
card2Discount
.
getType
());
}
}
}
}
Boolean
hasMonCardDiscountVirtualProduct
=
false
;
//如果购物车列表已有优惠项,则更新促销返回的优惠信息
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
StringUtils
.
equals
(
cartGoods
.
getSkuId
(),
"9999"
)){
cartGoods
.
setSkuName
(
monthCardDiscount
.
getDiscountDesc
());
cartGoods
.
setSpuName
(
monthCardDiscount
.
getDiscountDesc
());
cartGoods
.
setPic
(
monthCardDiscount
.
getDiscountLogo
());
cartGoods
.
setQty
(
1
);
cartGoods
.
setAmount
(
monthCardDiscount
.
getDiscountAmount
());
hasMonCardDiscountVirtualProduct
=
true
;
}
}
//如果是菜单页加购月享卡商品.促销返回月享卡优惠后 虚拟一个 优惠项返回给前端
if
(!
hasMonCardDiscountVirtualProduct
){
CartGoods
virtualProduct
=
new
CartGoods
();
virtualProduct
.
setSkuId
(
"9999"
);
virtualProduct
.
setSpuId
(
"9999"
);
virtualProduct
.
setSkuName
(
monthCardDiscount
.
getDiscountDesc
());
virtualProduct
.
setSpuName
(
monthCardDiscount
.
getDiscountDesc
());
virtualProduct
.
setPic
(
monthCardDiscount
.
getCouponLogo
());
virtualProduct
.
setQty
(
1
);
virtualProduct
.
setAmount
(
monthCardDiscount
.
getDiscountAmount
());
cartGoodsList
.
add
(
virtualProduct
);
}
}
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
=
goodsList
.
parallelStream
()
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getCartGoodsUid
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
// 匹配随单购悦享卡
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountMon
=
couponDiscounts
.
stream
().
filter
(
t
->
(
(
ActivityTypeEnum
.
TYPE_3
2
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
t
.
getType
()))
(
ActivityTypeEnum
.
TYPE_3
7
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
t
.
getType
()))
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
continue
;
}
//商品券商品
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
())
||
discountMon
!=
null
)
{
// String couponCode = cartGoods.getCouponCode();
// // 计算优惠信息时,已将券校验过,放在map中
// Map<String, CheckSpqInfoResponseDto> validCouponMap = calculationDiscountResult.getValidCouponMap();
// if (MapUtils.isNotEmpty(validCouponMap)) {
// CheckSpqInfoResponseDto checkSpqInfoResponseDto = validCouponMap.get(couponCode);
// if (checkSpqInfoResponseDto != null) {
// cartGoods.setOriginalPrice(checkSpqInfoResponseDto.getPrice());
// cartGoods.setSpuId(checkSpqInfoResponseDto.getSpuId());
// cartGoods.setSkuId(StringUtils.isEmpty(checkSpqInfoResponseDto.getSkuId()) ? checkSpqInfoResponseDto.getSpuId() : checkSpqInfoResponseDto.getSkuId());
// cartGoods.setQty(1);
// cartGoods.setCouponCode(checkSpqInfoResponseDto.getCouponCode());
// cartGoods.setSpuName(checkSpqInfoResponseDto.getSpuName());
// }
// }
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
continue
;
//先将商品券商品最终售价设置为 原价
if
(!
StringUtils
.
equals
(
"9999"
,
cartGoods
.
getSkuId
())){
cartGoods
.
setAmount
(
cartGoods
.
getOriginalAmount
());
}
cartGoods
.
setAmount
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getRealAmount
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
discountsNew
=
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getDiscounts
();
if
(
CollectionUtils
.
isNotEmpty
(
discountsNew
))
{
log
.
info
(
"couponDiscountCalculation:{}"
,
discountsNew
);
//这里过滤掉了 月享卡2.0,因为月享卡2.0商品不用展示划线价,故显示原价
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
();
if
(
null
!=
targetDiscount
&&
targetDiscount
.
isPresent
())
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
targetDiscount
.
get
();
cartGoods
.
setCouponName
(
goodsDiscount
.
getActivityName
());
//普通商品券 和月享卡1.0的 商品最终售价更新为促销返回价格
cartGoods
.
setAmount
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getRealAmount
());
}
}
}
...
...
@@ -157,7 +198,7 @@ public class CouponDiscountCalculation {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
()))
||(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
())))))
{
||(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
)))
{
return
;
}
Map
<
String
,
Integer
>
extendTypeMap
=
calculationDiscountResult
.
getDiscounts
().
stream
().
filter
(
o
->
o
.
getExtendType
()
!=
null
)
...
...
@@ -170,11 +211,20 @@ public class CouponDiscountCalculation {
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
couponDiscounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))))).
collect
(
Collectors
.
toList
());
||
(
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
))).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
discounts
))
{
return
;
}
/**
* 月享卡2.0 促销单独返回 月享卡优惠
*/
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
MonthCardDiscount
monthCardDiscount
=
calculationDiscountResult
.
getMonthlyEnjoyCardDiscount
();
if
(
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
discount
.
getType
()))
&&
null
==
monthCardDiscount
){
return
;
}
shoppingCartGoodsDto
.
setMonthCardDiscount
(
monthCardDiscount
);
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
if
(
CollectionUtils
.
isEmpty
(
goodsList
))
{
return
;
...
...
@@ -184,7 +234,10 @@ public class CouponDiscountCalculation {
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getCartGoodsUid
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
// 匹配随单购悦享卡
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
discounts
.
stream
().
filter
(
t
->
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
discounts
.
stream
()
.
filter
(
t
->
((
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
t
.
getType
()))
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoods
:
shoppingCartGoodsDto
.
getProducts
())
{
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
continue
;
...
...
@@ -222,7 +275,8 @@ public class CouponDiscountCalculation {
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
list
=
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getDiscounts
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)
&&
discount
!=
null
)
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
list
.
stream
()
.
filter
(
t
->
((
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
t
.
getType
()))
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
.
filter
(
t
->
((
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_37
.
getCode
().
equals
(
t
.
getType
())
||
ActivityTypeEnum
.
TYPE_38
.
getCode
().
equals
(
t
.
getType
()))
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
if
(
goodsDiscount
!=
null
){
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
...
...
@@ -403,7 +457,7 @@ public class CouponDiscountCalculation {
List
<
CouponProductVo
>
calculAmountProductList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
))
{
cartGoods
.
forEach
(
cartGood
->
{
if
(
StringUtils
.
isNotEmpty
(
cartGood
.
getCouponCode
()))
{
if
(
!
StringUtils
.
equals
(
cartGood
.
getSkuId
(),
"9999"
)
&&
StringUtils
.
isNotEmpty
(
cartGood
.
getCouponCode
()))
{
CouponProductVo
couponProductVo
=
new
CouponProductVo
();
couponProductVo
.
setAmount
(
cartGood
.
getAmount
().
intValue
());
couponProductVo
.
setKeyProductCode
(
cartGood
.
getCustomerCode
());
...
...
@@ -413,29 +467,6 @@ public class CouponDiscountCalculation {
couponProductVo
.
setCategoryCode
(
null
);
calculAmountProductList
.
add
(
couponProductVo
);
}
// if (CollectionUtils.isNotEmpty(cartGood.getProductComboList())) {
// cartGood.getProductComboList().forEach(comboxGoods -> {
// CouponProductVo couponProductVo = new CouponProductVo();
// couponProductVo.setAmount(Integer.valueOf(comboxGoods.getAmount().toString()));
// couponProductVo.setKeyProductCode(comboxGoods.getCustomerCode());
// couponProductVo.setQuantity(comboxGoods.getQty());
// couponProductVo.setProductId(comboxGoods.getGoodsId());
// couponProductVo.setCategoryCode(null);
// productList.add(couponProductVo);
// });
// }
// if (CollectionUtils.isNotEmpty(cartGood.getProductGroupList())) {
// cartGood.getProductGroupList().forEach(comboxGoods -> {
// CouponProductVo couponProductVo = new CouponProductVo();
// couponProductVo.setAmount(Integer.valueOf(comboxGoods.getAmount().toString()));
// couponProductVo.setKeyProductCode(comboxGoods.getCustomerCode());
// couponProductVo.setQuantity(comboxGoods.getQty());
// couponProductVo.setProductId(comboxGoods.getGoodsId());
// couponProductVo.setCategoryCode(null);
// productList.add(couponProductVo);
// });
// }
});
res
.
setProductList
(
cartGoods
);
Long
totalAmount
=
createProductRequest
(
cartGoods
,
calculAmountProductList
);
...
...
@@ -475,7 +506,7 @@ public class CouponDiscountCalculation {
try
{
for
(
CartGoods
cartGood
:
cartGoods
)
{
// 剔除商品券得商品
if
(
StringUtils
.
isEmpty
(
cartGood
.
getSkuId
())
&&
StringUtils
.
isEmpty
(
cartGood
.
getSpuId
()))
{
if
(
StringUtils
.
isEmpty
(
cartGood
.
getSkuId
())
&&
StringUtils
.
isEmpty
(
cartGood
.
getSpuId
())
||
StringUtils
.
equals
(
"9999"
,
cartGood
.
getSkuId
())
)
{
continue
;
}
// 剔除商品券得商品,麦咖啡逻辑
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/BatchGoodsInfoVo.java
View file @
11208477
...
...
@@ -105,9 +105,9 @@ public class BatchGoodsInfoVo {
*/
private
int
isMonthCard
;
/**
* 是否为
种子券商品 1:是;0:否
* 是否为
月享卡商品
*/
private
int
is
SeedCoupon
Goods
;
private
int
is
MonthCard
Goods
;
/**
* 月享卡加购信息
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/MCoffeeAddGoodsRequestVo.java
View file @
11208477
...
...
@@ -144,9 +144,9 @@ public class MCoffeeAddGoodsRequestVo {
*/
private
int
isMonthCard
;
/**
* 是否为
种子券商品 1:是;0:否
* 是否为
月享卡商品
*/
private
int
is
SeedCoupon
Goods
;
private
int
is
MonthCard
Goods
;
/**
* 月享卡加购信息
*/
...
...
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