文件备份的bug

This commit is contained in:
chenxudong 2025-04-16 16:07:36 +08:00
parent 7139f5350c
commit 1aae819f4e
3 changed files with 4 additions and 4 deletions

View File

@ -136,7 +136,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.getId()); String fileSysPath = commonService.getFileSysPath(edFileInfo.getId());
backupHandler.backupFiles(fileSysPath, edFileInfo.getParentId()); backupHandler.backupFiles(fileSysPath);
String fileDbPath = commonService.getDbPath(edFileInfo.getFilePath()); 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());

View File

@ -21,7 +21,7 @@ public class BackupHandler {
@Resource @Resource
private ElePropertyConfig elePropertyConfig; private ElePropertyConfig elePropertyConfig;
public BackupFileResLog backupFiles(String filePath, String id) { public BackupFileResLog backupFiles(String filePath) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("file", new File(filePath)); map.put("file", new File(filePath));
String url = StrFormatter.format("http://{}:{}/data/file/backup/upload", elePropertyConfig.getRemoteHost(), elePropertyConfig.getRemotePort()); String url = StrFormatter.format("http://{}:{}/data/file/backup/upload", elePropertyConfig.getRemoteHost(), elePropertyConfig.getRemotePort());

View File

@ -68,7 +68,7 @@ public class BackupTask {
.eq(EdFileInfo::getId, id)); .eq(EdFileInfo::getId, id));
String sysFilePath = commonService.getFileSysPath(fileInfo.getId()); String sysFilePath = commonService.getFileSysPath(fileInfo.getId());
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
BackupFileResLog resLog = backupHandler.backupFiles(sysFilePath, id); BackupFileResLog resLog = backupHandler.backupFiles(sysFilePath);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
fileBackupLogMapper.update(null, Wrappers.<FileBackupLog>lambdaUpdate() fileBackupLogMapper.update(null, Wrappers.<FileBackupLog>lambdaUpdate()
.eq(FileBackupLog::getFileId, id) .eq(FileBackupLog::getFileId, id)
@ -100,7 +100,7 @@ public class BackupTask {
String fileSysPath = commonService.getFileSysPath(edFileInfo.getId()); String fileSysPath = commonService.getFileSysPath(edFileInfo.getId());
UserThreadLocal.remove(); UserThreadLocal.remove();
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
BackupFileResLog resLog = backupHandler.backupFiles(fileSysPath, edFileInfo.getId()); BackupFileResLog resLog = backupHandler.backupFiles(fileSysPath);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
FileBackupLog backupLog = new FileBackupLog() FileBackupLog backupLog = new FileBackupLog()
.setId(IdWorker.getSnowFlakeIdString()) .setId(IdWorker.getSnowFlakeIdString())