调通了文件移动

This commit is contained in:
chenxudong 2024-12-27 09:02:39 +08:00
parent d7a818bb3a
commit 28b6c4f772
1 changed files with 5 additions and 2 deletions

View File

@ -677,16 +677,19 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
// 处理MySQL相关逻辑
EdFileInfo newEdFileInfo = BeanUtil.copyProperties(srcFileInfo, EdFileInfo.class);
newEdFileInfo.newInit();
String dbPathByDbPath = commonService.getCodePathByDbPath(destFolderInfo.getFilePath());
newEdFileInfo.setParentId(targetFolderId)
.setFileVersion(FILE_START_VERSION)
.setFileName(srcFileInfo.getFileName() + "_1")
.setFileCode(commonService.createFileCode(targetFolderId, srcFileInfo.getFileType(), FILE_START_VERSION, newEdFileInfo.getFileTime()))
.setFileCode(commonService.createFileCode(dbPathByDbPath, srcFileInfo.getFileType(), FILE_START_VERSION, newEdFileInfo.getFileTime()))
.setFilePath(destFolderInfo.getFilePath() + MYSQL_FILE_PATH_SPLIT + newEdFileInfo.getId());
resetFileInfoName(newEdFileInfo);
this.baseMapper.insert(newEdFileInfo);
// 移动文件
String srcFileSysPath = commonService.getFileSysPath(srcFileInfo.getFilePath());
String destFileSysPath = commonService.getFileSysPath(destFolderInfo.getFilePath());
String destFileSysPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
fileSystemService.moveFile(srcFileSysPath, destFileSysPath, deleteSrc);
this.baseMapper.deleteById(srcFileInfo.getId());
}
return ElectromagneticResultUtil.success(true);
}