|
@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
-import java.util.Set;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class AlgorithmService {
|
|
public class AlgorithmService {
|
|
@@ -26,7 +25,7 @@ public class AlgorithmService {
|
|
String linuxTempPath;
|
|
String linuxTempPath;
|
|
|
|
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
- public ResponseBodyVO<String> check(String minioPath) {
|
|
|
|
|
|
+ public ResponseBodyVO<String> check(String minioPath) {
|
|
|
|
|
|
String[] split = minioPath.split("\\.");
|
|
String[] split = minioPath.split("\\.");
|
|
int length = split.length;
|
|
int length = split.length;
|
|
@@ -34,24 +33,12 @@ public class AlgorithmService {
|
|
|
|
|
|
//1 根据 minio 路径获取输入流
|
|
//1 根据 minio 路径获取输入流
|
|
InputStream inputStream = MinioUtil.downloadToStream(minioClient, bucketName, minioPath);
|
|
InputStream inputStream = MinioUtil.downloadToStream(minioClient, bucketName, minioPath);
|
|
- //2 将输入流解压到临时目录
|
|
|
|
- String algorithmTarLinuxTempPath = linuxTempPath + minioPath;
|
|
|
|
- Set<String> pathList = FileUtil.decompress(inputStream, algorithmTarLinuxTempPath, "." + s);
|
|
|
|
- //3 获取文件列表中是否有 docker-entrypoint.sh
|
|
|
|
- boolean result = false;
|
|
|
|
- for (String path : pathList) {
|
|
|
|
- if (path.contains(".dockerenv")) {
|
|
|
|
- result = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- FileUtil.rm(algorithmTarLinuxTempPath);
|
|
|
|
- if (result) {
|
|
|
|
|
|
+// FileUtil.writeInputStreamToLocalFile();
|
|
|
|
+ //2 判断压缩包中是否有 docker-entrypoint.sh
|
|
|
|
+ if (FileUtil.scan(inputStream, "." + s, ".dockerenv")){
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "算法可用!", null);
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "算法可用!", null);
|
|
} else {
|
|
} else {
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "算法不可用!", null);
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "算法不可用!", null);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|