Commit fc95e342 by ping.wu

切换门店校验购物车商品

parent cfd1697e
......@@ -97,10 +97,10 @@ public class MCoffeeShoppingCartController {
/**
* 切换点餐方式或者门店
*/
@ApiAnnotation(logMessage = "switchCartGoods")
@PostMapping(value = "/switchCartGoods")
public BaseResponse switchCartGoods(@Validated @LogParams @RequestBody SwitchShoppingCartRequestVo request) {
return shoppingCartMCoffeeService.switchCartGoods(request);
@ApiAnnotation(logMessage = "switchCartGoodsCheck")
@PostMapping(value = "/switchCartGoodsCheck")
public BaseResponse switchCartGoodsCheck(@Validated @LogParams @RequestBody SwitchShoppingCartRequestVo request) {
return shoppingCartMCoffeeService.switchCartGoodsCheck(request);
}
......
......@@ -433,12 +433,34 @@ public class ShoppingCartMCoffeeServiceImpl {
/**
* 切换点餐方式或者门店
*/
public BaseResponse switchCartGoods(SwitchShoppingCartRequestVo requestVo) {
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo();
public BaseResponse switchCartGoodsCheck(SwitchShoppingCartRequestVo requestVo) {
String jsonString = JSONObject.toJSONString(requestVo);
ShoppingCartInfoRequestVo shoppingCartInfoRequestVo = JSONObject.parseObject(jsonString,ShoppingCartInfoRequestVo.class);
return getGoodsList(shoppingCartInfoRequestVo);
// return ResponseUtil.success(shoppingCartGoodsResponseVo);
if (StringUtils.isEmpty(shoppingCartInfoRequestVo.getShopId())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
}
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = new ShoppingCartGoodsResponseVo();
String sessionId = shoppingCartInfoRequestVo.getSessionId();
// 获取用户信息
CustomerInfoVo assortmentCustomerInfoVo = getCustomerInfoVo(sessionId);
String userId = assortmentCustomerInfoVo.getMemberId();
String partnerId = shoppingCartInfoRequestVo.getPartnerId();
String storeId = shoppingCartInfoRequestVo.getShopId();
String appId = shoppingCartInfoRequestVo.getAppId();
String menuType = shoppingCartInfoRequestVo.getMenuType();
Integer orderType = shoppingCartInfoRequestVo.getOrderType();
String receiveId = shoppingCartInfoRequestVo.getReceiveId();
// 获取购物车商品
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, sessionId, "", shoppingCartBaseService);
// 如果购物车商品不为空, 则check购物车中所有商品
if (CollectionUtils.isNotEmpty(cartGoodsList)) {
// check购物车中所有商品
checkCartGoods(partnerId, storeId,orderType,menuType,shoppingCartGoodsResponseVo,cartGoodsList);
}
return ResponseUtil.success(shoppingCartGoodsResponseVo);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment