From a3c4e72902f103129679486fb6f5e67c8f49f0dd Mon Sep 17 00:00:00 2001 From: paulGao Date: Tue, 31 May 2022 16:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E6=89=B9=E5=8F=91=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PreventDuplicateSubmissionsInterceptor.java | 4 ++-- .../sku/render/impl/WholesaleSaleModelRenderImpl.java | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) 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); }