|
@@ -28,12 +28,15 @@ public class AlgorithmService {
|
|
|
@SneakyThrows
|
|
|
public ResponseBodyVO<String> check(String minioPath) {
|
|
|
|
|
|
+ String[] split = minioPath.split("\\.");
|
|
|
+ int length = split.length;
|
|
|
+ String s = split[length - 1];
|
|
|
|
|
|
//1 根据 minio 路径获取输入流
|
|
|
InputStream inputStream = MinioUtil.downloadToStream(minioClient, bucketName, minioPath);
|
|
|
//2 将输入流解压到临时目录
|
|
|
- String algorithmTarLinuxTempPath = linuxTempPath + minioPath;
|
|
|
- Set<String> pathList = FileUtil.decompress(inputStream, algorithmTarLinuxTempPath, ".tgz");
|
|
|
+ String algorithmTarLinuxTempPath = linuxTempPath + minioPath;
|
|
|
+ Set<String> pathList = FileUtil.decompress(inputStream, algorithmTarLinuxTempPath, "." + s);
|
|
|
//3 获取文件列表中是否又 docker-entrypoint.sh
|
|
|
boolean result = false;
|
|
|
for (String path : pathList) {
|
|
@@ -45,9 +48,9 @@ public class AlgorithmService {
|
|
|
|
|
|
FileUtil.rm(algorithmTarLinuxTempPath);
|
|
|
if (result) {
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "算法可用!", null);
|
|
|
} else {
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "算法不可用!", null);
|
|
|
}
|
|
|
|
|
|
}
|