Authored by wujiexiang

add log

... ... @@ -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();
}
... ...
... ... @@ -9,9 +9,9 @@ import java.util.List;
* Created by shengguo.cai on 2018/11/20.
*/
public interface CouponProductLimitMapper {
void deleteByCouponId(@Param("id") Integer id);
int deleteByCouponId(@Param("id") Integer id);
void insertBatchByProductIds(@Param("productIds") List<Integer> productIds, @Param("limitType") int limitType, @Param("couponId") int couponId);
int insertBatchByProductIds(@Param("productIds") List<Integer> productIds, @Param("limitType") int limitType, @Param("couponId") int couponId);
List<CouponProductLimit> selectByCouponId(@Param("id") Integer id);
... ...