Commit 94af7352 by 孙昱

sunyu::update::update about batchOperateCartGoods

parent 036acadf
......@@ -39,7 +39,6 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
/**
* 商品信息
*/
@NotEmpty(message = "商品信息不可为空")
private List<BatchGoodsInfoVo> goodsInfos;
}
\ No newline at end of file
......@@ -370,14 +370,11 @@ public class ShoppingCartMCoffeeServiceImpl {
if (StringUtils.isEmpty(requestVo.getShopId())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
}
if (CollectionUtils.isEmpty(requestVo.getGoodsInfos())) {
if (CollectionUtils.isEmpty(requestVo.getGoodsInfos()) && CollectionUtils.isEmpty(requestVo.getQtyInfoList())) {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_INVAILD);
}
if (CollectionUtils.isEmpty(requestVo.getQtyInfoList())){
return ResponseUtil.error(ResponseResult.SHOPPING_CART_UPDATE_ERROR);
}
BaseResponse baseResponse;
BaseResponse baseResponse = new BaseResponse();
if (CollectionUtils.isNotEmpty(requestVo.getQtyInfoList())) {
BatchUpdateGoodsQtyRequestVo updateGoodsQtyRequestVo = new BatchUpdateGoodsQtyRequestVo();
updateGoodsQtyRequestVo.setAppId(requestVo.getAppId());
updateGoodsQtyRequestVo.setChannelType(requestVo.getChannelType());
......@@ -391,10 +388,11 @@ public class ShoppingCartMCoffeeServiceImpl {
updateGoodsQtyRequestVo.setQtyInfoList(requestVo.getQtyInfoList());
baseResponse = this.batchUpdateGoodsQty(updateGoodsQtyRequestVo);
//批量更新失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(),baseResponse.getCode())){
if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse;
}
}
if (CollectionUtils.isNotEmpty(requestVo.getGoodsInfos())) {
MCoffeeBatchAddGoodsRequestVo addGoodsRequestVo = new MCoffeeBatchAddGoodsRequestVo();
addGoodsRequestVo.setAppId(requestVo.getAppId());
addGoodsRequestVo.setChannelType(requestVo.getChannelType());
......@@ -408,9 +406,10 @@ public class ShoppingCartMCoffeeServiceImpl {
addGoodsRequestVo.setGoodsInfos(requestVo.getGoodsInfos());
baseResponse = this.addBatchGoods(addGoodsRequestVo);
//批量新增失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(),baseResponse.getCode())){
if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse;
}
}
return baseResponse;
}
......
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