添加parentId
This commit is contained in:
parent
cbcc133c2f
commit
58e4c4397d
|
|
@ -141,6 +141,7 @@ public class LoginInterceptor implements HandlerInterceptor {
|
||||||
} else { // 返回为ResponseEntity,且状态为失败。
|
} else { // 返回为ResponseEntity,且状态为失败。
|
||||||
userAccessLog.setAccessSuccess(false);
|
userAccessLog.setAccessSuccess(false);
|
||||||
}
|
}
|
||||||
|
userAccessLogMapper.insert(userAccessLog);
|
||||||
UserThreadLocal.remove();
|
UserThreadLocal.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fileSystemService.renameFile(srcFilePath, srcPrjName + "." + IdUtil.fastSimpleUUID() + DELETE_FLAG);
|
// fileSystemService.renameFile(srcFilePath, srcPrjName + "." + IdUtil.fastSimpleUUID() + DELETE_FLAG);
|
||||||
UserThreadLocal.setSuccessInfo(id, "删除目录 {} 成功", fileInfo.getFileName());
|
UserThreadLocal.setSuccessInfo(srcFileInfo.getParentId(), id, "删除目录 {} 成功", fileInfo.getFileName());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = StrFormatter.format("删除文件 {} 失败,目录非空。", fileInfo.getFileName());
|
String info = StrFormatter.format("删除文件 {} 失败,目录非空。", fileInfo.getFileName());
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
long total = edFileInfoPage.getTotal();
|
long total = edFileInfoPage.getTotal();
|
||||||
List<FileInfoVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoVO.class);
|
List<FileInfoVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoVO.class);
|
||||||
resetFileSize(records);
|
resetFileSize(records);
|
||||||
UserThreadLocal.setSuccessInfo("", "", "查询搜索文件成功");
|
UserThreadLocal.setSuccessInfo("", "", "查询文件成功");
|
||||||
return ElectromagneticResultUtil.success(new RespPageVO<>(total, records));
|
return ElectromagneticResultUtil.success(new RespPageVO<>(total, records));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,7 +211,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
EdFileInfo fileInfo = this.baseMapper.selectById(id);
|
EdFileInfo fileInfo = this.baseMapper.selectById(id);
|
||||||
if (fileInfo.getDataType() == EleDataTypeEnum.FOLDER.code) {
|
if (fileInfo.getDataType() == EleDataTypeEnum.FOLDER.code) {
|
||||||
ElectromagneticResult<?> res = commonService.deleteFolder(id, dataOwnCode);
|
ElectromagneticResult<?> res = commonService.deleteFolder(id, dataOwnCode);
|
||||||
UserThreadLocal.setSuccessInfo(id, "作废目录 {} 成功", fileInfo.getFileName());
|
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), id, "作废目录 {} 成功", fileInfo.getFileName());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
|
@ -222,7 +222,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.set(EdFileInfo::getEffectFlag, false)
|
.set(EdFileInfo::getEffectFlag, false)
|
||||||
.set(EdFileInfo::getAllDeleted, true)
|
.set(EdFileInfo::getAllDeleted, true)
|
||||||
.eq(EdFileInfo::getFileId, fileInfo.getFileId()));
|
.eq(EdFileInfo::getFileId, fileInfo.getFileId()));
|
||||||
UserThreadLocal.setSuccessInfo(id, "作废目录 {} 成功", fileInfo.getFileName());
|
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), id, "作废目录 {} 成功", fileInfo.getFileName());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,7 +247,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
headers.add("Expires", "0");
|
headers.add("Expires", "0");
|
||||||
String newFileName = Base64.encode(fileName.substring(0, fileName.lastIndexOf(".")));
|
String newFileName = Base64.encode(fileName.substring(0, fileName.lastIndexOf(".")));
|
||||||
response.setHeader("content-disposition", "attachment;filename=" + newFileName);
|
response.setHeader("content-disposition", "attachment;filename=" + newFileName);
|
||||||
UserThreadLocal.setSuccessInfo(fileInfo.getFileId(), "下载文件 {} 成功", fileName);
|
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), fileInfo.getFileId(), "下载文件 {} 成功", fileName);
|
||||||
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
||||||
return ResponseEntity
|
return ResponseEntity
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -316,7 +316,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
||||||
String newName = updateFileInfoDTO.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
String newName = updateFileInfoDTO.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
||||||
fileSystemService.renameFile(srcFilePath, newName);
|
fileSystemService.renameFile(srcFilePath, newName);
|
||||||
UserThreadLocal.setSuccessInfo(updateFileInfoDTO.getId(), "更新文件信息成功,新文件名为 {}", newFileName);
|
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), updateFileInfoDTO.getId(), "更新文件信息成功,新文件名为 {}", newFileName);
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = StrFormatter.format("更新文件信息失败,新文件名 {}, 原因 {}", newFileName, e.getMessage());
|
String info = StrFormatter.format("更新文件信息失败,新文件名 {}, 原因 {}", newFileName, e.getMessage());
|
||||||
|
|
@ -805,7 +805,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
log.error(info, e);
|
log.error(info, e);
|
||||||
throw new BizException(info);
|
throw new BizException(info);
|
||||||
}
|
}
|
||||||
UserThreadLocal.setSuccessInfo(finalEdFileInfo.getFileId(), "文件 {} 为上传到 {} 成功,同名同后缀的处理方式为 {},存入的文件名为 {}", fileName, destPath, strategyStr, finalEdFileInfo.getFileName()+ "." + finalEdFileInfo.getFileType());
|
UserThreadLocal.setSuccessInfo(finalEdFileInfo.getParentId(), finalEdFileInfo.getFileId(), "文件 {} 为上传到 {} 成功,同名同后缀的处理方式为 {},存入的文件名为 {}", fileName, destPath, strategyStr, finalEdFileInfo.getFileName()+ "." + finalEdFileInfo.getFileType());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -866,7 +866,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
} else {
|
} else {
|
||||||
srcFileInfo = handMoveConflict(targetFolderId, strategy, srcFileInfo, destFolderInfo, dataOwnCode);
|
srcFileInfo = handMoveConflict(targetFolderId, strategy, srcFileInfo, destFolderInfo, dataOwnCode);
|
||||||
}
|
}
|
||||||
UserThreadLocal.setSuccessInfo(srcFileInfo.getFileId(), "文件 {} 移动到 {},成功,处理文件同名同后缀的方式为 {},最终文件名为 {}", srcFileInfo.getFileName() + "." + srcFileInfo.getFileName(),
|
UserThreadLocal.setSuccessInfo(srcFileInfo.getParentId(), srcFileInfo.getFileId(), "文件 {} 移动到 {},成功,处理文件同名同后缀的方式为 {},最终文件名为 {}", srcFileInfo.getFileName() + "." + srcFileInfo.getFileName(),
|
||||||
commonService.getDbPath(destFolderInfo.getFilePath()), FileRepeatEnum.getDesc(strategy), srcFileInfo.getFileName());
|
commonService.getDbPath(destFolderInfo.getFilePath()), FileRepeatEnum.getDesc(strategy), srcFileInfo.getFileName());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
}
|
}
|
||||||
|
|
@ -953,7 +953,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
||||||
EdFileInfo destFolderInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
EdFileInfo destFolderInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getId, targetFolderId));
|
.eq(EdFileInfo::getId, targetFolderId));
|
||||||
EdFileInfo destFileInfo = null;
|
EdFileInfo destFileInfo;
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
// 没有同名文件
|
// 没有同名文件
|
||||||
// 首先将信息保存到MySQL
|
// 首先将信息保存到MySQL
|
||||||
|
|
@ -975,7 +975,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
} else {
|
} else {
|
||||||
destFileInfo = handCopyConflict(targetFolderId, strategy, srcFileInfo, destFolderInfo, dataOwnCode);
|
destFileInfo = handCopyConflict(targetFolderId, strategy, srcFileInfo, destFolderInfo, dataOwnCode);
|
||||||
}
|
}
|
||||||
UserThreadLocal.setSuccessInfo(destFileInfo.getFileId(), "文件 {} 复制到 {},成功,处理文件同名同后缀的方式为 {},最终文件名为 {}", destFileInfo.getFileName() + "." + destFileInfo.getFileName(),
|
UserThreadLocal.setSuccessInfo(destFileInfo.getParentId(), destFileInfo.getFileId(), "文件 {} 复制到 {},成功,处理文件同名同后缀的方式为 {},最终文件名为 {}", destFileInfo.getFileName() + "." + destFileInfo.getFileName(),
|
||||||
commonService.getDbPath(destFolderInfo.getFilePath()), FileRepeatEnum.getDesc(strategy), srcFileInfo.getFileName());
|
commonService.getDbPath(destFolderInfo.getFilePath()), FileRepeatEnum.getDesc(strategy), srcFileInfo.getFileName());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
}
|
}
|
||||||
|
|
@ -1278,7 +1278,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + fileName);
|
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + fileName);
|
||||||
headers.add(HttpHeaders.CONTENT_TYPE, mimeType);
|
headers.add(HttpHeaders.CONTENT_TYPE, mimeType);
|
||||||
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
||||||
UserThreadLocal.setSuccessInfo(fileInfo.getFileId(), "文件预览成功,文件名为 {}", fileInfo.getFileName() + "." + fileInfo.getFileType());
|
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), fileInfo.getFileId(), "文件预览成功,文件名为 {}", fileInfo.getFileName() + "." + fileInfo.getFileType());
|
||||||
return ResponseEntity
|
return ResponseEntity
|
||||||
.ok()
|
.ok()
|
||||||
.headers(headers)
|
.headers(headers)
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
this.save(fileInfo);
|
this.save(fileInfo);
|
||||||
// 保存到文件系统
|
// 保存到文件系统
|
||||||
fileSystemService.createDirectory(commonService.getEleDataPath(dataOwnCode) + File.separator + prjName);
|
fileSystemService.createDirectory(commonService.getEleDataPath(dataOwnCode) + File.separator + prjName);
|
||||||
UserThreadLocal.setSuccessInfo(newPrjId, "创建 {} 项目成功。", prjName);
|
UserThreadLocal.setSuccessInfo("", newPrjId, "创建 {} 项目成功。", prjName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = StrFormatter.format("工程 {} 创建失败,具体为--->{}", prjName, e.getMessage());
|
String info = StrFormatter.format("工程 {} 创建失败,具体为--->{}", prjName, e.getMessage());
|
||||||
log.error(info, e);
|
log.error(info, e);
|
||||||
|
|
@ -156,7 +156,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
.set(EdFileInfo::getUpdatedBy, UserThreadLocal.getUserId())
|
.set(EdFileInfo::getUpdatedBy, UserThreadLocal.getUserId())
|
||||||
.set(EdFileInfo::getUpdatedTime, new Date()));
|
.set(EdFileInfo::getUpdatedTime, new Date()));
|
||||||
fileSystemService.renameFile(commonService.getEleDataPath(dataOwnCode), oldPrjName, newPrjName);
|
fileSystemService.renameFile(commonService.getEleDataPath(dataOwnCode), oldPrjName, newPrjName);
|
||||||
UserThreadLocal.setSuccessInfo(prjId, "修改工层名 {} 为 {} 成功。", oldPrjName, newPrjName);
|
UserThreadLocal.setSuccessInfo("", prjId, "修改工层名 {} 为 {} 成功。", oldPrjName, newPrjName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = StrFormatter.format("修改工程名异常--->{},{}", newPrjName, e.getMessage());
|
String info = StrFormatter.format("修改工程名异常--->{},{}", newPrjName, e.getMessage());
|
||||||
log.error(info, e);
|
log.error(info, e);
|
||||||
|
|
@ -197,7 +197,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
// 对原文件进行处理
|
// 对原文件进行处理
|
||||||
EdFileInfo prjFile = this.getById(prjId);
|
EdFileInfo prjFile = this.getById(prjId);
|
||||||
fileSystemService.renameFile(commonService.getFileSysPath(prjId, dataOwnCode), prjFile + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG);
|
fileSystemService.renameFile(commonService.getFileSysPath(prjId, dataOwnCode), prjFile + "_" + IdUtil.fastSimpleUUID() + DELETE_FLAG);
|
||||||
UserThreadLocal.setSuccessInfo(prjId, "废除 {} 项目成功。", prjFile.getFileName());
|
UserThreadLocal.setSuccessInfo("", prjId, "废除 {} 项目成功。", prjFile.getFileName());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = "废除项目失败";
|
String info = "废除项目失败";
|
||||||
|
|
@ -228,7 +228,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
int id = Integer.parseInt(this.baseMapper.maxPrjId());
|
int id = Integer.parseInt(this.baseMapper.maxPrjId());
|
||||||
String folderId = String.valueOf(id + 1);
|
String folderId = String.valueOf(id + 1);
|
||||||
ElectromagneticResult<?> electromagneticResult = commonService.addFolder(parentId, folderName, true, folderId, null, dataOwnCode);
|
ElectromagneticResult<?> electromagneticResult = commonService.addFolder(parentId, folderName, true, folderId, null, dataOwnCode);
|
||||||
UserThreadLocal.setSuccessInfo(electromagneticResult.getData() + "", "添加子集 {} 成功", folderName);
|
UserThreadLocal.setSuccessInfo(parentId, electromagneticResult.getData() + "", "添加子集 {} 成功", folderName);
|
||||||
return electromagneticResult;
|
return electromagneticResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -319,7 +319,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
.likeRight(EdFileInfo::getFilePath, prjId);
|
.likeRight(EdFileInfo::getFilePath, prjId);
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
commonService.deletePrjSysDir(fileSysPaths);
|
commonService.deletePrjSysDir(fileSysPaths);
|
||||||
UserThreadLocal.setSuccessInfo(prjId, "项目 {} 发布成功", fileInfo.getFileName());
|
UserThreadLocal.setSuccessInfo("", prjId, "项目 {} 发布成功", fileInfo.getFileName());
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = StrFormatter.format("项目 {} 发布异常", fileInfo.getFileName());
|
String info = StrFormatter.format("项目 {} 发布异常", fileInfo.getFileName());
|
||||||
|
|
@ -463,7 +463,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
.eq(EdFileInfo::getId, id)
|
.eq(EdFileInfo::getId, id)
|
||||||
.set(EdFileInfo::getFileName, newFolderName));
|
.set(EdFileInfo::getFileName, newFolderName));
|
||||||
fileSystemService.renameFile(sysFilePath, newFolderName);
|
fileSystemService.renameFile(sysFilePath, newFolderName);
|
||||||
UserThreadLocal.setSuccessInfo(id, "子集名称 {} 修改成功", newFolderName);
|
UserThreadLocal.setSuccessInfo(parentId, id, "子集名称 {} 修改成功", newFolderName);
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = StrFormatter.format("修改子集名称为 {} 失败", newFolderName);
|
String info = StrFormatter.format("修改子集名称为 {} 失败", newFolderName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue