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
5fe42420
Commit
5fe42420
authored
May 27, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发券商品 替换成普通商品 测试
parent
a090c59a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
7 deletions
+38
-7
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+38
-7
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
5fe42420
...
...
@@ -2922,7 +2922,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
if
(
replaceGoodsRequestVo
.
getShopId
().
equals
(
replaceGoodsRequestVo
.
getOldShopId
()))
{
// 门店号 一致 不作处理 测试结束 需要放开
return
ResponseUtil
.
success
();
}
...
...
@@ -2944,7 +2943,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 删除购物车中的不匹配商品 加购信息不包含营销促销活动和优惠券,价格以切换后的当前门店为准
List
<
Integer
>
excludeType
=
Arrays
.
asList
(
// 换购券
//
GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType(),
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
(),
// 万能券商品
GoodsTypeEnum
.
ALL_COUPON_GOODS
.
getGoodsType
(),
// 虚拟商品
...
...
@@ -2952,14 +2951,22 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 异常商品
GoodsTypeEnum
.
EXCEPTION_GOODS
.
getGoodsType
());
List
<
CartGoods
>
excludeGoods
=
allCartGoodsList
.
stream
().
filter
(
cartGoods
->
!
excludeType
.
contains
(
cartGoods
.
getGoodsType
())).
collect
(
toList
());
LogUtil
.
info
(
"replaceGoodsType begin "
,
null
,
JSON
.
toJSONString
(
excludeGoods
));
List
<
CartGoods
>
HGcouponGoods
=
allCartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
().
equals
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
())).
collect
(
toList
());
if
(!
CollectionUtils
.
isEmpty
(
HGcouponGoods
))
{
// 替换 换购券的商品 变成普通商品 --> 优惠券商品变成 普通商品带到其他门店去
List
<
CartGoods
>
goodsList
=
new
ArrayList
<>(
HGcouponGoods
.
size
());
HGcouponGoods
.
forEach
(
cartGoods
->
{
goodsList
.
add
(
replaceGoodsType
(
cartGoods
));
});
excludeGoods
.
addAll
(
goodsList
);
}
LogUtil
.
info
(
"replaceGoodsType end "
,
null
,
JSON
.
toJSONString
(
excludeGoods
));
if
(
CollectionUtils
.
isEmpty
(
excludeGoods
))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_REPLACE_GOODS_AND_CLEAR
);
}
if
(
replaceGoodsRequestVo
.
getHook
()!=
null
)
{
testDemo
(
excludeGoods
,
replaceGoodsRequestVo
,
userId
);
return
ResponseUtil
.
success
();
}
boolean
fullReplace
=
true
;
if
(
excludeGoods
.
size
()!=
allCartGoodsList
.
size
())
{
...
...
@@ -3033,6 +3040,30 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return
ResponseUtil
.
success
();
}
/**
* 替换 优惠券商品 变成普通商品
* @param excludeGood
*/
private
CartGoods
replaceGoodsType
(
CartGoods
excludeGood
)
{
CartGoods
ret
=
new
CartGoods
();
String
skuId
=
excludeGood
.
getSkuId
();
// 优惠券换购商品 spuid:88608274545893050894 "goodsId": "spq88608274545893050894"
ret
.
setGoodsId
(
skuId
);
ret
.
setAddCartTime
(
System
.
currentTimeMillis
());
ret
.
setSpuId
(
skuId
);
ret
.
setSkuId
(
skuId
);
ret
.
setQty
(
excludeGood
.
getQty
());
ret
.
setCouponCode
(
null
);
ret
.
setGoodsType
(
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
());
ret
.
setExtra
(
excludeGood
.
getExtra
());
ret
.
setNodeId
(
excludeGood
.
getNodeId
());
ret
.
setCategoryName
(
excludeGood
.
getCategoryName
());
ret
.
setProductComboList
(
excludeGood
.
getProductComboList
());
ret
.
setProductGroupList
(
excludeGood
.
getProductGroupList
());
ret
.
setProductMaterialList
(
excludeGood
.
getProductMaterialList
());
return
ret
;
}
private
void
testDemo
(
List
<
CartGoods
>
excludeGoods
,
ShopGoodsReplaceVo
replaceGoodsRequestVo
,
String
userId
)
{
String
partnerId
=
replaceGoodsRequestVo
.
getPartnerId
();
String
storeId
=
replaceGoodsRequestVo
.
getShopId
();
...
...
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