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