From 330d0a43108e3b971a5d2d511d7c4dcfbcce6512 Mon Sep 17 00:00:00 2001 From: chenxudong Date: Fri, 18 Apr 2025 09:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/controller/FileBackupLogController.java | 6 ++++-- .../software/manage/service/FileBackLogService.java | 4 +++- .../manage/service/serviceimpl/CommonService.java | 2 +- .../service/serviceimpl/FileBackLogServiceImpl.java | 11 +++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/controller/FileBackupLogController.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/controller/FileBackupLogController.java index 961fdb1..54e3f22 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/controller/FileBackupLogController.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/controller/FileBackupLogController.java @@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @RestController @RequestMapping("/data/ed/backup/") public class FileBackupLogController { @@ -27,7 +29,7 @@ public class FileBackupLogController { @GetMapping(value = "restore") @UserOperation(value = "系统恢复", modelName = UserOperationModuleEnum.BACKUP_FILE) public ElectromagneticResult restore() { - fileBackLogService.restore(); - return ElectromagneticResultUtil.success(true); + List restorePaths = fileBackLogService.restore(); + return ElectromagneticResultUtil.success(restorePaths); } } diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/FileBackLogService.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/FileBackLogService.java index 1d7ea7c..e712056 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/FileBackLogService.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/FileBackLogService.java @@ -2,9 +2,11 @@ package com.electromagnetic.industry.software.manage.service; import com.electromagnetic.industry.software.common.resp.ElectromagneticResult; +import java.util.List; + public interface FileBackLogService { ElectromagneticResult query(Integer pageNumber, Integer pageSize); - void restore(); + List restore(); } diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/CommonService.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/CommonService.java index daec140..899d763 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/CommonService.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/CommonService.java @@ -201,7 +201,7 @@ public class CommonService { EdFileInfo fileInfo = map.get(id); String tmp; if (fileInfo.getDataType().equals(EleDataTypeEnum.FILE.code)) { - tmp = fileInfo.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode(); + tmp = fileInfo.getFileName() + "." + fileInfo.getFileType(); } else { tmp = fileInfo.getFileName() + File.separator; } diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileBackLogServiceImpl.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileBackLogServiceImpl.java index e8cfc89..4eb1d01 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileBackLogServiceImpl.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileBackLogServiceImpl.java @@ -79,18 +79,19 @@ public class FileBackLogServiceImpl extends ServiceImpl restore() { List edFileInfos = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class) .select(EdFileInfo.class, file -> !StrUtil.equals(file.getColumn(), "file_content")) .eq(EdFileInfo::getPermanentDeleted, false) .eq(EdFileInfo::getDataType, EleDataTypeEnum.FILE.code)); + List restoreFilePaths = new ArrayList<>(); for (EdFileInfo edFileInfo : edFileInfos) { - String destPath = ""; + String destPath; if (DataOwnEnum.isUserCode(edFileInfo.getDataOwn())) { - destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + edFileInfo.getCreatedBy() + File.separator + commonService.getDbPath(edFileInfo.getFilePath()); + destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + edFileInfo.getCreatedBy() + File.separator + edFileInfo.getId(); } else { - destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + commonService.getDbPath(edFileInfo.getFilePath()); + destPath = commonService.getPrjRootPath1(edFileInfo.getDataOwn()) + File.separator + edFileInfo.getId(); } destPath = destPath.replace("//", "/"); log.info("back up file path is {}", destPath); @@ -98,9 +99,11 @@ public class FileBackLogServiceImpl extends ServiceImpl