文档库导入--编号验重且提示
This commit is contained in:
+28
-7
@@ -1571,13 +1571,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
String serialNumber = StringUtils.valueOf(map.get("serial_number"));
|
||||
//String serialNumber = StringUtils.valueOf(map.get("serial_number"));
|
||||
//编码验重
|
||||
List<BussDocumentLibraryEO> list = this.list();
|
||||
if(list.size() != 0){
|
||||
List<String> serialNumberList = list.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList());
|
||||
if(serialNumberList.contains(serialNumber)){
|
||||
throw new JeroBootException("编号已存在不能重复添加");
|
||||
}
|
||||
}
|
||||
// List<BussDocumentLibraryEO> list = this.list();
|
||||
// if(list.size() != 0){
|
||||
// List<String> serialNumberList = list.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList());
|
||||
// if(serialNumberList.contains(serialNumber)){
|
||||
// throw new JeroBootException("编号已存在不能重复添加");
|
||||
// }
|
||||
// }
|
||||
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String issueTime = (String) (map.get("issue_time"));
|
||||
@@ -5453,6 +5453,27 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
throw new JeroBootException(html);
|
||||
} else {
|
||||
//验证重复的标准号
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
if (mapList.size() != 0) {
|
||||
for (Map<String, Object> map : mapList) {
|
||||
serialNumberList.add(StringUtils.valueOf(map.get("serial_number")));
|
||||
}
|
||||
}
|
||||
List<BussDocumentLibraryEO> list = this.list();
|
||||
if(list.size() != 0){
|
||||
List<BussDocumentLibraryEO> serialNumberListTemp = list.stream()
|
||||
.filter(e -> serialNumberList.contains(e.getSerialNumber())).collect(Collectors.toList());
|
||||
if(serialNumberListTemp.size() != 0){
|
||||
List<String> collect = serialNumberListTemp.stream().map(BussDocumentLibraryEO::getSerialNumber).distinct().collect(Collectors.toList());
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException(StringUtils.join(collect,",")+" 编号已存在不能重复添加");
|
||||
}else{
|
||||
throw new JeroBootException(StringUtils.join(collect,",")+" already exists and cannot be added again");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mapList.size() != 0) {
|
||||
for (Map<String, Object> map : mapList) {
|
||||
this.addInfo(map);
|
||||
|
||||
Reference in New Issue
Block a user