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
f70985fb
Commit
f70985fb
authored
Nov 29, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建订单增加批量使用优惠券参数
parent
44b4c123
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
order-application-service/src/main/java/cn/freemud/entities/vo/CreateOrderVo.java
+5
-0
order-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
+17
-0
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
+35
-0
No files found.
order-application-service/src/main/java/cn/freemud/entities/vo/CreateOrderVo.java
View file @
f70985fb
...
...
@@ -155,6 +155,11 @@ public class CreateOrderVo {
private
String
couponCode
;
/**
* 券码列表
*/
private
List
<
String
>
couponCodes
;
/**
* 运费券code
*/
private
String
freightCouponCode
;
...
...
order-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartInfoRequestVo.java
View file @
f70985fb
...
...
@@ -53,6 +53,11 @@ public class ShoppingCartInfoRequestVo {
* 优惠券code
*/
private
String
couponCode
;
/**
* 优惠券code列表
*/
private
List
<
couponCode
>
couponCodes
;
/**
* 运费券code
*/
...
...
@@ -179,4 +184,16 @@ public class ShoppingCartInfoRequestVo {
private
Boolean
sendCoupon
;
}
@Data
public
final
static
class
couponCode
{
/**
* 优惠券
*/
private
String
couponCode
;
/**
* 活动号
*/
private
String
activityCode
;
}
}
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
View file @
f70985fb
...
...
@@ -504,6 +504,41 @@ public class CheckOrder {
shoppingCartInfoRequestVo
.
setActivityCode
(
activeCode
);
shoppingCartInfoRequestVo
.
setCardCode
(
createOrderVo
.
getCardCode
());
}
// 如果批量使用优惠券或者商品券,校验 couponCode
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
couponCodes
=
new
ArrayList
();
if
(
createOrderVo
.
getCouponCodes
()
!=
null
&&
!
createOrderVo
.
getCouponCodes
().
isEmpty
())
{
createOrderVo
.
getCouponCodes
().
forEach
(
couponCode
->{
// 校验couponCode
GetCouponDetailResponseDto
getCouponDetailResponseDto
=
couponService
.
getMemberCoupon
(
GetMemberCouponRequestVo
.
builder
()
.
partnerId
(
createOrderVo
.
getPartnerId
())
.
couponCode
(
couponCode
).
build
());
if
(
Objects
.
equals
(
getCouponDetailResponseDto
,
null
)
||
CollectionUtils
.
isEmpty
(
getCouponDetailResponseDto
.
getDetails
())
||
getCouponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
()
==
null
||
getCouponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getActiveCode
()
==
null
)
{
if
((
CollectionUtils
.
isNotEmpty
(
getCouponDetailResponseDto
.
getDetails
().
get
(
0
).
getActiveRestrictionVOS
())
&&
CollectionUtils
.
isEmpty
(
getCouponDetailResponseDto
.
getDetails
().
get
(
0
).
getActiveRestrictionVOS
().
stream
()
.
filter
(
a
->
Objects
.
equals
(
a
.
getStoreIdPartner
(),
createOrderVo
.
getShopId
())).
collect
(
Collectors
.
toList
()))
))
{
throw
new
ServiceException
(
ResponseResult
.
COUPON_SHOP_NOTSUPPORT
);
}
else
{
throw
new
ServiceException
(
ResponseResult
.
COUPON_GETINFO_INVAILD
);
}
}
String
activeCode
=
getCouponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getActiveCode
();
ShoppingCartInfoRequestVo
.
couponCode
coupon
=
new
ShoppingCartInfoRequestVo
.
couponCode
();
coupon
.
setCouponCode
(
couponCode
);
coupon
.
setActivityCode
(
activeCode
);
couponCodes
.
add
(
coupon
);
});
if
(
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getCardCode
())){
shoppingCartInfoRequestVo
.
setCardCode
(
createOrderVo
.
getCardCode
());
}
}
shoppingCartInfoRequestVo
.
setCouponCodes
(
couponCodes
);
// 通过购物车获取优惠信息
GetShoppingCartGoodsApportionDto
requestDto
=
new
GetShoppingCartGoodsApportionDto
();
// 设置用户选择的买一赠一商品信息
...
...
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