diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java index a2fdbde13..1ea7bcd8f 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java @@ -86,12 +86,34 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl dummyInventoryInfoEOS = this.list(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.in(BussDocumentLibraryEO::getId, Arrays.asList(dummyInventoryInfoEO.getIds().split(","))); List bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper); + List serialNumberList = new ArrayList<>(); + if(bussDocumentLibraryEOList.size() != 0){ + serialNumberList = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); + } + + //需要验重(验重--已添加过的不能再添加,提示该标准已存在清单中,不可添加) + if(dummyInventoryInfoEOS.size() != 0 && serialNumberList.size() != 0){ + List finalSerialNumberList = serialNumberList; + List collect = dummyInventoryInfoEOS.stream() + .filter(e -> finalSerialNumberList.contains(e.getSerialNumber())).collect(Collectors.toList()); + List serialNumberListTemp = collect.stream().map(DummyInventoryInfoEO::getSerialNumber).collect(Collectors.toList()); + if(serialNumberListTemp.size() > 0){ + if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){ + throw new JeroBootException(StringUtils.join(serialNumberListTemp,",") + "已存在不能重复添加,请重新选择"); + }else{ + throw new JeroBootException(StringUtils.join(serialNumberListTemp,",") + "Already exists and cannot be added again"); + } + } + } + List list = new ArrayList<>(); for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) { DummyInventoryInfoEO dummyInventoryInfoEOTemp = new DummyInventoryInfoEO();