|
|
|
@@ -176,15 +176,15 @@ public class ModelsServiceImpl implements ModelsService { |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResponseEntity<InputStreamResource> downloadModels(Integer id) { |
|
|
|
public ResponseEntity<InputStreamResource> downloadModels(Integer id) throws Exception { |
|
|
|
ModelsVersion modelsVersion = this.modelsVersionDao.queryById(id); |
|
|
|
if (modelsVersion == null) { |
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); |
|
|
|
throw new Exception("未找到该版本模型"); |
|
|
|
} |
|
|
|
// 从数据库中获取存储路径(即MinIO中的对象名称) |
|
|
|
String objectName = modelsVersion.getUrl(); |
|
|
|
if(objectName == null || objectName.isEmpty() ){ |
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); |
|
|
|
throw new Exception("未找到该版本模型文件"); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
@@ -200,7 +200,7 @@ public class ModelsServiceImpl implements ModelsService { |
|
|
|
.body(resource); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); |
|
|
|
throw new Exception("下载模型文件错误"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|