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
c88aae8c
Commit
c88aae8c
authored
Oct 20, 2020
by
yu.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sunyu::reset commit
parent
f1d83636
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
60 deletions
+62
-60
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/ShoppingCartBaseService.java
+59
-58
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartBaseServiceImpl.java
+3
-2
No files found.
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/ShoppingCartBaseService.java
View file @
c88aae8c
...
@@ -25,6 +25,7 @@ import com.freemud.application.sdk.api.productcenter.request.product.valid.Valid
...
@@ -25,6 +25,7 @@ import com.freemud.application.sdk.api.productcenter.request.product.valid.Valid
import
com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryByIdsResponse
;
import
com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryByIdsResponse
;
import
com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopProductResponse
;
import
com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopProductResponse
;
import
com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopProductResult
;
import
com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopProductResult
;
import
com.freemud.application.sdk.api.productcenter.service.MenuService
;
import
com.freemud.application.sdk.api.productcenter.service.ProductService
;
import
com.freemud.application.sdk.api.productcenter.service.ProductService
;
import
com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequest
;
import
com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequest
;
import
com.freemud.application.sdk.api.storecenter.response.vo.GetOrgTreeListResponse
;
import
com.freemud.application.sdk.api.storecenter.response.vo.GetOrgTreeListResponse
;
...
@@ -343,32 +344,32 @@ public interface ShoppingCartBaseService {
...
@@ -343,32 +344,32 @@ public interface ShoppingCartBaseService {
* @param checkCartRequest
* @param checkCartRequest
* @param cartGoodsStates
* @param cartGoodsStates
*/
*/
//
default void getProductInfoAndVerifyNew(CheckCartRequest checkCartRequest, CartGoodsStates cartGoodsStates) {
default
void
getProductInfoAndVerifyNew
(
CheckCartRequest
checkCartRequest
,
CartGoodsStates
cartGoodsStates
)
{
//
if (CollectionUtils.isEmpty(checkCartRequest.getCartGoodsList())) {
if
(
CollectionUtils
.
isEmpty
(
checkCartRequest
.
getCartGoodsList
()))
{
//
return;
return
;
//
}
}
//
// 获取购物车中所有的商品详情
// 获取购物车中所有的商品详情
//
// 包含:1、普通商品 2、套餐内的固定商品和可选商品
// 包含:1、普通商品 2、套餐内的固定商品和可选商品
//
ShoppingCartAdapter shoppingCartAdapter = SDKCommonBaseContextWare.getBean(ShoppingCartAdapter.class);
ShoppingCartAdapter
shoppingCartAdapter
=
SDKCommonBaseContextWare
.
getBean
(
ShoppingCartAdapter
.
class
);
//
GetProductInfoRequest getSpuProductInfoRequest = shoppingCartAdapter.convertGetProductInfoRequest(checkCartRequest);
GetProductInfoRequest
getSpuProductInfoRequest
=
shoppingCartAdapter
.
convertGetProductInfoRequest
(
checkCartRequest
);
//
getSpuProductInfoRequest.setMenuType(checkCartRequest.getMenuType());
getSpuProductInfoRequest
.
setMenuType
(
checkCartRequest
.
getMenuType
());
//
BaseResponse<List<ProductBeanDTO>> productInfo = getProductsInfo(getSpuProductInfoRequest);
BaseResponse
<
List
<
ProductBeanDTO
>>
productInfo
=
getProductsInfo
(
getSpuProductInfoRequest
);
//
if ((productInfo == null) || (!CartResponseConstant.SUCCESS.getCode().equals(productInfo.getCode()))) {
if
((
productInfo
==
null
)
||
(!
CartResponseConstant
.
SUCCESS
.
getCode
().
equals
(
productInfo
.
getCode
())))
{
//
return;
return
;
//
}
}
//
//更新购物车详细信息
//更新购物车详细信息
//
updateCartGoodsListInfoNew(checkCartRequest.getCartGoodsList(), productInfo.getResult(), cartGoodsStates, checkCartRequest.getPartnerId(), checkCartRequest.getStoreId(), checkCartRequest.getTableNumber());
updateCartGoodsListInfoNew
(
checkCartRequest
.
getCartGoodsList
(),
productInfo
.
getResult
(),
cartGoodsStates
,
checkCartRequest
.
getPartnerId
(),
checkCartRequest
.
getStoreId
(),
checkCartRequest
.
getTableNumber
());
//
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = checkCartRequest.getShoppingCartGoodsResponseVo();
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
checkCartRequest
.
getShoppingCartGoodsResponseVo
();
//
// 有非法商品
// 有非法商品
//
if (cartGoodsStates.isHasInvalidGoods()) {
if
(
cartGoodsStates
.
isHasInvalidGoods
())
{
//
setToastMsgIfNotExist(shoppingCartGoodsResponseVo, ShoppingCartConstant.SHOPPING_CART_INVALID_GOODS_EXIST);
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
SHOPPING_CART_INVALID_GOODS_EXIST
);
//
}
}
//
// 价格发生变化时返回
// 价格发生变化时返回
//
if (cartGoodsStates.isPriceChanged()) {
if
(
cartGoodsStates
.
isPriceChanged
())
{
//
setToastMsgIfNotExist(shoppingCartGoodsResponseVo, ShoppingCartConstant.SHOPPING_CART_ACTIVITY_CHANGE);
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
SHOPPING_CART_ACTIVITY_CHANGE
);
//
}
}
//
checkCartRequest.setShoppingCartGoodsResponseVo(shoppingCartGoodsResponseVo);
checkCartRequest
.
setShoppingCartGoodsResponseVo
(
shoppingCartGoodsResponseVo
);
//
}
}
/**
/**
* 根据点餐方式、校验商品券是否满足
* 根据点餐方式、校验商品券是否满足
...
@@ -474,38 +475,38 @@ public interface ShoppingCartBaseService {
...
@@ -474,38 +475,38 @@ public interface ShoppingCartBaseService {
cartGoodsList
.
removeIf
(
k
->
invalidGoodsIdList
.
contains
(
k
.
getCartGoodsUid
())
||
StringUtils
.
isEmpty
(
k
.
getCartGoodsUid
()));
cartGoodsList
.
removeIf
(
k
->
invalidGoodsIdList
.
contains
(
k
.
getCartGoodsUid
())
||
StringUtils
.
isEmpty
(
k
.
getCartGoodsUid
()));
}
}
//
default Map<String, GetMenuByIdsResponseDto.DataBean.MenuDetailDto> checkMenuProducts(String partnerId,
default
Map
<
String
,
GetMenuByIdsResponseDto
.
DataBean
.
MenuDetailDto
>
checkMenuProducts
(
String
partnerId
,
//
String shopId,
String
shopId
,
//
List<String> productIds, String trackingNo,String menuType) {
List
<
String
>
productIds
,
String
trackingNo
,
String
menuType
)
{
//
//
Map<String, GetMenuByIdsResponseDto.DataBean.MenuDetailDto> menuDetailDtosMap = new HashMap<>();
Map
<
String
,
GetMenuByIdsResponseDto
.
DataBean
.
MenuDetailDto
>
menuDetailDtosMap
=
new
HashMap
<>();
//
//
//查询spu商品是否在菜单
//查询spu商品是否在菜单
//
GetMenuCategoryByIdsRequest getMenuCategoryByIdsDto = GetMenuCategoryByIdsRequest.builder()
GetMenuCategoryByIdsRequest
getMenuCategoryByIdsDto
=
GetMenuCategoryByIdsRequest
.
builder
()
//
.businessDate(DateTimeUtils.getCurrentDateTimeStr())
.
businessDate
(
DateTimeUtils
.
getCurrentDateTimeStr
())
//
.channelType(menuType)
.
channelType
(
menuType
)
//
.partnerId(partnerId)
.
partnerId
(
partnerId
)
//
.shopId(shopId)
.
shopId
(
shopId
)
//
.productIds(productIds).build();
.
productIds
(
productIds
).
build
();
//
MenuService menuService = SDKCommonBaseContextWare.getBean(MenuService.class);
MenuService
menuService
=
SDKCommonBaseContextWare
.
getBean
(
MenuService
.
class
);
//
com.freemud.application.sdk.api.base.BaseResponse<GetMenuCategoryByIdsResponse> getMenuCategoryByIdsResponse = menuService.getMenuCategoryByIds(getMenuCategoryByIdsDto, trackingNo);
com
.
freemud
.
application
.
sdk
.
api
.
base
.
BaseResponse
<
GetMenuCategoryByIdsResponse
>
getMenuCategoryByIdsResponse
=
menuService
.
getMenuCategoryByIds
(
getMenuCategoryByIdsDto
,
trackingNo
);
//
//
if (getMenuCategoryByIdsResponse == null || !CartResponseConstant.SUCCESS.getCode().equals(getMenuCategoryByIdsResponse.getCode())
if
(
getMenuCategoryByIdsResponse
==
null
||
!
CartResponseConstant
.
SUCCESS
.
getCode
().
equals
(
getMenuCategoryByIdsResponse
.
getCode
())
//
|| getMenuCategoryByIdsResponse.getData() == null || CollectionUtils.isEmpty(getMenuCategoryByIdsResponse.getData().getMenuDetailDtos())) {
||
getMenuCategoryByIdsResponse
.
getData
()
==
null
||
CollectionUtils
.
isEmpty
(
getMenuCategoryByIdsResponse
.
getData
().
getMenuDetailDtos
()))
{
//
return null;
return
null
;
//
}
}
//
//
Map<String, GetMenuCategoryByIdsResponse.MenuDetailDto> menuDetailDtosMapTemp = getMenuCategoryByIdsResponse.getData().getMenuDetailDtos().parallelStream()
Map
<
String
,
GetMenuCategoryByIdsResponse
.
MenuDetailDto
>
menuDetailDtosMapTemp
=
getMenuCategoryByIdsResponse
.
getData
().
getMenuDetailDtos
().
parallelStream
()
//
.collect(Collectors.toMap(GetMenuCategoryByIdsResponse.MenuDetailDto::getProductId, Function.identity(), (k1, k2) -> k1));
.
collect
(
Collectors
.
toMap
(
GetMenuCategoryByIdsResponse
.
MenuDetailDto
::
getProductId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
//
//
for (Map.Entry<String, GetMenuCategoryByIdsResponse.MenuDetailDto> entry : menuDetailDtosMapTemp.entrySet()) {
for
(
Map
.
Entry
<
String
,
GetMenuCategoryByIdsResponse
.
MenuDetailDto
>
entry
:
menuDetailDtosMapTemp
.
entrySet
())
{
//
GetMenuByIdsResponseDto.DataBean.MenuDetailDto menuDetailDto = new GetMenuByIdsResponseDto.DataBean.MenuDetailDto();
GetMenuByIdsResponseDto
.
DataBean
.
MenuDetailDto
menuDetailDto
=
new
GetMenuByIdsResponseDto
.
DataBean
.
MenuDetailDto
();
//
BeanUtils.copyProperties(entry.getValue(), menuDetailDto);
BeanUtils
.
copyProperties
(
entry
.
getValue
(),
menuDetailDto
);
//
menuDetailDtosMap.put(entry.getKey(), menuDetailDto);
menuDetailDtosMap
.
put
(
entry
.
getKey
(),
menuDetailDto
);
//
}
}
//
//
return menuDetailDtosMap;
return
menuDetailDtosMap
;
//
}
}
/**
/**
* 当ToastMsg为空时才赋值
* 当ToastMsg为空时才赋值
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartBaseServiceImpl.java
View file @
c88aae8c
...
@@ -22,6 +22,7 @@ import com.freemud.application.sdk.api.productcenter.request.product.GetProductR
...
@@ -22,6 +22,7 @@ import com.freemud.application.sdk.api.productcenter.request.product.GetProductR
import
com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryByIdsResponse
;
import
com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryByIdsResponse
;
import
com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryInfoResponse
;
import
com.freemud.application.sdk.api.productcenter.response.menu.GetMenuCategoryInfoResponse
;
import
com.freemud.application.sdk.api.productcenter.response.product.GetProductInfosResponse
;
import
com.freemud.application.sdk.api.productcenter.response.product.GetProductInfosResponse
;
import
com.freemud.application.sdk.api.productcenter.service.MenuService
;
import
com.freemud.application.sdk.api.productcenter.service.ProductService
;
import
com.freemud.application.sdk.api.productcenter.service.ProductService
;
import
com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter
;
import
com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.*
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.*
;
...
@@ -69,8 +70,8 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
...
@@ -69,8 +70,8 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
private
RedisCache
redisCache
;
private
RedisCache
redisCache
;
@Autowired
@Autowired
private
RedisTemplate
redisTemplate
;
private
RedisTemplate
redisTemplate
;
//
@Autowired
@Autowired
//
private MenuService menuService;
private
MenuService
menuService
;
@Autowired
@Autowired
private
ShoppingCartAdapter
shoppingCartAdapter
;
private
ShoppingCartAdapter
shoppingCartAdapter
;
@Autowired
@Autowired
...
...
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