Authored by caoyan

Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/ufo-platform into test6.9.10

... ... @@ -189,7 +189,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
if (!couponTypeEnum.isPresent()){
throw new ServiceException(400, "错误:不合法的优惠券类型");
}
parseSkupAllowType(req);
parseSkupForbidType(req);
int productLimitType = req.getProductLimitType().intValue();
List<Integer> productIds = getProductIdsAndCheckProductLimitParam(productLimitType,req.getProductLimitValue());
... ... @@ -257,36 +257,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
}
private void parseSkupAllowType(CouponSaveUpdateReq req) {
if (StringUtils.isBlank(req.getSkupAllowType())) {
throw new ServiceException(403, "可使用该优惠券的商品属性不能为空");
}
List<String> allowAttributeTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupAllowType());
req.setSkupAllowType(Joiner.on(",").join(allowAttributeTypes));
}
// private void parseSkupForbidType(CouponSaveUpdateReq req) {
// if (StringUtils.isBlank(req.getSkupForbidType())) {
// req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
// return;
// private void parseSkupAllowType(CouponSaveUpdateReq req) {
// if (StringUtils.isBlank(req.getSkupAllowType())) {
// throw new ServiceException(403, "可使用该优惠券的商品属性不能为空");
// }
// List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());
// if (CollectionUtils.isEmpty(limitTypes)) {
// req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
// return;
// }
// for (String limitType : limitTypes) {
// if (!limitType.matches("\\d+")) {
// throw new ServiceException(400, "错误:不合法的限制类型");
// }
// if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {
// throw new ServiceException(401, "错误:不合法的限制类型");
// }
// }
// req.setSkupForbidType(Joiner.on(",").join(limitTypes));
// List<String> allowAttributeTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupAllowType());
// req.setSkupAllowType(Joiner.on(",").join(allowAttributeTypes));
// }
private void parseSkupForbidType(CouponSaveUpdateReq req) {
if (StringUtils.isBlank(req.getSkupForbidType())) {
req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
return;
}
List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());
if (CollectionUtils.isEmpty(limitTypes)) {
req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
return;
}
for (String limitType : limitTypes) {
if (!limitType.matches("\\d+")) {
throw new ServiceException(400, "错误:不合法的限制类型");
}
if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {
throw new ServiceException(401, "错误:不合法的限制类型");
}
}
req.setSkupForbidType(Joiner.on(",").join(limitTypes));
}
private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) {
if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){
// 清理之前的记录
... ...
... ... @@ -21,13 +21,13 @@
<result column="pid" property="pid" jdbcType="INTEGER" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="skup_forbid_type" property="skupForbidType" jdbcType="VARCHAR" />
<result column="skup_allow_type" property="skupAllowType" jdbcType="VARCHAR" />
<!--<result column="skup_allow_type" property="skupAllowType" jdbcType="VARCHAR" />-->
</resultMap>
<sql id="Base_Column_List">
id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num,
use_limit_type,use_limit_value,product_limit_type,product_limit_value,start_time,
end_time,status,create_time,pid,remark,skup_forbid_type,skup_forbid_type
end_time,status,create_time,pid,remark,skup_forbid_type
</sql>
<insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="param.id">
insert into coupon(id,coupon_token,coupon_name,coupon_amount,coupon_type,coupon_num,use_num,send_num,
... ... @@ -130,9 +130,6 @@
<if test="param.remark != null">
remark=#{param.remark},
</if>
<if test="param.skupAllowType != null">
skup_allow_type=#{param.skupAllowType},
</if>
</set>
where id = #{param.id}
</update>
... ...