From 5d8fca9ee1bd0b42d9d1db481c9aa4bc1b1b7da7 Mon Sep 17 00:00:00 2001 From: chenxudong Date: Wed, 5 Mar 2025 10:37:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=A4=87=E4=BB=BD=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FileBackupLogController.java | 2 +- .../software/manage/pojo/resp/FileBackLogVO.java | 2 ++ .../serviceimpl/FileRecycleServiceImpl.java | 15 +++++++++------ 3 files changed, 12 insertions(+), 7 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 ee84204..c7bf5f1 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 @@ -18,7 +18,7 @@ public class FileBackupLogController { private FileBackLogService fileBackLogService; @RequestMapping(value = "list") - @UserOperation(value="查询了备份日志", modelName = UserOperationModuleEnum.BACKUP_FILE) + @UserOperation(value="查询备份日志", modelName = UserOperationModuleEnum.BACKUP_FILE) public ElectromagneticResult list(@RequestParam int pageNum, @RequestParam int pageSize) { return fileBackLogService.query(pageNum, pageSize); } diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/pojo/resp/FileBackLogVO.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/pojo/resp/FileBackLogVO.java index 2a66667..89f5df3 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/pojo/resp/FileBackLogVO.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/pojo/resp/FileBackLogVO.java @@ -19,4 +19,6 @@ public class FileBackLogVO { private Date backEndTime; + private boolean backupSuccess; + } diff --git a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileRecycleServiceImpl.java b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileRecycleServiceImpl.java index ab9b63e..818bbd1 100644 --- a/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileRecycleServiceImpl.java +++ b/electrmangnetic/src/main/java/com/electromagnetic/industry/software/manage/service/serviceimpl/FileRecycleServiceImpl.java @@ -19,6 +19,7 @@ import com.electromagnetic.industry.software.common.util.IdWorker; import com.electromagnetic.industry.software.common.util.UserThreadLocal; import com.electromagnetic.industry.software.manage.config.ElePropertyConfig; import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper; +import com.electromagnetic.industry.software.manage.mapper.FileBackupLogMapper; import com.electromagnetic.industry.software.manage.mapper.UserMapper; import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo; import com.electromagnetic.industry.software.manage.pojo.models.FileBackupLog; @@ -53,11 +54,13 @@ public class FileRecycleServiceImpl implements FileRecycleService { @Resource private CommonService commonService; @Resource - private BackupTask backupTask; + private FileBackupLogMapper fileBackupLogMapper; @Resource private FileSystemService fileSystemService; @Resource private ElePropertyConfig elePropertyConfig; + @Resource + private BackupTask backupTask; @Override public ElectromagneticResult list(RecycleFileQueryDTO pars) { @@ -127,7 +130,7 @@ public class FileRecycleServiceImpl implements FileRecycleService { List fileSysPaths = new ArrayList<>(); for (EdFileInfo edFileInfo : edFileInfos) { String fileSysPath = commonService.getFileSysPath(edFileInfo.getFilePath(), edFileInfo.getDataOwn()); - FileBackupLog fileBackupLog = backupTask.getBaseMapper().selectOne(Wrappers.lambdaQuery(FileBackupLog.class).eq(FileBackupLog::getFileId, edFileInfo.getId())); + FileBackupLog fileBackupLog = fileBackupLogMapper.selectOne(Wrappers.lambdaQuery(FileBackupLog.class).eq(FileBackupLog::getFileId, edFileInfo.getId())); String saveFileName = edFileInfo.getFileName() + "." + edFileInfo.getFileType() + "." + edFileInfo.getFileCode(); @@ -152,11 +155,11 @@ public class FileRecycleServiceImpl implements FileRecycleService { if (backup.getBackupSuccess()) { backupLog.setBackupSuccess(true); - backupTask.getBaseMapper().insert(backupLog); + fileBackupLogMapper.insert(backupLog); } else { backupLog.setBackupSuccess(false); backupLog.setFailInfoDetail(backup.getFailInfoDetail()); - backupTask.getBaseMapper().insert(backupLog); + fileBackupLogMapper.insert(backupLog); throw new BizException(StrFormatter.format("删除文件 {} 失败,原因 备份该文件出现错误,联系管理员查看日志", saveFileName)); } @@ -174,11 +177,11 @@ public class FileRecycleServiceImpl implements FileRecycleService { .setFileName(saveFileName); if (backup.getBackupSuccess()) { fileBackupLog.setBackupSuccess(true); - backupTask.getBaseMapper().update(fileBackupLog, null); + fileBackupLogMapper.update(fileBackupLog, null); } else { fileBackupLog.setBackupSuccess(false); fileBackupLog.setFailInfoDetail(backup.getFailInfoDetail()); - backupTask.getBaseMapper().update(fileBackupLog, null); + fileBackupLogMapper.update(fileBackupLog, null); throw new BizException(StrFormatter.format("删除文件 {} 失败,原因 备份该文件出现错误,联系管理员查看日志", saveFileName)); } }