Authored by LUOXC

限制香港地区用券

package com.yohoufo.order.charge;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
import com.yohobuy.ufo.model.promotion.UserCouponsBo;
import com.yohobuy.ufo.model.promotion.constant.CouponProductLimitTypeEnum;
import com.yohobuy.ufo.model.promotion.constant.CouponUseLimitTypeEnum;
... ... @@ -161,4 +162,20 @@ public class CouponRuleMatcher {
return true;
}
}
private static class SkupRegionRuleMatcher implements IRuleMatcher {
@Override
public String ruleName() {
return "SkupRegion";
}
@Override
public boolean match(ChargeGoods chargeGoods, UserCouponsBo couponsBo) {
// 香港地区不支持优惠券使用
if (chargeGoods.getRegion() == RegionEnum.HONGKONG){
return false;
}
return true;
}
}
}
... ...
package com.yohoufo.order.charge.model;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
import com.yohobuy.ufo.model.order.constants.SkupType;
import lombok.Data;
import lombok.ToString;
... ... @@ -23,6 +24,8 @@ public class ChargeGoods {
private SkupType skupType;
private RegionEnum region;
/**
* 商品金额
*/
... ...
... ... @@ -287,6 +287,7 @@ public class ShoppingServiceImpl implements IShoppingService {
.goodsPrice(skupInfo.getGoodsPrice())
.productId(skupInfo.getProductId())
.attributes(skupAttr)
.region(RegionEnum.getRegion(skupInfo.getRegion()).orElse(RegionEnum.MAINLAND))
.skup(skupInfo.getId())
.activityCutPrice(BigDecimal.ZERO)
.skupType(skupType)
... ...