update to v1.0.29 测试阶段,完善功能

This commit is contained in:
kohgylw@163.com 2020-05-01 09:28:12 +08:00
parent 0d177d3387
commit 03bf129fba
19 changed files with 87 additions and 29 deletions

View File

@ -141,6 +141,7 @@ test.auth.xxx=ucd
【已完成】进一步完善文本预览功能——当目标文件无法正常打开时,会显示提示信息。
【已完成】修复了在某些情况下音乐播放功能无法正确显示列表中第一首歌的歌词的问题。
【已完成】修复了在非x86环境下使用自定义ffmpeg视频解码引擎后可能会导致“在线播放”功能出现异常的问题。
【已完成】修复上传文件和上传文件夹功能在取消时会互相冲突的问题。
【已完成】修复了上传文件夹功能无法上传Unix/Linux系统中的隐藏文件夹以“.”开头)的问题。
【已完成】修复了上传文件和上传文件夹功能在取消时会互相冲突的问题。
【已完成】修复了一些情况下快捷键会失效或功能异常的问题。
【已完成】其他一些细节优化。

View File

@ -442,9 +442,10 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
return NO_AUTHORIZED;
}
final List<Folder> l = this.fu.getParentList(fid);
if (fu.deleteAllChildFolder(fid) <= 0) {
if (flm.deleteById(fid) <= 0) {
return "cannotDeleteFile";
} else {
fu.deleteAllChildFolder(fid);
this.lu.writeDeleteFolderEvent(request, folder, l);
}
}
@ -780,21 +781,22 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
// 获得冲突的文件夹
Folder f = flm.queryByParentId(locationpath).parallelStream()
.filter((e) -> e.getFolderName().equals(folder.getFolderName())).findFirst().get();
// 判断是否为复制模式
if (isCopy) {
// 则先在目标文件夹内复制整个原文件夹的节点树
Folder newFolder = fu.copyFolderByNewNameToPath(folder, account, locationpath, null);
if (newFolder != null) {
// 再删除冲突的文件夹
// 注意上述两个过程不可颠倒因为有可能会出现复制自己再覆盖自己的情况
if (fu.deleteAllChildFolder(f.getFolderId()) > 0) {
// 先删除冲突文件夹的节点
if (flm.deleteById(f.getFolderId()) > 0) {
// 判断是否为复制模式
if (isCopy) {
// 则先在目标文件夹内复制整个原文件夹的节点树
Folder newFolder = fu.copyFolderByNewNameToPath(folder, account, locationpath, null);
// 之后删除冲突文件夹的所有子文件夹必须在复制后执行否则可能会出现还没复制完就被删了的问题
fu.deleteAllChildFolder(f.getFolderId());
if (newFolder != null) {
// 注意上述过程均不可颠倒否则可能会导致文件夹名冲突或复制内容不全的问题
this.lu.writeMoveFileEvent(request, newFolder, isCopy);
break;
}
}
} else {
// 不是则先将冲突的文件夹删除
if (fu.deleteAllChildFolder(f.getFolderId()) > 0) {
} else {
// 不是直接删除冲突文件夹的所有子文件夹
fu.deleteAllChildFolder(f.getFolderId());
// 再将原文件夹移入目标文件夹内
Map<String, String> map = new HashMap<>();
map.put("folderId", folder.getFolderId());
@ -805,6 +807,7 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
}
}
}
// 上述操作没从正常的位置break则说明操作出错返回错误提示
return "cannotMoveFiles";
case "both":
// 保留两者需要先判断移动后是否会导致目标文件夹的文件列表超限
@ -878,7 +881,9 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
}
// 上述操作全部成功而未中途退出的话则证明移动任务顺利结束返回成功提示信息
return "moveFilesSuccess";
} catch (Exception e) {
} catch (
Exception e) {
// 如果中途产生了异常那么返回失败提示
return ERROR_PARAMETER;
}

View File

