fix(文件管理): 异常数据保护

This commit is contained in:
fit2-zhao 2022-08-19 09:37:47 +08:00 committed by fit2-zhao
parent 627f75172b
commit ea2b7e9649
1 changed files with 10 additions and 6 deletions

View File

@ -165,12 +165,16 @@ public class FileAssociationService {
private List<BodyFile> getRefFiles(Body body) { private List<BodyFile> getRefFiles(Body body) {
List<BodyFile> files = new ArrayList<>(); List<BodyFile> files = new ArrayList<>();
body.getKvs().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> { if (body != null && !CollectionUtils.isEmpty(body.getKvs())) {
files.addAll(keyValue.getFiles().stream().filter(BodyFile::isRef).collect(Collectors.toList())); body.getKvs().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> {
}); files.addAll(keyValue.getFiles().stream().filter(BodyFile::isRef).collect(Collectors.toList()));
body.getBinary().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> { });
files.addAll(keyValue.getFiles().stream().filter(BodyFile::isRef).collect(Collectors.toList())); }
}); if (body != null && !CollectionUtils.isEmpty(body.getBinary())) {
body.getBinary().stream().filter(KeyValue::isFile).filter(KeyValue::isEnable).forEach(keyValue -> {
files.addAll(keyValue.getFiles().stream().filter(BodyFile::isRef).collect(Collectors.toList()));
});
}
return files; return files;
} }
} }