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
afb45369
Commit
afb45369
authored
Jun 11, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容老版本 couponcode
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
342b2da0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
57 deletions
+64
-57
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+0
-4
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
+20
-14
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMallServiceImpl.java
+13
-11
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+31
-28
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
afb45369
...
...
@@ -540,10 +540,6 @@ public class CouponServiceImpl implements CouponService {
private
ActivityClassifyCouponBean
returnSuccessAvailiableCoupons
(
String
couponCode
,
boolean
hasGoodsCoupon
,
ActivityClassifyCouponBean
availableCouponResponseVo
,
List
<
ActivityCouponBean
>
usableCoupons
,
List
<
ActivityCouponBean
>
disableCoupons
,
Map
<
String
,
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
memberCouponMap
,
List
<
CouponStateVo
>
couponStateList
,
String
chooseCouponCode
)
{
LogUtil
.
info
(
"配送券-0--"
,
couponCode
,
hasGoodsCoupon
);
LogUtil
.
info
(
"配送券-1--"
,
availableCouponResponseVo
,
usableCoupons
);
LogUtil
.
info
(
"配送券-3--"
,
disableCoupons
,
memberCouponMap
);
LogUtil
.
info
(
"配送券-4--"
,
couponStateList
,
chooseCouponCode
);
int
disableCouponNum
=
0
;
int
usableCouponNum
=
0
;
for
(
CouponStateVo
couponStateVo
:
couponStateList
)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
View file @
afb45369
...
...
@@ -433,17 +433,21 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
appId
=
shoppingCartInfoRequestVo
.
getAppId
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
if
(!
CollectionUtils
.
isEmpty
(
couponCodes
))
{
// 兼容老版本
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
ShoppingCartInfoRequestVo
.
couponCode
otherCouponCode
=
couponCodes
.
stream
()
.
filter
(
couponCode
->
!
couponCode
.
getCouponType
().
equals
(
CouponTypeEnum
.
TYPE_5
.
getCode
())
)
.
filter
(
couponCode
1
->
couponCode1
.
getCouponType
()!=
null
&&
couponCode1
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_5
.
getCode
())
!=
0
)
.
findFirst
().
orElse
(
null
);
if
(
otherCouponCode
!=
null
)
{
if
(
otherCouponCode
!=
null
)
{
// 由于对下面逻辑 不是很清楚 并且修改了 优惠券传参规则 所以直接设置一遍 防止出错
shoppingCartInfoRequestVo
.
setCouponCode
(
otherCouponCode
.
getCouponCode
());
shoppingCartInfoRequestVo
.
setActivityCode
(
otherCouponCode
.
getActivityCode
());
}
}
String
menuType
=
shoppingCartInfoRequestVo
.
getMenuType
();
Integer
orderType
=
shoppingCartInfoRequestVo
.
getOrderType
();
String
receiveId
=
shoppingCartInfoRequestVo
.
getReceiveId
();
...
...
@@ -495,20 +499,22 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
// 下面代码 由于接口改动 已经不适用 begin
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
// 当couponCode不为空时,需参与价格计算
//
if (StringUtils.isNotEmpty(couponCode)) {
//
ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon coupon = new ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon();
//
coupon.setCode(couponCode);
//
coupon.setActivityCode(activityCode);
//
coupons.add(coupon);
//
}
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
couponCode
);
coupon
.
setActivityCode
(
activityCode
);
coupons
.
add
(
coupon
);
}
// 上面代码 由于接口改动 已经不适用 end
if
(!
CollectionUtils
.
isEmpty
(
couponCodes
))
{
couponCodes
.
forEach
(
shoppingCouponCode
->
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
shoppingCouponCode
.
getCouponCode
());
coupon
.
setActivityCode
(
shoppingCouponCode
.
getActivityCode
());
coupon
.
setCouponType
(
shoppingCouponCode
.
getCouponType
());
coupons
.
add
(
coupon
);
if
(!
shoppingCouponCode
.
getCouponCode
().
equals
(
couponCode
))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
shoppingCouponCode
.
getCouponCode
());
coupon
.
setActivityCode
(
shoppingCouponCode
.
getActivityCode
());
coupon
.
setCouponType
(
shoppingCouponCode
.
getCouponType
());
coupons
.
add
(
coupon
);
}
});
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMallServiceImpl.java
View file @
afb45369
...
...
@@ -363,17 +363,21 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
String
storeId
=
this
.
getBindMallShopId
(
appId
);
shoppingCartInfoRequestVo
.
setShopId
(
storeId
);
List
<
CartGoods
>
cartGoodsList
=
new
ArrayList
<>();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
if
(!
CollectionUtils
.
isEmpty
(
couponCodes
))
{
// 兼容老版本
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
ShoppingCartInfoRequestVo
.
couponCode
otherCouponCode
=
couponCodes
.
stream
()
.
filter
(
couponCode
->
!
couponCode
.
getCouponType
().
equals
(
CouponTypeEnum
.
TYPE_5
.
getCode
())
)
.
filter
(
couponCode
1
->
couponCode1
.
getCouponType
()!=
null
&&
couponCode1
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_5
.
getCode
())
!=
0
)
.
findFirst
().
orElse
(
null
);
if
(
otherCouponCode
!=
null
)
{
if
(
otherCouponCode
!=
null
)
{
// 由于对下面逻辑 不是很清楚 并且修改了 优惠券传参规则 所以直接设置一遍 防止出错
shoppingCartInfoRequestVo
.
setCouponCode
(
otherCouponCode
.
getCouponCode
());
shoppingCartInfoRequestVo
.
setActivityCode
(
otherCouponCode
.
getActivityCode
());
}
}
String
menuType
=
shoppingCartInfoRequestVo
.
getMenuType
();
Integer
orderType
=
shoppingCartInfoRequestVo
.
getOrderType
();
// 获取购物车商品
...
...
@@ -400,15 +404,13 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
assortmentCustomerInfoVo
.
getSessionId
(),
""
,
this
.
shoppingCartBaseService
);
}
ArrayList
<
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
couponCodes
))
{
couponCodes
.
forEach
(
shoppingCouponCode
->
{
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
shoppingCouponCode
.
getCouponCode
());
coupon
.
setActivityCode
(
shoppingCouponCode
.
getActivityCode
());
coupon
.
setCouponType
(
shoppingCouponCode
.
getCouponType
());
coupons
.
add
(
coupon
);
});
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
couponCode
);
coupon
.
setActivityCode
(
activityCode
);
coupons
.
add
(
coupon
);
}
buildCoupons
(
coupons
,
shoppingCartInfoRequestVo
.
getCouponCodes
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
afb45369
...
...
@@ -619,14 +619,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
appId
=
shoppingCartInfoRequestVo
.
getAppId
();
//
String couponCode = shoppingCartInfoRequestVo.getCouponCode();
//
String activityCode = shoppingCartInfoRequestVo.getActivityCode();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
couponCodes
=
shoppingCartInfoRequestVo
.
getCouponCodes
();
if
(!
CollectionUtils
.
isEmpty
(
couponCodes
))
{
// 兼容老版本
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
StringUtils
.
isEmpty
(
couponCode
))
{
ShoppingCartInfoRequestVo
.
couponCode
otherCouponCode
=
couponCodes
.
stream
()
.
filter
(
couponCode
->
!
couponCode
.
getCouponType
().
equals
(
CouponTypeEnum
.
TYPE_5
.
getCode
())
)
.
filter
(
couponCode
1
->
couponCode1
.
getCouponType
()!=
null
&&
couponCode1
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_5
.
getCode
())
!=
0
)
.
findFirst
().
orElse
(
null
);
if
(
otherCouponCode
!=
null
)
{
if
(
otherCouponCode
!=
null
)
{
// 由于对下面逻辑 不是很清楚 并且修改了 优惠券传参规则 所以直接设置一遍 防止出错
shoppingCartInfoRequestVo
.
setCouponCode
(
otherCouponCode
.
getCouponCode
());
shoppingCartInfoRequestVo
.
setActivityCode
(
otherCouponCode
.
getActivityCode
());
...
...
@@ -680,12 +681,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
CouponPromotionVO
couponPromotionVO
=
couponAdapter
.
getCouponPromotionVO
(
shoppingCartInfoRequestVo
,
userLoginInfoDto
);
if
(
grayPush
(
partnerId
,
storeId
,
"2"
))
{
ArrayList
<
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
//
if (StringUtils.isNotEmpty(couponCode)) {
//
CalculationSharingDiscountRequestDto.CalculationDiscountCoupon coupon = new CalculationSharingDiscountRequestDto.CalculationDiscountCoupon();
//
coupon.setCode(couponCode);
//
coupon.setActivityCode(activityCode);
//
coupons.add(coupon);
//
}
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
couponCode
);
coupon
.
setActivityCode
(
activityCode
);
coupons
.
add
(
coupon
);
}
buildCoupons
(
coupons
,
shoppingCartInfoRequestVo
.
getCouponCodes
());
...
...
@@ -734,20 +735,22 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
else
{
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
// 当couponCode不为空时,需参与价格计算
//
if (StringUtils.isNotEmpty(couponCode)) {
//
ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon coupon = new ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon();
//
coupon.setCode(couponCode);
//
coupon.setActivityCode(activityCode);
//
coupons.add(coupon);
//
}
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
couponCode
);
coupon
.
setActivityCode
(
activityCode
);
coupons
.
add
(
coupon
);
}
// 配送券信息放入 用于促销计算
if
(
!
CollectionUtils
.
is
Empty
(
shoppingCartInfoRequestVo
.
getCouponCodes
()))
{
if
(
CollectionUtils
.
isNot
Empty
(
shoppingCartInfoRequestVo
.
getCouponCodes
()))
{
shoppingCartInfoRequestVo
.
getCouponCodes
().
forEach
(
shoppingCode
->{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
shoppingCode
.
getCouponCode
());
coupon
.
setActivityCode
(
shoppingCode
.
getActivityCode
());
coupon
.
setCouponType
(
shoppingCode
.
getCouponType
());
coupons
.
add
(
coupon
);
if
(!
shoppingCode
.
getCouponCode
().
equals
(
couponCode
))
{
coupon
.
setCode
(
shoppingCode
.
getCouponCode
());
coupon
.
setActivityCode
(
shoppingCode
.
getActivityCode
());
coupon
.
setCouponType
(
shoppingCode
.
getCouponType
());
coupons
.
add
(
coupon
);
}
});
}
...
...
@@ -783,14 +786,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
request
.
setSessionId
(
shoppingCartInfoRequestVo
.
getSessionId
());
request
.
setShopId
(
shoppingCartInfoRequestVo
.
getShopId
());
request
.
setVersion
(
shoppingCartInfoRequestVo
.
getVersion
());
if
(
!
CollectionUtils
.
is
Empty
(
shoppingCartInfoRequestVo
.
getCouponCodes
()))
{
if
(
CollectionUtils
.
isNot
Empty
(
shoppingCartInfoRequestVo
.
getCouponCodes
()))
{
List
<
PremiumExchangeRequestVo
.
couponCode
>
list
=
new
ArrayList
<>();
shoppingCartInfoRequestVo
.
getCouponCodes
().
forEach
(
co
uponCo
de
->
{
shoppingCartInfoRequestVo
.
getCouponCodes
().
forEach
(
code
->
{
PremiumExchangeRequestVo
.
couponCode
vo
=
new
PremiumExchangeRequestVo
.
couponCode
();
vo
.
setActivityCode
(
co
uponCo
de
.
getActivityCode
());
vo
.
setCouponCode
(
co
uponCo
de
.
getCouponCode
());
vo
.
setCouponType
(
co
uponCo
de
.
getCouponType
());
vo
.
setIndex
(
co
uponCo
de
.
getIndex
());
vo
.
setActivityCode
(
code
.
getActivityCode
());
vo
.
setCouponCode
(
code
.
getCouponCode
());
vo
.
setCouponType
(
code
.
getCouponType
());
vo
.
setIndex
(
code
.
getIndex
());
list
.
add
(
vo
);
});
request
.
setCouponCodes
(
list
);
...
...
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