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
116adeb2
Commit
116adeb2
authored
Dec 01, 2020
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车校验券号
parent
b599b2ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+25
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
116adeb2
...
...
@@ -95,6 +95,7 @@ public enum ResponseResult {
SHOPPING_CART_HG_COUPON_NOT_EXIST
(
"44027"
,
"换购券不存在"
),
SHOPPING_CART_LIMIT_ADD
(
"44025"
,
"加购数量超过限制"
),
SHOPPING_CART_GOODS_CHECK_ERROR
(
"44028"
,
"当前餐盘中没有可用券的饮品"
),
SHOPPING_CART_COUPON_NOT_USE
(
"44029"
,
"优惠券不可用"
),
/**
* 订单状态码
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
116adeb2
...
...
@@ -622,6 +622,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 在原价、现价、折扣价上增加第一次使用会员卡的费用
this
.
addNeedCardAmount
(
shoppingCartInfoRequestVo
,
shoppingCartGoodsResponseVo
);
}
// 校验入参券是否可用
if
(!
checkAvailableCoupon
(
shoppingCartGoodsResponseVo
,
shoppingCartInfoRequestVo
.
getCouponCode
())){
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_USE
);
};
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
...
...
@@ -645,9 +650,16 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
goodsList
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
goodsList
.
getCode
()))
{
return
goodsList
;
}
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
goodsList
.
getResult
();
// 校验入参券是否可用
if
(!
checkAvailableCoupon
(
shoppingCartGoodsResponseVo
,
shoppingCartInfoRequestVo
.
getCouponCode
())){
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_USE
);
};
//SVC卡支付
SVCCardPay
(
shoppingCartInfoRequestVo
.
getCardCode
(),
shoppingCartInfoRequestVo
.
getReceiveId
(),
partnerId
,
storeId
,
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
...
...
@@ -2094,4 +2106,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return
false
;
}
}
private
boolean
checkAvailableCoupon
(
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
couponCode
)
{
if
(
shoppingCartGoodsResponseVo
==
null
||
shoppingCartGoodsResponseVo
.
getAvailableCoupon
()
==
null
||
shoppingCartGoodsResponseVo
.
getAvailableCoupon
().
getUsableCoupons
()
==
null
){
return
false
;
}
List
<
ActivityCouponBean
>
usableCoupons
=
shoppingCartGoodsResponseVo
.
getAvailableCoupon
().
getUsableCoupons
();
ActivityCouponBean
activityCouponBean
=
usableCoupons
.
stream
().
filter
(
p
->
p
.
getCouponCode
().
equals
(
couponCode
)).
findFirst
().
orElse
(
null
);
if
(
activityCouponBean
==
null
){
return
false
;
}
else
{
return
true
;
}
}
}
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