|
|
|
@@ -81,6 +81,12 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
String secretAccessKey; |
|
|
|
@Value("${minio.endpoint}") |
|
|
|
String endpoint; |
|
|
|
@Value("${minio.endpointIp}") |
|
|
|
String endpointIp; |
|
|
|
@Value("${minio.dataReleaseBucketName}") |
|
|
|
private String bucketName; |
|
|
|
@Value("${minio.platformDataBucketName}") |
|
|
|
private String platformDataBucketName; |
|
|
|
@Value("${git.endpoint}") |
|
|
|
String gitendpoint; |
|
|
|
@Value("${git.cloneEndpoint}") |
|
|
|
@@ -89,9 +95,6 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
String gitCloneEndpointIp; |
|
|
|
@Value("${git.projectDatasetId}") |
|
|
|
Integer projectDatasetId; |
|
|
|
|
|
|
|
@Value("${minio.dataReleaseBucketName}") |
|
|
|
private String bucketName; |
|
|
|
@Value("${git.localPath}") |
|
|
|
String localPathlocal; |
|
|
|
|
|
|
|
@@ -597,25 +600,27 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResponseEntity<InputStreamResource> downloadDatasetlocal(String filePath) throws Exception { |
|
|
|
File file = new File(filePath); |
|
|
|
|
|
|
|
if (!file.exists()) { |
|
|
|
throw new FileNotFoundException("File not found: " + filePath); |
|
|
|
} |
|
|
|
|
|
|
|
InputStreamResource resource = new InputStreamResource(new FileInputStream(file)); |
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
|
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName()); |
|
|
|
headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(file.length())); |
|
|
|
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE); |
|
|
|
|
|
|
|
return ResponseEntity.ok() |
|
|
|
.headers(headers) |
|
|
|
.contentLength(file.length()) |
|
|
|
.contentType(MediaType.APPLICATION_OCTET_STREAM) |
|
|
|
.body(resource); |
|
|
|
public String downloadDatasetlocal(String filePath) throws Exception { |
|
|
|
// File file = new File(filePath); |
|
|
|
// |
|
|
|
// if (!file.exists()) { |
|
|
|
// throw new FileNotFoundException("File not found: " + filePath); |
|
|
|
// } |
|
|
|
// |
|
|
|
// InputStreamResource resource = new InputStreamResource(new FileInputStream(file)); |
|
|
|
// |
|
|
|
// HttpHeaders headers = new HttpHeaders(); |
|
|
|
// headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName()); |
|
|
|
// headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(file.length())); |
|
|
|
// headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE); |
|
|
|
// |
|
|
|
// return ResponseEntity.ok() |
|
|
|
// .headers(headers) |
|
|
|
// .contentLength(file.length()) |
|
|
|
// .contentType(MediaType.APPLICATION_OCTET_STREAM) |
|
|
|
// .body(resource); |
|
|
|
String[] split = filePath.split("/"); |
|
|
|
return endpointIp + "/" + bucketName + "/" + platformDataBucketName + "/" + String.join("/", Arrays.copyOfRange(split, 3, split.length)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@@ -756,7 +761,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void privateToPublic(NewDatasetVo newDatasetVo) throws Exception { |
|
|
|
public void privateToPublic(NewDatasetVo newDatasetVo) throws Exception { |
|
|
|
//获取版本列表信息,每一个版本的配置文件都要更改 |
|
|
|
String token = gitService.checkoutToken(); |
|
|
|
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, newDatasetVo.getOwner(), newDatasetVo.getIdentifier()); |
|
|
|
@@ -781,7 +786,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("id", projectDetail.get("project_id")); |
|
|
|
param.put("is_public", true); |
|
|
|
gitService.updateProjectDetail(param,newDatasetVo.getOwner(),newDatasetVo.getIdentifier(),token); |
|
|
|
gitService.updateProjectDetail(param, newDatasetVo.getOwner(), newDatasetVo.getIdentifier(), token); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|