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
b2776672
Commit
b2776672
authored
Sep 04, 2020
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
套餐商品空键位修改
parent
5d32fc3b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
59 deletions
+66
-59
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+44
-36
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+20
-22
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/TimeSaleCalculation.java
+1
-1
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
b2776672
...
...
@@ -84,6 +84,7 @@ public enum ResponseResult {
SHOPPING_CART_GIFTS_PRODUCT_NOT_EXIST
(
"44018"
,
"买赠商品不存在"
),
SHOPPING_CART_SHOP_ID_NOT_EMPTY
(
"44019"
,
"门店编号不能为空"
),
SHOPPING_CART_COUPON_CAN_NOT_USE_THIS_SHOP
(
"44020"
,
"券不适用于该门店"
),
SHOPPING_CART_SEAT_EMPTY
(
"44020"
,
"键位为空"
),
/**
* 订单状态码
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
b2776672
...
...
@@ -84,6 +84,8 @@ public class ShoppingCartMCoffeeServiceImpl {
@Autowired
private
OrderSdkService
orderSdkService
;
private
static
final
String
nullSeat
=
"508106"
;
/**
* 添加商品、超值加购、商品券
*/
...
...
@@ -243,7 +245,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
//商品券行商品数量不可增加
if
(
cartGoods
.
getCouponCode
()
!=
null
&&
qty
>
1
)
{
if
(
cartGoods
.
getCouponCode
()
!=
null
&&
qty
>
1
)
{
throw
new
ServiceException
(
ResponseResult
.
NOT_SUPPORTED
);
}
...
...
@@ -342,7 +344,7 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_ADD_INVAILD
);
}
// 获取购物车商品-查询用户券-券码校验可用券
availableCoupon
=
couponDiscountCalculation
.
availableCoupon
(
partnerId
,
storeId
,
userId
,
thirdPartyMemberID
,
unionId
,
appId
,
couponCode
,
orderType
,
cartGoodsList
);
availableCoupon
=
couponDiscountCalculation
.
availableCoupon
(
partnerId
,
storeId
,
userId
,
thirdPartyMemberID
,
unionId
,
appId
,
couponCode
,
orderType
,
cartGoodsList
);
return
ResponseUtil
.
success
(
availableCoupon
);
}
...
...
@@ -660,23 +662,11 @@ public class ShoppingCartMCoffeeServiceImpl {
CartGoods
addCartGoods
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
oldCartGoodsList
)
{
List
<
CartGoods
>
newCartGoods
=
new
ArrayList
<>();
newCartGoods
.
addAll
(
oldCartGoodsList
);
//商品券单独设置一行
newCartGoods
=
checkNewCartGoods
(
newCartGoods
,
addCartGoods
);
newCartGoods
.
add
(
addCartGoods
);
//加购商品校验
List
<
CartGoods
>
allCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
newCartGoods
);
//添加商品为商品券时,商品校验接口券号未设置,设置商品券号
// if (StringUtils.isNotBlank(addCartGoods.getCouponCode())) {
// for (CartGoods cartGoods : allCartGoodsList) {
// if (cartGoods.getGoodsId().equals(addCartGoods.getGoodsId()) && cartGoods.getCouponCode() == null) {
// cartGoods.setCouponCode(addCartGoods.getCouponCode());
// cartGoods.setGoodsType(2);
// break;
// }
// }
// }
List
<
CartGoods
>
nowCartGoodsList
=
new
ArrayList
<>();
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
allCartGoodsList
.
forEach
(
oldCartGoods
->
{
...
...
@@ -758,32 +748,47 @@ public class ShoppingCartMCoffeeServiceImpl {
}
/**
*
商品券单独设置一行
*
套餐空键位处理
*/
private
List
<
CartGoods
>
checkNewCartGoods
(
List
<
CartGoods
>
newCartGoods
,
CartGoods
addCartGoods
)
{
Integer
qty
=
addCartGoods
.
getQty
()
==
null
?
0
:
addCartGoods
.
getQty
();
private
Map
<
String
,
String
>
checkNewCartGoods
(
List
<
CartGoods
>
newCartGoods
,
Integer
oper
,
Map
<
String
,
String
>
result
)
{
if
(
StringUtils
.
isNotBlank
(
addCartGoods
.
getCouponCode
()))
{
newCartGoods
.
add
(
addCartGoods
);
return
newCartGoods
;
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
boolean
isadd
=
true
;
if
(
CollectionUtils
.
isNotEmpty
(
newCartGoods
))
{
//删除套餐空键位
if
(
oper
==
1
)
{
for
(
CartGoods
goods
:
newCartGoods
)
{
if
(
goods
.
getSkuId
().
equals
(
addCartGoods
.
getSkuId
())
&&
goods
.
getSpuId
().
equals
(
addCartGoods
.
getSpuId
()))
{
if
(
goods
.
getProductGroupList
()
!=
null
&&
addCartGoods
.
getProductGroupList
()
!=
null
&&
goods
.
getProductGroupList
().
size
()
==
addCartGoods
.
getProductGroupList
().
size
())
{
if
(
CollectionUtils
.
isNotEmpty
(
goods
.
getProductGroupList
()))
{
List
<
CartGoods
.
ComboxGoods
>
productGroupList
=
new
ArrayList
<>();
for
(
CartGoods
.
ComboxGoods
comboxGoods
:
goods
.
getProductGroupList
())
{
if
(
nullSeat
.
equals
(
comboxGoods
.
getGoodsId
()))
{
map
.
put
(
goods
.
getCartGoodsUid
(),
goods
.
getGoodsId
());
}
else
{
productGroupList
.
add
(
comboxGoods
);
}
}
goods
.
setProductGroupList
(
productGroupList
);
}
}
if
(
isadd
)
{
newCartGoods
.
add
(
addCartGoods
);
return
map
;
}
//恢复套餐空键位
if
(
oper
==
2
&&
result
.
size
()
!=
0
){
for
(
CartGoods
cartGoods
:
newCartGoods
)
{
if
(
result
.
get
(
cartGoods
.
getCartGoodsUid
())
!=
null
)
{
CartGoods
.
ComboxGoods
comboxGoods
=
new
CartGoods
.
ComboxGoods
();
comboxGoods
.
setGoodsId
(
nullSeat
);
comboxGoods
.
setSkuId
(
nullSeat
);
comboxGoods
.
setCustomerCode
(
nullSeat
);
comboxGoods
.
setQty
(
1
);
comboxGoods
.
setOriginalPrice
(
0L
);
comboxGoods
.
setFinalPrice
(
0L
);
cartGoods
.
getProductGroupList
().
add
(
comboxGoods
);
}
}
}
else
{
newCartGoods
.
add
(
addCartGoods
);
}
return
newCartGoods
;
return
map
;
}
...
...
@@ -846,7 +851,7 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setClassificationName
(
productBeanListSpuClass
.
get
(
0
).
getCategoryName
());
if
(
StringUtils
.
isBlank
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
()))
{
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品键位编号为空"
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SEAT_EMPTY
);
}
//超值加购商品赋值
...
...
@@ -865,7 +870,6 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setTaxId
(
productBeanListSpuClass
.
get
(
0
).
getTaxId
());
}
}
...
...
@@ -931,6 +935,9 @@ public class ShoppingCartMCoffeeServiceImpl {
private
List
<
CartGoods
>
checkCartGoods
(
String
partnerId
,
String
storeId
,
Integer
orderType
,
String
menuType
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
cartGoodsList
)
{
//去除套餐商品空键位
// Map<String, String> map = checkNewCartGoods(cartGoodsList,1,null);
//筛选数量不为0商品
cartGoodsList
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getQty
()
!=
0
).
collect
(
Collectors
.
toList
());
...
...
@@ -955,7 +962,8 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
CollectionUtils
.
isNotEmpty
(
reduceGoods
))
{
allCartGoodsList
.
addAll
(
reduceGoods
);
}
//恢复套餐商品空键位
// checkNewCartGoods(allCartGoodsList,2,map);
return
allCartGoodsList
;
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
b2776672
...
...
@@ -134,9 +134,19 @@ public class CouponDiscountCalculation {
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getActivityType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getActivityType
()))
)))
{
return
;
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
>
couponDiscounts
=
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getCouponDiscounts
();
//订单级别券优惠
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
>
couponDiscounts
=
calculationDiscountResult
.
getCouponDiscounts
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
if
(
CollectionUtils
.
isEmpty
(
goodsList
))
{
return
;
}
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsMap
=
goodsList
.
parallelStream
()
.
collect
(
Collectors
.
toMap
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoods
:
shoppingCartGoodsDto
.
getProducts
())
{
//商品券商品
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
()))
{
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
couponDiscount
:
couponDiscounts
)
{
...
...
@@ -153,30 +163,18 @@ public class CouponDiscountCalculation {
cartGoods
.
setActivityDiscountsDtos
(
productActivityDiscountsDtos
);
}
}
if
(
goodsMap
.
get
(
cartGoods
.
getSkuId
())
==
null
)
{
continue
;
}
//商品券键位编号为空
if
(
StringUtils
.
isBlank
(
goodsMap
.
get
(
cartGoods
.
getSkuId
()).
getArtNo
())){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SEAT_EMPTY
);
}
cartGoods
.
setCustomerCode
(
goodsMap
.
get
(
cartGoods
.
getSkuId
()).
getArtNo
());
}
}
// List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods> goodsList = calculationDiscountResult.getGoods();
// if (CollectionUtils.isEmpty(goodsList)) {
// return;
// }
//
// Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods> goodsMap = goodsList.parallelStream()
// .collect(Collectors.toMap(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods::getGoodsId, Function.identity(), (k1, k2) -> k1));
//
// for (ShoppingCartGoodsDto.CartGoodsDetailDto cartGoods : shoppingCartGoodsDto.getProducts()) {
// //商品券商品
// if (StringUtils.isNotBlank(cartGoods.getCouponCode())) {
// if (goodsMap.get(cartGoods.getSkuId()) == null) {
// continue;
// }
// //商品券键位编号为空
// if(StringUtils.isBlank(goodsMap.get(cartGoods.getSkuId()).getArtNo())){
// throw new ServiceException(ResponseResult.OPERATE_TOO_OFTEN);
// }
// cartGoods.setCustomerCode(goodsMap.get(cartGoods.getSkuId()).getArtNo());
// }
// }
}
// public void getCoupon(CouponPromotionVO couponPromotionVO, ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo){
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/TimeSaleCalculation.java
View file @
b2776672
...
...
@@ -127,7 +127,7 @@ public class TimeSaleCalculation {
}
//活动商品键位编号为空
if
(
CollectionUtils
.
isNotEmpty
(
goods
.
getDiscounts
())
&&
StringUtils
.
isBlank
(
goods
.
getArtNo
())){
throw
new
ServiceException
(
ResponseResult
.
OPERATE_TOO_OFTEN
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SEAT_EMPTY
);
}
cartGoods
.
setCustomerCode
(
goods
.
getArtNo
());
Long
totalDiscountAmount
=
goodsDiscount
.
getDiscount
();
...
...
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