虚拟清单--添加验重
This commit is contained in:
+23
-1
@@ -86,12 +86,34 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
*/
|
||||
@Override
|
||||
public void add(DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||
//需要验重(验重--已添加过的不能再添加,提示该标准已存在清单中,不可添加)
|
||||
if(StringUtils.isNotBlank(dummyInventoryInfoEO.getIds())){
|
||||
//虚拟清单详情表所有数据
|
||||
List<DummyInventoryInfoEO> dummyInventoryInfoEOS = this.list();
|
||||
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(BussDocumentLibraryEO::getId, Arrays.asList(dummyInventoryInfoEO.getIds().split(",")));
|
||||
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper);
|
||||
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
if(bussDocumentLibraryEOList.size() != 0){
|
||||
serialNumberList = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
//需要验重(验重--已添加过的不能再添加,提示该标准已存在清单中,不可添加)
|
||||
if(dummyInventoryInfoEOS.size() != 0 && serialNumberList.size() != 0){
|
||||
List<String> finalSerialNumberList = serialNumberList;
|
||||
List<DummyInventoryInfoEO> collect = dummyInventoryInfoEOS.stream()
|
||||
.filter(e -> finalSerialNumberList.contains(e.getSerialNumber())).collect(Collectors.toList());
|
||||
List<String> 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<DummyInventoryInfoEO> list = new ArrayList<>();
|
||||
for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) {
|
||||
DummyInventoryInfoEO dummyInventoryInfoEOTemp = new DummyInventoryInfoEO();
|
||||
|
||||
Reference in New Issue
Block a user