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