Compare commits

..

No commits in common. "a0bbdaddc832861e15ef2ed71be62cd9ee9a202a" and "89821b83f5ff7cebc9bfa7acf502753beb012ea4" have entirely different histories.

1 changed files with 8 additions and 9 deletions

View File

@ -474,7 +474,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
ZipUtil.unzip(zipDirPath, tmpDir);
update2Database(tmpDir, dataOwnCode);
fileSystemService.deleteFile(zipDirPath, destColibPath);
UserThreadLocal.setSuccessInfo("", "", "导入数据库成功,文件名称为 " + mainName);
UserThreadLocal.setSuccessInfo("", "", "导入数据库成功");
return ElectromagneticResultUtil.success(true);
}
@ -494,13 +494,13 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
}
private void updateFileRelationInfo(String prjDirPath) {
String path = prjDirPath + File.separator + ED_FILE_RELATION + ".json";
String path = prjDirPath + File.separator + ED_TAG_RELATIONS + ".json";
List<EdFileRelation> relations = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), EdFileRelation.class);
edFileRelationService.saveOrUpdateBatch(relations);
}
private void updateFileTageInfo(String prjDirPath) {
String path = prjDirPath + File.separator + ED_TAG_RELATIONS + ".json";
String path = prjDirPath + File.separator + USER_ACCESS_LOG + ".json";
List<FileTagRelation> relations = JSONUtil.toList(FileUtil.readString(path, Charset.defaultCharset()), FileTagRelation.class);
fileTagRelationService.saveOrUpdateBatch(relations);
}
@ -692,7 +692,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
private void update2FileSystem(Set<EdFileInfo> needMove2FileSystemFiles, String prjDirPath, int dataOwnCode) {
List<EdFileInfo> files = needMove2FileSystemFiles.stream().filter(e -> e.getDataType().equals(EleDataTypeEnum.FILE.code)).toList();
List<File> files1 = Arrays.stream(Objects.requireNonNull(new File(prjDirPath).listFiles())).filter(e -> e.isDirectory() && e.getName().startsWith(EXPORT_PRJ_NAME)).toList();
List<File> files1 = FileUtil.loopFiles(new File(prjDirPath), file -> file.isDirectory() && file.getName().startsWith(EXPORT_PRJ_NAME));
String prjFilePath = files1.get(0).getAbsolutePath();
for (EdFileInfo edFileInfo : files) {
String id = edFileInfo.getId();
@ -748,7 +748,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
// 导出标签相关信息
exportFileTagInfo(nowTimeStr, exportFileIds, userDownloadDataDir);
// 导出操作记录相关
exportLogInfo(nowTimeStr, userDownloadDataDir);
exportLogInfo(nowTimeStr, exportFileIds, userDownloadDataDir);
String prjDirPath = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr;
String exportZipFile = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + ".zip";
@ -772,12 +772,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
FileSystemResource fileSystemResource = new FileSystemResource(file);
HttpHeaders headers = new HttpHeaders();
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
String tmpFileName = fileSystemResource.getFilename() + "_" + nowTimeStr;
String fileName = Base64.encode(tmpFileName);
String fileName = Base64.encode(fileSystemResource.getFilename() + "_" + nowTimeStr);
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
response.setHeader("content-disposition", "attachment;filename=" + fileName);
UserThreadLocal.setSuccessInfo("", "", "导出数据库成功,文件名称为" + tmpFileName);
UserThreadLocal.setSuccessInfo("", "", "导出数据库成功");
// 构建响应实体(可以返回<byte[]或Resource返回类型取决body入参类型)
return ResponseEntity
.ok()
@ -787,7 +786,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
.body(new InputStreamResource(fileSystemResource.getInputStream()));
}
private void exportLogInfo(String nowTimeStr, String userDownloadDataDir) {
private void exportLogInfo(String nowTimeStr, List<String> exportFileIds, String userDownloadDataDir) {
List<UserAccessLog> userAccessLogs = userAccessLogService.getBaseMapper().selectList(null);
String json = JSONUtil.toJsonStr(userAccessLogs);
String path = userDownloadDataDir + File.separator + EXPORT_PRJ_NAME + "_" + nowTimeStr + File.separator + USER_ACCESS_LOG + ".json";