From 5464b742dc54b62d041fc91bbd005b6f8907d065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E5=A4=A7=E9=94=90?= <1070211640@qq.com> Date: Tue, 19 Mar 2024 16:10:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=8F=96=E6=B6=88=E7=8A=B6=E6=80=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/impl/DatasetServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java index edfa83bd..8a072593 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetServiceImpl.java @@ -184,16 +184,16 @@ public class DatasetServiceImpl implements DatasetService { */ @Override - public ResponseEntity downloadDataset(Integer id) { + public ResponseEntity 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("下载数据集文件错误"); } }