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

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

View File

@ -165,12 +165,16 @@ public class FileAssociationService {
private List<BodyFile> getRefFiles(Body body) {
List<BodyFile> files = new ArrayList<>();
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.getKvs())) {
body.getKvs().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;
}
}