mirror of
https://github.com/KOHGYLW/kiftd-source.git
synced 2025-01-09 04:27:56 +08:00
update to v1.2.0-SNAPSHOT
This commit is contained in:
parent
1dad6552d3
commit
1e4b59c95c
@ -1,7 +1,7 @@
|
||||
## 欢迎访问kiftd源代码资源库!
|
||||
### Welcome to visit source of kiftd!
|
||||
|
||||
_当前版本:v1.1.1-RELEASE_
|
||||
_当前版本:v1.2.0-SNAPSHOT_
|
||||
|
||||
### 简介
|
||||
_kiftd——一款便捷、开源、功能完善的个人&团队&小型团队网盘服务器系统。_
|
||||
@ -18,7 +18,7 @@ kiftd能够帮助您快速搭建起一个面向家庭、团队或组织的网盘
|
||||
|
||||
### 构建说明
|
||||
_下列条目为kiftd开发环境的基本信息,如需对源代码进行查看及编译,推荐使用所列配置。_
|
||||
+ JDK版本:1.8.0_131
|
||||
+ JDK版本:1.8.0
|
||||
+ 项目管理框架:Maven(m2e 1.8.0 for Eclipse),Archetype:mavem-archetype-quickstart 1.1。
|
||||
+ 编码格式:UTF-8
|
||||
+ 项目资源及配置:Spring Boot+MyBatis+H2 DB,详见pom.xml文档。
|
||||
@ -72,5 +72,5 @@ _提示:源代码路径下包含了一些程序运行所需的非源代码资
|
||||
### 联系作者?
|
||||
如有任何需要(例如对该资源有疑问、意见或建议),请发件联系作者: kohgylw@163.com (青阳龙野),随时恭候您的来信!
|
||||
|
||||
青阳龙野@kohgylw by 2023年09月13日
|
||||
青阳龙野@kohgylw by 2023年12月23日
|
||||
|
||||
|
15
TODO.txt
15
TODO.txt
@ -1,4 +1,4 @@
|
||||
kiftd项目 计划表-2022-08-09 by 青阳龙野
|
||||
kiftd项目 计划表-2023-12-23 by 青阳龙野
|
||||
|
||||
已完成 v1.0.17
|
||||
--------------
|
||||
@ -200,3 +200,16 @@ test.auth.xxx=ucd
|
||||
【已完成】优化了文件列表的文件体积显示,新增了GB和TB两个体积单位。
|
||||
【已完成】解决“文件”功能中,FileSystemManager.transferFile(:935)的Java 8兼容性问题。
|
||||
【已完成】优化剪切复制操作,使得用户不必完成粘贴步骤,可以重新开始此操作流程。
|
||||
|
||||
计划中 v1.2.0
|
||||
--------------
|
||||
【已完成】将文件体积的单位精确到Byte,以便用户能够更加精准地获取文件体积。
|
||||
【待实现】在账户配置中新增“超级管理员”身份设置:具备该身份的账户将无视权限和分组设定,可执行一切操作并可访问任何文件夹(包括“仅创建者”文件夹)。
|
||||
注:该功能旨在方便系统管理员更为方便快捷的对整个系统进行全权管理。
|
||||
【待实现】新增扩展存储区导出功能:当用户删除某一扩展存储区时,可以选择将该存储区内的文件全部导出至指定位置,便于对其进行归档。
|
||||
【待实现】完善移动“m”权限的安全性:当仅有“m”权限时,用户可执行“复制”操作;若同时具备删除“d”权限,才可以进行“剪切”操作。
|
||||
注:这是为了防止使用者先将某个文件从一个原本不具备删除权限的文件夹内移动的一个具备删除权限的文件夹内再将其删除的恶意操作。
|
||||
【已完成】新增文件夹体积计算功能:当访问者打开文件夹的“详细信息...”模态框时,系统将实时统计该文件夹的内容总体积,之后将结果显示在该界面上供用户查看。
|
||||
【待实现】新增导入账户设置:当执行“导入”操作时,可以使用指定账户来为它们设置“创建者”。
|
||||
【待实现】优化剪切复制操作:如果执行粘贴时已剪切或复制的文件不再存在,那么在提示后自动清除剪切或复制的文件记录,将剪切或复制显示恢复到初始状态。
|
||||
【待实现】优化服务器端UI:如果开启了https协议,则将端口号显示为https的端口号。
|
||||
|
20
pom.xml
20
pom.xml
@ -1,10 +1,11 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>kohgylw</groupId>
|
||||
<artifactId>kiftd</artifactId>
|
||||
<version>1.1.1-RELEASE</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>kiftd</name>
|
||||
@ -39,7 +40,8 @@
|
||||
<!-- end Gson -->
|
||||
|
||||
<!-- file 操作资源 -->
|
||||
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
@ -100,13 +102,15 @@
|
||||
<!-- end Thumbnailator -->
|
||||
|
||||
<!-- 图片格式处理 -->
|
||||
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-jpeg -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-jpeg -->
|
||||
<dependency>
|
||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||
<artifactId>imageio-jpeg</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-tiff -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-tiff -->
|
||||
<dependency>
|
||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||
<artifactId>imageio-tiff</artifactId>
|
||||
@ -126,13 +130,15 @@
|
||||
<artifactId>itext</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/net.sourceforge.jchardet/jchardet -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/net.sourceforge.jchardet/jchardet -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jchardet</groupId>
|
||||
<artifactId>jchardet</artifactId>
|
||||
|
@ -55,8 +55,7 @@ public class ConsoleRunner {
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param args
|
||||
* java.lang.String[] 启动参数
|
||||
* @param args java.lang.String[] 启动参数
|
||||
* @return kohgylw.kiftd.mc.ConsoleRunner 本启动器唯一实例
|
||||
*/
|
||||
public static ConsoleRunner build(final String[] args) {
|
||||
@ -222,6 +221,7 @@ public class ConsoleRunner {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Printer.instance.print(e.toString());
|
||||
Printer.instance.print("错误:读取命令时出现意外导致程序退出,请重启kiftd。");
|
||||
}
|
||||
});
|
||||
|
@ -47,43 +47,36 @@ public class UIRunner {
|
||||
|
||||
@Override
|
||||
public int getPropertiesStatus() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getPropertiesStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPort() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMustLogin() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().mustLogin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogLevel getLogLevel() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getLogLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileSystemPath() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getFileSystemPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBufferSize() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getBuffSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VCLevel getVCLevel() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getVCLevel();
|
||||
}
|
||||
|
||||
@ -103,49 +96,41 @@ public class UIRunner {
|
||||
|
||||
@Override
|
||||
public LogLevel getInitLogLevel() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getInitLogLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VCLevel getInitVCLevel() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getInitVCLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitFileSystemPath() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getInitFileSystemPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitProt() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getInitPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitBufferSize() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getInitBuffSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowChangePassword() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().isAllowChangePassword();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpenFileChain() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().isOpenFileChain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxExtendStoresNum() {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().getMaxExtendstoresNum();
|
||||
}
|
||||
});
|
||||
@ -153,7 +138,6 @@ public class UIRunner {
|
||||
|
||||
@Override
|
||||
public boolean update(ServerSetting s) {
|
||||
// TODO 自动生成的方法存根
|
||||
return ConfigureReader.instance().doUpdate(s);
|
||||
}
|
||||
});
|
||||
|
@ -2,9 +2,11 @@ package kohgylw.kiftd.server.controller;
|
||||
|
||||
import org.springframework.stereotype.*;
|
||||
import javax.annotation.*;
|
||||
|
||||
import kohgylw.kiftd.server.service.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.*;
|
||||
|
||||
import javax.servlet.http.*;
|
||||
|
||||
/**
|
||||
@ -180,8 +182,7 @@ public class HomeController {
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param request
|
||||
* HttpServletRequest 请求对象
|
||||
* @param request HttpServletRequest 请求对象
|
||||
* @return String 预览图片的JSON信息
|
||||
*/
|
||||
@RequestMapping(value = { "/getPrePicture.ajax" }, produces = { CHARSET_BY_AJAX })
|
||||
@ -198,10 +199,8 @@ public class HomeController {
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param request
|
||||
* HttpServletRequest 请求对象,其中应包含fileId指定预览图片的文件块ID。
|
||||
* @param response
|
||||
* HttpServletResponse 响应对象,用于写出压缩后的数据流。
|
||||
* @param request HttpServletRequest 请求对象,其中应包含fileId指定预览图片的文件块ID。
|
||||
* @param response HttpServletResponse 响应对象,用于写出压缩后的数据流。
|
||||
*/
|
||||
@RequestMapping({ "/showCondensedPicture.do" })
|
||||
public void showCondensedPicture(final HttpServletRequest request, final HttpServletResponse response) {
|
||||
@ -241,7 +240,10 @@ public class HomeController {
|
||||
/**
|
||||
*
|
||||
* <h2>移动文件操作前置确认</h2>
|
||||
* <p>该逻辑用于在执行移动或复制前确认目标文件夹是否合法以及是否会产生文件名冲突。</p>
|
||||
* <p>
|
||||
* 该逻辑用于在执行移动或复制前确认目标文件夹是否合法以及是否会产生文件名冲突。
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param request javax.servlet.http.HttpServletRequest 请求对象
|
||||
* @return java.lang.String 判断结果,详情请见具体实现
|
||||
@ -255,7 +257,10 @@ public class HomeController {
|
||||
/**
|
||||
*
|
||||
* <h2>执行移动文件操作</h2>
|
||||
* <p>该逻辑用于正式执行移动或复制操作,在调用之前应先执行判断操作。</p>
|
||||
* <p>
|
||||
* 该逻辑用于正式执行移动或复制操作,在调用之前应先执行判断操作。
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param request javax.servlet.http.HttpServletRequest 请求对象
|
||||
* @return java.lang.String 执行结果,详情请见具体实现
|
||||
@ -269,7 +274,10 @@ public class HomeController {
|
||||
/**
|
||||
*
|
||||
* <h2>执行全局查询</h2>
|
||||
* <p>该逻辑用于进行全局搜索,将会迭代搜索目标文件夹及其全部子文件夹以查找符合关键字的结果,并返回单独的搜索结果视图。</p>
|
||||
* <p>
|
||||
* 该逻辑用于进行全局搜索,将会迭代搜索目标文件夹及其全部子文件夹以查找符合关键字的结果,并返回单独的搜索结果视图。
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param request javax.servlet.http.HttpServletRequest 请求对象
|
||||
* @return java.lang.String 搜索结果,详情请见具体实现
|
||||
@ -316,4 +324,11 @@ public class HomeController {
|
||||
public String getFileChainKey(final HttpServletRequest request) {
|
||||
return fcs.getChainKeyByFid(request);
|
||||
}
|
||||
|
||||
// 对指定文件夹的内容进行统计
|
||||
@RequestMapping(value = { "/countFolderContent.ajax" }, produces = { CHARSET_BY_AJAX })
|
||||
@ResponseBody
|
||||
public String countFolderContent(final HttpServletRequest request) {
|
||||
return fs.getFolderCountResult(request);
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ public class KiftdCtl {
|
||||
Printer.instance.print("服务器引擎已启动。");
|
||||
return KiftdCtl.run;
|
||||
} catch (Exception e) {
|
||||
Printer.instance.print(e.toString());
|
||||
Printer.instance.print("出现错误,服务器引擎启动失败。");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package kohgylw.kiftd.server.service;
|
||||
|
||||
import javax.servlet.http.*;
|
||||
|
||||
public interface FolderService
|
||||
{
|
||||
public interface FolderService {
|
||||
|
||||
String newFolder(final HttpServletRequest request);
|
||||
|
||||
String deleteFolder(final HttpServletRequest request);
|
||||
@ -20,9 +20,25 @@ public interface FolderService
|
||||
* 执行后,将返回一个结果json对象,其中包括result和newName两个属性。result的值可为:success 成功,error 失败。
|
||||
* 若创建成功,则可从newName中获取这个新建的文件夹名称,并在上传文件夹时使用该名称作为newFolderName属性的值。
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param request javax.servlet.http.HttpServletRequest 请求对象
|
||||
* @return java.lang.String 返回的结果json对象
|
||||
* @param request 请求对象
|
||||
* @return String 返回的结果json对象
|
||||
*/
|
||||
String createNewFolderByName(final HttpServletRequest request);
|
||||
|
||||
/**
|
||||
*
|
||||
* <h2>统计一个文件夹内的内容信息</h2>
|
||||
* <p>
|
||||
* 该方法用于统计指定文件夹的内容信息,并以json格式返回结果。
|
||||
* </p>
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @version 1.0
|
||||
* @return String 如果该请求不合法则返回“ERROR”,如果合法则返回json格式的统计信息
|
||||
*
|
||||
*/
|
||||
String getFolderCountResult(final HttpServletRequest request);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import kohgylw.kiftd.server.enumeration.*;
|
||||
import kohgylw.kiftd.server.listener.ServerInitListener;
|
||||
import kohgylw.kiftd.server.model.*;
|
||||
import kohgylw.kiftd.server.pojo.CreateNewFolderByNameRespons;
|
||||
import kohgylw.kiftd.server.pojo.FolderCountResult;
|
||||
import kohgylw.kiftd.server.util.*;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@ -338,4 +339,42 @@ public class FolderServiceImpl implements FolderService {
|
||||
return gson.toJson(cnfbnr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFolderCountResult(HttpServletRequest request) {
|
||||
// 例行检查
|
||||
final String folderId = request.getParameter("folderId");
|
||||
if (folderId == null || folderId.length() == 0) {
|
||||
return "ERROR";
|
||||
}
|
||||
Folder vf = this.fm.queryById(folderId);
|
||||
final String account = (String) request.getSession().getAttribute("ACCOUNT");
|
||||
if (!ConfigureReader.instance().accessFolder(vf, account)) {
|
||||
return "ERROR";
|
||||
}
|
||||
FolderCountResult fcr = new FolderCountResult();
|
||||
countFoldersIterator(folderId, account, fcr);
|
||||
return gson.toJson(fcr);
|
||||
}
|
||||
|
||||
// 迭代统计文件夹内容
|
||||
private void countFoldersIterator(String fid, String account, FolderCountResult fcr) {
|
||||
// 迭代统计可访问的文件夹数量
|
||||
long folderSize = 0L;
|
||||
for (Folder f : this.fm.queryByParentId(fid)) {
|
||||
if (ConfigureReader.instance().accessFolder(f, account)) {
|
||||
folderSize++;
|
||||
countFoldersIterator(f.getFolderId(), account, fcr);
|
||||
}
|
||||
}
|
||||
fcr.setFolderNum(fcr.getFolderNum() + folderSize);
|
||||
// 统计文件数量及其总体积
|
||||
List<Node> nodes = this.nm.queryByParentFolderId(fid);
|
||||
fcr.setFileNum(fcr.getFileNum() + nodes.size());
|
||||
long fileSize = 0L;
|
||||
for (Node n : nodes) {
|
||||
fileSize += Long.parseLong(n.getFileSize());
|
||||
}
|
||||
fcr.setTotalSize(fcr.getTotalSize() + fileSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class FileBlockUtil {
|
||||
Iterator<Path> listFiles = Files.newDirectoryStream(f.toPath()).iterator();
|
||||
while (listFiles.hasNext()) {
|
||||
File tempFile = listFiles.next().toFile();
|
||||
if(!tempFile.getName().startsWith(".")) {
|
||||
if (!tempFile.getName().startsWith(".")) {
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
@ -272,18 +272,17 @@ public class FileBlockUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
* <h2>计算上传文件的体积</h2>
|
||||
* <h2>生成上传文件的体积标识</h2>
|
||||
* <p>
|
||||
* 该方法用于将上传文件的体积换算以MB表示,以便存入文件系统。
|
||||
* 该方法用于将上传文件的体积转换为以B为单位的字符串标识,以便存入文件系统。
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param size 文件的体积,以Byte为单位
|
||||
* @return java.lang.String 计算出来的体积,以MB为单位
|
||||
* @param size 文件的体积,以Byte为单位,例如“1024”
|
||||
* @return java.lang.String 以B为单位的字符串标识,例如“1024”
|
||||
*/
|
||||
public String getFileSize(final long size) {
|
||||
final int mb = (int) (size / 1048576L);
|
||||
return "" + mb;
|
||||
return Long.toString(size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -488,6 +487,14 @@ public class FileBlockUtil {
|
||||
File block = getFileFromBlocks(node);
|
||||
if (block == null) {
|
||||
fm.deleteById(node.getFileId());
|
||||
} else {
|
||||
// 文件体积校对
|
||||
long size = Long.parseLong(node.getFileSize());
|
||||
if (block.length() != size) {
|
||||
// 如果记录的文件体积与实际体积不符,则更正文件体积
|
||||
node.setFileSize(Long.toString(block.length()));
|
||||
fm.update(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Folder> folders = flm.queryByParentId(fid);
|
||||
|
@ -76,7 +76,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
Container c = window.getContentPane();
|
||||
JToolBar toolBar = new JToolBar();
|
||||
toolBar.setFloatable(false);
|
||||
// TODO 自动生成的 catch 块
|
||||
homeBtn = new JButton("根目录[/Root]");
|
||||
backToParentFolder = new JButton("上一级[^]");
|
||||
importBtn = new JButton("导入[<-]");
|
||||
@ -106,28 +105,22 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
// 各个工具栏按钮的功能实现
|
||||
homeBtn.addActionListener((e) -> {
|
||||
disableAllButtons();
|
||||
worker.execute(() -> {
|
||||
try {
|
||||
getFolderView("root");
|
||||
} catch (Exception e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
JOptionPane.showMessageDialog(window, "出现意外错误:无法读取文件列表,请重试或重启应用。", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
enableAllButtons();
|
||||
});
|
||||
});
|
||||
backToParentFolder.addActionListener((e) -> {
|
||||
disableAllButtons();
|
||||
worker.execute(() -> {
|
||||
try {
|
||||
getFolderView(currentView.getCurrent().getFolderParent());
|
||||
} catch (Exception e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
JOptionPane.showMessageDialog(window, "出现意外错误:无法读取文件列表,请重试或重启应用。", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
enableAllButtons();
|
||||
});
|
||||
});
|
||||
importBtn.addActionListener((e) -> {
|
||||
disableAllButtons();
|
||||
JFileChooser importChooer = new JFileChooser();
|
||||
@ -195,15 +188,14 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
}
|
||||
}
|
||||
FSProgressDialog fsd = FSProgressDialog.getNewInstance();
|
||||
Thread deleteListenerDialog = new Thread(() -> {
|
||||
Thread t = new Thread(() -> {
|
||||
fsd.show();
|
||||
});
|
||||
deleteListenerDialog.start();
|
||||
t.start();
|
||||
try {
|
||||
FileSystemManager.getInstance().exportTo(folders, nodes, path, type);
|
||||
fsd.close();
|
||||
} catch (Exception e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
fsd.close();
|
||||
JOptionPane.showMessageDialog(window, "导出文件时失败,该操作已被中断,未能全部导出。", "错误",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
@ -219,10 +211,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
int[] selected = filesTable.getSelectedRows();
|
||||
worker.execute(() -> {
|
||||
Runnable doDeleteThread = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO 自动生成的方法存根
|
||||
List<String> selectedNodes = new ArrayList<>();
|
||||
List<String> selectedFolders = new ArrayList<>();
|
||||
int borderIndex = currentView.getFolders().size();
|
||||
@ -234,16 +222,15 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
}
|
||||
}
|
||||
FSProgressDialog fsd = FSProgressDialog.getNewInstance();
|
||||
Thread fsProgressDialogThread = new Thread(() -> {
|
||||
Thread t = new Thread(() -> {
|
||||
fsd.show();
|
||||
});
|
||||
fsProgressDialogThread.start();
|
||||
t.start();
|
||||
try {
|
||||
FileSystemManager.getInstance().delete(selectedFolders.toArray(new String[0]),
|
||||
selectedNodes.toArray(new String[0]));
|
||||
fsd.close();
|
||||
} catch (Exception e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
fsd.close();
|
||||
JOptionPane.showMessageDialog(window, "删除文件时失败,该操作已被中断,未能全部删除。", "错误",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
@ -251,9 +238,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
}
|
||||
refresh();
|
||||
enableAllButtons();
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(doDeleteThread);
|
||||
});
|
||||
} else {
|
||||
enableAllButtons();
|
||||
@ -261,11 +245,9 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
});
|
||||
refreshBtn.addActionListener((e) -> {
|
||||
disableAllButtons();
|
||||
worker.execute(() -> {
|
||||
refresh();
|
||||
enableAllButtons();
|
||||
});
|
||||
});
|
||||
// 生成文件列表
|
||||
filesTable = new FilesTable();
|
||||
filesTable.setRowHeight((int) (16 * proportion));
|
||||
@ -274,7 +256,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
// TODO 自动生成的方法存根
|
||||
if (filesTable.getSelectedRows().length > 0) {
|
||||
exportBtn.setEnabled(true);
|
||||
deleteBtn.setEnabled(true);
|
||||
@ -304,7 +285,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// TODO 自动生成的方法存根
|
||||
disableAllButtons();
|
||||
worker.execute(() -> {
|
||||
Folder f = filesTable.getDoubleClickFolder(e);
|
||||
@ -312,7 +292,7 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
try {
|
||||
getFolderView(f.getFolderId());
|
||||
} catch (Exception e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
Printer.instance.print(e.toString());
|
||||
}
|
||||
}
|
||||
enableAllButtons();
|
||||
@ -324,13 +304,10 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
|
||||
@Override
|
||||
public void dropActionChanged(DropTargetDragEvent dtde) {
|
||||
// TODO 自动生成的方法存根
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drop(DropTargetDropEvent dtde) {
|
||||
// TODO 自动生成的方法存根
|
||||
if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
|
||||
try {
|
||||
@ -344,38 +321,28 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
enableAllButtons();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// TODO 自动生成的 catch 块
|
||||
worker.execute(() -> {
|
||||
Runnable refreshThread = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO 自动生成的方法存根
|
||||
refresh();
|
||||
}
|
||||
|
||||
};
|
||||
SwingUtilities.invokeLater(refreshThread);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dragOver(DropTargetDragEvent dtde) {
|
||||
// TODO 自动生成的方法存根
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dragExit(DropTargetEvent dte) {
|
||||
// TODO 自动生成的方法存根
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dragEnter(DropTargetDragEvent dtde) {
|
||||
// TODO 自动生成的方法存根
|
||||
|
||||
}
|
||||
};
|
||||
window.setDropTarget(new DropTarget(window, DnDConstants.ACTION_COPY_OR_MOVE, dtl));
|
||||
@ -388,7 +355,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
try {
|
||||
getFolderView(currentView.getCurrent().getFolderId());
|
||||
} catch (Exception e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
JOptionPane.showMessageDialog(window, "无法刷新文件列表,请重试或返回根目录。", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
@ -415,7 +381,7 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
enableAllButtons();
|
||||
window.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
// TODO 自动生成的 catch 块
|
||||
Printer.instance.print(e.toString());
|
||||
Printer.instance.print("错误:无法打开文件系统,该文件系统可能正在被另一个kiftd占用。");
|
||||
}
|
||||
}
|
||||
@ -466,7 +432,6 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
try {
|
||||
exi = FileSystemManager.getInstance().hasExistsFilesOrFolders(files, folderId);
|
||||
} catch (SQLException e1) {
|
||||
// TODO 自动生成的 catch 块
|
||||
JOptionPane.showMessageDialog(window, "出现意外错误,无法导入文件,请刷新或重启应用后重试。", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
refresh();
|
||||
return;
|
||||
@ -490,10 +455,10 @@ public class FSViewer extends KiftdDynamicWindow {
|
||||
}
|
||||
// 打开进度提示会话框
|
||||
FSProgressDialog fsd = FSProgressDialog.getNewInstance();
|
||||
Thread fspt = new Thread(() -> {
|
||||
Thread t = new Thread(() -> {
|
||||
fsd.show();
|
||||
});
|
||||
fspt.start();
|
||||
t.start();
|
||||
try {
|
||||
FileSystemManager.getInstance().importFrom(files, folderId, type);
|
||||
} catch (FoldersTotalOutOfLimitException e1) {
|
||||
|
@ -9,6 +9,7 @@ import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import kohgylw.kiftd.printer.Printer;
|
||||
import kohgylw.kiftd.server.model.Node;
|
||||
import kohgylw.kiftd.util.file_system_manager.pojo.Folder;
|
||||
|
||||
@ -25,7 +26,7 @@ import kohgylw.kiftd.util.file_system_manager.pojo.Folder;
|
||||
*/
|
||||
public class FilesTable extends JTable {
|
||||
|
||||
private static final String[] columns = new String[] { "名称", "创建日期", "大小(MB)", "创建者" };
|
||||
private static final String[] columns = new String[] { "名称", "创建日期", "大小", "创建者" };
|
||||
private static List<Folder> folders;// 当前显示的文件夹列表
|
||||
public static final int MAX_LIST_LIMIT = Integer.MAX_VALUE;
|
||||
|
||||
@ -33,13 +34,11 @@ public class FilesTable extends JTable {
|
||||
private static final long serialVersionUID = -3436472714356711024L;
|
||||
|
||||
public FilesTable() {
|
||||
// TODO 自动生成的构造函数存根
|
||||
super(new Object[][] {}, columns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
// TODO 自动生成的方法存根
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -47,28 +46,23 @@ public class FilesTable extends JTable {
|
||||
Runnable doUpdate = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO 自动生成的方法存根
|
||||
try {
|
||||
setModel(new TableModel() {
|
||||
@Override
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
// TODO 自动生成的方法存根
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTableModelListener(TableModelListener l) {
|
||||
// TODO 自动生成的方法存根
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
// TODO 自动生成的方法存根
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
// TODO 自动生成的方法存根
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return rowIndex < folders.size() ? "/" + folders.get(rowIndex).getFolderName()
|
||||
@ -95,50 +89,43 @@ public class FilesTable extends JTable {
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
// TODO 自动生成的方法存根
|
||||
return columns[columnIndex];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
// TODO 自动生成的方法存根
|
||||
return columns.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
// TODO 自动生成的方法存根
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTableModelListener(TableModelListener l) {
|
||||
// TODO 自动生成的方法存根
|
||||
}
|
||||
});
|
||||
setRowFontColor();
|
||||
validate();
|
||||
FilesTable.folders = folders;
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
Printer.instance.print(e.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
// 避免操作过快导致的异常
|
||||
Thread t = new Thread(() -> {
|
||||
SwingUtilities.invokeLater(doUpdate);
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
|
||||
private void setRowFontColor() {
|
||||
DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer() {
|
||||
/** */
|
||||
|
||||
private static final long serialVersionUID = 5132133158132959506L;
|
||||
|
||||
@Override
|
||||
protected void setValue(Object value) {
|
||||
// TODO 自动生成的方法存根
|
||||
// 文件夹和文件名称染色(文件是黑色,文件夹是蓝色,以便区分)
|
||||
if (value instanceof String && ((String) value).startsWith("/")) {
|
||||
setForeground(Color.BLUE);
|
||||
} else {
|
||||
@ -148,17 +135,38 @@ public class FilesTable extends JTable {
|
||||
}
|
||||
};
|
||||
DefaultTableCellRenderer dtcr2 = new DefaultTableCellRenderer() {
|
||||
/** */
|
||||
|
||||
private static final long serialVersionUID = 5132133158132959506L;
|
||||
|
||||
@Override
|
||||
protected void setValue(Object value) {
|
||||
// TODO 自动生成的方法存根
|
||||
if (value instanceof String && ((String) value).equals("0")) {
|
||||
setText((String) "<1");
|
||||
if (!"--".equals(value)) {
|
||||
// 对文件体积进行换算
|
||||
if (value instanceof String) {
|
||||
double convertSize;
|
||||
String unit;
|
||||
long size = Long.parseLong((String) value);
|
||||
if (size < 1024) {
|
||||
convertSize = (double) size;
|
||||
unit = "B";
|
||||
} else if (size < 1048576L) {
|
||||
convertSize = ((double) size / 1024.0);
|
||||
unit = "KB";
|
||||
} else if (size < 1073741824L) {
|
||||
convertSize = ((double) size / 1048576.0);
|
||||
unit = "MB";
|
||||
} else if (size < 1099511627776L) {
|
||||
convertSize = ((double) size / 1073741824.0);
|
||||
unit = "GB";
|
||||
} else {
|
||||
setText((String) value);
|
||||
convertSize = ((double) size / 1099511627776.0);
|
||||
unit = "TB";
|
||||
}
|
||||
setText(String.format("%.1f", convertSize) + " " + unit);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setText((String) value);
|
||||
}
|
||||
};
|
||||
getColumn(columns[0]).setCellRenderer(dtcr);
|
||||
@ -173,8 +181,7 @@ public class FilesTable extends JTable {
|
||||
* </p>
|
||||
*
|
||||
* @author 青阳龙野(kohgylw)
|
||||
* @param e
|
||||
* java.awt.event.MouseEvent 鼠标事件
|
||||
* @param e java.awt.event.MouseEvent 鼠标事件
|
||||
* @return kohgylw.kiftd.util.file_system_manager.pojo.Folder 被双击的文件夹
|
||||
*/
|
||||
public Folder getDoubleClickFolder(MouseEvent e) {
|
||||
|
@ -457,8 +457,7 @@ public class FileSystemManager {
|
||||
node.setFileParentFolder(folderId);
|
||||
node.setFileCreationDate(ServerTimeUtil.accurateToDay());
|
||||
node.setFileCreator("SYS_IN");
|
||||
int mb = (int) (size / 1024L / 1024L);
|
||||
node.setFileSize(mb + "");
|
||||
node.setFileSize(Long.toString(size));
|
||||
// 保存文件块并写入新节点
|
||||
File block = saveToFileBlocks(f);
|
||||
if (block == null) {
|
||||
|
@ -38,7 +38,7 @@ Class-Path: libs/spring-boot-starter-web-2.7.0.jar libs/spring-boot-star
|
||||
r libs/commons-codec-1.15.jar libs/flexmark-0.50.44.jar libs/flexmark-u
|
||||
til-0.50.44.jar
|
||||
Implementation-Title: kiftd
|
||||
Implementation-Version: 1.1.1-RELEASE
|
||||
Implementation-Version: 1.2.0-SNAPSHOT
|
||||
Main-Class: kohgylw.kiftd.mc.MC
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Wed Sep 13 10:29:09 CST 2023
|
||||
#Sat Dec 23 23:26:10 CST 2023
|
||||
m2e.projectLocation=/Users/kohgylw/Programs/java_workspace/kiftd
|
||||
m2e.projectName=kiftd
|
||||
groupId=kohgylw
|
||||
artifactId=kiftd
|
||||
version=1.1.1-RELEASE
|
||||
version=1.2.0-SNAPSHOT
|
||||
|
@ -1,10 +1,11 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>kohgylw</groupId>
|
||||
<artifactId>kiftd</artifactId>
|
||||
<version>1.1.1-RELEASE</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>kiftd</name>
|
||||
@ -39,7 +40,8 @@
|
||||
<!-- end Gson -->
|
||||
|
||||
<!-- file 操作资源 -->
|
||||
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
@ -100,13 +102,15 @@
|
||||
<!-- end Thumbnailator -->
|
||||
|
||||
<!-- 图片格式处理 -->
|
||||
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-jpeg -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-jpeg -->
|
||||
<dependency>
|
||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||
<artifactId>imageio-jpeg</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-tiff -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-tiff -->
|
||||
<dependency>
|
||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||
<artifactId>imageio-tiff</artifactId>
|
||||
@ -126,13 +130,15 @@
|
||||
<artifactId>itext</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/net.sourceforge.jchardet/jchardet -->
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/net.sourceforge.jchardet/jchardet -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jchardet</groupId>
|
||||
<artifactId>jchardet</artifactId>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user