|
@@ -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
|
- parseSkupForbidType(req);
|
192
|
+ parseSkupAllowType(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());
|
|
@@ -256,26 +256,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
@@ -256,26 +256,36 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
256
|
return new ApiResponse.ApiResponseBuilder().build();
|
256
|
return new ApiResponse.ApiResponseBuilder().build();
|
257
|
}
|
257
|
}
|
258
|
|
258
|
|
259
|
- private void parseSkupForbidType(CouponSaveUpdateReq req) {
|
|
|
260
|
- if (StringUtils.isBlank(req.getSkupForbidType())) {
|
|
|
261
|
- req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
|
|
|
262
|
- return;
|
|
|
263
|
- }
|
|
|
264
|
- List<String> limitTypes = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(req.getSkupForbidType());
|
|
|
265
|
- if (CollectionUtils.isEmpty(limitTypes)) {
|
|
|
266
|
- req.setSkupForbidType(SKUP_FORBID_TYPE_NONE);
|
|
|
267
|
- return;
|
|
|
268
|
- }
|
|
|
269
|
- for (String limitType : limitTypes) {
|
|
|
270
|
- if (!limitType.matches("\\d+")) {
|
|
|
271
|
- throw new ServiceException(400, "错误:不合法的限制类型");
|
|
|
272
|
- }
|
|
|
273
|
- if (!SkupType.of(Integer.parseInt(limitType)).isPresent() && !SKUP_FORBID_TYPE_NONE.equals(limitType)) {
|
|
|
274
|
- throw new ServiceException(401, "错误:不合法的限制类型");
|
|
|
275
|
- }
|
|
|
276
|
- }
|
|
|
277
|
- req.setSkupForbidType(Joiner.on(",").join(limitTypes));
|
|
|
278
|
- }
|
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;
|
|
|
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
|
+// }
|
279
|
|
289
|
|
280
|
private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) {
|
290
|
private void saveProductLimitItems(CouponSaveUpdateReq req, int productLimitType, List<Integer> productIds) {
|
281
|
if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){
|
291
|
if(req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_SPECIALPRODUCT || req.getProductLimitType() == Coupon.PRODUCTLIMITTYPE_EXCLUDE){
|