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
fe98c8cb
Commit
fe98c8cb
authored
Aug 30, 2021
by
胡博文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决买M件N券到算页不自动选最优券的问题
parent
cadf9167
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
210 additions
and
34 deletions
+210
-34
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
+6
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartParamDto.java
+2
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/ShoppingCartBaseService.java
+10
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/CollageCartBaseServiceImpl.java
+5
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/MealCartBaseServiceImpl.java
+5
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartBaseServiceImpl.java
+26
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartMallBaseServiceImpl.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+7
-0
shopping-cart-application-service/src/main/java/cn/freemud/factory/AbstractShoppingCartImpl.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/AssortmentSdkService.java
+34
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMallServiceImpl.java
+11
-6
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+84
-21
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
+9
-1
No files found.
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
View file @
fe98c8cb
...
@@ -96,6 +96,12 @@ public class CartGoods {
...
@@ -96,6 +96,12 @@ public class CartGoods {
* 商品券code
* 商品券code
*/
*/
private
String
couponCode
;
private
String
couponCode
;
/**
* 0 可用 1 不可用 (结算页识别是否需要传买M赠N券code)
* 默认不可用,经过算价后进行更新。
*/
private
Integer
canUseCoupon
=
1
;
/**
/**
* 商品券门槛金额
* 商品券门槛金额
*/
*/
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartParamDto.java
View file @
fe98c8cb
...
@@ -36,6 +36,8 @@ public class CartParamDto {
...
@@ -36,6 +36,8 @@ public class CartParamDto {
private
String
cartGoodsUid
;
private
String
cartGoodsUid
;
private
Integer
canUseCoupon
;
private
Integer
qty
;
private
Integer
qty
;
private
MealClearOperationEnum
operationType
;
private
MealClearOperationEnum
operationType
;
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/ShoppingCartBaseService.java
View file @
fe98c8cb
...
@@ -940,6 +940,16 @@ public interface ShoppingCartBaseService {
...
@@ -940,6 +940,16 @@ public interface ShoppingCartBaseService {
BaseResponse
<
List
<
CartGoods
>>
updateGoodsQty
(
CartParamDto
cartParamDto
,
String
trackingNo
);
BaseResponse
<
List
<
CartGoods
>>
updateGoodsQty
(
CartParamDto
cartParamDto
,
String
trackingNo
);
/**
/**
* 更新券状态
*
* @param cartParamDto
* @param trackingNo
* @return
*/
BaseResponse
updateGoodsCouponStatus
(
CartParamDto
cartParamDto
,
String
trackingNo
);
/**
* 查询组织机构
* 查询组织机构
* @param partnerId
* @param partnerId
* @param storeId
* @param storeId
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/CollageCartBaseServiceImpl.java
View file @
fe98c8cb
...
@@ -194,6 +194,11 @@ public class CollageCartBaseServiceImpl implements ShoppingCartBaseService {
...
@@ -194,6 +194,11 @@ public class CollageCartBaseServiceImpl implements ShoppingCartBaseService {
}
}
}
}
@Override
public
BaseResponse
updateGoodsCouponStatus
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
return
null
;
}
/**
/**
* 获取当前购物车版本
* 获取当前购物车版本
* 默认0
* 默认0
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/MealCartBaseServiceImpl.java
View file @
fe98c8cb
...
@@ -442,6 +442,11 @@ public class MealCartBaseServiceImpl implements ShoppingCartBaseService {
...
@@ -442,6 +442,11 @@ public class MealCartBaseServiceImpl implements ShoppingCartBaseService {
}
}
@Override
@Override
public
BaseResponse
updateGoodsCouponStatus
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
return
null
;
}
@Override
public
void
checkNoProductExistMenu
(
CheckCartRequest
checkCartRequest
,
Set
<
String
>
keySet
)
{
public
void
checkNoProductExistMenu
(
CheckCartRequest
checkCartRequest
,
Set
<
String
>
keySet
)
{
// 当商品不存在于菜单中且不是商品券时,需置空移除
// 当商品不存在于菜单中且不是商品券时,需置空移除
List
<
String
>
removeList
=
new
ArrayList
<>();
List
<
String
>
removeList
=
new
ArrayList
<>();
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartBaseServiceImpl.java
View file @
fe98c8cb
...
@@ -248,6 +248,32 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
...
@@ -248,6 +248,32 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
}
}
}
}
/**
* 更新购物车券状态
*
* @param cartParamDto
* @param trackingNo
* @return
*/
@Override
public
BaseResponse
updateGoodsCouponStatus
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
try
{
String
redisKey
=
getShoppingCartGoodsKey
(
cartParamDto
);
BoundHashOperations
<
String
,
String
,
CartGoods
>
operations
=
redisTemplate
.
boundHashOps
(
redisKey
);
CartGoods
cartGoods
=
operations
.
get
(
cartParamDto
.
getCartGoodsUid
());
if
(
cartGoods
!=
null
)
{
// 更新券状态
cartGoods
.
setCanUseCoupon
(
cartParamDto
.
getCanUseCoupon
());
operations
.
put
(
cartParamDto
.
getCartGoodsUid
(),
cartGoods
);
}
//return this.getCartGoodsList(cartParamDto, trackingNo);
}
catch
(
Exception
e
)
{
ShoppingSdkLogUtil
.
printErrorLog
(
"assortment-shoppingcart-sdk"
,
trackingNo
,
e
.
getMessage
(),
"updateGoodsCouponStatus"
,
cartParamDto
,
e
,
Level
.
ERROR
);
}
return
CartResponseUtil
.
success
();
}
@Override
@Override
public
BaseResponse
clear
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
public
BaseResponse
clear
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
try
{
try
{
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartMallBaseServiceImpl.java
View file @
fe98c8cb
...
@@ -128,6 +128,11 @@ public class ShoppingCartMallBaseServiceImpl implements ShoppingCartBaseService
...
@@ -128,6 +128,11 @@ public class ShoppingCartMallBaseServiceImpl implements ShoppingCartBaseService
}
}
@Override
@Override
public
BaseResponse
updateGoodsCouponStatus
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
return
null
;
}
@Override
public
BaseResponse
clear
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
public
BaseResponse
clear
(
CartParamDto
cartParamDto
,
String
trackingNo
)
{
try
{
try
{
redisTemplate
.
delete
(
this
.
getShoppingCartGoodsKey
(
cartParamDto
));
redisTemplate
.
delete
(
this
.
getShoppingCartGoodsKey
(
cartParamDto
));
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
fe98c8cb
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
package
cn
.
freemud
.
entities
.
vo
;
package
cn
.
freemud
.
entities
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
...
@@ -85,6 +86,12 @@ public class CartGoods {
...
@@ -85,6 +86,12 @@ public class CartGoods {
* 商品券code
* 商品券code
*/
*/
private
String
couponCode
;
private
String
couponCode
;
/**
* 0 可用 1 不可用 (结算页识别是否需要传买M赠N券code)
*/
@JsonIgnore
private
Integer
canUseCoupon
=
1
;
/**
/**
* 商品券名称
* 商品券名称
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/factory/AbstractShoppingCartImpl.java
View file @
fe98c8cb
...
@@ -340,9 +340,9 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
...
@@ -340,9 +340,9 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
//外卖场景下 查询门店配送信息
//外卖场景下 查询门店配送信息
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
)){
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
)){
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
deliveryAmount
,
null
);
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
deliveryAmount
,
null
,
null
);
}
else
{
}
else
{
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
null
,
null
);
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
null
,
null
,
null
);
}
}
return
calculationDiscountResult
;
return
calculationDiscountResult
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
View file @
fe98c8cb
...
@@ -97,7 +97,7 @@ public interface ShoppingCartNewService {
...
@@ -97,7 +97,7 @@ public interface ShoppingCartNewService {
boolean
isMember
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
);
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
,
Integer
accountFlag
);
List
<
CartGoods
>
updateCartGoodsLegal
(
CartGoods
cartGoods
,
String
userId
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
CartGoods
>
oldAllCartGoodsList
);
List
<
CartGoods
>
updateCartGoodsLegal
(
CartGoods
cartGoods
,
String
userId
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
CartGoods
>
oldAllCartGoodsList
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/AssortmentSdkService.java
View file @
fe98c8cb
...
@@ -20,7 +20,9 @@ import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
...
@@ -20,7 +20,9 @@ import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.RedisKeyConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.ShoppingCartConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.ShoppingCartConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BizTypeEnum
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.GetProductInfoRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.GetProductInfoRequest
;
...
@@ -37,6 +39,7 @@ import cn.freemud.entities.dto.GetMenuResponseDto.DataBean.RootNodeBean.Children
...
@@ -37,6 +39,7 @@ import cn.freemud.entities.dto.GetMenuResponseDto.DataBean.RootNodeBean.Children
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -101,6 +104,37 @@ public class AssortmentSdkService {
...
@@ -101,6 +104,37 @@ public class AssortmentSdkService {
return
updateNowBuyGoodsQtyBySdk
(
buyType
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
qty
,
tableNumber
,
shoppingCartService
,
bizType
);
return
updateNowBuyGoodsQtyBySdk
(
buyType
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
qty
,
tableNumber
,
shoppingCartService
,
bizType
);
}
}
/**
* 更新购物车 买M赠N券商品状态
*
* @param partnerId 商户号
* @param userId 用户id
* @param storeId 门店id
* @return
*/
public
void
updateGoodsCouponStatus
(
String
partnerId
,
String
userId
,
String
storeId
,
List
<
CartGoods
>
cartGoods
,
ShoppingCartBaseService
shoppingCartService
,
Integer
bizType
)
{
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartParamDto
cartParamDto
=
getCartParamDto
(
partnerId
,
storeId
,
userId
);
for
(
CartGoods
cartGood
:
cartGoods
)
{
int
buyType
=
0
;
cartParamDto
.
setCartGoodsUid
(
cartGood
.
getCartGoodsUid
());
// 0 表示券可用 1 表示不可用
cartParamDto
.
setCanUseCoupon
(
0
);
// cartParamDto.setTableNumber(tableNumber);
cartParamDto
.
setUserId
(
userId
);
cartParamDto
.
setBizType
(
bizType
);
//立即购买==1 ,设置新的缓存key
if
(
buyType
==
ShoppingCartConstant
.
NOW_BUY_TYPE
)
{
cartParamDto
.
setBuyType
(
buyType
);
}
shoppingCartService
.
updateGoodsCouponStatus
(
cartParamDto
,
LogThreadLocal
.
getTrackingNo
());
}
}
/**
/**
* 调用聚合sdk获取缓存中购物车信息
* 调用聚合sdk获取缓存中购物车信息
*
*
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
View file @
fe98c8cb
...
@@ -789,7 +789,7 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
...
@@ -789,7 +789,7 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
}
}
@Override
@Override
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
)
{
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
,
Integer
accoutFlag
)
{
ActivityCalculationDiscountRequestDto
activityCalculationDiscountRequestDto
=
getActivityCalculationDiscountRequestDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
ActivityCalculationDiscountRequestDto
activityCalculationDiscountRequestDto
=
getActivityCalculationDiscountRequestDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
// 校验后有效的商品券map
// 校验后有效的商品券map
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMallServiceImpl.java
View file @
fe98c8cb
...
@@ -54,6 +54,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
...
@@ -54,6 +54,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
import
com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartMallBaseServiceImpl
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartMallBaseServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
io.swagger.models.auth.In
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.ObjectUtils
;
...
@@ -138,6 +139,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -138,6 +139,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
String
menuType
=
addShoppingCartGoodsRequestVo
.
getMenuType
();
String
menuType
=
addShoppingCartGoodsRequestVo
.
getMenuType
();
Integer
orderType
=
addShoppingCartGoodsRequestVo
.
getOrderType
();
Integer
orderType
=
addShoppingCartGoodsRequestVo
.
getOrderType
();
addShoppingCartGoodsRequestVo
.
setShopId
(
storeId
);
addShoppingCartGoodsRequestVo
.
setShopId
(
storeId
);
Integer
accountType
=
0
;
//非结算页
//清空临时购物车
//清空临时购物车
// 构造请求参数,进行清空购物车
// 构造请求参数,进行清空购物车
if
(
ShoppingCartConstant
.
NOW_BUY_TYPE
==
addShoppingCartGoodsRequestVo
.
getBuyType
())
{
if
(
ShoppingCartConstant
.
NOW_BUY_TYPE
==
addShoppingCartGoodsRequestVo
.
getBuyType
())
{
...
@@ -189,7 +191,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -189,7 +191,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
ActivityQueryDto
activityQueryDto
=
activityAdapter
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
addShoppingCartGoodsRequestVo
.
getOrderType
());
ActivityQueryDto
activityQueryDto
=
activityAdapter
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
addShoppingCartGoodsRequestVo
.
getOrderType
());
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
discountResult
=
null
;
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
discountResult
=
null
;
discountResult
=
sharingDiscountService
.
getCalculationSharingDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
<>(),
null
,
deliveryAmount
,
null
,
null
);
discountResult
=
sharingDiscountService
.
getCalculationSharingDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
<>(),
null
,
deliveryAmount
,
null
,
null
,
accountType
);
sharingCartService
.
distribute
(
discountResult
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
null
,
null
,
null
,
activityQueryDto
,
menuType
,
deliveryAmount
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
partnerId
,
null
,
userId
,
storeId
);
sharingCartService
.
distribute
(
discountResult
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
null
,
null
,
null
,
activityQueryDto
,
menuType
,
deliveryAmount
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
partnerId
,
null
,
userId
,
storeId
);
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
discountResult
,
null
,
partnerId
);
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
discountResult
,
null
,
partnerId
);
...
@@ -245,6 +247,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -245,6 +247,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
String
receiveId
=
updateShoppingCartGoodsQtyRequestVo
.
getReceiveId
();
String
receiveId
=
updateShoppingCartGoodsQtyRequestVo
.
getReceiveId
();
String
menuType
=
updateShoppingCartGoodsQtyRequestVo
.
getMenuType
();
String
menuType
=
updateShoppingCartGoodsQtyRequestVo
.
getMenuType
();
Integer
orderType
=
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
();
Integer
orderType
=
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
();
Integer
accountFlag
=
0
;
// 非结算页
// 先验证商品是否存在
// 先验证商品是否存在
CartGoods
cartGoods
=
assortmentSdkService
.
getCartGoodsBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
null
);
CartGoods
cartGoods
=
assortmentSdkService
.
getCartGoodsBySdk
(
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
null
);
...
@@ -283,7 +286,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -283,7 +286,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
()
//券
,
new
ArrayList
()
//券
,
null
//加价购商品
,
null
//加价购商品
,
deliveryAmount
,
deliveryAmount
,
null
,
null
);
,
null
,
null
,
accountFlag
);
sharingCartService
.
distribute
(
discountResult
sharingCartService
.
distribute
(
discountResult
,
cartGoodsList
,
cartGoodsList
...
@@ -364,6 +367,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -364,6 +367,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
Integer
accountFlag
=
shoppingCartInfoRequestVo
.
getFlag
();
// 兼容老版本
// 兼容老版本
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
ChooseCouponVo
otherCouponCode
=
couponCodes
.
stream
()
ChooseCouponVo
otherCouponCode
=
couponCodes
.
stream
()
...
@@ -441,7 +445,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -441,7 +445,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
,
coupons
,
coupons
,
sendGoods
,
sendGoods
,
deliveryAmount
,
deliveryAmount
,
null
,
null
);
,
null
,
null
,
accountFlag
);
sharingCartService
.
distribute
(
calculationSharingDiscountResult
sharingCartService
.
distribute
(
calculationSharingDiscountResult
,
cartGoodsList
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
shoppingCartGoodsResponseVo
...
@@ -529,6 +533,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -529,6 +533,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
Integer
accountFlag
=
shoppingCartInfoRequestVo
.
getFlag
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
if
(
Objects
.
isNull
(
couponCode
)
&&
CollectionUtils
.
isNotEmpty
(
couponCodes
))
{
if
(
Objects
.
isNull
(
couponCode
)
&&
CollectionUtils
.
isNotEmpty
(
couponCodes
))
{
ChooseCouponVo
otherCouponCode
=
couponCodes
.
stream
()
ChooseCouponVo
otherCouponCode
=
couponCodes
.
stream
()
...
@@ -598,7 +603,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -598,7 +603,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
,
coupons
,
coupons
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
deliveryAmount
,
deliveryAmount
,
shoppingCartInfoRequestVo
,
null
);
,
shoppingCartInfoRequestVo
,
null
,
accountFlag
);
// 活动校验
// 活动校验
calculationSharingValidatorService
.
validator
(
discountResult
calculationSharingValidatorService
.
validator
(
discountResult
...
@@ -630,8 +635,8 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
...
@@ -630,8 +635,8 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
@Override
@Override
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
)
{
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
,
Integer
accountFlag
)
{
return
null
;
return
null
;
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
View file @
fe98c8cb
...
@@ -427,7 +427,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
...
@@ -427,7 +427,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
))
{
return
;
return
;
}
}
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
new
ArrayList
<>(),
new
ArrayList
<>(),
BusinessTypeEnum
.
SAAS_MALL
.
getCode
(),
0L
,
null
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
new
ArrayList
<>(),
new
ArrayList
<>(),
BusinessTypeEnum
.
SAAS_MALL
.
getCode
(),
0L
,
null
,
null
);
if
(
calculationDiscountResult
==
null
)
{
if
(
calculationDiscountResult
==
null
)
{
return
;
return
;
}
}
...
@@ -556,7 +556,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
...
@@ -556,7 +556,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
@Override
@Override
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
)
{
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
,
Integer
accountFlag
)
{
ActivityCalculationDiscountRequestDto
activityCalculationDiscountRequestDto
=
getActivityCalculationDiscountRequestDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
ActivityCalculationDiscountRequestDto
activityCalculationDiscountRequestDto
=
getActivityCalculationDiscountRequestDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
t
->
!
isWeightProduct
(
t
)).
collect
(
Collectors
.
toList
());
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
t
->
!
isWeightProduct
(
t
)).
collect
(
Collectors
.
toList
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
fe98c8cb
...
@@ -299,6 +299,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -299,6 +299,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
tableNumber
=
addShoppingCartGoodsRequestVo
.
getTableNumber
();
String
tableNumber
=
addShoppingCartGoodsRequestVo
.
getTableNumber
();
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
// 商品券和换购券券号
String
couponCode
=
addShoppingCartGoodsRequestVo
.
getCouponCode
();
// 商品券和换购券券号
Integer
bizType
=
addShoppingCartGoodsRequestVo
.
getBizType
();
// 7-爱马哥预定单
Integer
bizType
=
addShoppingCartGoodsRequestVo
.
getBizType
();
// 7-爱马哥预定单
Integer
accountFlag
=
0
;
//非结算页
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
// 兼容老版本
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
// 兼容老版本
couponCode
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
couponCode
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
}
}
...
@@ -381,8 +382,25 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -381,8 +382,25 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
<>()
//券
,
new
ArrayList
<>()
//券
,
null
//加价购商品
,
null
//加价购商品
,
deliveryAmount
,
deliveryAmount
,
null
,
bizType
);
,
null
,
bizType
,
accountFlag
);
//更新购物车
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
discountResult
.
getDiscounts
();
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
mnCouponDiscount
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
discounts
))
{
mnCouponDiscount
=
discounts
.
stream
().
filter
(
discount
->
ActivityTypeEnum
.
TYPE_330
.
getCode
().
equals
(
discount
.
getType
())).
collect
(
toList
());
}
String
mnCouponCode
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
mnCouponDiscount
))
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
mnCouponDiscount
.
get
(
0
);
mnCouponCode
=
discount
.
getActivityCode
();
}
if
(
StringUtils
.
isNotBlank
(
mnCouponCode
))
{
String
finalMnCouponCode
=
mnCouponCode
;
List
<
CartGoods
>
couponCartGoods
=
allCartGoodsList
.
stream
().
filter
(
good
->
finalMnCouponCode
.
equals
(
good
.
getCouponCode
())).
collect
(
toList
());
//更新购物车状态
assortmentSdkService
.
updateGoodsCouponStatus
(
partnerId
,
userId
,
storeId
,
couponCartGoods
,
shoppingCartBaseService
,
bizType
);
}
sharingCartService
.
distribute
(
discountResult
sharingCartService
.
distribute
(
discountResult
,
allCartGoodsList
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
shoppingCartGoodsResponseVo
...
@@ -402,11 +420,29 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -402,11 +420,29 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//
//
}
else
{
}
else
{
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
,
accountFlag
);
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
);
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getSendGoods
())){
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getSendGoods
()))
{
sendGoodsQtyCheck
(
productsCount
,
appId
,
partnerId
,
userId
,
storeId
,
tableNumber
,
oldCartGoodsList
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
(),
bizType
);
sendGoodsQtyCheck
(
productsCount
,
appId
,
partnerId
,
userId
,
storeId
,
tableNumber
,
oldCartGoodsList
,
shoppingCartBaseService
,
calculationDiscountResult
.
getSendGoods
(),
bizType
);
}
}
//校验
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getDiscounts
()))
{
String
activityCouponCode
=
null
;
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
>
couponDiscounts
=
calculationDiscountResult
.
getCouponDiscounts
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
>
couponResults
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
couponDiscounts
))
{
couponResults
=
couponDiscounts
.
stream
().
filter
(
discount
->
ActivityTypeEnum
.
TYPE_330
.
getCode
().
equals
(
discount
.
getActivityType
())).
collect
(
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
couponResults
))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
coupon
=
couponDiscounts
.
get
(
0
);
activityCouponCode
=
coupon
.
getCouponCode
();
}
if
(
StringUtils
.
isNotBlank
(
activityCouponCode
))
{
String
finalActivityCouponCode
=
activityCouponCode
;
List
<
CartGoods
>
couponCartGoods
=
allCartGoodsList
.
stream
().
filter
(
good
->
finalActivityCouponCode
.
equals
(
good
.
getCouponCode
())).
collect
(
toList
());
//更新购物车状态
assortmentSdkService
.
updateGoodsCouponStatus
(
partnerId
,
userId
,
storeId
,
couponCartGoods
,
shoppingCartBaseService
,
bizType
);
}
}
// 当商品数量被设为0时
// 当商品数量被设为0时
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
if
(
Objects
.
equals
(
cartGoods
.
getQty
(),
0
))
{
...
@@ -474,6 +510,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -474,6 +510,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
Integer
orderType
=
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
();
Integer
orderType
=
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
();
String
receiveId
=
updateShoppingCartGoodsQtyRequestVo
.
getReceiveId
();
String
receiveId
=
updateShoppingCartGoodsQtyRequestVo
.
getReceiveId
();
Integer
bizType
=
updateShoppingCartGoodsQtyRequestVo
.
getBizType
();
Integer
bizType
=
updateShoppingCartGoodsQtyRequestVo
.
getBizType
();
Integer
accountFlag
=
0
;
//非结算页
// 先验证商品是否存在
// 先验证商品是否存在
...
@@ -516,7 +553,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -516,7 +553,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
()
//券
,
new
ArrayList
()
//券
,
null
//加价购商品
,
null
//加价购商品
,
deliveryAmount
,
deliveryAmount
,
null
,
bizType
);
,
null
,
bizType
,
accountFlag
);
sharingCartService
.
distribute
(
discountResult
sharingCartService
.
distribute
(
discountResult
,
cartGoodsList
,
cartGoodsList
...
@@ -537,7 +574,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -537,7 +574,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
else
{
}
else
{
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
);
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
(),
new
ArrayList
<>(),
null
,
deliveryAmount
,
bizType
,
accountFlag
);
if
(
calculationDiscountResult
==
null
)
{
if
(
calculationDiscountResult
==
null
)
{
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
}
}
...
@@ -628,6 +665,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -628,6 +665,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
Integer
bizType
=
shoppingCartInfoRequestVo
.
getBizType
();
Integer
bizType
=
shoppingCartInfoRequestVo
.
getBizType
();
// 1 为结算页
Integer
accountFlag
=
shoppingCartInfoRequestVo
.
getFlag
();
// 兼容老版本
// 兼容老版本
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
...
@@ -724,7 +763,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -724,7 +763,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
sendGoods
,
sendGoods
,
deliveryAmount
,
deliveryAmount
,
null
,
null
,
bizType
);
,
bizType
,
accountFlag
);
sharingCartService
.
distribute
(
calculationSharingDiscountResult
sharingCartService
.
distribute
(
calculationSharingDiscountResult
,
cartGoodsList
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
shoppingCartGoodsResponseVo
...
@@ -765,7 +804,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -765,7 +804,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 获取优惠信息 调用促销
// 获取优惠信息 调用促销
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
null
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
);
cartGoodsList
,
coupons
,
null
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
,
accountFlag
);
if
(
calculationDiscountResult
==
null
)
{
if
(
calculationDiscountResult
==
null
)
{
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
}
}
...
@@ -1002,6 +1041,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1002,6 +1041,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
List
<
ChooseCouponVo
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
Integer
bizType
=
shoppingCartInfoRequestVo
.
getBizType
();
Integer
bizType
=
shoppingCartInfoRequestVo
.
getBizType
();
Integer
accountFlag
=
shoppingCartInfoRequestVo
.
getFlag
();
if
(
Objects
.
isNull
(
couponCode
)
&&
CollectionUtils
.
isNotEmpty
(
couponCodes
))
{
if
(
Objects
.
isNull
(
couponCode
)
&&
CollectionUtils
.
isNotEmpty
(
couponCodes
))
{
// fisherman 这里可能会有问题 如果只有配送券的情况下 这里 过滤掉了 得检查后面的逻辑 是否用了list去做事情
// fisherman 这里可能会有问题 如果只有配送券的情况下 这里 过滤掉了 得检查后面的逻辑 是否用了list去做事情
...
@@ -1103,7 +1143,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1103,7 +1143,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
coupons
,
coupons
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
deliveryAmount
,
deliveryAmount
,
shoppingCartInfoRequestVo
,
bizType
);
,
shoppingCartInfoRequestVo
,
bizType
,
accountFlag
);
// 活动校验
// 活动校验
calculationSharingValidatorService
.
validator
(
discountResult
calculationSharingValidatorService
.
validator
(
discountResult
...
@@ -1150,7 +1190,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1150,7 +1190,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
userLoginInfoDto
.
getWxAppid
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartInfoRequestVo
.
getReceiveId
(),
deliveryAmount
,
bizType
,
accountFlag
);
//临时方案
//临时方案
packgeAdditional
(
shoppingCartInfoRequestVo
,
premiumExchangeActivity
);
packgeAdditional
(
shoppingCartInfoRequestVo
,
premiumExchangeActivity
);
// 促销活动的优惠金额计算
// 促销活动的优惠金额计算
...
@@ -1401,9 +1441,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1401,9 +1441,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
*/
@Override
@Override
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
public
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getActivityCalculationDiscountResponse
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
)
{
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
menuType
,
Long
distributionFee
,
Integer
bizType
,
Integer
accountFlag
)
{
ActivityCalculationDiscountRequestDto
activityCalculationDiscountRequestDto
=
getActivityCalculationDiscountRequestDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
ActivityCalculationDiscountRequestDto
activityCalculationDiscountRequestDto
=
getActivityCalculationDiscountRequestDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
...
@@ -1472,13 +1522,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1472,13 +1522,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//添加请求的优惠券信息 买M赠N券,不重复加促销券集合字段
//添加请求的优惠券信息 买M赠N券,不重复加促销券集合字段
String
finalCouponCode
=
couponCode
;
String
finalCouponCode
=
couponCode
;
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
collect
=
coupons
.
stream
().
filter
(
calculationDiscountCoupon
->
Objects
.
equals
(
calculationDiscountCoupon
.
getCode
(),
finalCouponCode
)).
collect
(
toList
());
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
collect
=
coupons
.
stream
().
filter
(
calculationDiscountCoupon
->
Objects
.
equals
(
calculationDiscountCoupon
.
getCode
(),
finalCouponCode
)).
collect
(
toList
());
if
(
CollectionUtils
.
isEmpty
(
collect
)){
// canUseCoupon 0 表示可用
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
if
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())
&&
accountFlag
==
1
)
{
if
(
cartGoods
.
getCanUseCoupon
()
==
0
)
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfoResponseDto
.
getCouponCode
());
coupon
.
setCode
(
checkSpqInfoResponseDto
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfoResponseDto
.
getActiveCode
());
coupon
.
setActivityCode
(
checkSpqInfoResponseDto
.
getActiveCode
());
coupons
.
add
(
coupon
);
coupons
.
add
(
coupon
);
}
}
}
else
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfoResponseDto
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfoResponseDto
.
getActiveCode
());
coupons
.
add
(
coupon
);
}
}
// 添加商品券代表的商品
// 添加商品券代表的商品
// 换购券传给促销要带code
// 换购券传给促销要带code
String
goodsId
=
StringUtils
.
isEmpty
(
checkSpqInfoResponseDto
.
getSkuId
())
?
checkSpqInfoResponseDto
.
getSpuId
()
:
checkSpqInfoResponseDto
.
getSkuId
();
String
goodsId
=
StringUtils
.
isEmpty
(
checkSpqInfoResponseDto
.
getSkuId
())
?
checkSpqInfoResponseDto
.
getSpuId
()
:
checkSpqInfoResponseDto
.
getSkuId
();
...
@@ -2502,15 +2562,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2502,15 +2562,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getCalculationDiscountResult
(
String
menuType
private
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
getCalculationDiscountResult
(
String
menuType
,
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
String
wxappid
,
Integer
orderType
,
boolean
isMember
,
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
String
wxappid
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
receiveId
,
Long
deliveryAmount
,
Integer
bizType
)
{
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
String
receiveId
,
Long
deliveryAmount
,
Integer
bizType
,
Integer
accountFlag
)
{
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
null
;
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
null
;
//外卖场景下 查询门店配送信息
//外卖场景下 查询门店配送信息
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
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
);
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
deliveryAmount
,
bizType
,
accountFlag
);
}
else
{
}
else
{
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
null
,
bizType
);
calculationDiscountResult
=
this
.
getActivityCalculationDiscountResponse
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
cartGoodsList
,
coupons
,
sendGoodsList
,
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
(),
null
,
bizType
,
accountFlag
);
}
}
return
calculationDiscountResult
;
return
calculationDiscountResult
;
...
@@ -2912,6 +2972,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2912,6 +2972,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
menuType
=
request
.
getMenuType
();
String
menuType
=
request
.
getMenuType
();
Integer
orderType
=
request
.
getOrderType
();
Integer
orderType
=
request
.
getOrderType
();
Integer
bizType
=
request
.
getBizType
();
Integer
bizType
=
request
.
getBizType
();
Integer
accountFlag
=
0
;
//不关心是否为结算页 设置为非结算页
// 返回构造对象
// 返回构造对象
PremiumExchangeResponseVo
premiumExchangeResponseVo
=
new
PremiumExchangeResponseVo
();
PremiumExchangeResponseVo
premiumExchangeResponseVo
=
new
PremiumExchangeResponseVo
();
...
@@ -2949,7 +3010,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2949,7 +3010,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
coupons
//券
,
coupons
//券
,
null
//加价购商品
,
null
//加价购商品
,
0L
,
0L
,
null
,
bizType
);
,
null
,
bizType
,
accountFlag
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchangeSharing
(
discountResult
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchangeSharing
(
discountResult
);
}
else
{
}
else
{
...
@@ -2973,7 +3034,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2973,7 +3034,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
});
});
}
}
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
null
,
null
,
0L
,
bizType
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
coupons
,
null
,
null
,
0L
,
bizType
,
accountFlag
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchange
(
calculationDiscountResult
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchange
(
calculationDiscountResult
);
}
}
...
@@ -3095,6 +3157,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -3095,6 +3157,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
menuType
=
requestVo
.
getMenuType
();
String
menuType
=
requestVo
.
getMenuType
();
Integer
orderType
=
requestVo
.
getOrderType
();
Integer
orderType
=
requestVo
.
getOrderType
();
Integer
bizType
=
requestVo
.
getBizType
();
Integer
bizType
=
requestVo
.
getBizType
();
Integer
accountFlag
=
0
;
//非结算页
CouponAvailableCartInfo
couponAvailableCartInfo
;
CouponAvailableCartInfo
couponAvailableCartInfo
;
List
<
String
>
orgCodes
=
commonService
.
getOrgIdsForCoupon
(
partnerId
,
storeId
);
List
<
String
>
orgCodes
=
commonService
.
getOrgIdsForCoupon
(
partnerId
,
storeId
);
...
@@ -3113,12 +3176,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -3113,12 +3176,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
<>()
//券
,
new
ArrayList
<>()
//券
,
null
//加价购商品
,
null
//加价购商品
,
deliveryAmount
,
deliveryAmount
,
null
,
bizType
);
,
null
,
bizType
,
accountFlag
);
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfoSharing
(
partnerId
,
storeId
,
discountResult
,
orgCodes
);
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfoSharing
(
partnerId
,
storeId
,
discountResult
,
orgCodes
);
}
else
{
}
else
{
// 获取优惠信息
// 获取优惠信息
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
<>(),
null
,
null
,
deliveryAmount
,
bizType
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
=
getCalculationDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
cartGoodsList
,
new
ArrayList
<>(),
null
,
null
,
deliveryAmount
,
bizType
,
accountFlag
);
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfo
(
partnerId
,
storeId
,
calculationDiscountResult
,
orgCodes
);
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfo
(
partnerId
,
storeId
,
calculationDiscountResult
,
orgCodes
);
}
}
return
ResponseUtil
.
success
(
couponAvailableCartInfo
);
return
ResponseUtil
.
success
(
couponAvailableCartInfo
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
View file @
fe98c8cb
...
@@ -3,6 +3,7 @@ package cn.freemud.service.impl.calculate;
...
@@ -3,6 +3,7 @@ package cn.freemud.service.impl.calculate;
import
cn.freemud.base.util.JsonUtil
;
import
cn.freemud.base.util.JsonUtil
;
import
cn.freemud.constant.ApplicationConstant
;
import
cn.freemud.constant.ApplicationConstant
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountRequestDto
;
import
cn.freemud.entities.dto.CheckSpqInfoRequestDto
;
import
cn.freemud.entities.dto.CheckSpqInfoRequestDto
;
import
cn.freemud.entities.dto.CheckSpqInfoResponseDto
;
import
cn.freemud.entities.dto.CheckSpqInfoResponseDto
;
import
cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto
;
import
cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto
;
...
@@ -85,7 +86,7 @@ public class CalculationSharingDiscountService {
...
@@ -85,7 +86,7 @@ public class CalculationSharingDiscountService {
,
List
<
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
Long
deliveryAmount
,
Long
deliveryAmount
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
Integer
bizType
)
{
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
Integer
bizType
,
Integer
accountFlag
)
{
CalculationSharingDiscountRequestDto
calculationSharingDiscountRequestDto
=
this
.
commonSharingDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
CalculationSharingDiscountRequestDto
calculationSharingDiscountRequestDto
=
this
.
commonSharingDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
...
@@ -157,9 +158,16 @@ public class CalculationSharingDiscountService {
...
@@ -157,9 +158,16 @@ public class CalculationSharingDiscountService {
coupon
.
setCode
(
checkSpqInfo
.
getCouponCode
());
coupon
.
setCode
(
checkSpqInfo
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfo
.
getActiveCode
());
coupon
.
setActivityCode
(
checkSpqInfo
.
getActiveCode
());
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
coupons
.
stream
().
filter
(
p
->
coupon
.
getActivityCode
().
equals
(
p
.
getActivityCode
())
&&
coupon
.
getCode
().
equals
(
p
.
getCode
())).
findFirst
().
orElse
(
null
);
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
coupons
.
stream
().
filter
(
p
->
coupon
.
getActivityCode
().
equals
(
p
.
getActivityCode
())
&&
coupon
.
getCode
().
equals
(
p
.
getCode
())).
findFirst
().
orElse
(
null
);
//避免不满足使用券的商品 再才传给促销算价(目前只促销只支持单张券的算价)
if
(
calculationDiscountCoupon
==
null
)
{
if
(
calculationDiscountCoupon
==
null
)
{
if
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
())
&&
accountFlag
==
1
){
if
(
cartGoods
.
getCanUseCoupon
()
==
0
)
{
coupons
.
add
(
coupon
);
coupons
.
add
(
coupon
);
}
}
}
else
{
coupons
.
add
(
coupon
);
}
}
// 添加商品券代表的商品放入促销
// 添加商品券代表的商品放入促销
String
goodsId
=
StringUtils
.
isNotBlank
(
checkSpqInfo
.
getSkuId
())
?
checkSpqInfo
.
getSkuId
()
:
checkSpqInfo
.
getSpuId
();
String
goodsId
=
StringUtils
.
isNotBlank
(
checkSpqInfo
.
getSkuId
())
?
checkSpqInfo
.
getSkuId
()
:
checkSpqInfo
.
getSpuId
();
this
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
(),
couponCode
);
this
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
(),
couponCode
);
...
...
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