修复无法新建批发商品
This commit is contained in:
parent
1ecd32027e
commit
a3c4e72902
@ -36,8 +36,8 @@ public class PreventDuplicateSubmissionsInterceptor {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Long count = cache.incr(getParams(), preventDuplicateSubmissions.expire());
|
Long count = cache.incr(getParams(), preventDuplicateSubmissions.expire());
|
||||||
//如果超过1或者设置的参数,则表示重复提交了
|
//如果超过2或者设置的参数,则表示重复提交了
|
||||||
if (count.intValue() >= 1) {
|
if (count.intValue() >= 2) {
|
||||||
throw new ServiceException(ResultCode.LIMIT_ERROR);
|
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.collection.CollUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.lili.common.enums.ResultCode;
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||||
@ -38,7 +39,9 @@ public class WholesaleSaleModelRenderImpl implements SalesModelRender {
|
|||||||
Assert.notEmpty(goodsOperationDTO.getWholesaleList(), "批发规则不能为空");
|
Assert.notEmpty(goodsOperationDTO.getWholesaleList(), "批发规则不能为空");
|
||||||
this.checkWholesaleList(goodsOperationDTO.getWholesaleList());
|
this.checkWholesaleList(goodsOperationDTO.getWholesaleList());
|
||||||
List<Wholesale> collect = goodsOperationDTO.getWholesaleList().stream().sorted(Comparator.comparing(Wholesale::getPrice)).collect(Collectors.toList());
|
List<Wholesale> 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);
|
wholesaleService.saveOrUpdateBatch(collect);
|
||||||
goodsSku.setPrice(collect.get(0).getPrice());
|
goodsSku.setPrice(collect.get(0).getPrice());
|
||||||
goodsSku.setCost(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.setPrice(collect.get(0).getPrice());
|
||||||
skus.setCost(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);
|
wholesaleService.saveOrUpdateBatch(collect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user