From 4ce49e120506481bb95c346b74f6ebe5cc92416c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=B4=AB=E5=BD=B1233?= <1440196015@qq.com>
Date: Fri, 18 Jul 2025 15:29:26 +0800
Subject: [PATCH] =?UTF-8?q?v2.0.0=20=E6=9B=B4=E6=96=B0=EF=BC=9A=20=20=20?=
=?UTF-8?q?=20=201=E3=80=81SpringBoot=E4=BB=8E3.1.1=E5=8D=87=E7=BA=A7?=
=?UTF-8?q?=E5=88=B03.5.3=20=20=20=20=202=E3=80=81JDK=E4=BB=8E17=E5=8D=87?=
=?UTF-8?q?=E7=BA=A7=E5=88=B021=E5=B9=B6=E5=BC=80=E5=90=AF=E8=99=9A?=
=?UTF-8?q?=E6=8B=9F=E7=BA=BF=E7=A8=8B=20=20=20=20=203=E3=80=81=E5=88=A0?=
=?UTF-8?q?=E9=99=A4RocksDB=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=EF=BC=8C?=
=?UTF-8?q?=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8=E8=AF=A5=E7=BC=93=E5=AD=98?=
=?UTF-8?q?=E6=96=B9=E6=A1=88=20=20=20=20=204=E3=80=81=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E6=96=B9=E5=BC=8F=EF=BC=8C?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8StreamingResponseBody=EF=BC=8C=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E5=A4=A7=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=20=20=20?=
=?UTF-8?q?=20=205=E3=80=81=E5=BC=95=E5=85=A5metona-cache-spring-boot-star?=
=?UTF-8?q?ter=EF=BC=8C=E4=BD=BF=E7=94=A8=E6=AD=A4=E7=BC=93=E5=AD=98?=
=?UTF-8?q?=E6=96=B9=E6=A1=88=20=20=20=20=206=E3=80=81=E9=87=8D=E6=9E=84?=
=?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=97=A5=E5=BF=97=E9=A1=B5=E9=9D=A2=E5=8F=8A?=
=?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=B8=8D=E5=86=8D?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AF=BB=E5=8F=96=E6=97=A5=E5=BF=97=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E6=96=B9=E5=BC=8F=EF=BC=8C=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8B=A6=E6=88=AA=E5=99=A8=E5=AE=9E=E6=97=B6?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=97=A5=E5=BF=97=20=20=20=20=207=E3=80=81?=
=?UTF-8?q?=E4=B8=8D=E5=86=8D=E7=94=9F=E6=88=90=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=EF=BC=8C=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BB=8EINFO=E6=94=B9=E4=B8=BADEBUG=EF=BC=8C?=
=?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9B=B4=E8=AF=A6=E7=BB=86=E7=9A=84=E5=86=85?=
=?UTF-8?q?=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 11 +-
pom.xml | 4 +-
.../cn/somkit/fmt/action/LoggingAction.java | 9 --
.../cn/somkit/fmt/action/SystemAction.java | 53 -------
.../java/cn/somkit/fmt/config/FmtConfig.java | 41 -----
.../java/cn/somkit/fmt/utils/ParamUtils.java | 63 --------
.../java/cn/somkit/fmt/utils/PathUtils.java | 53 -------
src/main/resources/bin/startup.bat | 2 +-
src/main/resources/bin/startup.sh | 4 +-
src/main/resources/templates/download.html | 4 -
src/main/resources/templates/system.html | 150 ------------------
src/main/resources/templates/upload.html | 4 -
版本记录/readme.md | 12 +-
13 files changed, 17 insertions(+), 393 deletions(-)
delete mode 100644 src/main/java/cn/somkit/fmt/action/SystemAction.java
delete mode 100644 src/main/java/cn/somkit/fmt/config/FmtConfig.java
delete mode 100644 src/main/java/cn/somkit/fmt/utils/ParamUtils.java
delete mode 100644 src/main/java/cn/somkit/fmt/utils/PathUtils.java
delete mode 100644 src/main/resources/templates/system.html
diff --git a/README.md b/README.md
index 9174536..ba903c9 100644
--- a/README.md
+++ b/README.md
@@ -5,13 +5,12 @@
2. 文件下载、文件上传、在线日志
#### 软件架构
-1. Jdk 17
+1. Jdk 21
2. Maven 3.6.3
-3. SpringBoot 3.1.1
-4. SpringBoot Starter Thymeleaf 3.1.1
-5. SpringBoot Starter WebSocket 3.1.1
-6. RocksDB 8.3.2
-7. Hutool Json 5.8.21
+3. SpringBoot 3.5.3
+4. SpringBoot Starter Thymeleaf 3.5.3
+5. SpringBoot Starter WebSocket 3.5.3
+7. Hutool 5.8.25
7. AXUI 2.1.1
diff --git a/pom.xml b/pom.xml
index 006bc36..31841aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,9 +10,9 @@
cn.somkit
fmt
- 1.3.0
+ 2.0.0
fmt
- fmt
+ File Manage System for by SpringBoot
21
diff --git a/src/main/java/cn/somkit/fmt/action/LoggingAction.java b/src/main/java/cn/somkit/fmt/action/LoggingAction.java
index bea8a45..68d173f 100644
--- a/src/main/java/cn/somkit/fmt/action/LoggingAction.java
+++ b/src/main/java/cn/somkit/fmt/action/LoggingAction.java
@@ -1,21 +1,12 @@
package cn.somkit.fmt.action;
import cn.metona.cache.Cache;
-import cn.somkit.fmt.entity.LoggerMessage;
-import cn.somkit.fmt.utils.LoggerQueue;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
@Controller
@RequestMapping("/logging")
diff --git a/src/main/java/cn/somkit/fmt/action/SystemAction.java b/src/main/java/cn/somkit/fmt/action/SystemAction.java
deleted file mode 100644
index 2a17172..0000000
--- a/src/main/java/cn/somkit/fmt/action/SystemAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package cn.somkit.fmt.action;
-
-import cn.somkit.fmt.annotation.ApiOperate;
-import cn.somkit.fmt.config.FmtConfig;
-import cn.somkit.fmt.utils.ParamUtils;
-import cn.somkit.fmt.utils.PathUtils;
-import cn.somkit.fmt.utils.RocksDBUtils;
-import org.rocksdb.RocksDBException;
-import org.springframework.stereotype.Controller;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Controller
-@RequestMapping("/system")
-public class SystemAction {
-
- @GetMapping("/index")
- public ModelAndView index() throws Exception{
- Map map = new HashMap<>();
- map.put("Upload_File_Path", ParamUtils.getUploadPath());
- map.put("Temp_File_Path", ParamUtils.getTempFilePath());
- map.put("Log_File_Path", ParamUtils.getLogFilePath());
- map.put("Max_Read_Length", ParamUtils.getMaxReadLength());
- map.put("Read_Interval", ParamUtils.getReadInterval());
- ModelAndView mv = new ModelAndView();
- mv.setViewName("system");
- mv.addObject(FmtConfig.System_Cf_Name, map);
- return mv;
- }
-
- @PostMapping("/save")
- @ResponseBody
- @ApiOperate(description = "保存系统设置")
- public Map save(@RequestParam Map map) throws Exception {
- if(map != null && !map.isEmpty()){
- map.keySet().forEach(key -> {
- try {
- if(StringUtils.hasText(map.get(key))){
- String value = map.get(key).startsWith("./") ? PathUtils.resolve(map.get(key)) : map.get(key);
- RocksDBUtils.put(FmtConfig.System_Cf_Name, key, value);
- }
- } catch (RocksDBException e) {
- throw new RuntimeException(e);
- }
- });
- }
- return Map.of("code", 200, "message", "保存成功");
- }
-}
diff --git a/src/main/java/cn/somkit/fmt/config/FmtConfig.java b/src/main/java/cn/somkit/fmt/config/FmtConfig.java
deleted file mode 100644
index 54c8778..0000000
--- a/src/main/java/cn/somkit/fmt/config/FmtConfig.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.somkit.fmt.config;
-
-import cn.somkit.fmt.utils.PathUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-
-/**
- * 系统参数配置
- */
-@Component
-public class FmtConfig {
-
- public static String System_Cf_Name = "system";
-
- public static String Upload_File_Path = "./data/files";
-
- public static String Temp_File_Path = "./data/files/temp";
-
- @Value("${somkit.upload.path}")
- public void setUpload_File_Path(String upload_file_path) {
- if(StringUtils.hasText(upload_file_path)){
- //如果使用相对路径,转换为绝对路径
- if(upload_file_path.startsWith("./")){
- upload_file_path = PathUtils.resolve(upload_file_path);
- }
- Upload_File_Path = upload_file_path;
- }
- }
-
- @Value("${somkit.upload.temp-path}")
- public void setTemp_File_Path(String temp_file_path) {
- if(StringUtils.hasText(temp_file_path)){
- //如果使用相对路径,转换为绝对路径
- if(temp_file_path.startsWith("./")){
- temp_file_path = PathUtils.resolve(temp_file_path);
- }
- Temp_File_Path = temp_file_path;
- }
- }
-}
diff --git a/src/main/java/cn/somkit/fmt/utils/ParamUtils.java b/src/main/java/cn/somkit/fmt/utils/ParamUtils.java
deleted file mode 100644
index 1837c74..0000000
--- a/src/main/java/cn/somkit/fmt/utils/ParamUtils.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package cn.somkit.fmt.utils;
-
-import cn.somkit.fmt.config.FmtConfig;
-import cn.somkit.fmt.config.LogSocketConfig;
-import org.springframework.util.StringUtils;
-
-public class ParamUtils {
-
- public static String getUploadPath() throws Exception {
- String path = RocksDBUtils.get(FmtConfig.System_Cf_Name, "Upload_File_Path");
- if(StringUtils.hasText(path)){
- return path;
- } else {
- path = FmtConfig.Upload_File_Path;
- RocksDBUtils.put(FmtConfig.System_Cf_Name, "Upload_File_Path", path);
- return path;
- }
- }
-
- public static String getTempFilePath() throws Exception {
- String path = RocksDBUtils.get(FmtConfig.System_Cf_Name, "Temp_File_Path");
- if(StringUtils.hasText(path)){
- return path;
- } else {
- path = FmtConfig.Temp_File_Path;
- RocksDBUtils.put(FmtConfig.System_Cf_Name, "Temp_File_Path", path);
- return path;
- }
- }
-
- public static String getLogFilePath() throws Exception {
- String path = RocksDBUtils.get(FmtConfig.System_Cf_Name, "Log_File_Path");
- if(StringUtils.hasText(path)){
- return path;
- } else {
- path = LogSocketConfig.Log_File_Path;
- RocksDBUtils.put(FmtConfig.System_Cf_Name, "Log_File_Path", path);
- return path;
- }
- }
-
- public static String getMaxReadLength() throws Exception {
- String path = RocksDBUtils.get(FmtConfig.System_Cf_Name, "Max_Read_Length");
- if(StringUtils.hasText(path)){
- return path;
- } else {
- path = LogSocketConfig.Max_Read_Length;
- RocksDBUtils.put(FmtConfig.System_Cf_Name, "Max_Read_Length", path);
- return path;
- }
- }
-
- public static String getReadInterval() throws Exception {
- String path = RocksDBUtils.get(FmtConfig.System_Cf_Name, "Read_Interval");
- if(StringUtils.hasText(path)){
- return path;
- } else {
- path = LogSocketConfig.Read_Interval;
- RocksDBUtils.put(FmtConfig.System_Cf_Name, "Read_Interval", path);
- return path;
- }
- }
-}
diff --git a/src/main/java/cn/somkit/fmt/utils/PathUtils.java b/src/main/java/cn/somkit/fmt/utils/PathUtils.java
deleted file mode 100644
index 0840794..0000000
--- a/src/main/java/cn/somkit/fmt/utils/PathUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package cn.somkit.fmt.utils;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-/**
- * 路径工具类
- */
-public class PathUtils {
-
- /**
- * 解析相对路径为绝对路径
- * @param relativePath 相对路径
- * @return 绝对路径
- */
- public static String resolve(String relativePath) {
- if(relativePath.startsWith("./")){
- relativePath = relativePath.replace("./", "");
- }
- // 获取当前工作目录的Path对象
- Path currentWorkingDirectory = Paths.get("").toAbsolutePath();
- // 使用相对路径创建Path对象
- Path relativePathObject = Paths.get(relativePath);
- // 解析相对路径,补全为绝对路径
- Path absolutePath = currentWorkingDirectory.resolve(relativePathObject);
- return absolutePath.toString();
- }
-
- /**
- * 创建文件夹
- * @param directoryPath 文件夹路径
- */
- public static void directory(String directoryPath){
- // 使用Paths.get()方法创建Path对象
- Path dirPath = Paths.get(directoryPath);
- // 检查文件夹是否存在
- if (Files.notExists(dirPath)) {
- try {
- // 如果不存在,则创建文件夹及其所有必需的父目录
- Files.createDirectories(dirPath);
- System.out.println("Directory created: " + dirPath);
- } catch (IOException e) {
- // 如果创建过程中出现异常,打印错误信息
- System.err.println("Failed to create directory: " + dirPath);
- e.printStackTrace();
- }
- } else {
- System.out.println("Directory already exists: " + dirPath);
- }
- }
-}
diff --git a/src/main/resources/bin/startup.bat b/src/main/resources/bin/startup.bat
index 769b709..575a2d0 100644
--- a/src/main/resources/bin/startup.bat
+++ b/src/main/resources/bin/startup.bat
@@ -1,5 +1,5 @@
chcp 65001
-SET JAR=D:/fmt/fmt-1.3.0.jar
+SET JAR=D:/fmt/fmt-2.0.0.jar
SET JAR_CONFIG=D:/fmt/config/
SET JAR_LIB=D:/fmt/lib/
java -Dfile.encoding=utf-8 -jar %JAR% --spring.config.location=%JAR_CONFIG% --spring.lib.location=%JAR_LIB%
\ No newline at end of file
diff --git a/src/main/resources/bin/startup.sh b/src/main/resources/bin/startup.sh
index 6410dd5..7e4f46e 100644
--- a/src/main/resources/bin/startup.sh
+++ b/src/main/resources/bin/startup.sh
@@ -1,8 +1,8 @@
#!/bin/bash
-JAR=/home/deploy/fmt/fmt-1.3.0.jar
+JAR=/home/deploy/fmt/fmt-2.0.0.jar
JAR_CONFIG=/home/deploy/fmt/config/
JAR_LIB=/home/deploy/fmt/lib/
-JAVA_HOME=/usr/local/jdk-17.0.7
+JAVA_HOME=/usr/local/jdk-21
JAVA=$JAVA_HOME/bin/java
nohup $JAVA -jar $JAR --spring.config.location=$JAR_CONFIG --spring.lib.location=$JAR_LIB -Djava.ext.dirs=$JAVA_HOME/lib &
tail -f nohup.out
\ No newline at end of file
diff --git a/src/main/resources/templates/download.html b/src/main/resources/templates/download.html
index 180062b..85499a8 100644
--- a/src/main/resources/templates/download.html
+++ b/src/main/resources/templates/download.html
@@ -43,10 +43,6 @@
在线日志
-
diff --git a/src/main/resources/templates/system.html b/src/main/resources/templates/system.html
deleted file mode 100644
index 874affa..0000000
--- a/src/main/resources/templates/system.html
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 系统设置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/resources/templates/upload.html b/src/main/resources/templates/upload.html
index 0254c11..c68583c 100644
--- a/src/main/resources/templates/upload.html
+++ b/src/main/resources/templates/upload.html
@@ -36,10 +36,6 @@
在线日志
-
diff --git a/版本记录/readme.md b/版本记录/readme.md
index 458ab33..c18ccec 100644
--- a/版本记录/readme.md
+++ b/版本记录/readme.md
@@ -17,11 +17,13 @@
上传文件格式新增支持js、css、html、vsdx、dmp、7z、ppt、pptx
AxUI的axAjax方法,timeout默认值改为6000000
```
-> v1.3.0
+> v2.0.0
```
- 修改RocksDB文件目录配置,使其支持使用相对路径
- 修改上传文件目录配置,使其支持使用相对路径
- 新增临时文件存放地址配置,支持相对路径
- 新增系统设置页面,支持在线配置上传文件地址、日志文件地址等参数
+ SpringBoot从3.1.1升级到3.5.3
+ JDK从17升级到21并开启虚拟线程
+ 删除RocksDB相关配置,不再使用该缓存方案
修改文件下载方式,使用StreamingResponseBody,支持大文件下载
+ 引入metona-cache-spring-boot-starter,使用此缓存方案
+ 重构在线日志页面及实现方式,不再使用读取日志文件方式,自定义日志拦截器实时获取日志
+ 不再生成自定义日志文件,日志打印从INFO改为DEBUG,打印更详细的内容
```
\ No newline at end of file