|
|
|
@ -19,7 +19,6 @@ import com.electromagnetic.industry.software.common.util.IdWorker;
|
|
|
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
|
|
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
|
|
|
import com.electromagnetic.industry.software.manage.config.ElePropertyConfig;
|
|
|
|
import com.electromagnetic.industry.software.manage.config.ElePropertyConfig;
|
|
|
|
import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper;
|
|
|
|
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.mapper.UserMapper;
|
|
|
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
|
|
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
|
|
|
import com.electromagnetic.industry.software.manage.pojo.models.FileBackupLog;
|
|
|
|
import com.electromagnetic.industry.software.manage.pojo.models.FileBackupLog;
|
|
|
|
@ -54,13 +53,11 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CommonService commonService;
|
|
|
|
private CommonService commonService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private FileBackupLogMapper fileBackupLogMapper;
|
|
|
|
private BackupTask backupTask;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private FileSystemService fileSystemService;
|
|
|
|
private FileSystemService fileSystemService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ElePropertyConfig elePropertyConfig;
|
|
|
|
private ElePropertyConfig elePropertyConfig;
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private BackupTask backupTask;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ElectromagneticResult<?> list(RecycleFileQueryDTO pars) {
|
|
|
|
public ElectromagneticResult<?> list(RecycleFileQueryDTO pars) {
|
|
|
|
@ -130,7 +127,7 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
|
|
|
List<String> fileSysPaths = new ArrayList<>();
|
|
|
|
List<String> fileSysPaths = new ArrayList<>();
|
|
|
|
for (EdFileInfo edFileInfo : edFileInfos) {
|
|
|
|
for (EdFileInfo edFileInfo : edFileInfos) {
|
|
|
|
String fileSysPath = commonService.getFileSysPath(edFileInfo.getFilePath(), edFileInfo.getDataOwn());
|
|
|
|
String fileSysPath = commonService.getFileSysPath(edFileInfo.getFilePath(), edFileInfo.getDataOwn());
|
|
|
|
FileBackupLog fileBackupLog = fileBackupLogMapper.selectOne(Wrappers.lambdaQuery(FileBackupLog.class).eq(FileBackupLog::getFileId, edFileInfo.getId()));
|
|
|
|
FileBackupLog fileBackupLog = backupTask.getBaseMapper().selectOne(Wrappers.lambdaQuery(FileBackupLog.class).eq(FileBackupLog::getFileId, edFileInfo.getId()));
|
|
|
|
|
|
|
|
|
|
|
|
String saveFileName = edFileInfo.getFileName() + "." + edFileInfo.getFileType() + "." + edFileInfo.getFileCode();
|
|
|
|
String saveFileName = edFileInfo.getFileName() + "." + edFileInfo.getFileType() + "." + edFileInfo.getFileCode();
|
|
|
|
|
|
|
|
|
|
|
|
@ -155,11 +152,11 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
|
|
|
|
|
|
|
|
|
|
|
if (backup.getBackupSuccess()) {
|
|
|
|
if (backup.getBackupSuccess()) {
|
|
|
|
backupLog.setBackupSuccess(true);
|
|
|
|
backupLog.setBackupSuccess(true);
|
|
|
|
fileBackupLogMapper.insert(backupLog);
|
|
|
|
backupTask.getBaseMapper().insert(backupLog);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
backupLog.setBackupSuccess(false);
|
|
|
|
backupLog.setBackupSuccess(false);
|
|
|
|
backupLog.setFailInfoDetail(backup.getFailInfoDetail());
|
|
|
|
backupLog.setFailInfoDetail(backup.getFailInfoDetail());
|
|
|
|
fileBackupLogMapper.insert(backupLog);
|
|
|
|
backupTask.getBaseMapper().insert(backupLog);
|
|
|
|
throw new BizException(StrFormatter.format("删除文件 {} 失败,原因 备份该文件出现错误,联系管理员查看日志", saveFileName));
|
|
|
|
throw new BizException(StrFormatter.format("删除文件 {} 失败,原因 备份该文件出现错误,联系管理员查看日志", saveFileName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -177,11 +174,11 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
|
|
|
.setFileName(saveFileName);
|
|
|
|
.setFileName(saveFileName);
|
|
|
|
if (backup.getBackupSuccess()) {
|
|
|
|
if (backup.getBackupSuccess()) {
|
|
|
|
fileBackupLog.setBackupSuccess(true);
|
|
|
|
fileBackupLog.setBackupSuccess(true);
|
|
|
|
fileBackupLogMapper.update(fileBackupLog, null);
|
|
|
|
backupTask.getBaseMapper().update(fileBackupLog, null);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
fileBackupLog.setBackupSuccess(false);
|
|
|
|
fileBackupLog.setBackupSuccess(false);
|
|
|
|
fileBackupLog.setFailInfoDetail(backup.getFailInfoDetail());
|
|
|
|
fileBackupLog.setFailInfoDetail(backup.getFailInfoDetail());
|
|
|
|
fileBackupLogMapper.update(fileBackupLog, null);
|
|
|
|
backupTask.getBaseMapper().update(fileBackupLog, null);
|
|
|
|
throw new BizException(StrFormatter.format("删除文件 {} 失败,原因 备份该文件出现错误,联系管理员查看日志", saveFileName));
|
|
|
|
throw new BizException(StrFormatter.format("删除文件 {} 失败,原因 备份该文件出现错误,联系管理员查看日志", saveFileName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|