Commit 502a4c23 by 孙昱

sunyu::update::fix bug

parent cdba7aa2
......@@ -374,24 +374,6 @@ public class ShoppingCartMCoffeeServiceImpl {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_INVAILD);
}
BaseResponse baseResponse = new BaseResponse();
if (CollectionUtils.isNotEmpty(requestVo.getQtyInfoList())) {
BatchUpdateGoodsQtyRequestVo updateGoodsQtyRequestVo = new BatchUpdateGoodsQtyRequestVo();
updateGoodsQtyRequestVo.setAppId(requestVo.getAppId());
updateGoodsQtyRequestVo.setChannelType(requestVo.getChannelType());
updateGoodsQtyRequestVo.setCarVer(requestVo.getCarVer());
updateGoodsQtyRequestVo.setMenuType(requestVo.getMenuType());
updateGoodsQtyRequestVo.setReceiveId(requestVo.getReceiveId());
updateGoodsQtyRequestVo.setSessionId(requestVo.getSessionId());
updateGoodsQtyRequestVo.setVersion(requestVo.getVersion());
updateGoodsQtyRequestVo.setShopId(requestVo.getShopId());
updateGoodsQtyRequestVo.setPartnerId(requestVo.getPartnerId());
updateGoodsQtyRequestVo.setQtyInfoList(requestVo.getQtyInfoList());
baseResponse = this.batchUpdateGoodsQty(updateGoodsQtyRequestVo);
//批量更新失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse;
}
}
if (CollectionUtils.isNotEmpty(requestVo.getGoodsInfos())) {
MCoffeeBatchAddGoodsRequestVo addGoodsRequestVo = new MCoffeeBatchAddGoodsRequestVo();
addGoodsRequestVo.setAppId(requestVo.getAppId());
......@@ -410,6 +392,25 @@ public class ShoppingCartMCoffeeServiceImpl {
return baseResponse;
}
}
if (CollectionUtils.isNotEmpty(requestVo.getQtyInfoList())) {
BatchUpdateGoodsQtyRequestVo updateGoodsQtyRequestVo = new BatchUpdateGoodsQtyRequestVo();
updateGoodsQtyRequestVo.setAppId(requestVo.getAppId());
updateGoodsQtyRequestVo.setChannelType(requestVo.getChannelType());
updateGoodsQtyRequestVo.setCarVer(requestVo.getCarVer());
updateGoodsQtyRequestVo.setMenuType(requestVo.getMenuType());
updateGoodsQtyRequestVo.setReceiveId(requestVo.getReceiveId());
updateGoodsQtyRequestVo.setSessionId(requestVo.getSessionId());
updateGoodsQtyRequestVo.setVersion(requestVo.getVersion());
updateGoodsQtyRequestVo.setShopId(requestVo.getShopId());
updateGoodsQtyRequestVo.setPartnerId(requestVo.getPartnerId());
updateGoodsQtyRequestVo.setQtyInfoList(requestVo.getQtyInfoList());
baseResponse = this.batchUpdateGoodsQty(updateGoodsQtyRequestVo);
//批量更新失败,直接返回错误
if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse;
}
}
return baseResponse;
}
......@@ -430,7 +431,25 @@ public class ShoppingCartMCoffeeServiceImpl {
BaseResponse baseResponse = null;
for (GoodsQtyInfo goodsQtyInfo : requestVo.getQtyInfoList()) {
UpdateShoppingCartGoodsQtyRequestVo singleUpdateRequest = batchQtyRequestConvert2SingleQtyRequest(goodsQtyInfo,requestVo);
baseResponse = this.updateGoodsQty(singleUpdateRequest);
try {
baseResponse = this.updateGoodsQty(singleUpdateRequest);
}catch (ServiceException e){
if (singleUpdateRequest.getQty() == 0 && e.getResult().getCode().equals(ResponseResult.SHOPPING_CART_UPDATE_ERROR.getCode())){
ShoppingCartClearRequestVo clearRequestVo = new ShoppingCartClearRequestVo();
clearRequestVo.setAppId(singleUpdateRequest.getAppId());
clearRequestVo.setUserId(null);
clearRequestVo.setOperationType(3);
clearRequestVo.setTableNumber(null);
clearRequestVo.setCreateCollageUserId(singleUpdateRequest.getCreateCollageUserId());
clearRequestVo.setReceiveId(singleUpdateRequest.getReceiveId());
clearRequestVo.setSessionId(singleUpdateRequest.getSessionId());
clearRequestVo.setPartnerId(singleUpdateRequest.getPartnerId());
clearRequestVo.setShopId(singleUpdateRequest.getShopId());
clearRequestVo.setOrderType(singleUpdateRequest.getOrderType());
clearRequestVo.setChannelType(singleUpdateRequest.getChannelType());
baseResponse = this.clear(clearRequestVo);
}
}
if (!Objects.equals(ResponseResult.SUCCESS.getCode(),baseResponse.getCode())){
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