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
4a5772eb
Commit
4a5772eb
authored
May 20, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一键加购 需求
parent
d09cd2b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
31 deletions
+45
-31
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShopGoodsReplaceVo.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+44
-31
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShopGoodsReplaceVo.java
View file @
4a5772eb
...
@@ -31,6 +31,7 @@ public class ShopGoodsReplaceVo extends BaseRequestVo {
...
@@ -31,6 +31,7 @@ public class ShopGoodsReplaceVo extends BaseRequestVo {
private
String
menuType
;
private
String
menuType
;
// 我需要的字段----------
// 我需要的字段----------
@NotEmpty
(
message
=
"oldShopId不能为空"
)
private
String
oldShopId
;
private
String
oldShopId
;
/**
/**
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
4a5772eb
...
@@ -2917,9 +2917,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2917,9 +2917,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* @return
* @return
*/
*/
public
BaseResponse
replaceGoodsByShop
(
ShopGoodsReplaceVo
replaceGoodsRequestVo
)
{
public
BaseResponse
replaceGoodsByShop
(
ShopGoodsReplaceVo
replaceGoodsRequestVo
)
{
if
(
StringUtils
.
isEmpty
(
replaceGoodsRequestVo
.
getShopId
())){
if
(
StringUtils
.
isEmpty
(
replaceGoodsRequestVo
.
getShopId
())
||
StringUtils
.
isEmpty
(
replaceGoodsRequestVo
.
getOldShopId
())){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
}
if
(
replaceGoodsRequestVo
.
getShopId
().
equals
(
replaceGoodsRequestVo
.
getOldShopId
()))
{
// 门店号 一致 不作处理 测试结束 需要放开
return
ResponseUtil
.
success
();
}
// 获取用户登录信息
// 获取用户登录信息
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
replaceGoodsRequestVo
.
getSessionId
());
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
replaceGoodsRequestVo
.
getSessionId
());
UserLoginInfoDto
userLoginInfoDto
=
convert2UserLoginInfoDto
(
assortmentCustomerInfoVo
);
UserLoginInfoDto
userLoginInfoDto
=
convert2UserLoginInfoDto
(
assortmentCustomerInfoVo
);
...
@@ -2967,36 +2973,39 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -2967,36 +2973,39 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 校验 获取到的商品数量 规格是否和 上家门店规格一直 sku spu
// 校验 获取到的商品数量 规格是否和 上家门店规格一直 sku spu
List
<
String
>
productIds
=
productBeanListSpuClass
.
stream
().
map
(
ProductBean:
:
getPid
).
collect
(
toList
());
List
<
String
>
productIds
=
productBeanListSpuClass
.
stream
().
map
(
ProductBean:
:
getPid
).
collect
(
toList
());
boolean
fullReplace
=
true
;
boolean
fullReplace
=
true
;
if
(
productIds
.
containsAll
(
spuIds
))
{
// 全部包含的情况 再次校验 sku是否包含
// if (productIds.containsAll(spuIds)) {
List
<
ProductBean
.
SkuProductBean
>
skuListAll
=
new
ArrayList
<>();
// // 全部包含的情况 再次校验 sku是否包含
productBeanListSpuClass
.
forEach
(
productBean
->
skuListAll
.
addAll
(
productBean
.
getSkuList
()));
// List<ProductBean.SkuProductBean> skuListAll = new ArrayList<>();
// productBeanListSpuClass.forEach(productBean -> skuListAll.addAll(productBean.getSkuList()));
List
<
String
>
productSkuIds
=
skuListAll
.
stream
().
map
(
ProductBean
.
SkuProductBean
::
getSkuId
).
collect
(
toList
());
//
List
<
String
>
excludeSkuList
=
excludeGoods
.
stream
().
map
(
CartGoods:
:
getSkuId
).
collect
(
toList
());
// List<String> productSkuIds = skuListAll.stream().map(ProductBean.SkuProductBean::getSkuId).collect(toList());
// 删除 不对等的sku存在
// List<String> excludeSkuList = excludeGoods.stream().map(CartGoods::getSkuId).collect(toList());
if
(!
productSkuIds
.
containsAll
(
excludeSkuList
))
{
// // 删除 不对等的sku存在
List
<
String
>
skuList
=
new
ArrayList
<>();
// if (!productSkuIds.containsAll(excludeSkuList)) {
excludeSkuList
.
forEach
(
sku
->{
// List<String> skuList = new ArrayList<>();
if
(!
productSkuIds
.
contains
(
sku
))
{
// excludeSkuList.forEach(sku ->{
skuList
.
add
(
sku
);
// if (!productSkuIds.contains(sku)) {
}
// skuList.add(sku);
});
// }
excludeGoods
=
excludeGoods
.
stream
().
filter
(
cartGoods
->
!
skuList
.
contains
(
cartGoods
.
getSpuId
())).
collect
(
Collectors
.
toList
());
// });
fullReplace
=
false
;
// excludeGoods = excludeGoods.stream().filter(cartGoods -> !skuList.contains(cartGoods.getSpuId())).collect(Collectors.toList());
}
// fullReplace = false;
// 全部包含,直接使用
// }
}
else
{
// // 全部包含,直接使用
// 不全部包含
// }else {
List
<
String
>
spuList
=
new
ArrayList
<>();
// // 不全部包含
productIds
.
forEach
(
s
->
{
// List<String> spuList = new ArrayList<>();
if
(!
spuIds
.
contains
(
s
))
{
// productIds.forEach(s -> {
spuList
.
add
(
s
);
// if (!spuIds.contains(s)) {
}
// spuList.add(s);
});
// }
excludeGoods
=
excludeGoods
.
stream
().
filter
(
cartGoods
->
!
spuList
.
contains
(
cartGoods
.
getSpuId
())).
collect
(
Collectors
.
toList
());
// });
fullReplace
=
false
;
// excludeGoods = excludeGoods.stream().filter(cartGoods -> !spuList.contains(cartGoods.getSpuId())).collect(Collectors.toList());
}
// fullReplace = false;
// }
// 商品小料数量 没校验
// 商品小料数量 没校验
// 购物车添加数量限制
// 购物车添加数量限制
// Integer productsCount = limitGoodsQty(excludeGoods, null, appId);
// Integer productsCount = limitGoodsQty(excludeGoods, null, appId);
...
@@ -3031,6 +3040,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -3031,6 +3040,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
fullReplace
=
false
;
fullReplace
=
false
;
return
fullReplace
;
return
fullReplace
;
}
}
if
(
allCartGoodsList
.
size
()
!=
excludeGoods
.
size
()){
// 表示有数据被删除
fullReplace
=
false
;
}
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
//判断当前商品在购物车是否已存在,存在则数量+1,不存在商品行 + 1
allCartGoodsList
.
forEach
(
oldCartGoods
->
{
allCartGoodsList
.
forEach
(
oldCartGoods
->
{
int
index
;
int
index
;
...
...
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