1.物理删除文件时不删除远端文件。2.个人数据层级结构新增用户id隔离。
This commit is contained in:
parent
6a48585380
commit
5b2817d66e
|
|
@ -122,6 +122,11 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEleDataPath(int dataOwnCode) {
|
public String getEleDataPath(int dataOwnCode) {
|
||||||
|
|
||||||
|
if (DataOwnEnum.isUserCode(dataOwnCode)) {
|
||||||
|
return PATH_MAP.get(dataOwnCode) + File.separator + UserThreadLocal.getUserId() + File.separator;
|
||||||
|
}
|
||||||
|
|
||||||
return PATH_MAP.get(dataOwnCode);
|
return PATH_MAP.get(dataOwnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +147,7 @@ public class CommonService {
|
||||||
public String getFileSysPath(String dbPath, int dataOwnCode) {
|
public String getFileSysPath(String dbPath, int dataOwnCode) {
|
||||||
ArrayList<String> paths = CollUtil.newArrayList(dbPath.split(MYSQL_FILE_PATH_SPLIT));
|
ArrayList<String> paths = CollUtil.newArrayList(dbPath.split(MYSQL_FILE_PATH_SPLIT));
|
||||||
String path = getDbPath(paths);
|
String path = getDbPath(paths);
|
||||||
return PATH_MAP.get(dataOwnCode) + File.separator + path;
|
return getEleDataPath(dataOwnCode) + File.separator + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDbPath(String dbPath) {
|
public String getDbPath(String dbPath) {
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
||||||
.eq(EdFileInfo::getFileId, fileId));
|
.eq(EdFileInfo::getFileId, fileId));
|
||||||
for (EdFileInfo edFileInfo : edFileInfos) {
|
for (EdFileInfo edFileInfo : edFileInfos) {
|
||||||
String fileSysPath = commonService.getFileSysPath(edFileInfo.getFilePath(), edFileInfo.getDataOwn());
|
String fileSysPath = commonService.getFileSysPath(edFileInfo.getFilePath(), edFileInfo.getDataOwn());
|
||||||
|
String fileDbPath = commonService.getDbPath(edFileInfo.getFilePath());
|
||||||
// 移动到tmp目录,七天后删除
|
// 移动到tmp目录,七天后删除
|
||||||
fileSystemService.moveFile(fileSysPath, elePropertyConfig.getEleTmpPath() + File.separator + new File(fileSysPath).getName());
|
fileSystemService.moveFile(fileSysPath, elePropertyConfig.getEleTmpPath() + File.separator + new File(fileSysPath).getName());
|
||||||
// 更新MySQL数据库
|
// 更新MySQL数据库
|
||||||
|
|
@ -136,11 +137,11 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
||||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||||
.set(EdFileInfo::getPermanentDeleted, true)
|
.set(EdFileInfo::getPermanentDeleted, true)
|
||||||
.set(EdFileInfo::getAllDeleted, true));
|
.set(EdFileInfo::getAllDeleted, true));
|
||||||
UserThreadLocal.setSuccessInfo(edFileInfo.getParentId(), edFileInfo.getId(), "删除文件 {} 成功,文件id {}", edFileInfos.get(0).getFileName() + "." + edFileInfos.get(0).getFileType(), fileId);
|
UserThreadLocal.setSuccessInfo(edFileInfo.getParentId(), edFileInfo.getId(), "删除文件 {} 成功,文件id {},文件路径 {}", edFileInfos.get(0).getFileName() + "." + edFileInfos.get(0).getFileType(), edFileInfo.getId(), fileDbPath);
|
||||||
BackupFileResLog resLog = backupHandler.deleteFile(edFileInfo.getId());
|
// BackupFileResLog resLog = backupHandler.deleteFile(edFileInfo.getId());
|
||||||
if (!Optional.ofNullable(resLog).map(BackupFileResLog::getBackupSuccess).orElse(false)) {
|
// if (!Optional.ofNullable(resLog).map(BackupFileResLog::getBackupSuccess).orElse(false)) {
|
||||||
log.warn("删除备份文件异常");
|
// log.warn("删除备份文件异常");
|
||||||
}
|
// }
|
||||||
return ElectromagneticResultUtil.success("删除文件成功");
|
return ElectromagneticResultUtil.success("删除文件成功");
|
||||||
}
|
}
|
||||||
return ElectromagneticResultUtil.success("删除文件成功");
|
return ElectromagneticResultUtil.success("删除文件成功");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue