Commit 2c3d9b4e by 徐康

太阳蛋优惠券校验

parent 67749415
package cn.freemud.enums;
public enum CouponExtendTypeEnum {
TYPE_11(11, "太阳蛋"),
;
private Integer code;
private String desc;
CouponExtendTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
...@@ -574,6 +574,7 @@ public class CheckMCCafeOrder { ...@@ -574,6 +574,7 @@ public class CheckMCCafeOrder {
} }
}); });
} }
List<String> skuIdList = shoppingCartGoodsDto.getProducts().stream().map(o -> o.getSkuId()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(mcCafeCouponVos)) { if(CollectionUtils.isNotEmpty(mcCafeCouponVos)) {
MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder() MCCafeCouponRequest mcCafeCouponRequest = MCCafeCouponRequest.builder()
.ver(88) .ver(88)
...@@ -607,6 +608,10 @@ public class CheckMCCafeOrder { ...@@ -607,6 +608,10 @@ public class CheckMCCafeOrder {
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用");
} }
} }
if(o.getCodeInfo().getExtend_type().equals(CouponExtendTypeEnum.TYPE_11.getCode()) && CollectionUtils.isNotEmpty(o.getCodeInfo().getBind_products())
&& !o.getCodeInfo().getBind_products().stream().filter(p -> skuIdList.contains(p.getSku_id())).findFirst().isPresent()) {
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "太阳蛋优惠券必须搭配固定商品同时购买");
}
}); });
} }
} }
......
...@@ -110,4 +110,16 @@ public class McdNetCouponInfoRespDto { ...@@ -110,4 +110,16 @@ public class McdNetCouponInfoRespDto {
*/ */
private List<McdNetCouponProductRespDto> products; private List<McdNetCouponProductRespDto> products;
/**
* 绑定商品
*/
private List<BindProductDto> bind_products;
@Data
public static class BindProductDto {
private String sku_id;
private String spu_id;
private String product_name;
}
} }
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