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
77507b07
Commit
77507b07
authored
Mar 17, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210317-频次券购物车校验每日使用次数-lcf'
parents
9da90a12
8d203da7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
20 deletions
+29
-20
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/CheckSpqInfoResponseDto.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/GetCouponDetailResponseDto.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
+4
-4
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+12
-4
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+10
-10
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/CheckSpqInfoResponseDto.java
View file @
77507b07
...
@@ -41,6 +41,6 @@ public class CheckSpqInfoResponseDto {
...
@@ -41,6 +41,6 @@ public class CheckSpqInfoResponseDto {
private
Integer
couponType
;
private
Integer
couponType
;
private
List
<
CartGoods
.
CartGoodsExtra
>
extras
;
private
List
<
CartGoods
.
CartGoodsExtra
>
extras
;
private
Boolean
isMultiCoupon
;
private
Integer
todayAvailableTimes
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/GetCouponDetailResponseDto.java
View file @
77507b07
...
@@ -36,6 +36,7 @@ public class GetCouponDetailResponseDto {
...
@@ -36,6 +36,7 @@ public class GetCouponDetailResponseDto {
* 可核销周,时间段设置
* 可核销周,时间段设置
*/
*/
private
List
<
ActiveRedeemTimeInterval
>
activeRedeemTimeIntervalList
;
private
List
<
ActiveRedeemTimeInterval
>
activeRedeemTimeIntervalList
;
private
Integer
today_available_times
;
}
}
@Data
@Data
public
static
class
Active
{
public
static
class
Active
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
View file @
77507b07
...
@@ -115,7 +115,7 @@ public interface ShoppingCartNewService {
...
@@ -115,7 +115,7 @@ public interface ShoppingCartNewService {
* @param productIds
* @param productIds
* @return
* @return
*/
*/
default
Pair
<
String
,
Boolean
>
validCoupon
(
String
partnerId
default
Pair
<
String
,
Integer
>
validCoupon
(
String
partnerId
,
String
storeId
,
String
storeId
,
String
couponCode
,
String
couponCode
,
List
<
Long
>
productIds
,
List
<
Long
>
productIds
...
@@ -133,7 +133,7 @@ public interface ShoppingCartNewService {
...
@@ -133,7 +133,7 @@ public interface ShoppingCartNewService {
}
}
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
return
new
Pair
(
spuId2
,
checkSpqInfoResponseDto
.
get
IsMultiCoupon
());
return
new
Pair
(
spuId2
,
checkSpqInfoResponseDto
.
get
TodayAvailableTimes
());
}
}
/**
/**
...
@@ -147,7 +147,7 @@ public interface ShoppingCartNewService {
...
@@ -147,7 +147,7 @@ public interface ShoppingCartNewService {
* @param goodsId
* @param goodsId
* @return
* @return
*/
*/
default
Pair
<
String
,
Boolean
>
validCoupon
(
String
partnerId
default
Pair
<
String
,
Integer
>
validCoupon
(
String
partnerId
,
String
storeId
,
String
storeId
,
String
couponCode
,
String
couponCode
,
List
<
Long
>
productIds
,
List
<
Long
>
productIds
...
@@ -165,7 +165,7 @@ public interface ShoppingCartNewService {
...
@@ -165,7 +165,7 @@ public interface ShoppingCartNewService {
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
couponProductDto
.
setType
(
checkSpqInfoResponseDto
.
getCouponType
());
couponProductDto
.
setType
(
checkSpqInfoResponseDto
.
getCouponType
());
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
return
new
Pair
(
spuId2
,
checkSpqInfoResponseDto
.
get
IsMultiCoupon
());
return
new
Pair
(
spuId2
,
checkSpqInfoResponseDto
.
get
TodayAvailableTimes
());
}
}
/**
/**
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
77507b07
...
@@ -778,9 +778,13 @@ public class CouponServiceImpl implements CouponService {
...
@@ -778,9 +778,13 @@ public class CouponServiceImpl implements CouponService {
dto
.
setCouponName
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getTitle
());
dto
.
setCouponName
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getTitle
());
dto
.
setActivityName
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getActiveName
());
dto
.
setActivityName
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getActiveName
());
if
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
!=
null
&&
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
>
1
){
if
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
!=
null
&&
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
>
1
){
dto
.
setIsMultiCoupon
(
true
);
if
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getToday_available_times
()
!=
null
){
dto
.
setTodayAvailableTimes
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getToday_available_times
());
}
else
{
dto
.
setTodayAvailableTimes
(
1
);
}
}
else
{
}
else
{
dto
.
set
IsMultiCoupon
(
false
);
dto
.
set
TodayAvailableTimes
(
1
);
}
}
dto
.
setPrice
(
productsVo
.
getFinalPrice
());
dto
.
setPrice
(
productsVo
.
getFinalPrice
());
dto
.
setSpuId
(
productsVo
.
getSpuId
());
dto
.
setSpuId
(
productsVo
.
getSpuId
());
...
@@ -945,9 +949,13 @@ public class CouponServiceImpl implements CouponService {
...
@@ -945,9 +949,13 @@ public class CouponServiceImpl implements CouponService {
}
}
CheckSpqInfoResponseDto
dto
=
new
CheckSpqInfoResponseDto
();
CheckSpqInfoResponseDto
dto
=
new
CheckSpqInfoResponseDto
();
if
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
!=
null
&&
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
>
1
){
if
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
!=
null
&&
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getActive
().
getMaxRedeemTimes
()
>
1
){
dto
.
setIsMultiCoupon
(
true
);
if
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getToday_available_times
()
!=
null
){
dto
.
setTodayAvailableTimes
(
couponDetailResponseDto
.
getDetails
().
get
(
0
).
getToday_available_times
());
}
else
{
dto
.
setTodayAvailableTimes
(
1
);
}
}
else
{
}
else
{
dto
.
set
IsMultiCoupon
(
false
);
dto
.
set
TodayAvailableTimes
(
1
);
}
}
dto
.
setCouponCode
(
couponCode
);
dto
.
setCouponCode
(
couponCode
);
dto
.
setActiveCode
(
couponActivityDetail
.
getActive
().
getActiveCode
());
dto
.
setActiveCode
(
couponActivityDetail
.
getActive
().
getActiveCode
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
View file @
77507b07
...
@@ -122,7 +122,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
...
@@ -122,7 +122,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
}
else
{
}
else
{
//校验券是否有效
//校验券是否有效
Pair
<
String
,
Boolean
>
pair
=
validCoupon
(
partnerId
,
storeId
,
spuId
,
productIds
,
BusinessTypeEnum
.
getByType
(
requestVo
.
getMenuType
()).
getCode
(),
null
,
null
);
Pair
<
String
,
Integer
>
pair
=
validCoupon
(
partnerId
,
storeId
,
spuId
,
productIds
,
BusinessTypeEnum
.
getByType
(
requestVo
.
getMenuType
()).
getCode
(),
null
,
null
);
spuId2
=
pair
.
getKey
();
spuId2
=
pair
.
getKey
();
}
}
// 获取商品信息
// 获取商品信息
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
77507b07
...
@@ -295,21 +295,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -295,21 +295,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
//商品skuId或者商品券的商品id
//商品skuId或者商品券的商品id
String
spuId2
=
spuId
;
String
spuId2
=
spuId
;
CouponProductDto
couponProductDto
=
new
CouponProductDto
();
CouponProductDto
couponProductDto
=
new
CouponProductDto
();
Boolean
isMultiCoupon
=
false
;
Integer
todayAvailableTimes
=
0
;
if
(
StringUtils
.
isBlank
(
couponCode
))
{
if
(
StringUtils
.
isBlank
(
couponCode
))
{
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
}
else
{
}
else
{
//校验券是否有效 这里是新的商品券支持多商品及换购券
//校验券是否有效 这里是新的商品券支持多商品及换购券
if
(
StringUtils
.
isNotBlank
(
skuId
))
{
if
(
StringUtils
.
isNotBlank
(
skuId
))
{
Pair
<
String
,
Boolean
>
pair
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
skuId
,
couponProductDto
);
Pair
<
String
,
Integer
>
pair
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
skuId
,
couponProductDto
);
spuId2
=
pair
.
getKey
();
spuId2
=
pair
.
getKey
();
isMultiCoupon
=
pair
.
getValue
();
todayAvailableTimes
=
pair
.
getValue
();
cartGoods
.
setGoodsId
(
spuId
);
cartGoods
.
setGoodsId
(
spuId
);
}
else
{
}
else
{
// 老版本商品券
// 老版本商品券
Pair
<
String
,
Boolean
>
pair
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
couponProductDto
);
Pair
<
String
,
Integer
>
pair
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
couponProductDto
);
spuId2
=
pair
.
getKey
();
spuId2
=
pair
.
getKey
();
isMultiCoupon
=
pair
.
getValue
();
todayAvailableTimes
=
pair
.
getValue
();
}
}
}
}
// // 获取商品详细信息
// // 获取商品详细信息
...
@@ -356,7 +356,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -356,7 +356,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
else
{
}
else
{
// 当商品是商品券,里面会判断如果购物车中已有商品券,会将cartGoods的CartGoodsUid设为null
// 当商品是商品券,里面会判断如果购物车中已有商品券,会将cartGoods的CartGoodsUid设为null
this
.
addProductGoods
(
addShoppingCartGoodsRequestVo
,
cartGoods
,
spuId2
,
userId
,
shoppingCartGoodsResponseVo
,
this
.
addProductGoods
(
addShoppingCartGoodsRequestVo
,
cartGoods
,
spuId2
,
userId
,
shoppingCartGoodsResponseVo
,
spuId
,
allCartGoodsList
,
productBeanListSpuClass
,
couponProductDto
,
couponCode
,
isMultiCoupon
);
spuId
,
allCartGoodsList
,
productBeanListSpuClass
,
couponProductDto
,
couponCode
,
todayAvailableTimes
);
}
}
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
userLoginInfoDto
.
getWxAppid
(),
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
.
getOrderType
());
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
userLoginInfoDto
.
getWxAppid
(),
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
.
getOrderType
());
...
@@ -1805,7 +1805,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1805,7 +1805,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
*/
private
void
addProductGoods
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
private
void
addProductGoods
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
CartGoods
cartGoods
,
String
spuId2
,
String
userId
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
spuId
,
CartGoods
cartGoods
,
String
spuId2
,
String
userId
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
spuId
,
List
<
CartGoods
>
allCartGoodsList
,
List
<
ProductBean
>
productBeanListSpuClass
,
CouponProductDto
couponProductDto
,
String
couponCode
,
Boolean
isMultiCoupon
)
{
,
List
<
CartGoods
>
allCartGoodsList
,
List
<
ProductBean
>
productBeanListSpuClass
,
CouponProductDto
couponProductDto
,
String
couponCode
,
Integer
todayAvailableTimes
)
{
...
@@ -1822,9 +1822,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1822,9 +1822,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
// 商品券Id
// 商品券Id
String
spqId
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
String
spqId
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
if
(
CollectionUtils
.
isNotEmpty
(
allCartGoodsList
)
&&
!
isMultiCoupon
){
if
(
CollectionUtils
.
isNotEmpty
(
allCartGoodsList
)){
CartGoods
sameCartGoods
=
allCartGoodsList
.
stream
().
filter
(
p
->
p
.
getSpuId
().
equals
(
spqId
)).
findFirst
().
orElse
(
null
);
int
sum
=
allCartGoodsList
.
stream
().
filter
(
p
->
p
.
getSpuId
().
equals
(
spqId
)).
mapToInt
(
CartGoods:
:
getQty
).
sum
(
);
if
(
s
ameCartGoods
!=
null
&&
sameCartGoods
.
getQty
()
!=
null
&&
sameCartGoods
.
getQty
()
>
0
){
if
(
s
um
+
cartGoods
.
getQty
()
>
todayAvailableTimes
){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
}
}
}
}
...
...
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