!171 修复无法新建批发商品

Merge pull request !171 from OceansDeep/feature/pg
This commit is contained in:
OceansDeep 2022-05-31 08:34:24 +00:00 committed by Gitee
commit e009604595
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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<Wholesale> collect = goodsOperationDTO.getWholesaleList().stream().sorted(Comparator.comparing(Wholesale::getPrice)).collect(Collectors.toList());
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());
}
if (CharSequenceUtil.isNotEmpty(goodsOperationDTO.getGoodsId())) {
wholesaleService.removeByGoodsId(goodsOperationDTO.getGoodsId());
}
wholesaleService.saveOrUpdateBatch(collect);
}