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
7edb36dd
Commit
7edb36dd
authored
Apr 21, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新老算价移出购物车
parent
4eac554e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
17 deletions
+48
-17
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/PlatformApportionService.java
+0
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/CouponService.java
+2
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponPromotionService.java
+1
-16
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+39
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/CouponSharingService.java
+6
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/PlatformApportionService.java
View file @
7edb36dd
...
@@ -218,7 +218,6 @@ public class PlatformApportionService extends AbstractApportionService {
...
@@ -218,7 +218,6 @@ public class PlatformApportionService extends AbstractApportionService {
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
if
(
cartGoods
.
getCartGoodsUid
().
startsWith
(
CommonsConstant
.
COUPON_PREFIX
)){
if
(
cartGoods
.
getCartGoodsUid
().
startsWith
(
CommonsConstant
.
COUPON_PREFIX
)){
String
spqId
=
cartGoods
.
getCartGoodsUid
().
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
String
spqId
=
cartGoods
.
getCartGoodsUid
().
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
if
(
CollectionUtils
.
isEmpty
(
validMemberCouponList
)){
if
(
CollectionUtils
.
isEmpty
(
validMemberCouponList
)){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
,
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
.
getMessage
());
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
,
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
.
getMessage
());
}
else
{
}
else
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/CouponService.java
View file @
7edb36dd
...
@@ -128,4 +128,6 @@ public interface CouponService {
...
@@ -128,4 +128,6 @@ public interface CouponService {
* 返回 key = 活动code, value= 返回是否匹配点餐方式
* 返回 key = 活动code, value= 返回是否匹配点餐方式
*/
*/
Map
<
String
,
Boolean
>
couponOrderWay
(
String
partnerId
,
List
<
String
>
activityCodes
,
Integer
orderTye
);
Map
<
String
,
Boolean
>
couponOrderWay
(
String
partnerId
,
List
<
String
>
activityCodes
,
Integer
orderTye
);
void
checkValidCoupon
(
CouponPromotionVO
couponPromotionVO
,
List
<
String
>
couponList
,
Map
<
String
,
List
<
String
>>
spqIdToCartUuid
,
String
couponCode
,
List
<
CartGoods
>
cartGoodsList
);
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponPromotionService.java
View file @
7edb36dd
...
@@ -132,23 +132,8 @@ public class CouponPromotionService implements IPromotionService {
...
@@ -132,23 +132,8 @@ public class CouponPromotionService implements IPromotionService {
List
<
String
>
validCouponCodeLis
=
new
ArrayList
<>();
List
<
String
>
validCouponCodeLis
=
new
ArrayList
<>();
if
(
couponPromotionVO
!=
null
&&
ObjectUtils
.
equals
(
CouponFlag
.
YES
.
getCode
(),
couponPromotionVO
.
getFlg
())){
if
(
couponPromotionVO
!=
null
&&
ObjectUtils
.
equals
(
CouponFlag
.
YES
.
getCode
(),
couponPromotionVO
.
getFlg
())){
validCouponCodeLis
=
shoppingCartGoodsResponseVo
.
getAvailableCoupon
().
getUsableCoupons
().
stream
().
map
(
ActivityCouponBean:
:
getCouponCode
).
collect
(
Collectors
.
toList
());
validCouponCodeLis
=
shoppingCartGoodsResponseVo
.
getAvailableCoupon
().
getUsableCoupons
().
stream
().
map
(
ActivityCouponBean:
:
getCouponCode
).
collect
(
Collectors
.
toList
());
}
else
{
GetMemberCouponListRequestDto
getMemberCouponListRequestDto
=
new
GetMemberCouponListRequestDto
(
shoppingCartInfoRequestVo
.
getPartnerId
(),
userLoginInfoDto
.
getMemberId
());
getMemberCouponListRequestDto
.
setStatusFlags
(
Arrays
.
asList
(
CouponStatus
.
STATUS_0
.
getCode
(),
CouponStatus
.
STATUS_2
.
getCode
()));
getMemberCouponListRequestDto
.
setPageNum
(
1
);
getMemberCouponListRequestDto
.
setPageSize
(
Integer
.
MAX_VALUE
);
List
<
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
validMemberCouponList
=
couponService
.
getValidMemberCouponList
(
getMemberCouponListRequestDto
,
shoppingCartInfoRequestVo
.
getOrderType
());
validCouponCodeLis
=
validMemberCouponList
.
stream
().
map
(
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
::
getCouponCode
).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isEmpty
(
validCouponCodeLis
)){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
,
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
.
getMessage
());
}
else
{
String
finalCouponCode
=
couponCode
;
String
memberCouponCode
=
validCouponCodeLis
.
stream
().
filter
(
p
->
finalCouponCode
.
equals
(
p
)).
findFirst
().
orElse
(
null
);
if
(
StringUtils
.
isBlank
(
memberCouponCode
)){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
,
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
.
getMessage
());
}
}
}
couponService
.
checkValidCoupon
(
couponPromotionVO
,
validCouponCodeLis
,
spqIdToCartUuid
,
couponCode
,
cartGoodsList
);
// 计算优惠信息时,已将券校验过,放在map中
// 计算优惠信息时,已将券校验过,放在map中
if
(
MapUtils
.
isNotEmpty
(
validCouponMap
))
{
if
(
MapUtils
.
isNotEmpty
(
validCouponMap
))
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
7edb36dd
...
@@ -61,6 +61,7 @@ import com.freemud.card.sdk.vo.coupon.request.MemberAddCouponVo;
...
@@ -61,6 +61,7 @@ import com.freemud.card.sdk.vo.coupon.request.MemberAddCouponVo;
import
com.freemud.card.sdk.vo.coupon.response.MemberBaseRespVo
;
import
com.freemud.card.sdk.vo.coupon.response.MemberBaseRespVo
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant
;
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.service.impl.ShoppingCartBaseServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -130,6 +131,10 @@ public class CouponServiceImpl implements CouponService {
...
@@ -130,6 +131,10 @@ public class CouponServiceImpl implements CouponService {
private
String
couponPartnerId
;
private
String
couponPartnerId
;
@Autowired
@Autowired
private
CouponAdapterClient
couponAdaptClient
;
private
CouponAdapterClient
couponAdaptClient
;
@Autowired
private
AssortmentSdkService
assortmentSdkService
;
@Autowired
private
ShoppingCartBaseServiceImpl
shoppingCartBaseService
;
/**
/**
* 获取优惠券列表
* 获取优惠券列表
...
@@ -1326,4 +1331,38 @@ public class CouponServiceImpl implements CouponService {
...
@@ -1326,4 +1331,38 @@ public class CouponServiceImpl implements CouponService {
}
}
return
CouponBarCodeMap
;
return
CouponBarCodeMap
;
}
}
@Override
public
void
checkValidCoupon
(
CouponPromotionVO
couponPromotionVO
,
List
<
String
>
couponList
,
Map
<
String
,
List
<
String
>>
spqIdToCartUuid
,
String
couponCode
,
List
<
CartGoods
>
cartGoodsList
)
{
List
<
String
>
validCouponCodeLis
=
new
ArrayList
<>();
if
(
couponPromotionVO
!=
null
&&
ObjectUtils
.
equals
(
CouponFlag
.
YES
.
getCode
(),
couponPromotionVO
.
getFlg
())){
validCouponCodeLis
=
couponList
;
}
else
{
GetMemberCouponListRequestDto
getMemberCouponListRequestDto
=
new
GetMemberCouponListRequestDto
(
couponPromotionVO
.
getPartnerId
(),
couponPromotionVO
.
getUserId
());
getMemberCouponListRequestDto
.
setStatusFlags
(
Arrays
.
asList
(
CouponStatus
.
STATUS_0
.
getCode
(),
CouponStatus
.
STATUS_2
.
getCode
()));
getMemberCouponListRequestDto
.
setPageNum
(
1
);
getMemberCouponListRequestDto
.
setPageSize
(
Integer
.
MAX_VALUE
);
List
<
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
>
validMemberCouponList
=
couponService
.
getValidMemberCouponList
(
getMemberCouponListRequestDto
,
couponPromotionVO
.
getOrderType
());
validCouponCodeLis
=
validMemberCouponList
.
stream
().
map
(
GetMemberCouponListResponseDto
.
Result
.
MemberCoupon
::
getCouponCode
).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isEmpty
(
validCouponCodeLis
)){
List
<
String
>
uuidList
=
spqIdToCartUuid
.
get
(
couponCode
);
if
(
CollectionUtils
.
isNotEmpty
(
uuidList
)){
List
<
CartGoods
>
newCartList
=
cartGoodsList
.
stream
().
filter
(
p
->
!
uuidList
.
contains
(
p
.
getCartGoodsUid
())).
collect
(
Collectors
.
toList
());
assortmentSdkService
.
setShoppingCart
(
couponPromotionVO
.
getPartnerId
(),
couponPromotionVO
.
getStoreId
(),
couponPromotionVO
.
getUserId
(),
newCartList
,
null
,
null
,
this
.
shoppingCartBaseService
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
,
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
.
getMessage
());
}
}
else
{
String
finalCouponCode
=
couponCode
;
String
memberCouponCode
=
validCouponCodeLis
.
stream
().
filter
(
p
->
finalCouponCode
.
equals
(
p
)).
findFirst
().
orElse
(
null
);
if
(
StringUtils
.
isBlank
(
memberCouponCode
)){
List
<
String
>
uuidList
=
spqIdToCartUuid
.
get
(
memberCouponCode
);
if
(
CollectionUtils
.
isNotEmpty
(
uuidList
)){
List
<
CartGoods
>
newCartList
=
cartGoodsList
.
stream
().
filter
(
p
->
!
uuidList
.
contains
(
p
.
getCartGoodsUid
())).
collect
(
Collectors
.
toList
());
assortmentSdkService
.
setShoppingCart
(
couponPromotionVO
.
getPartnerId
(),
couponPromotionVO
.
getStoreId
(),
couponPromotionVO
.
getUserId
(),
newCartList
,
null
,
null
,
this
.
shoppingCartBaseService
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
,
ResponseResult
.
SHOPPING_CART_USER_HAVE_NO_COUPON
.
getMessage
());
}
}
}
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/CouponSharingService.java
View file @
7edb36dd
...
@@ -132,6 +132,12 @@ public class CouponSharingService {
...
@@ -132,6 +132,12 @@ public class CouponSharingService {
couponCode
=
cartGoods
.
getCartGoodsUid
().
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
couponCode
=
cartGoods
.
getCartGoodsUid
().
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
useCoupon
=
false
;
useCoupon
=
false
;
}
}
List
<
String
>
validCouponCodeLis
=
new
ArrayList
<>();
if
(
couponPromotionVO
!=
null
&&
ObjectUtils
.
equals
(
CouponFlag
.
YES
.
getCode
(),
couponPromotionVO
.
getFlg
())){
validCouponCodeLis
=
shoppingCartGoodsResponseVo
.
getAvailableCoupon
().
getUsableCoupons
().
stream
().
map
(
ActivityCouponBean:
:
getCouponCode
).
collect
(
Collectors
.
toList
());
}
couponService
.
checkValidCoupon
(
couponPromotionVO
,
validCouponCodeLis
,
spqIdToCartUuid
,
couponCode
,
cartGoodsList
);
// 计算优惠信息时,已将券校验过,放在map中
// 计算优惠信息时,已将券校验过,放在map中
if
(
MapUtils
.
isNotEmpty
(
validCouponMap
))
{
if
(
MapUtils
.
isNotEmpty
(
validCouponMap
))
{
CheckSpqInfoResponseDto
checkSpqInfoResponseDto
;
CheckSpqInfoResponseDto
checkSpqInfoResponseDto
;
...
...
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