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
0f46f80e
Commit
0f46f80e
authored
Oct 20, 2020
by
徐康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校验保存的券是否可用
parent
1d04f228
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
25 deletions
+12
-25
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+12
-25
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
0f46f80e
...
...
@@ -316,12 +316,8 @@ public class ShoppingCartMCoffeeServiceImpl {
* 如果couponCode为空,则从缓存里尝试获取
* 如果couponCode不为空,则设置到缓存里
*/
// List<String> couponList = new ArrayList<>();
if
(
StringUtils
.
isEmpty
(
couponCode
))
{
couponCode
=
assortmentSdkService
.
getShoppingCartCoupon
(
partnerId
,
storeId
,
userId
,
shoppingCartBaseService
,
SaveCouponType
.
COUPON
.
getCode
());
// if(StringUtils.isNotEmpty(couponCode)) {
// couponList.add(couponCode);
// }
}
else
{
if
(
"remove"
.
equals
(
couponCode
))
{
couponCode
=
""
;
...
...
@@ -331,9 +327,6 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
StringUtils
.
isEmpty
(
freightCouponCode
))
{
freightCouponCode
=
assortmentSdkService
.
getShoppingCartCoupon
(
partnerId
,
storeId
,
userId
,
shoppingCartBaseService
,
SaveCouponType
.
FREIGHT_COUPON
.
getCode
());
// if(StringUtils.isNotEmpty(freightCouponCode)) {
// couponList.add(freightCouponCode);
// }
}
else
{
if
(
"remove"
.
equals
(
freightCouponCode
))
{
freightCouponCode
=
""
;
...
...
@@ -341,24 +334,15 @@ public class ShoppingCartMCoffeeServiceImpl {
assortmentSdkService
.
setShoppingCartCouponCode
(
partnerId
,
storeId
,
userId
,
freightCouponCode
,
shoppingCartBaseService
,
SaveCouponType
.
FREIGHT_COUPON
.
getCode
());
}
//校验代金券和运费券是否可用
// if(CollectionUtils.isNotEmpty(couponList)) {
// List<CouponState> couponStates = couponDiscountCalculation.buildAvailableCoupons(cartGoodsList, partnerId, storeId, couponList);
// if(CollectionUtils.isNotEmpty(couponStates)) {
// Map<String, Integer> couponStateMap = couponStates.stream().collect(Collectors.toMap(CouponState::getCouponCode, CouponState::getState, (k1, k2) -> k1));
// if(null == couponStateMap.get(couponCode) || Objects.equals(couponStateMap.get(couponCode), CouponStateEnum.STATE_1.getCode())) {
// couponCode = "";
// }
// if(null == couponStateMap.get(freightCouponCode) || Objects.equals(couponStateMap.get(freightCouponCode), CouponStateEnum.STATE_1.getCode())) {
// freightCouponCode = "";
// }
// } else {
// couponCode = "";
// freightCouponCode = "";
// }
// }
shoppingCartInfoRequestVo
.
setFreightCouponCode
(
freightCouponCode
);
//放到参数里
if
(
StringUtils
.
isNotEmpty
(
couponCode
)
)
{
shoppingCartInfoRequestVo
.
setCouponCode
(
couponCode
);
shoppingCartGoodsResponseVo
.
setCouponCode
(
couponCode
);
}
if
(
StringUtils
.
isNotEmpty
(
freightCouponCode
))
{
shoppingCartInfoRequestVo
.
setFreightCouponCode
(
freightCouponCode
);
shoppingCartGoodsResponseVo
.
setFreightCouponCode
(
freightCouponCode
);
}
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
);
...
...
@@ -369,6 +353,9 @@ public class ShoppingCartMCoffeeServiceImpl {
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
//先出参里的券设置为空,然后如果可用,再放到出参里
shoppingCartGoodsResponseVo
.
setCouponCode
(
""
);
shoppingCartGoodsResponseVo
.
setFreightCouponCode
(
""
);
if
(
StringUtils
.
isNotEmpty
(
couponCode
)
||
StringUtils
.
isNotEmpty
(
freightCouponCode
))
{
String
finalCouponCode
=
couponCode
;
String
finalFreightCouponCode
=
freightCouponCode
;
...
...
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