Authored by LUOXC

限制香港地区用券

1 package com.yohoufo.order.charge; 1 package com.yohoufo.order.charge;
2 2
3 import com.google.common.collect.Lists; 3 import com.google.common.collect.Lists;
  4 +import com.yohobuy.ufo.model.order.constants.RegionEnum;
4 import com.yohobuy.ufo.model.promotion.UserCouponsBo; 5 import com.yohobuy.ufo.model.promotion.UserCouponsBo;
5 import com.yohobuy.ufo.model.promotion.constant.CouponProductLimitTypeEnum; 6 import com.yohobuy.ufo.model.promotion.constant.CouponProductLimitTypeEnum;
6 import com.yohobuy.ufo.model.promotion.constant.CouponUseLimitTypeEnum; 7 import com.yohobuy.ufo.model.promotion.constant.CouponUseLimitTypeEnum;
@@ -161,4 +162,20 @@ public class CouponRuleMatcher { @@ -161,4 +162,20 @@ public class CouponRuleMatcher {
161 return true; 162 return true;
162 } 163 }
163 } 164 }
  165 +
  166 + private static class SkupRegionRuleMatcher implements IRuleMatcher {
  167 + @Override
  168 + public String ruleName() {
  169 + return "SkupRegion";
  170 + }
  171 +
  172 + @Override
  173 + public boolean match(ChargeGoods chargeGoods, UserCouponsBo couponsBo) {
  174 + // 香港地区不支持优惠券使用
  175 + if (chargeGoods.getRegion() == RegionEnum.HONGKONG){
  176 + return false;
  177 + }
  178 + return true;
  179 + }
  180 + }
164 } 181 }
1 package com.yohoufo.order.charge.model; 1 package com.yohoufo.order.charge.model;
2 2
  3 +import com.yohobuy.ufo.model.order.constants.RegionEnum;
3 import com.yohobuy.ufo.model.order.constants.SkupType; 4 import com.yohobuy.ufo.model.order.constants.SkupType;
4 import lombok.Data; 5 import lombok.Data;
5 import lombok.ToString; 6 import lombok.ToString;
@@ -23,6 +24,8 @@ public class ChargeGoods { @@ -23,6 +24,8 @@ public class ChargeGoods {
23 24
24 private SkupType skupType; 25 private SkupType skupType;
25 26
  27 + private RegionEnum region;
  28 +
26 /** 29 /**
27 * 商品金额 30 * 商品金额
28 */ 31 */
@@ -287,6 +287,7 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -287,6 +287,7 @@ public class ShoppingServiceImpl implements IShoppingService {
287 .goodsPrice(skupInfo.getGoodsPrice()) 287 .goodsPrice(skupInfo.getGoodsPrice())
288 .productId(skupInfo.getProductId()) 288 .productId(skupInfo.getProductId())
289 .attributes(skupAttr) 289 .attributes(skupAttr)
  290 + .region(RegionEnum.getRegion(skupInfo.getRegion()).orElse(RegionEnum.MAINLAND))
290 .skup(skupInfo.getId()) 291 .skup(skupInfo.getId())
291 .activityCutPrice(BigDecimal.ZERO) 292 .activityCutPrice(BigDecimal.ZERO)
292 .skupType(skupType) 293 .skupType(skupType)