Compare commits

..

2 Commits

3 changed files with 12 additions and 7 deletions

View File

@ -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);
}

View File

@ -19,4 +19,6 @@ public class FileBackLogVO {
private Date backEndTime;
private boolean backupSuccess;
}

View File

@ -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<String> 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));
}
}