解压缩以后清空缓存

This commit is contained in:
lilin 2025-07-16 16:26:44 +08:00
parent 55e5c06843
commit d71cd55426

View File

@ -2094,19 +2094,30 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
*/ */
private TsFiles createFileRecord(String fileName, String parentId, String workPath, private TsFiles createFileRecord(String fileName, String parentId, String workPath,
String taskId, String nodeId, String uploader, String fileSize) { String taskId, String nodeId, String uploader, String fileSize) {
// QueryWrapper<TsFiles> query = new QueryWrapper<TsFiles>()
QueryWrapper<TsFiles> query = new QueryWrapper<TsFiles>() // .eq("node_id", nodeId)
.eq("node_id", nodeId) // .eq("task_id", taskId)
.eq("task_id", taskId) // .eq("work_path", workPath)
.eq("work_path", workPath) // .eq("file_name", fileName)
.eq("file_name", fileName) // .eq("is_file", "FILE")
.eq("is_file", "FILE") // .eq("parent_id", parentId);
.eq("parent_id", parentId); // TsFiles existing = tsFilesMapper.selectOne(query);
TsFiles existing = tsFilesMapper.selectOne(query); // if (existing != null) {
if (existing != null) { // return existing;
return existing; // } else {
} else { // TsFiles fileRecord = new TsFiles();
TsFiles fileRecord = new TsFiles(); // fileRecord.setNodeId(nodeId);
// fileRecord.setTaskId(taskId);
// fileRecord.setParentId(parentId);
// fileRecord.setFileName(fileName);
// fileRecord.setWorkPath(workPath);
// fileRecord.setIsFile("FILE");
// fileRecord.setFileSize(fileSize);
// fileRecord.setUploadTime(new Timestamp(System.currentTimeMillis()));
// operateTsfeiles(fileRecord); // 插入或更新记录
// return fileRecord;
// }
TsFiles fileRecord = new TsFiles();
fileRecord.setNodeId(nodeId); fileRecord.setNodeId(nodeId);
fileRecord.setTaskId(taskId); fileRecord.setTaskId(taskId);
fileRecord.setParentId(parentId); fileRecord.setParentId(parentId);
@ -2117,7 +2128,6 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
fileRecord.setUploadTime(new Timestamp(System.currentTimeMillis())); fileRecord.setUploadTime(new Timestamp(System.currentTimeMillis()));
operateTsfeiles(fileRecord); // 插入或更新记录 operateTsfeiles(fileRecord); // 插入或更新记录
return fileRecord; return fileRecord;
}
} }
/** /**
@ -2212,7 +2222,8 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
.eq("task_id", tsFiles.getTaskId()) .eq("task_id", tsFiles.getTaskId())
.eq("work_path", tsFiles.getWorkPath()) .eq("work_path", tsFiles.getWorkPath())
.eq("file_name", tsFiles.getFileName()) .eq("file_name", tsFiles.getFileName())
.eq("is_file", tsFiles.getIsFile()); .eq("is_file", tsFiles.getIsFile())
.eq("parent_id", tsFiles.getParentId());
TsFiles existing = tsFilesMapper.selectOne(query); TsFiles existing = tsFilesMapper.selectOne(query);
if (existing != null) { if (existing != null) {
existing.setUpdateTime(new Timestamp(System.currentTimeMillis())); existing.setUpdateTime(new Timestamp(System.currentTimeMillis()));
@ -3641,7 +3652,6 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
// 递归创建父文件夹 // 递归创建父文件夹
boolean parentsCreated = createParentFolders(currentFile.getParentId()); boolean parentsCreated = createParentFolders(currentFile.getParentId());
if (!parentsCreated) { if (!parentsCreated) {
LOGGER.error("父文件夹创建失败");
return false; return false;
} }
@ -3657,21 +3667,17 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
//如果文件夹创建成功 //如果文件夹创建成功
if (flag) { if (flag) {
LOGGER.info("同步本地到minio,minio文件夹创建成功");
value = true; value = true;
currentFile.setUpdateTime(currentTime); currentFile.setUpdateTime(currentTime);
currentFile.setBackupPath(minioPath); currentFile.setBackupPath(minioPath);
int valueAdded = tsFilesMapper.updateById(currentFile); int valueAdded = tsFilesMapper.updateById(currentFile);
if (valueAdded == 1) { if (valueAdded == 1) {
LOGGER.info("同步本地到minio,minio文件夹创建成功,表结构修改成功。");
value = true; value = true;
} else { } else {
LOGGER.error("同步本地到minio,minio文件夹创建成功表结构修改失败");
value = false; value = false;
} }
} else { } else {
LOGGER.error("同步本地到minio,minio文件夹创建失败");
value = false; value = false;
} }
} else { } else {
@ -3697,7 +3703,6 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
// 递归创建父文件夹 // 递归创建父文件夹
boolean parentsCreated = createParentFolders(currentFile.getParentId()); boolean parentsCreated = createParentFolders(currentFile.getParentId());
if (!parentsCreated) { if (!parentsCreated) {
LOGGER.error("父文件夹创建失败");
return false; return false;
} }
//把本地文件上传到minio //把本地文件上传到minio
@ -3707,21 +3712,17 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
//如果上传成功 修改 表结构 //如果上传成功 修改 表结构
if (flag1) { if (flag1) {
LOGGER.info("同步本地到minio,minio文件创建成功");
value = true; value = true;
currentFile.setUpdateTime(currentTime); currentFile.setUpdateTime(currentTime);
currentFile.setBackupPath(minioPath); currentFile.setBackupPath(minioPath);
int valueAdded = tsFilesMapper.updateById(currentFile); int valueAdded = tsFilesMapper.updateById(currentFile);
if (valueAdded == 1) { if (valueAdded == 1) {
LOGGER.info("同步本地到minio,minio文件创建成功,表结构修改成功。");
value = true; value = true;
} else { } else {
LOGGER.error("同步本地到minio,minio文件创建成功表结构修改失败");
value = false; value = false;
} }
} else { } else {
LOGGER.error("同步本地到minio,minio文件创建失败");
value = false; value = false;
} }
} }
@ -4328,7 +4329,6 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
// 递归创建父文件夹 // 递归创建父文件夹
boolean parentsCreated = createLocalParentFolders(tsFiles.getParentId()); boolean parentsCreated = createLocalParentFolders(tsFiles.getParentId());
if (!parentsCreated) { if (!parentsCreated) {
LOGGER.error("父文件夹创建失败");
return false; return false;
} }
@ -4349,15 +4349,12 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
tsFiles.setWorkPath(path); tsFiles.setWorkPath(path);
int valueAdded = tsFilesMapper.updateById(tsFiles); int valueAdded = tsFilesMapper.updateById(tsFiles);
if (valueAdded == 1) { if (valueAdded == 1) {
LOGGER.info("同步minio到本地,本地文件夹创建成功,表结构修改成功。");
value = true; value = true;
} else { } else {
LOGGER.error("同步minio到本地,本地文件夹创建成功,表结构修改失败");
value = false; value = false;
} }
} else { } else {
LOGGER.error("同步minio到本地,本地文件夹创建失败");
value = false; value = false;
} }
@ -4380,7 +4377,6 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
// 递归创建父文件夹 // 递归创建父文件夹
boolean parentsCreated = createLocalParentFolders(tsFiles.getParentId()); boolean parentsCreated = createLocalParentFolders(tsFiles.getParentId());
if (!parentsCreated) { if (!parentsCreated) {
LOGGER.error("父文件夹创建失败");
return false; return false;
} }
@ -4411,11 +4407,8 @@ public class TsFilesServiceImpl extends ServiceImpl<TsFilesMapper, TsFiles> impl
tsFiles.setWorkPath(path); tsFiles.setWorkPath(path);
int valueAdded = tsFilesMapper.updateById(tsFiles); int valueAdded = tsFilesMapper.updateById(tsFiles);
if (valueAdded == 1) { if (valueAdded == 1) {
LOGGER.info("同步minio到本地,本地文件创建成功,表结构修改成功。");
LOGGER.info("文件下载成功:" + localPath);
value = true; value = true;
} else { } else {
LOGGER.error("同步minio到本地,本地文件创建成功,表结构修改失败");
value = false; value = false;
} }
} catch (Exception e) { } catch (Exception e) {