From 838215dce2591d234d7a98a115a8ddd9cbf159cb Mon Sep 17 00:00:00 2001 From: fanshuai <1141904845@qq.com> Date: Tue, 19 Mar 2024 15:58:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B=E4=B8=8D?= =?UTF-8?q?=E5=87=86=E8=BF=94=E5=9B=9E=E7=8A=B6=E6=80=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/service/ModelsService.java | 2 +- .../ruoyi/platform/service/impl/ModelsServiceImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java index e720f45c..7d79ea71 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java @@ -66,7 +66,7 @@ public interface ModelsService { String removeById(Integer id); - ResponseEntity downloadModels(Integer id); + ResponseEntity downloadModels(Integer id) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index c56252cf..bb8a7126 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -176,15 +176,15 @@ public class ModelsServiceImpl implements ModelsService { */ @Override - public ResponseEntity downloadModels(Integer id) { + public ResponseEntity 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("下载模型文件错误"); } }