diff --git a/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java b/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java index 77a3a66b..8f6decfe 100644 --- a/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java +++ b/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java @@ -36,8 +36,8 @@ public class PreventDuplicateSubmissionsInterceptor { try { Long count = cache.incr(getParams(), preventDuplicateSubmissions.expire()); - //如果超过1或者设置的参数,则表示重复提交了 - if (count.intValue() >= 1) { + //如果超过2或者设置的参数,则表示重复提交了 + if (count.intValue() >= 2) { throw new ServiceException(ResultCode.LIMIT_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/goods/sku/render/impl/WholesaleSaleModelRenderImpl.java b/framework/src/main/java/cn/lili/modules/goods/sku/render/impl/WholesaleSaleModelRenderImpl.java index ea18054e..a63660cb 100644 --- a/framework/src/main/java/cn/lili/modules/goods/sku/render/impl/WholesaleSaleModelRenderImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/sku/render/impl/WholesaleSaleModelRenderImpl.java @@ -2,6 +2,7 @@ package cn.lili.modules.goods.sku.render.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; +import cn.hutool.core.text.CharSequenceUtil; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.goods.entity.dos.GoodsSku; @@ -38,7 +39,9 @@ public class WholesaleSaleModelRenderImpl implements SalesModelRender { Assert.notEmpty(goodsOperationDTO.getWholesaleList(), "批发规则不能为空"); this.checkWholesaleList(goodsOperationDTO.getWholesaleList()); List collect = goodsOperationDTO.getWholesaleList().stream().sorted(Comparator.comparing(Wholesale::getPrice)).collect(Collectors.toList()); - wholesaleService.removeByGoodsId(goodsOperationDTO.getGoodsId()); + if (CharSequenceUtil.isNotEmpty(goodsOperationDTO.getGoodsId())) { + wholesaleService.removeByGoodsId(goodsOperationDTO.getGoodsId()); + } wholesaleService.saveOrUpdateBatch(collect); goodsSku.setPrice(collect.get(0).getPrice()); goodsSku.setCost(collect.get(0).getPrice()); @@ -54,7 +57,9 @@ public class WholesaleSaleModelRenderImpl implements SalesModelRender { skus.setPrice(collect.get(0).getPrice()); skus.setCost(collect.get(0).getPrice()); } - wholesaleService.removeByGoodsId(goodsOperationDTO.getGoodsId()); + if (CharSequenceUtil.isNotEmpty(goodsOperationDTO.getGoodsId())) { + wholesaleService.removeByGoodsId(goodsOperationDTO.getGoodsId()); + } wholesaleService.saveOrUpdateBatch(collect); }