From 85703d02bf7d3566ec377e2384dab855db0fd5f9 Mon Sep 17 00:00:00 2001
From: gaoxq <376340421@qq.com>
Date: Thu, 2 Apr 2026 12:11:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../config/GlobalExceptionHandler.java | 43 ++++++++
web-vue/src/components/FileIcon.vue | 98 +++++++++++++++++++
2 files changed, 141 insertions(+)
create mode 100644 src/main/java/com/filesystem/config/GlobalExceptionHandler.java
create mode 100644 web-vue/src/components/FileIcon.vue
diff --git a/src/main/java/com/filesystem/config/GlobalExceptionHandler.java b/src/main/java/com/filesystem/config/GlobalExceptionHandler.java
new file mode 100644
index 0000000..a44b76b
--- /dev/null
+++ b/src/main/java/com/filesystem/config/GlobalExceptionHandler.java
@@ -0,0 +1,43 @@
+package com.filesystem.config;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import java.io.IOException;
+import java.util.Map;
+
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+
+ /**
+ * 处理所有运行时异常
+ */
+ @ExceptionHandler(RuntimeException.class)
+ public ResponseEntity> handleRuntimeException(RuntimeException e) {
+ e.printStackTrace();
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(Map.of("message", e.getMessage() != null ? e.getMessage() : "服务器内部错误"));
+ }
+
+ /**
+ * 处理 IO 异常(如 ZIP 压缩失败)
+ */
+ @ExceptionHandler(IOException.class)
+ public ResponseEntity> handleIOException(IOException e) {
+ e.printStackTrace();
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(Map.of("message", "文件操作失败: " + (e.getMessage() != null ? e.getMessage() : "未知错误")));
+ }
+
+ /**
+ * 处理所有其他异常
+ */
+ @ExceptionHandler(Exception.class)
+ public ResponseEntity> handleException(Exception e) {
+ e.printStackTrace();
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(Map.of("message", "服务器错误: " + (e.getMessage() != null ? e.getMessage() : "未知错误")));
+ }
+}
diff --git a/web-vue/src/components/FileIcon.vue b/web-vue/src/components/FileIcon.vue
new file mode 100644
index 0000000..4ee3e81
--- /dev/null
+++ b/web-vue/src/components/FileIcon.vue
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+