|
@@ -305,20 +305,19 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
@@ -305,20 +305,19 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
305
|
|
305
|
|
306
|
private void saveProductLimitItems(Integer couponId, List<ProductCondition> productConditions) {
|
306
|
private void saveProductLimitItems(Integer couponId, List<ProductCondition> productConditions) {
|
307
|
// 清理之前的记录
|
307
|
// 清理之前的记录
|
308
|
- couponProductLimitMapper.deleteByCouponId(couponId);
|
|
|
309
|
- int itemCount = 0;
|
308
|
+ int deletedCount = couponProductLimitMapper.deleteByCouponId(couponId);
|
|
|
309
|
+ int updateCount = 0;
|
310
|
// 重新插入
|
310
|
// 重新插入
|
311
|
if (CollectionUtils.isNotEmpty(productConditions)) {
|
311
|
if (CollectionUtils.isNotEmpty(productConditions)) {
|
312
|
// productIds 可能超过500个 每500个插入一次
|
312
|
// productIds 可能超过500个 每500个插入一次
|
313
|
//Iterable<List<Integer>> productIdBatch = Iterables.partition(productIds, 1000);
|
313
|
//Iterable<List<Integer>> productIdBatch = Iterables.partition(productIds, 1000);
|
314
|
for (ProductCondition pc : productConditions) {
|
314
|
for (ProductCondition pc : productConditions) {
|
315
|
if (CollectionUtils.isNotEmpty(pc.getProductIds())) {
|
315
|
if (CollectionUtils.isNotEmpty(pc.getProductIds())) {
|
316
|
- couponProductLimitMapper.insertBatchByProductIds(pc.getProductIds(), pc.getProductConditionType(), couponId);
|
|
|
317
|
- itemCount += pc.getProductIds().size();
|
316
|
+ updateCount += couponProductLimitMapper.insertBatchByProductIds(pc.getProductIds(), pc.getProductConditionType(), couponId);
|
318
|
}
|
317
|
}
|
319
|
}
|
318
|
}
|
320
|
}
|
319
|
}
|
321
|
- LOGGER.info("{} saveProductLimitItems count is {}", couponId, itemCount);
|
320
|
+ LOGGER.info("{} saveProductLimitItems, deletedCount:{}, updateCount:{}", couponId, deletedCount, updateCount);
|
322
|
}
|
321
|
}
|
323
|
|
322
|
|
324
|
private List<Integer> getProductIdsAndCheckProductLimitParam(int productLimitType, String productLimitValue) {
|
323
|
private List<Integer> getProductIdsAndCheckProductLimitParam(int productLimitType, String productLimitValue) {
|
|
@@ -383,6 +382,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
@@ -383,6 +382,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
383
|
//排除商品
|
382
|
//排除商品
|
384
|
jsonObject.put("excludeProductIds",Strings.listToDelimitedString(findProductIds(ProductLimitType.Exclude_Product.getLimitType(), productLimitList)));
|
383
|
jsonObject.put("excludeProductIds",Strings.listToDelimitedString(findProductIds(ProductLimitType.Exclude_Product.getLimitType(), productLimitList)));
|
385
|
//jsonObject.put("productLimits",productLimitList);
|
384
|
//jsonObject.put("productLimits",productLimitList);
|
|
|
385
|
+
|
|
|
386
|
+ LOGGER.info("{} coupon info:{}", id, jsonObject);
|
386
|
return new ApiResponse.ApiResponseBuilder().data(jsonObject).build();
|
387
|
return new ApiResponse.ApiResponseBuilder().data(jsonObject).build();
|
387
|
}
|
388
|
}
|
388
|
|
389
|
|