@ -132,7 +132,8 @@ public class FolderServiceImpl implements FolderService {
}
// 执行迭代删除
final List<Folder> l = this.fu.getParentList(folderId);
if (this.fu.deleteAllChildFolder(folderId) > 0) {
if (this.fm.deleteById(folderId) > 0) {
fu.deleteAllChildFolder(folderId);
this.lu.writeDeleteFolderEvent(request, folder, l);
ServerInitListener.needCheck = true;
return "deleteFolderSuccess";
@ -255,7 +256,8 @@ public class FolderServiceImpl implements FolderService {
return "deleteError";
}
final List<Folder> l = this.fu.getParentList(rf.getFolderId());
if (this.fu.deleteAllChildFolder(rf.getFolderId()) > 0) {
if (this.fm.deleteById(rf.getFolderId()) > 0) {
fu.deleteAllChildFolder(rf.getFolderId());
this.lu.writeDeleteFolderEvent(request, rf, l);
} else {
return "deleteError";
@ -276,7 +278,7 @@ public class FolderServiceImpl implements FolderService {
cnfbnr.setResult("error");
return gson.toJson(cnfbnr);
}
if (!TextFormateUtil.instance().matcherFolderName(folderName) || folderName.indexOf(".") == 0) {
if (!TextFormateUtil.instance().matcherFolderName(folderName)) {
cnfbnr.setResult("error");
return gson.toJson(cnfbnr);
}

View File

@ -54,10 +54,20 @@ public class FolderUtil {
return idList;
}
public int deleteAllChildFolder(final String folderId) {
/**
*
* <h2>删除一个文件夹树</h2>
* <p>
* 该方法将会尝试删除一个文件夹内的所有文件和文件夹最后也会删除传入文件夹本身
* 它是线程执行的因此不会阻塞原线程也不会返回任何结果
* </p>
*
* @author 青阳龙野(kohgylw)
* @param folderId java.lang.String 要删除的文件夹树的ID不能为null
*/
public void deleteAllChildFolder(final String folderId) {
final Thread deleteChildFolderThread = new Thread(() -> this.iterationDeleteFolder(folderId));
deleteChildFolderThread.start();
return this.fm.deleteById(folderId);
}
private void iterationDeleteFolder(final String folderId) {
@ -85,9 +95,6 @@ public class FolderUtil {
if (parentId == null || folderName == null || parentId.length() <= 0 || folderName.length() <= 0) {
return null;
}
if (folderName.indexOf(".") == 0) {
return null;
}
final Folder parentFolder = this.fm.queryById(parentId);
if (parentFolder == null) {
return null;
@ -241,7 +248,7 @@ public class FolderUtil {
return null;
}
}
/**
*
* <h2>在指定路径内复制一份目标文件夹的拷贝并可设定新名称</h2>

View File

@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Thu Apr 30 22:27:48 CST 2020
#Fri May 01 09:22:56 CST 2020
version=1.0.29-SNAPSHOT
groupId=kohgylw
m2e.projectName=kiftd

View File

@ -293,7 +293,7 @@
<h5 id="deleteFolderMessage"></h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="cancelDeleteFolderBtn" type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<span id="deleteFolderBox"></span>
</div>
</div>
@ -545,7 +545,7 @@
<h5 id="deleteFileMessage" class="wordbreak"></h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="cancelDeleteFileBox" type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<span id="deleteFileBox"></span>
</div>
</div>
@ -609,7 +609,7 @@
</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="cancelDownloadAllCheckedBtn" type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<span id="downloadAllCheckedBox"></span>
</div>
</div>
@ -698,7 +698,7 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="cancelMoveFilesBtn" type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<span id="moveFilesBox"></span>
</div>
</div>

View File

@ -1291,6 +1291,7 @@ function showDeleteFolderModel(folderId, folderName) {
"<button id='dmbutton' type='button' class='btn btn-danger' onclick='deleteFolder("
+ '"' + folderId + '"' + ")'>删除</button>");
$("#dmbutton").attr('disabled', false);
$("#cancelDeleteFolderBtn").attr('disabled', false);
$('#deleteFolderMessage').text(
"提示:确定要彻底删除文件夹:[" + folderName + "]及其全部内容么?该操作不可恢复");
$('#deleteFolderModal').modal('toggle');
@ -1299,6 +1300,7 @@ function showDeleteFolderModel(folderId, folderName) {
// 执行删除文件夹
function deleteFolder(folderId) {
$("#dmbutton").attr('disabled', true);
$("#cancelDeleteFolderBtn").attr('disabled', true);
$('#deleteFolderMessage').text("提示:正在删除,请稍候...");
$.ajax({
type : "POST",
@ -1314,24 +1316,29 @@ function deleteFolder(folderId) {
if (result == "noAuthorized") {
$('#deleteFolderMessage').text("提示:您的操作未被授权,删除文件夹失败");
$("#dmbutton").attr('disabled', false);
$("#cancelDeleteFolderBtn").attr('disabled', true);
} else if (result == "errorParameter") {
$('#deleteFolderMessage').text("提示:参数不正确,删除文件夹失败");
$("#dmbutton").attr('disabled', false);
$("#cancelDeleteFolderBtn").attr('disabled', true);
} else if (result == "cannotDeleteFolder") {
$('#deleteFolderMessage').text("提示:出现意外错误,可能未能删除文件夹");
$("#dmbutton").attr('disabled', false);
$("#cancelDeleteFolderBtn").attr('disabled', true);
} else if (result == "deleteFolderSuccess") {
$('#deleteFolderModal').modal('hide');
showFolderView(locationpath);
} else {
$('#deleteFolderMessage').text("提示:出现意外错误,可能未能删除文件夹");
$("#dmbutton").attr('disabled', false);
$("#cancelDeleteFolderBtn").attr('disabled', true);
}
}
},
error : function() {
$('#deleteFolderMessage').text("提示:出现意外错误,可能未能删除文件夹");
$("#dmbutton").attr('disabled', false);
$("#cancelDeleteFolderBtn").attr('disabled', true);
}
});
}
@ -1747,6 +1754,7 @@ function showDeleteFileModel(fileId, fileName) {
"<button id='dfmbutton' type='button' class='btn btn-danger' onclick='deleteFile("
+ '"' + fileId + '"' + ")'>删除</button>");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
$('#deleteFileMessage').text("提示:确定要彻底删除文件:[" + fileName + "]么?该操作不可恢复");
$('#deleteFileModal').modal('toggle');
}
@ -1754,6 +1762,7 @@ function showDeleteFileModel(fileId, fileName) {
// 执行删除文件操作
function deleteFile(fileId) {
$("#dfmbutton").attr('disabled', true);
$("#cancelDeleteFileBox").attr('disabled', true);
$('#deleteFileMessage').text("提示:正在删除,请稍候...");
$.ajax({
type : "POST",
@ -1769,24 +1778,29 @@ function deleteFile(fileId) {
if (result == "noAuthorized") {
$('#deleteFileMessage').text("提示:您的操作未被授权,删除失败");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
} else if (result == "errorParameter") {
$('#deleteFileMessage').text("提示:参数不正确,删除失败");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
} else if (result == "cannotDeleteFile") {
$('#deleteFileMessage').text("提示:出现意外错误,可能未能删除文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
} else if (result == "deleteFileSuccess") {
$('#deleteFileModal').modal('hide');
showFolderView(locationpath);
} else {
$('#deleteFileMessage').text("提示:出现意外错误,可能未能删除文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
}
}
},
error : function() {
$('#deleteFileMessage').text("提示:出现意外错误,可能未能删除文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
}
});
}
@ -2114,12 +2128,14 @@ function showDownloadAllCheckedModel() {
"<button id='dclmbutton' type='button' class='btn btn-primary' onclick='downloadAllChecked()'>开始下载</button>");
$("#dclmbutton").attr('disabled', false);
}
$("#cancelDownloadAllCheckedBtn").attr('disabled', false);
$("#downloadAllCheckedModal").modal('toggle');
}
// 下载选中的所有文件
function downloadAllChecked() {
$("#dclmbutton").attr('disabled', true);
$("#cancelDownloadAllCheckedBtn").attr('disabled', true);
var faf = getCheckedFilesAndFolders();
$("#downloadAllCheckedName").text(
"提示:服务器正在对选中资源进行压缩(共" + faf.size
@ -2172,6 +2188,8 @@ function downloadAllChecked() {
if (result == "ERROR") {
$("#downloadAllCheckedName")
.text("提示:压缩过程出错。无法完成压缩,请重试或告知管理员。");
$("#dclmbutton").attr('disabled', false);
$("#cancelDownloadAllCheckedBtn").attr('disabled', false);
} else {
$("#downloadAllCheckedLoad").text("");
$("#downloadAllCheckedName").text("提示:压缩完成!准备开始下载...");
@ -2192,6 +2210,8 @@ function downloadAllChecked() {
},
error : function() {
$("#downloadAllCheckedName").text("提示:请求失败。无法完成压缩,请重试或告知管理员。");
$("#dclmbutton").attr('disabled', false);
$("#cancelDownloadAllCheckedBtn").attr('disabled', false);
}
});
}
@ -2201,6 +2221,7 @@ function showDeleteAllCheckedModel() {
$('#deleteFileBox').html("");
var faf = getCheckedFilesAndFolders();
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
if (faf.size == 0) {
$('#deleteFileMessage').html(checkFilesTip);
} else {
@ -2217,6 +2238,7 @@ function deleteAllChecked() {
// TODO 提交全部删除请求
var faf = getCheckedFilesAndFolders();
$("#dfmbutton").attr('disabled', true);
$("#cancelDeleteFileBox").attr('disabled', true);
$('#deleteFileMessage').text("提示:正在删除,请稍候...");
$.ajax({
type : "POST",
@ -2233,24 +2255,29 @@ function deleteAllChecked() {
if (result == "noAuthorized") {
$('#deleteFileMessage').text("提示:您的操作未被授权,删除失败");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
} else if (result == "errorParameter") {
$('#deleteFileMessage').text("提示:参数不正确,未能全部删除文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
} else if (result == "cannotDeleteFile") {
$('#deleteFileMessage').text("提示:出现意外错误,可能未能删除全部文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
} else if (result == "deleteFileSuccess") {
$('#deleteFileModal').modal('hide');
showFolderView(locationpath);
} else {
$('#deleteFileMessage').text("提示:出现意外错误,可能未能删除全部文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
}
}
},
error : function() {
$('#deleteFileMessage').text("提示:出现意外错误,可能未能删除全部文件");
$("#dfmbutton").attr('disabled', false);
$("#cancelDeleteFileBox").attr('disabled', false);
}
});
}
@ -2598,6 +2625,7 @@ function stickFile() {
"<button id='dmvfbutton' type='button' class='btn btn-danger' onclick='doMoveFiles()'>全部移动</button>");
}
$("#selectFileMoveModelAsAll").removeAttr("checked");
$("#cancelMoveFilesBtn").attr('disabled', false);
$("#selectFileMoveModelAlert").hide();
$('#moveFilesModal').modal('show');
}
@ -2606,6 +2634,7 @@ function stickFile() {
// 先行确认文件移动操作
function doMoveFiles() {
$("#dmvfbutton").attr('disabled', true);
$("#cancelMoveFilesBtn").attr('disabled', true);
var method = "MOVE";
if (isCopy) {
$('#moveFilesMessage').text("提示:正在复制,请稍候...");
@ -2633,26 +2662,31 @@ function doMoveFiles() {
case "noAuthorized":
$('#moveFilesMessage').text("提示:您的操作未被授权,操作失败");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "errorParameter":
$('#moveFilesMessage').text(
"提示:参数不正确,无法完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "cannotMoveFiles":
$('#moveFilesMessage').text(
"提示:出现意外错误,可能未能完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "filesTotalOutOfLimit":
$('#moveFilesMessage').text(
"提示:该文件夹内存储的文件数量已达上限,无法添加更多文件");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "foldersTotalOutOfLimit":
$('#moveFilesMessage').text(
"提示:该文件夹内存储的文件夹数量已达上限,无法添加更多文件夹");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "confirmMoveFiles":
strMoveOptMap = {};
@ -2690,6 +2724,7 @@ function doMoveFiles() {
$('#moveFilesMessage').text(
"提示:出现意外错误,可能未能完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
}
break;
}
@ -2698,6 +2733,7 @@ function doMoveFiles() {
error : function() {
$('#moveFilesMessage').text("提示:出现意外错误,可能未能完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
}
});
}
@ -2767,26 +2803,31 @@ function sendMoveFilesReq() {
case "noAuthorized":
$('#moveFilesMessage').text("提示:您的操作未被授权,操作失败");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "errorParameter":
$('#moveFilesMessage').text(
"提示:参数不正确,无法完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "filesTotalOutOfLimit":
$('#moveFilesMessage').text(
"提示:该文件夹内存储的文件数量已达上限,无法添加更多文件");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "foldersTotalOutOfLimit":
$('#moveFilesMessage').text(
"提示:该文件夹内存储的文件夹数量已达上限,无法添加更多文件夹");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "cannotMoveFiles":
$('#moveFilesMessage').text(
"提示:出现意外错误,可能未能完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
case "moveFilesSuccess":
$('#moveFilesModal').modal('hide');
@ -2796,6 +2837,7 @@ function sendMoveFilesReq() {
$('#moveFilesMessage').text(
"提示:出现意外错误,可能未能完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
break;
}
}
@ -2803,6 +2845,7 @@ function sendMoveFilesReq() {
error : function() {
$('#moveFilesMessage').text("提示:出现意外错误,可能未能完成此操作,请刷新后重试");
$("#dmvfbutton").attr('disabled', false);
$("#cancelMoveFilesBtn").attr('disabled', false);
}
});
}