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
f638ae41
Commit
f638ae41
authored
May 26, 2022
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时优化,卡配置互斥的情况导致购物车返回数据不对,
解决方案: 先自己重新请求一次购物车
parent
fdb37cd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
81 deletions
+87
-81
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+87
-76
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingCartService.java
+0
-5
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
f638ae41
...
...
@@ -325,7 +325,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
else
{
//校验券是否有效 这里是新的商品券支持多商品及换购券
ValidCouponBo
validCouponBo
=
assortmentSdkService
.
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
skuId
,
couponProductDto
,
cartGoods
);
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
skuId
,
couponProductDto
,
cartGoods
);
spuId2
=
validCouponBo
.
getSkuId
();
todayAvailableTimes
=
validCouponBo
.
getTodayAvailableTimes
();
if
(
StringUtils
.
isNotBlank
(
skuId
))
{
...
...
@@ -349,7 +349,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//缓存中获取购物车商品信息
// 注意,围餐和点餐redis数据结构不一样
List
<
CartGoods
>
allCartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
addShoppingCartGoodsRequestVo
.
getSessionId
(),
null
,
shoppingCartBaseService
,
bizType
);
List
<
CartGoods
>
allCartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
addShoppingCartGoodsRequestVo
.
getSessionId
(),
null
,
shoppingCartBaseService
,
bizType
);
if
(
CollectionUtils
.
isEmpty
(
allCartGoodsList
))
{
allCartGoodsList
=
new
ArrayList
<>();
}
...
...
@@ -381,27 +381,27 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
<>()
//结算页选中的代金券
,
null
//加价购商品
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
(),
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
(),
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
//更新购物车券状态
newCalculationUpdateCouponStatus
(
userId
,
partnerId
,
storeId
,
bizType
,
cartGoods
,
allCartGoodsList
,
discountResult
);
sharingCartService
.
distribute
(
discountResult
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
null
,
userLoginInfoDto
,
null
,
activityQueryDto
,
menuType
,
deliveryAmount
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
partnerId
,
null
,
userId
,
storeId
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
partnerId
,
null
,
userId
,
storeId
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
discountResult
,
null
,
partnerId
);
//
}
else
{
// 获取优惠信息
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
new
DiscountSharingDto
());
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getSendGoods
())){
sendGoodsQtyCheck
(
productsCount
,
appId
,
partnerId
,
userId
,
storeId
,
tableNumber
,
oldCartGoodsList
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
(),
bizType
);
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
new
DiscountSharingDto
());
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getSendGoods
()))
{
sendGoodsQtyCheck
(
productsCount
,
appId
,
partnerId
,
userId
,
storeId
,
tableNumber
,
oldCartGoodsList
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
(),
bizType
);
}
//更新买M N券 券状态
calculationUpdateCouponStatus
(
userId
,
partnerId
,
storeId
,
bizType
,
allCartGoodsList
,
calculationDiscountResult
);
// 当商品数量被设为0时
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
assortmentSdkService
.
updateGoodsQtyBySdk
(
partnerId
,
userId
,
storeId
,
cartGoods
.
getCartGoodsUid
(),
0
,
""
,
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
updateGoodsQtyBySdk
(
partnerId
,
userId
,
storeId
,
cartGoods
.
getCartGoodsUid
(),
0
,
""
,
shoppingCartBaseService
,
bizType
);
}
// 促销活动的优惠金额计算
updateShoppingCartGoodsDiscount
(
null
,
activityQueryDto
,
calculationDiscountResult
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
null
,
userLoginInfoDto
,
addShoppingCartGoodsRequestVo
.
getMenuType
(),
deliveryAmount
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
...
...
@@ -491,7 +491,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 先验证商品是否存在
CartGoods
cartGoods
=
assortmentSdkService
.
getCartGoodsBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
bizType
);
CartGoods
cartGoods
=
assortmentSdkService
.
getCartGoodsBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
bizType
);
if
(
cartGoods
==
null
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_UPDATE_ERROR
);
// throw new ServiceException(ResponseResult.SHOPPING_CART_UPDATE_ERROR);
...
...
@@ -500,7 +500,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
checkUpdateStock
(
updateShoppingCartGoodsQtyRequestVo
,
cartGoods
);
Integer
oldQty
=
cartGoods
.
getQty
();
// 更新购物车中数量
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
updateGoodsQtyBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
qty
<
0
?
0
:
qty
,
""
,
shoppingCartBaseService
,
bizType
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
updateGoodsQtyBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
qty
<
0
?
0
:
qty
,
""
,
shoppingCartBaseService
,
bizType
);
// check购物车中所有商品
CheckCartRequest
checkCartRequest
=
assortmentSdkService
.
checkShoppingCartSdk
(
cartGoodsList
,
partnerId
,
storeId
,
shoppingCartGoodsResponseVo
,
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
(),
""
,
updateShoppingCartGoodsQtyRequestVo
.
getMenuType
(),
shoppingCartBaseService
);
...
...
@@ -511,7 +511,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
cartGoodsList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
checkCartRequest
.
getCartGoodsList
()),
CartGoods
.
class
);
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
updateShoppingCartGoodsQtyRequestVo
.
getSessionId
(),
""
,
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
updateShoppingCartGoodsQtyRequestVo
.
getSessionId
(),
""
,
shoppingCartBaseService
,
bizType
);
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
userLoginInfoDto
.
getWxAppid
(),
shoppingCartGoodsResponseVo
,
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
());
ActivityQueryDto
activityQueryDto
=
activityAdapter
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
());
...
...
@@ -531,10 +531,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
()
//券
,
null
//加价购商品
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
discountSharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
null
,
bizType
,
accountFlag
,
discountSharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
//校验加购数量
if
(
discountResult
!=
null
)
{
sendGoodsQtyCheckForUpdate
(
cartGoodsList
,
oldQty
,
appId
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
discountResult
.
getSendGoods
(),
bizType
);
sendGoodsQtyCheckForUpdate
(
cartGoodsList
,
oldQty
,
appId
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
discountResult
.
getSendGoods
(),
bizType
);
}
newCalculationUpdateCouponStatus
(
userId
,
partnerId
,
storeId
,
bizType
,
cartGoods
,
cartGoodsList
,
discountResult
);
...
...
@@ -552,17 +552,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
null
,
userId
,
storeId
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
discountResult
,
null
,
partnerId
);
}
else
{
// 获取优惠信息
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
discountSharingDto
);
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
discountSharingDto
);
if
(
calculationDiscountResult
==
null
)
{
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
}
if
(
calculationDiscountResult
!=
null
)
{
sendGoodsQtyCheckForUpdate
(
cartGoodsList
,
oldQty
,
appId
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
(),
bizType
);
sendGoodsQtyCheckForUpdate
(
cartGoodsList
,
oldQty
,
appId
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
(),
bizType
);
}
//校验
calculationUpdateCouponStatus
(
userId
,
partnerId
,
storeId
,
bizType
,
cartGoodsList
,
calculationDiscountResult
);
...
...
@@ -581,7 +581,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
void
newCalculationUpdateCouponStatus
(
String
userId
,
String
partnerId
,
String
storeId
,
Integer
bizType
,
CartGoods
cartGoods
,
List
<
CartGoods
>
cartGoodsList
,
CalculationDiscountResult
discountResult
)
{
List
<
Discount
>
discounts
=
null
;
if
(
null
!=
discountResult
)
{
discounts
=
discountResult
.
getDiscounts
();
discounts
=
discountResult
.
getDiscounts
();
}
List
<
Discount
>
mnCouponDiscount
=
null
;
...
...
@@ -598,7 +598,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
finalMnCouponCode
=
mnCouponCode
;
List
<
CartGoods
>
couponCartGoods
=
cartGoodsList
.
stream
().
filter
(
good
->
finalMnCouponCode
.
equals
(
good
.
getCouponCode
())).
collect
(
toList
());
//更新购物车状态
assortmentSdkService
.
updateGoodsCouponStatus
(
partnerId
,
userId
,
storeId
,
couponCartGoods
,
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
updateGoodsCouponStatus
(
partnerId
,
userId
,
storeId
,
couponCartGoods
,
shoppingCartBaseService
,
bizType
);
}
}
...
...
@@ -686,7 +686,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
unChooseCouponCode
=
shoppingCartInfoRequestVo
.
getUnChooseCouponCode
();
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
""
,
shoppingCartBaseService
,
bizType
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
""
,
shoppingCartBaseService
,
bizType
);
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check是否反选取消商品券
...
...
@@ -696,8 +696,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
GoodsTypeEnum
.
couponTypeList
.
contains
(
cartGoods
.
getGoodsType
()))
{
if
(
Objects
.
equals
(
cartGoods
.
getCouponCode
()
,
unChooseCouponCode
))
{
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
cartGoods
.
getCouponCode
(),
menuType
,
null
);
if
(
Objects
.
equals
(
cartGoods
.
getCouponCode
()
,
unChooseCouponCode
))
{
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
cartGoods
.
getCouponCode
(),
menuType
,
null
);
GetProductsVo
productInfo
=
null
;
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())
||
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
productInfo
=
couponService
.
getSpqProductInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
...
...
@@ -723,7 +723,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
cartGoodsList
=
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
checkCartRequest
.
getCartGoodsList
()),
CartGoods
.
class
);
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
assortmentCustomerInfoVo
.
getSessionId
(),
""
,
this
.
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
assortmentCustomerInfoVo
.
getSessionId
(),
""
,
this
.
shoppingCartBaseService
,
bizType
);
}
// 获取基础运费,并且 组装 deliveryAmountList字段: 额外配送费 如夜间配送费等
...
...
@@ -771,7 +771,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
sendGoods
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
discountSharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
bizType
,
accountFlag
,
discountSharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
sharingCartService
.
distribute
(
calculationSharingDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
...
...
@@ -785,7 +785,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
partnerId
,
shoppingCartInfoRequestVo
.
getFlag
()
,
userId
,
storeId
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
storeId
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
calculationSharingDiscountResult
,
shoppingCartInfoRequestVo
.
getFlag
(),
partnerId
);
}
else
{
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
...
...
@@ -813,7 +813,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 获取优惠信息 调用促销
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
null
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
,
accountFlag
,
nightDistributionFee
,
discountSharingDto
);
cartGoodsList
,
coupons
,
null
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
,
accountFlag
,
nightDistributionFee
,
discountSharingDto
);
if
(
calculationDiscountResult
==
null
)
{
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
}
...
...
@@ -880,10 +880,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
/**
* 加车 和list接口 公用处理方法
* 加车 和list接口 公用处理方法
*
* @param shoppingCartGoodsResponseVo
*/
private
void
shoppingCartAddOrListCommonResponseHandle
(
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
){
private
void
shoppingCartAddOrListCommonResponseHandle
(
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
if
(
Objects
.
isNull
(
shoppingCartGoodsResponseVo
))
{
return
;
}
...
...
@@ -899,22 +900,24 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/**
* 如果有夜间配送费 需要维护划线价 deliveryAmount 字段, ___> 注意, 配送费的优惠是 促销在算(又特么各算一半,这产品真是恶心)
*
* @param deliveryAmount
* @param nightDistributionFee
* @return
*/
private
Long
responseDataMaintain2DeliverAmount
(
Long
deliveryAmount
,
long
nightDistributionFee
)
{
private
Long
responseDataMaintain2DeliverAmount
(
Long
deliveryAmount
,
long
nightDistributionFee
)
{
if
(
Objects
.
isNull
(
deliveryAmount
))
{
deliveryAmount
=
0L
;
}
if
(
nightDistributionFee
<
0
){
if
(
nightDistributionFee
<
0
)
{
return
deliveryAmount
;
}
return
deliveryAmount
+
nightDistributionFee
;
}
/**
* 获取 券使用的门槛信息
* 获取 券使用的门槛信息
*
* @param products
* @return
*/
...
...
@@ -1016,9 +1019,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
@Override
public
BaseResponse
getGoodsListCheck
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
Set
<
String
>
cardCodesSet
=
new
HashSet
<>();
if
(
CollectionUtils
.
isNotEmpty
(
shoppingCartInfoRequestVo
.
getCardCodes
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
shoppingCartInfoRequestVo
.
getCardCodes
()))
{
cardCodesSet
.
addAll
(
shoppingCartInfoRequestVo
.
getCardCodes
());
}
else
if
(
StringUtils
.
isNotBlank
(
shoppingCartInfoRequestVo
.
getCardCode
()))
{
}
else
if
(
StringUtils
.
isNotBlank
(
shoppingCartInfoRequestVo
.
getCardCode
()))
{
cardCodesSet
.
add
(
shoppingCartInfoRequestVo
.
getCardCode
());
}
if
(
CollectionUtils
.
isEmpty
(
cardCodesSet
))
{
...
...
@@ -1055,6 +1058,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return
goodsList
;
}
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
goodsList
.
getResult
();
// fisherman -> 储值卡互斥需求 发现bug 导致返回购物车数据不对 当前时间节点无法修复 重新请求一次
if
(
Objects
.
nonNull
(
shoppingCartInfoRequestVo
.
getEnableSharing
())
&&
shoppingCartInfoRequestVo
.
getEnableSharing
().
compareTo
(
0
)
==
0
)
{
goodsList
=
getGoodsList
(
shoppingCartInfoRequestVo
);
if
(
goodsList
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
goodsList
.
getCode
()))
{
return
goodsList
;
}
shoppingCartGoodsResponseVo
=
goodsList
.
getResult
();
}
//SVC卡支付
SVCCardPay
(
cardCodes
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
partnerId
,
storeId
,
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
goodsList
.
getResult
());
...
...
@@ -1084,7 +1095,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
String
partnerId
=
shoppingCartClearRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartClearRequestVo
.
getShopId
();
shoppingCartNewBaseService
.
clear
(
partnerId
,
storeId
,
userId
,
bizType
);
shoppingCartNewBaseService
.
clear
(
partnerId
,
storeId
,
userId
,
bizType
);
if
(
ObjectUtils
.
equals
(
shoppingCartClearRequestVo
.
getOperationType
(),
OperationTypeEnum
.
PAY_SUCCESS
.
getOperationType
()))
{
return
ResponseUtil
.
success
();
}
...
...
@@ -1151,7 +1162,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
=
shoppingCartInfoRequestVo
.
getSendGoods
();
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
tableNumber
,
shoppingCartBaseService
,
bizType
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
tableNumber
,
shoppingCartBaseService
,
bizType
);
if
(
cartGoodsList
==
null
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_GETINFO_INVAILD
);
// throw new ServiceException(ResponseResult.SHOPPING_CART_GETINFO_INVAILD);
...
...
@@ -1190,7 +1201,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 多规格的sku商品计算包装费
//this.checkSkuOnVersion(cartGoodsList, partnerId, storeId, shoppingCartGoodsResponseVo);
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
assortmentCustomerInfoVo
.
getSessionId
(),
tableNumber
,
this
.
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
assortmentCustomerInfoVo
.
getSessionId
(),
tableNumber
,
this
.
shoppingCartBaseService
,
bizType
);
if
(
CollectionUtils
.
isNotEmpty
(
sendGoodsList
))
{
processSendGoods
(
sendGoodsList
,
partnerId
,
storeId
,
shoppingCartInfoRequestVo
.
getMenuType
(),
shoppingCartBaseService
);
...
...
@@ -1237,7 +1248,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
coupons
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
deliveryAmount
,
shoppingCartInfoRequestVo
,
bizType
,
accountFlag
,
discountSharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
shoppingCartInfoRequestVo
,
bizType
,
accountFlag
,
discountSharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
// 活动校验
calculationSharingValidatorService
.
validator
(
discountResult
...
...
@@ -1284,7 +1295,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
// 获取优惠信息
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
discountSharingDto
);
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
discountSharingDto
);
//临时方案
packgeAdditional
(
shoppingCartInfoRequestVo
,
premiumExchangeActivity
);
// 促销活动的优惠金额计算
...
...
@@ -1311,6 +1322,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/**
* 设置购物车是否可以下单状态
*
* @param shoppingCartGoodsResponseVo
*/
private
void
setNonSingleOrder
(
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
...
...
@@ -1410,11 +1422,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
List
<
GetSvcInfoByMemberIdResponse
>
memberCardResponses
=
svcInfoByMemberId
.
getData
();
// 查询储值卡的余额
List
<
String
>
cardCodes
=
memberCardResponses
.
stream
().
map
(
GetSvcInfoByMemberIdResponse:
:
getCardCode
).
collect
(
Collectors
.
toList
());
if
(
statusFlagList
!=
null
&&
statusFlagList
.
size
()>
0
&&
statusFlagList
.
contains
(
0
))
{
if
(
statusFlagList
!=
null
&&
statusFlagList
.
size
()
>
0
&&
statusFlagList
.
contains
(
0
))
{
//从SVC查询出有效的储值卡,状态2
SvcCardDetailRequest
req
=
new
SvcCardDetailRequest
(
partnerId
,
cardCodes
);
SvcCardDetailRequest
req
=
new
SvcCardDetailRequest
(
partnerId
,
cardCodes
);
BaseResponse
<
List
<
SvcCardDetailsResponse
>>
details
=
svcAppClient
.
details
(
req
);
cardCodes
=
details
.
getResult
().
stream
().
filter
(
item
->
item
.
getCardState
().
equals
(
2
)).
map
(
SvcCardDetailsResponse:
:
getCardCode
).
collect
(
toList
());
cardCodes
=
details
.
getResult
().
stream
().
filter
(
item
->
item
.
getCardState
().
equals
(
2
)).
map
(
SvcCardDetailsResponse:
:
getCardCode
).
collect
(
toList
());
}
SVCCardAmountRequest
svcCardAmountRequest
=
new
SVCCardAmountRequest
();
svcCardAmountRequest
.
setCardCodes
(
cardCodes
);
...
...
@@ -1588,7 +1600,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductGroupList
())
&&
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductComboList
()))
{
cartGoodsList
.
remove
(
i
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
,
bizType
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_NO_MEAL
);
}
}
...
...
@@ -1605,7 +1617,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
StringUtils
.
isBlank
(
couponCode
))
{
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
);
}
else
{
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
,
cartGoods
);
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
,
cartGoods
);
CheckSpqInfoResponseDto
checkSpqInfoResponseDto
=
null
;
// fisherman 删除商品券导致 购物车显示商品名称 为换购券 券名称
boolean
viewProductName
=
false
;
...
...
@@ -1614,17 +1626,18 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
viewProductName
=
true
;
checkSpqInfoResponseDto
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
}
else
{
checkSpqInfoResponseDto
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
checkSpqInfoResponseDto
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
}
// 商品券不存在时,将商品券从购物车移除
if
(
checkSpqInfoResponseDto
==
null
)
{
cartGoodsList
.
remove
(
i
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
,
bizType
);
continue
;
}
if
(
cartGoodsUid
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
validCouponMap
.
put
(
couponCode
,
checkSpqInfoResponseDto
);
}
if
(!
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
}
if
(!
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
validCouponMap
.
put
(
couponCode
+
checkSpqInfoResponseDto
.
getSkuId
(),
checkSpqInfoResponseDto
);
validCouponMap
.
put
(
couponCode
,
checkSpqInfoResponseDto
);
}
...
...
@@ -1641,7 +1654,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
cartGoods
.
setName
(
checkSpqInfoResponseDto
.
getSkuName
());
cartGoods
.
setSpuName
(
checkSpqInfoResponseDto
.
getSkuName
());
cartGoods
.
setSkuName
(
checkSpqInfoResponseDto
.
getSkuName
());
}
else
{
}
else
{
cartGoods
.
setName
(
checkSpqInfoResponseDto
.
getCouponName
());
cartGoods
.
setSpuName
(
checkSpqInfoResponseDto
.
getCouponName
());
}
...
...
@@ -1657,8 +1670,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// canUseCoupon 0 表示可用
accountFlag
=
accountFlag
==
null
?
0
:
accountFlag
;
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
if
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())
&&
accountFlag
==
1
)
{
if
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())
&&
accountFlag
==
1
)
{
if
(
cartGoods
.
getCanUseCoupon
()
==
0
)
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfoResponseDto
.
getCouponCode
());
...
...
@@ -1682,7 +1694,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 当加价购商品不为空时
if
(
CollectionUtils
.
isNotEmpty
(
sendGoodsList
))
{
for
(
ShoppingCartInfoRequestVo
.
SendGoods
sendGoods
:
sendGoodsList
)
{
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
sendGoods
.
getGoodsId
(),
sendGoods
.
getQty
(),
sendGoods
.
getOriginalPrice
(),
100
,
""
,
null
);
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
sendGoods
.
getGoodsId
(),
sendGoods
.
getQty
(),
sendGoods
.
getOriginalPrice
(),
100
,
""
,
null
);
}
}
calculationDiscountGoodsList
.
removeIf
(
calculationDiscountGoods
->
(
calculationDiscountGoods
.
getGoodsQuantity
().
equals
(
0
)));
...
...
@@ -1787,7 +1799,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// calculationDiscountGoods.setMemberDiscount(memberDiscount);
// this.addCalculationDiscountGoods(calculationDiscountGoodsList, calculationDiscountGoods);
// }
private
void
addCalculationDiscountGoods
(
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
,
String
goodsId
,
Integer
goodsQuantity
...
...
@@ -2246,7 +2257,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo
.
setToastMsg
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getToastMsg
());
shoppingCartGoodsResponseVo
.
setChanged
(
checkCartRequest
.
getShoppingCartGoodsResponseVo
().
getChanged
());
}
List
<
CartGoods
>
allCartGoodsList
=
checkCartRequest
.
getCartGoodsList
();
List
<
CartGoods
>
allCartGoodsList
=
checkCartRequest
.
getCartGoodsList
();
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
allCartGoodsList
.
forEach
(
oldCartGoods
->
{
...
...
@@ -2260,7 +2271,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 重新set购物车信息到缓存中
assortmentSdkService
.
setShoppingCart
(
addShoppingCartGoodsRequestVo
.
getPartnerId
(),
addShoppingCartGoodsRequestVo
.
getShopId
(),
userId
,
nowCartGoodsList
,
addShoppingCartGoodsRequestVo
.
getSessionId
(),
addShoppingCartGoodsRequestVo
.
getTableNumber
(),
this
.
shoppingCartBaseService
,
addShoppingCartGoodsRequestVo
.
getBizType
());
userId
,
nowCartGoodsList
,
addShoppingCartGoodsRequestVo
.
getSessionId
(),
addShoppingCartGoodsRequestVo
.
getTableNumber
(),
this
.
shoppingCartBaseService
,
addShoppingCartGoodsRequestVo
.
getBizType
());
oldAllCartGoodsList
.
clear
();
oldAllCartGoodsList
.
addAll
(
nowCartGoodsList
);
return
nowCartGoodsList
;
...
...
@@ -2313,7 +2324,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
CollectionUtils
.
isNotEmpty
(
allCartGoodsList
))
{
if
(
Objects
.
equals
(
CouponTypeEnum
.
TYPE_0
.
getCode
(),
couponProductDto
.
getType
())
||
Objects
.
equals
(
CouponTypeEnum
.
TYPE_4
.
getCode
(),
couponProductDto
.
getType
()))
{
int
sum
=
allCartGoodsList
.
stream
().
filter
(
p
->
Objects
.
equals
(
p
.
getCouponCode
(),
couponCode
)).
mapToInt
(
CartGoods:
:
getQty
).
sum
();
int
sum
=
allCartGoodsList
.
stream
().
filter
(
p
->
Objects
.
equals
(
p
.
getCouponCode
(),
couponCode
)).
mapToInt
(
CartGoods:
:
getQty
).
sum
();
//今日可用次数判断
if
(
sum
+
cartGoods
.
getQty
()
>
todayAvailableTimes
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
...
...
@@ -2380,7 +2391,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
private
void
commonItemVerfity
(
String
channel
,
String
partnerId
,
String
storeId
,
List
<
Long
>
productIds
,
Integer
qty
){
private
void
commonItemVerfity
(
String
channel
,
String
partnerId
,
String
storeId
,
List
<
Long
>
productIds
,
Integer
qty
)
{
GetProductStockRequestDto
requestDto
=
new
GetProductStockRequestDto
();
requestDto
.
setChannel
(
channel
);
requestDto
.
setPartnerId
(
partnerId
);
...
...
@@ -2460,7 +2471,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
else
if
((
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getOrderType
(),
CreateOrderType
.
TAKE_OUT
.
getCode
())
||
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getReachStoreType
(),
OrderType
.
COLLECT_GOODS
.
getCode
())))
{
//fisherman 【ID1033456】自提根据模板配置计算餐具包装费
PackAmountConfig
packAmountByStoreConfig
=
commonFunctionHandle
.
getPackAmountByStoreConfig
(
shoppingCartInfoRequestVo
,
shoppingCartGoodsResponseVo
.
getNewPackAmount
(),
shoppingCartGoodsResponseVo
.
getTotalAmount
());
PackAmountConfig
packAmountByStoreConfig
=
commonFunctionHandle
.
getPackAmountByStoreConfig
(
shoppingCartInfoRequestVo
,
shoppingCartGoodsResponseVo
.
getNewPackAmount
(),
shoppingCartGoodsResponseVo
.
getTotalAmount
());
Long
packAmount
=
packAmountByStoreConfig
.
getNewPackAmount
();
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
packAmount
);
shoppingCartGoodsResponseVo
.
setPackageAmountCollectType
(
CollectionUtils
.
isEmpty
(
packAmountByStoreConfig
.
getCollectType
())
?
1
:
2
);
...
...
@@ -2726,15 +2737,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
CalculationDiscountResult
getCalculationDiscountResult
(
String
menuType
,
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
String
wxappid
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
receiveId
,
Long
deliveryAmount
,
Integer
bizType
,
Integer
accountFlag
,
long
nightDistributionFee
,
DiscountSharingDto
discountSharingDto
)
{
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
receiveId
,
Long
deliveryAmount
,
Integer
bizType
,
Integer
accountFlag
,
long
nightDistributionFee
,
DiscountSharingDto
discountSharingDto
)
{
// 获取优惠信息
CalculationDiscountResult
calculationDiscountResult
=
null
;
//外卖场景下 查询门店配送信息
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
deliveryAmount
,
bizType
,
accountFlag
,
nightDistributionFee
,
discountSharingDto
);
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
deliveryAmount
,
bizType
,
accountFlag
,
nightDistributionFee
,
discountSharingDto
);
}
else
{
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
null
,
bizType
,
accountFlag
,
0L
,
discountSharingDto
);
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
null
,
bizType
,
accountFlag
,
0L
,
discountSharingDto
);
}
return
calculationDiscountResult
;
...
...
@@ -2820,7 +2831,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
break
;
case
1
:
{
//商户+门店级别(新算价)
String
partnerId_storeId
=
partnerId
.
concat
(
storeId
);
String
partnerId_storeId
=
partnerId
.
concat
(
storeId
);
if
(
Arrays
.
asList
(
center
.
getGrayList
().
split
(
","
)).
contains
(
partnerId_storeId
))
{
enable
=
true
;
}
...
...
@@ -2945,7 +2956,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/**
* 购物车添加完成后促销返回赠送商品总数量校验
*/
public
void
sendGoodsQtyCheck
(
Integer
checkQty
,
String
appid
,
String
partnerId
,
String
userId
,
String
storeId
,
String
tableNumber
,
List
<
CartGoods
>
oldCartGoodsList
,
ShoppingCartBaseService
shoppingCartService
,
List
<
SendActivity
>
sendActivitys
,
Integer
bizType
)
{
public
void
sendGoodsQtyCheck
(
Integer
checkQty
,
String
appid
,
String
partnerId
,
String
userId
,
String
storeId
,
String
tableNumber
,
List
<
CartGoods
>
oldCartGoodsList
,
ShoppingCartBaseService
shoppingCartService
,
List
<
SendActivity
>
sendActivitys
,
Integer
bizType
)
{
if
(
CollectionUtils
.
isEmpty
(
sendActivitys
))
{
return
;
}
...
...
@@ -2957,7 +2968,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
int
cartLimitCount
=
queryLimitCount
(
partnerId
,
appid
);
if
(
cartLimitCount
!=
0
&&
checkQty
+
sendQty
>
cartLimitCount
)
{
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
oldCartGoodsList
,
null
,
tableNumber
,
shoppingCartService
,
bizType
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
oldCartGoodsList
,
null
,
tableNumber
,
shoppingCartService
,
bizType
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_LIMIT_ADD
);
}
}
...
...
@@ -2965,7 +2976,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/**
* 购物车添加完成后促销返回赠送商品总数量校验
*/
public
void
sendGoodsQtyCheckForUpdate
(
List
<
CartGoods
>
cartGoodsList
,
Integer
goodsQty
,
String
appid
,
String
partnerId
,
String
userId
,
String
storeId
,
String
cartGoodsUid
,
String
tableNumber
,
ShoppingCartBaseService
shoppingCartService
,
List
<
SendActivity
>
sendActivitys
,
Integer
bizType
)
{
public
void
sendGoodsQtyCheckForUpdate
(
List
<
CartGoods
>
cartGoodsList
,
Integer
goodsQty
,
String
appid
,
String
partnerId
,
String
userId
,
String
storeId
,
String
cartGoodsUid
,
String
tableNumber
,
ShoppingCartBaseService
shoppingCartService
,
List
<
SendActivity
>
sendActivitys
,
Integer
bizType
)
{
Integer
updateQty
=
0
;
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
for
(
CartGoods
goods
:
cartGoodsList
)
{
...
...
@@ -2983,7 +2994,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
if
(
cartLimitCount
!=
0
&&
updateQty
+
sendQty
>
cartLimitCount
)
{
assortmentSdkService
.
updateGoodsQtyBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
goodsQty
,
""
,
shoppingCartBaseService
,
bizType
);
assortmentSdkService
.
updateGoodsQtyBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
goodsQty
,
""
,
shoppingCartBaseService
,
bizType
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_LIMIT_ADD
);
}
}
...
...
@@ -3141,7 +3152,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 返回构造对象
PremiumExchangeResponseVo
premiumExchangeResponseVo
=
new
PremiumExchangeResponseVo
();
premiumExchangeResponseVo
.
setResultCode
(
ActivityResultCodeEnum
.
NON_PARTICIPATE
.
getCode
());
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
request
.
getSessionId
(),
null
,
shoppingCartBaseService
,
bizType
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
request
.
getSessionId
(),
null
,
shoppingCartBaseService
,
bizType
);
DiscountSharingDto
discountSharingDto
=
new
DiscountSharingDto
();
discountSharingDto
.
setEnableSharing
(
request
.
getEnableSharing
());
if
(
grayPush
(
partnerId
,
storeId
,
"2"
))
{
...
...
@@ -3176,7 +3187,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
coupons
//券
,
null
//加价购商品
,
0L
,
null
,
bizType
,
accountFlag
,
discountSharingDto
,
0L
);
,
null
,
bizType
,
accountFlag
,
discountSharingDto
,
0L
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchangeSharing
(
discountResult
);
}
else
{
...
...
@@ -3200,8 +3211,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
});
}
// 获取优惠信息
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
null
,
null
,
0L
,
bizType
,
accountFlag
,
0L
,
discountSharingDto
);
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
null
,
null
,
0L
,
bizType
,
accountFlag
,
0L
,
discountSharingDto
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchange
(
calculationDiscountResult
);
}
...
...
@@ -3283,7 +3294,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
PromotionResultVO
vo
=
new
PromotionResultVO
();
if
(
grayPush
)
{
ActivityBaseResponseDto
<
PromotionResultVO
>
responseDto
=
activityClient
.
getV3Promotion
(
request
);
if
(
responseDto
!=
null
&&
StringUtils
.
equals
(
responseDto
.
getStatusCode
(),
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
))
{
if
(
responseDto
!=
null
&&
StringUtils
.
equals
(
responseDto
.
getStatusCode
(),
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
))
{
vo
.
setV3Promotion
(
responseDto
.
getResult
().
isV3Promotion
());
}
}
...
...
@@ -3349,7 +3360,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
Long
deliveryAmount
=
calculateDeliveryAmount
(
requestVo
.
getReceiveId
(),
partnerId
,
storeId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
shoppingCartGoodsResponseVo
,
requestVo
.
getOrderType
());
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCartForCoupon
(
partnerId
,
requestVo
.
getStoreId
(),
userId
,
""
,
shoppingCartBaseService
,
bizType
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCartForCoupon
(
partnerId
,
requestVo
.
getStoreId
(),
userId
,
""
,
shoppingCartBaseService
,
bizType
);
if
(
grayPush
(
partnerId
,
storeId
,
"2"
))
{
//此对象用于传递参数,省的一直增加方法参数个数
DiscountSharingDto
sharingDto
=
new
DiscountSharingDto
();
...
...
@@ -3365,16 +3376,16 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
<>()
//券
,
null
//加价购商品
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
sharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
,
null
,
bizType
,
accountFlag
,
sharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()));
if
(
discountResult
!=
null
&&
Objects
.
equals
(
discountResult
.
getV3Promotion
(),
true
))
{
//v3
if
(
discountResult
!=
null
&&
Objects
.
equals
(
discountResult
.
getV3Promotion
(),
true
))
{
//v3
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfoSharingV3
(
partnerId
,
storeId
,
discountResult
,
orgCodes
);
}
else
{
//v2
}
else
{
//v2
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfoSharing
(
partnerId
,
storeId
,
discountResult
,
orgCodes
);
}
}
else
{
// 获取优惠信息
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
<>(),
null
,
null
,
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
new
DiscountSharingDto
());
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
<>(),
null
,
null
,
deliveryAmount
,
bizType
,
accountFlag
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
()),
new
DiscountSharingDto
());
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfo
(
partnerId
,
storeId
,
calculationDiscountResult
,
orgCodes
);
}
return
ResponseUtil
.
success
(
couponAvailableCartInfo
);
...
...
@@ -3408,7 +3419,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
userId
,
replaceGoodsRequestVo
.
getSessionId
(),
null
,
shoppingCartBaseService
,
null
);
shoppingCartBaseService
,
null
);
if
(
CollectionUtils
.
isEmpty
(
allCartGoodsList
))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_REPLACE_GOODS
);
}
...
...
@@ -3561,10 +3572,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
allCartGoodsList
=
notCheckStock
;
shoppingCartNewBaseService
.
clear
(
replaceGoodsRequestVo
.
getPartnerId
(),
replaceGoodsRequestVo
.
getShopId
(),
userId
,
replaceGoodsRequestVo
.
getBizType
());
shoppingCartNewBaseService
.
clear
(
replaceGoodsRequestVo
.
getPartnerId
(),
replaceGoodsRequestVo
.
getShopId
(),
userId
,
replaceGoodsRequestVo
.
getBizType
());
// 重新set购物车信息到缓存中
assortmentSdkService
.
setShoppingCart
(
replaceGoodsRequestVo
.
getPartnerId
(),
replaceGoodsRequestVo
.
getShopId
(),
userId
,
allCartGoodsList
,
replaceGoodsRequestVo
.
getSessionId
(),
null
,
this
.
shoppingCartBaseService
,
replaceGoodsRequestVo
.
getBizType
());
userId
,
allCartGoodsList
,
replaceGoodsRequestVo
.
getSessionId
(),
null
,
this
.
shoppingCartBaseService
,
replaceGoodsRequestVo
.
getBizType
());
excludeGoods
.
clear
();
excludeGoods
.
addAll
(
allCartGoodsList
);
return
fullReplace
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingCartService.java
View file @
f638ae41
...
...
@@ -86,11 +86,6 @@ public class CalculationSharingCartService {
if
(
BusinessTypeEnum
.
SAAS_MALL
.
getCode
().
equals
(
menuType
)
&&
null
!=
shoppingCartInfoRequestVo
&&
OrderChannelType
.
SAASMALL
.
getCode
().
equalsIgnoreCase
(
shoppingCartInfoRequestVo
.
getChannelType
()))
{
deliverySharingService
.
mallDeliveryResponse
(
shoppingCartGoodsResponseVo
,
deliveryAmount
,
discountResult
);
}
logUtil
.
info
(
"fisherman 1 "
,
JSON
.
toJSONString
(
discountResult
));
logUtil
.
info
(
"fisherman 2 "
,
JSON
.
toJSONString
(
cartGoodsList
));
logUtil
.
info
(
"fisherman 3 "
,
JSON
.
toJSONString
(
shoppingCartGoodsResponseVo
));
logUtil
.
info
(
"fisherman 4 "
,
JSON
.
toJSONString
(
couponPromotionVO
));
logUtil
.
info
(
"fisherman 5 "
,
JSON
.
toJSONString
(
shoppingCartInfoRequestVo
));
/**
* 可用券及券折扣
*/
...
...
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