commit
e009604595
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user