Commit 3bb6eb3f by yu.sun

sunyu::update::checkout cartInfo about coupon disable

parent c9fac5bb
......@@ -51,6 +51,11 @@ public class ShoppingCartConstant {
public static final String CART_PRODUCT_INVALID_STATE = "您选择的【$spuName】商品已失效;";
/**
* 优惠券不满足使用条件
*/
public static final String COUPON_IS_DISABLE = "您选择的【$couponName】不满足使用条件";
/**
* 必选商品组无勾选商品
*/
public static final int PRODUCT_GROUP_EMPTY= 109;
......
......@@ -51,6 +51,10 @@ public class CartGoods {
* 商品券code
*/
private String couponCode;
/**
* 商品券名称
*/
private String couponName;
private String spuId;
private String skuId;
......
......@@ -1476,20 +1476,24 @@ public class ShoppingCartMCoffeeServiceImpl {
List<String> invalidSpu = new ArrayList<>();
List<String> notFoundSpu = new ArrayList<>();
List<String> changePriceSpu = new ArrayList<>();
List<String> disableCoupon = new ArrayList<>();
for (int i = 0; i < validateResult.getFailureList().size(); i++) {
checkCartRequest.getShoppingCartGoodsResponseVo().setChanged(true);
ValiadShopProductResult validaProduct = validateResult.getFailureList().get(i);
for (com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods cartGoods : checkCartRequest.getCartGoodsList()) {
if (cartGoods.getSkuId().equals(validaProduct.getSkuId())) {
String spuName = null == validaProduct.getProductType() ? cartGoods.getSpuName() : validaProduct.getProductType().getName();
String couponName = StringUtils.isNotEmpty(cartGoods.getCouponName()) ? cartGoods.getCouponName() : "";
if (PRODUCT_DOWN == validaProduct.getCode()) {
invalidSpu.add(spuName);
disableCoupon.add(couponName);
cartGoodsStates.setHasInvalidGoods(true);
cartGoods.setCartGoodsUid(null);
break;
}
if (PRODUCT_NOTFOUND == validaProduct.getCode()) {
notFoundSpu.add(spuName);
disableCoupon.add(couponName);
cartGoodsStates.setHasInvalidGoods(true);
cartGoods.setCartGoodsUid(null);
break;
......@@ -1520,6 +1524,10 @@ public class ShoppingCartMCoffeeServiceImpl {
toastMsg = toastMsg.concat(CART_PRODUCT_PRICE_CHANGE.replace("$spuName",StringUtils.join(changePriceSpu,",")));
}
if (CollectionUtils.isNotEmpty(disableCoupon)){
toastMsg = toastMsg.concat(COUPON_IS_DISABLE.replace("$couponName",StringUtils.join(disableCoupon,",")));
}
checkCartRequest.getShoppingCartGoodsResponseVo().setToastMsg(toastMsg);
setToastMsgIfNotExist(checkCartRequest.getShoppingCartGoodsResponseVo(), com.freemud.sdk.api.assortment.shoppingcart.constant.ShoppingCartConstant.SHOPPING_CART_GOODS_CHANGE);
......
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