|
@@ -189,7 +189,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
@@ -189,7 +189,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
189
|
if (!couponTypeEnum.isPresent()){
|
189
|
if (!couponTypeEnum.isPresent()){
|
190
|
throw new ServiceException(400, "错误:不合法的优惠券类型");
|
190
|
throw new ServiceException(400, "错误:不合法的优惠券类型");
|
191
|
}
|
191
|
}
|
192
|
- parseSkupAllowType(req);
|
192
|
+ parseSkupForbidType(req);
|
193
|
|
193
|
|
194
|
int productLimitType = req.getProductLimitType().intValue();
|
194
|
int productLimitType = req.getProductLimitType().intValue();
|
195
|
List<Integer> productIds = getProductIdsAndCheckProductLimitParam(productLimitType,req.getProductLimitValue());
|
195
|
List<Integer> productIds = getProductIdsAndCheckProductLimitParam(productLimitType,req.getProductLimitValue());
|
|
@@ -257,36 +257,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
@@ -257,36 +257,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
257
|
}
|
257
|
}
|
258
|
|
258
|
|
259
|
|
259
|
|
260
|
- private void parseSkupAllowType(CouponSaveUpdateReq req) {
|
|
|
261
|
- if (StringUtils.isBlank(req.getSkupAllowType())) {
|
|
|
262
|
- throw new ServiceException(403, "可使用该优惠券的商品属性不能为空");
|
|
|
263
|
- }
|
|
|
264
|
- List<String> allowAttributeTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupAllowType());
|
|
|
265
|
- req.setSkupAllowType(Joiner.on(",").join(allowAttributeTypes));
|
|
|
266
|
- }
|
|
|
267
|
-
|
|
|
268
|
-
|
|
|
269
|
-// private void parseSkupForbidType(CouponSaveUpdateReq req) {
|
|
|
270
|
-// if (StringUtils.isBlank(req.getSkupForbidType())) {
|
|
|
271
|
-// req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
|
|
|
272
|
-// return;
|
260
|
+// private void parseSkupAllowType(CouponSaveUpdateReq req) {
|
|
|
261
|
+// if (StringUtils.isBlank(req.getSkupAllowType())) {
|
|
|
262
|
+// throw new ServiceException(403, "可使用该优惠券的商品属性不能为空");
|
273
|
// }
|
263
|
// }
|
274
|
-// List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());
|
|
|
275
|
-// if (CollectionUtils.isEmpty(limitTypes)) {
|
|
|
276
|
-// req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
|
|
|
277
|
-// return;
|
|
|
278
|
-// }
|
|
|
279
|
-// for (String limitType : limitTypes) {
|
|
|
280
|
-// if (!limitType.matches("\\d+")) {
|
|
|
281
|
-// throw new ServiceException(400, "错误:不合法的限制类型");
|
|
|
282
|
-// }
|
|
|
283
|
-// if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {
|
|
|
284
|
-// throw new ServiceException(401, "错误:不合法的限制类型");
|
|
|
285
|
-// }
|
|
|
286
|
-// }
|
|
|
287
|
-// req.setSkupForbidType(Joiner.on(",").join(limitTypes));
|
264
|
+// List<String> allowAttributeTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupAllowType());
|
|
|
265
|
+// req.setSkupAllowType(Joiner.on(",").join(allowAttributeTypes));
|
288
|
// }
|
266
|
// }
|
289
|
|
267
|
|
|
|
268
|
+
|
|
|
269
|
+ private void parseSkupForbidType(CouponSaveUpdateReq req) {
|
|
|
270
|
+ if (StringUtils.isBlank(req.getSkupForbidType())) {
|
|
|
271
|
+ req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
|
|
|
272
|
+ return;
|
|
|
273
|
+ }
|
|
|
274
|
+ List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());
|
|
|
275
|
+ if (CollectionUtils.isEmpty(limitTypes)) {
|
|
|
276
|
+ req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
|
|
|
277
|
+ return;
|
|
|
278
|
+ }
|
|
|
279
|
+ for (String limitType : limitTypes) {
|
|
|
280
|
+ if (!limitType.matches("\\d+")) {
|
|
|
281
|
+ throw new ServiceException(400, "错误:不合法的限制类型");
|
|
|
282
|
+ }
|
|
|
283
|
+ if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {
|
|
|
284
|
+ throw new ServiceException(401, "错误:不合法的限制类型");
|
|
|
285
|
+ }
|
|
|
286
|
+ }
|
|
|
287
|
+ req.setSkupForbidType(Joiner.on(",").join(limitTypes));
|
|
|
288
|
+ }
|
|
|
289
|
+
|
290
|
private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) {
|
290
|
private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) {
|
291
|
if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){
|
291
|
if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){
|
292
|
// 清理之前的记录
|
292
|
// 清理之前的记录
|