From b6f01bc2d061dac5a09ca712144ab9de41382b9b Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 6 Mar 2025 21:00:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(common):=20=E4=BC=98=E5=8C=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 Hutool 的 FileUtil 类将文件大小转换为更易读的格式 - 更新 README 中的 ContiNew Starter 版本号至 2.9.0 --- README.md | 4 ++-- .../admin/common/config/exception/GlobalExceptionHandler.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e476a64..74816511 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Release -ContiNew Starter +ContiNew Starter Spring Boot @@ -231,7 +231,7 @@ public class DeptController extends BaseControllerArco Design | 2.56.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 | | TypeScript | 5.0.4 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 | | Vite | 5.1.5 | 下一代的前端工具链,为开发提供极速响应。 | -| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.8.3 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | +| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.9.0 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | | Spring Boot | 3.2.12 | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) | | Undertow | 2.3.17.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 | | Sa-Token + JWT | 1.39.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 | diff --git a/continew-common/src/main/java/top/continew/admin/common/config/exception/GlobalExceptionHandler.java b/continew-common/src/main/java/top/continew/admin/common/config/exception/GlobalExceptionHandler.java index 23e88a90..5b34dddd 100644 --- a/continew-common/src/main/java/top/continew/admin/common/config/exception/GlobalExceptionHandler.java +++ b/continew-common/src/main/java/top/continew/admin/common/config/exception/GlobalExceptionHandler.java @@ -16,6 +16,7 @@ package top.continew.admin.common.config.exception; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.text.CharSequenceUtil; import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; @@ -94,7 +95,8 @@ public class GlobalExceptionHandler { } else { return defaultFail; } - return R.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()), "请上传小于 %s MB 的文件".formatted(Long.parseLong(sizeLimit) / 1024 / 1024)); + return R.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()), "请上传小于 %s 的文件".formatted(FileUtil + .readableFileSize(Long.parseLong(sizeLimit)))); } /**