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
4ba08330
Commit
4ba08330
authored
Mar 11, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品券多次添加fix
parent
c2e6e6dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
+7
-12
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
+3
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+11
-2
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
View file @
4ba08330
...
@@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSON;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
javafx.util.Pair
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -114,12 +115,12 @@ public interface ShoppingCartNewService {
...
@@ -114,12 +115,12 @@ public interface ShoppingCartNewService {
* @param productIds
* @param productIds
* @return
* @return
*/
*/
default
String
validCoupon
(
String
partnerId
default
Pair
<
String
,
Boolean
>
validCoupon
(
String
partnerId
,
String
storeId
,
String
storeId
,
String
couponCode
,
String
couponCode
,
List
<
Long
>
productIds
,
List
<
Long
>
productIds
,
String
menuType
,
String
menuType
,
CouponProductDto
couponProductDto
,
Integer
couponQty
)
{
,
CouponProductDto
couponProductDto
)
{
String
spuId2
;
String
spuId2
;
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
);
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
...
@@ -127,15 +128,12 @@ public interface ShoppingCartNewService {
...
@@ -127,15 +128,12 @@ public interface ShoppingCartNewService {
if
(
checkSpqInfoResponseDto
==
null
)
{
if
(
checkSpqInfoResponseDto
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
}
}
if
(!
checkSpqInfoResponseDto
.
getIsMultiCoupon
()
&&
couponQty
!=
null
&&
couponQty
>
1
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
}
if
(
couponProductDto
!=
null
)
{
if
(
couponProductDto
!=
null
)
{
couponProductDto
.
setType
(
checkSpqInfoResponseDto
.
getCouponType
());
couponProductDto
.
setType
(
checkSpqInfoResponseDto
.
getCouponType
());
}
}
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
productIds
.
add
(
Long
.
parseLong
(
checkSpqInfoResponseDto
.
getSkuId
()));
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
spuId2
=
checkSpqInfoResponseDto
.
getSkuId
();
return
spuId2
;
return
new
Pair
(
spuId2
,
checkSpqInfoResponseDto
.
getIsMultiCoupon
())
;
}
}
/**
/**
...
@@ -149,13 +147,13 @@ public interface ShoppingCartNewService {
...
@@ -149,13 +147,13 @@ public interface ShoppingCartNewService {
* @param goodsId
* @param goodsId
* @return
* @return
*/
*/
default
String
validCoupon
(
String
partnerId
default
Pair
<
String
,
Boolean
>
validCoupon
(
String
partnerId
,
String
storeId
,
String
storeId
,
String
couponCode
,
String
couponCode
,
List
<
Long
>
productIds
,
List
<
Long
>
productIds
,
String
menuType
,
String
menuType
,
String
goodsId
,
String
goodsId
,
CouponProductDto
couponProductDto
,
Integer
couponQty
)
{
,
CouponProductDto
couponProductDto
)
{
String
spuId2
;
String
spuId2
;
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
);
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
CouponService
couponService
=
SDKCommonBaseContextWare
.
getBean
(
CouponService
.
class
);
...
@@ -164,13 +162,10 @@ public interface ShoppingCartNewService {
...
@@ -164,13 +162,10 @@ public interface ShoppingCartNewService {
if
(
checkSpqInfoResponseDto
==
null
)
{
if
(
checkSpqInfoResponseDto
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_MIX_NOT_EXIST
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_MIX_NOT_EXIST
);
}
}
if
(!
checkSpqInfoResponseDto
.
getIsMultiCoupon
()
&&
couponQty
!=
null
&&
couponQty
>
1
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
}
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
spuId2
;
return
new
Pair
(
spuId2
,
checkSpqInfoResponseDto
.
getIsMultiCoupon
())
;
}
}
/**
/**
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
View file @
4ba08330
...
@@ -43,6 +43,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto;
...
@@ -43,6 +43,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto;
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.request.CheckCartRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.MealCartBaseServiceImpl
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.MealCartBaseServiceImpl
;
import
javafx.util.Pair
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -121,7 +122,8 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
...
@@ -121,7 +122,8 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
}
else
{
}
else
{
//校验券是否有效
//校验券是否有效
spuId2
=
validCoupon
(
partnerId
,
storeId
,
spuId
,
productIds
,
BusinessTypeEnum
.
getByType
(
requestVo
.
getMenuType
()).
getCode
(),
null
,
null
);
Pair
<
String
,
Boolean
>
pair
=
validCoupon
(
partnerId
,
storeId
,
spuId
,
productIds
,
BusinessTypeEnum
.
getByType
(
requestVo
.
getMenuType
()).
getCode
(),
null
,
null
);
spuId2
=
pair
.
getKey
();
}
}
// 获取商品信息
// 获取商品信息
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
4ba08330
...
@@ -75,6 +75,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
...
@@ -75,6 +75,7 @@ import com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest;
import
com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
javafx.util.Pair
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.ObjectUtils
;
...
@@ -291,16 +292,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -291,16 +292,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
;
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
))
{
spuId2
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
skuId
,
couponProductDto
,
addShoppingCartGoodsRequestVo
.
getQty
());
Pair
<
String
,
Boolean
>
pair
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
skuId
,
couponProductDto
);
spuId2
=
pair
.
getKey
();
isMultiCoupon
=
pair
.
getValue
();
cartGoods
.
setGoodsId
(
spuId
);
cartGoods
.
setGoodsId
(
spuId
);
}
else
{
}
else
{
// 老版本商品券
// 老版本商品券
spuId2
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
couponProductDto
,
addShoppingCartGoodsRequestVo
.
getQty
());
Pair
<
String
,
Boolean
>
pair
=
validCoupon
(
partnerId
,
storeId
,
couponCode
,
productIds
,
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
(),
couponProductDto
);
spuId2
=
pair
.
getKey
();
isMultiCoupon
=
pair
.
getValue
();
}
}
}
}
// 获取商品详细信息
// 获取商品详细信息
...
@@ -330,6 +336,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -330,6 +336,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
allCartGoodsList.get(allCartGoodsList.indexOf(cartGoods)).getQty() + cartGoods.getQty() : cartGoods.getQty();
allCartGoodsList.get(allCartGoodsList.indexOf(cartGoods)).getQty() + cartGoods.getQty() : cartGoods.getQty();
*/
*/
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
if
(
checkQty
>
1
&&
!
isMultiCoupon
){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
}
//购物车添加数量限制
//购物车添加数量限制
Integer
productsCount
=
limitGoodsQty
(
allCartGoodsList
,
cartGoods
,
appId
);
Integer
productsCount
=
limitGoodsQty
(
allCartGoodsList
,
cartGoods
,
appId
);
//查询多个商品库存信息 TODO
//查询多个商品库存信息 TODO
...
...
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