Commit c15145f7 by 孙昱

sunyu::update::new function about clear month-card information by couponCode

parent 95c0c85e
......@@ -42,4 +42,10 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
@NotEmpty(message = "商品信息不可为空")
private List<BatchGoodsInfoVo> goodsInfos;
/**
* 根据券号清除当前购物车中月卡及商品信息
*/
private String redundancyCouponCode;
}
\ No newline at end of file
package cn.freemud.entities.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class ClearCouponCodeRequestVo extends BaseRequestVo {
@NotEmpty(message = "券号不可为空")
private String redundancyCouponCode;
}
......@@ -243,9 +243,9 @@ public class ShoppingCartMCoffeeServiceImpl {
// 促销活动的优惠金额计算
calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, couponCode,
oldCartGoodsList, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo,null);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, oldCartGoodsList, null, tableNumber, this.shoppingCartBaseService);
newCartGoods = oldCartGoodsList;
}
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, oldCartGoodsList, null, tableNumber, this.shoppingCartBaseService);
newCartGoods = oldCartGoodsList;
// 返回购物车数据
setAddAndUpdateResponse(shoppingCartGoodsResponseVo, newCartGoods, null, ShoppingCartConstant.ADD_AND_UPDATE, null);
}
......@@ -383,6 +383,18 @@ public class ShoppingCartMCoffeeServiceImpl {
}
BaseResponse baseResponse;
//清除券信息
if (StringUtils.isNotEmpty(requestVo.getRedundancyCouponCode())){
ClearCouponCodeRequestVo clearCouponCodeRequestVo = new ClearCouponCodeRequestVo();
clearCouponCodeRequestVo.setRedundancyCouponCode(requestVo.getRedundancyCouponCode());
clearCouponCodeRequestVo.setSessionId(requestVo.getSessionId());
clearCouponCodeRequestVo.setPartnerId(requestVo.getPartnerId());
clearCouponCodeRequestVo.setShopId(requestVo.getShopId());
clearCouponCodeRequestVo.setOrderType(requestVo.getOrderType());
clearCouponCodeRequestVo.setChannelType(requestVo.getChannelType());
baseResponse = clearCouponInfoByCode(clearCouponCodeRequestVo);
}
BatchUpdateGoodsQtyRequestVo updateGoodsQtyRequestVo = new BatchUpdateGoodsQtyRequestVo();
updateGoodsQtyRequestVo.setAppId(requestVo.getAppId());
updateGoodsQtyRequestVo.setChannelType(requestVo.getChannelType());
......@@ -445,6 +457,31 @@ public class ShoppingCartMCoffeeServiceImpl {
}
/**
* 根据券号清除券信息
* @param requestVo
* @return
*/
public BaseResponse clearCouponInfoByCode(ClearCouponCodeRequestVo requestVo){
if (StringUtils.isEmpty(requestVo.getShopId())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
}
String sessionId = requestVo.getSessionId();
// 获取用户信息
CustomerInfoVo assortmentCustomerInfoVo = getCustomerInfoVo(sessionId);
String userId = assortmentCustomerInfoVo.getMemberId();
String partnerId = requestVo.getPartnerId();
String storeId = requestVo.getShopId();
// 获取购物车商品
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, sessionId, "", shoppingCartBaseService);
for (CartGoods cartGoods : cartGoodsList) {
if (StringUtils.equals(cartGoods.getCouponCode(),requestVo.getRedundancyCouponCode())){
cartGoods.setCouponCode("");
}
}
return ResponseUtil.success();
}
/**
* 更新商品数量
*/
public BaseResponse updateGoodsQty(UpdateShoppingCartGoodsQtyRequestVo updateShoppingCartGoodsQtyRequestVo) {
......
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