refactor(接口定义): 资源池加载插件直接从MinIO获取

--story=1011108 --user=王孝刚 资源池加载插件直接从MinIO获取
https://www.tapd.cn/55049933/s/1331634
This commit is contained in:
wxg0103 2023-02-10 13:11:44 +08:00 committed by wxg0103
parent cf92376038
commit 54e94ac6d4
1 changed files with 7 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import io.metersphere.dto.ProjectJarConfig;
import io.metersphere.metadata.service.FileMetadataService; import io.metersphere.metadata.service.FileMetadataService;
import io.metersphere.utils.JarConfigUtils; import io.metersphere.utils.JarConfigUtils;
import io.metersphere.vo.BooleanPool; import io.metersphere.vo.BooleanPool;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -59,7 +60,7 @@ public class NewDriverManager {
FileMetadataService fileMetadataService = CommonBeanFactory.getBean(FileMetadataService.class); FileMetadataService fileMetadataService = CommonBeanFactory.getBean(FileMetadataService.class);
map.forEach((key, value) -> { map.forEach((key, value) -> {
//历史数据 //历史数据
value.stream().filter(s -> s.isHasFile()).forEach(s -> { value.stream().distinct().filter(s -> s.isHasFile()).forEach(s -> {
//获取文件内容 //获取文件内容
byte[] bytes = new byte[0]; byte[] bytes = new byte[0];
// 兼容历史数据 // 兼容历史数据
@ -72,9 +73,11 @@ public class NewDriverManager {
File.separator, File.separator,
String.valueOf(s.getUpdateTime()), ".jar"), bytes); String.valueOf(s.getUpdateTime()), ".jar"), bytes);
}); });
List<String> jarIds = value.stream().filter(s -> !s.isHasFile()).map(ProjectJarConfig::getId).collect(Collectors.toList()); List<String> jarIds = value.stream().distinct().filter(s -> !s.isHasFile()).map(ProjectJarConfig::getId).collect(Collectors.toList());
List<FileInfoDTO> fileInfoDTOS = fileMetadataService.downloadFileByIds(jarIds); if (CollectionUtils.isNotEmpty(jarIds)) {
ApiFileUtil.createFiles(fileInfoDTOS, key, value); List<FileInfoDTO> fileInfoDTOS = fileMetadataService.downloadFileByIds(jarIds);
ApiFileUtil.createFiles(fileInfoDTOS, key, value);
}
}); });
} }
} }