|
|
|
@@ -184,16 +184,16 @@ public class DatasetServiceImpl implements DatasetService { |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResponseEntity<InputStreamResource> downloadDataset(Integer id) { |
|
|
|
public ResponseEntity<InputStreamResource> downloadDataset(Integer id) throws Exception { |
|
|
|
DatasetVersion datasetVersion = this.datasetVersionDao.queryById(id); |
|
|
|
if (datasetVersion == null) { |
|
|
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null); |
|
|
|
throw new Exception("未找到该版本下数据集"); |
|
|
|
} |
|
|
|
|
|
|
|
// 从数据库中获取存储路径(即MinIO中的对象名称) |
|
|
|
String objectName = datasetVersion.getUrl(); |
|
|
|
if(objectName == null || objectName.isEmpty() ){ |
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); |
|
|
|
throw new Exception("未找到该版本数据集文件"); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
@@ -210,7 +210,7 @@ public class DatasetServiceImpl implements DatasetService { |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); |
|
|
|
throw new Exception("下载数据集文件错误"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|