|
@@ -201,7 +201,10 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addGoods(List<GoodsWrapper.Goods> goodsList, Integer operatorId) {
|
|
|
- List<String> snList = goodsList.stream().map(GoodsWrapper.Goods::getSn).distinct().collect(Collectors.toList());
|
|
|
+ List<String> snList = goodsList.stream().map(GoodsWrapper.Goods::getSn).collect(Collectors.toList());
|
|
|
+ if (snList.size() != new HashSet<>(snList).size()) {
|
|
|
+ throw new BizException("商品货号重复");
|
|
|
+ }
|
|
|
List<Goods> bySns = goodsDao.findBySns(snList);
|
|
|
if (!CollectionUtils.isEmpty(bySns)) {
|
|
|
throw new BizException("商品货号重复");
|