操作本地文件夹分支人工交互模块,文件夹的前缀路径读取不再使用FTP的路径

This commit is contained in:
qiaoqinzheng 2024-03-20 14:02:54 +08:00
parent 46eba27ace
commit c9ee863667
3 changed files with 30 additions and 30 deletions

View File

@ -180,7 +180,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result;
}
// 切割数据库存储的文件路径获取路径信息
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String pathName = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
// 切割数据库存储的文件路径获取文件名称
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH) + 1);
// 声明phd实体类
@ -598,7 +598,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Map<String, Object> map = new HashMap<>();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
// 上传文件路径
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
// 获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
@ -737,7 +737,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("The comparison file path does not exist");
return result;
}
compareFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + compareFilePath;
compareFilePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + compareFilePath;
File compareFile = ftpUtil.downloadFile(compareFilePath);
if (Objects.isNull(compareFile)) {
result.error500("The comparison file path does not exist");
@ -769,7 +769,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
long m_nCount = phd.getSpec().getNum_g_channel();
List<Double> vEnergy = phd.getVEnergy();
//加载compare文件
String compareFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String compareFilePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String fromPath = compareFilePath + StringPool.SLASH + compareFileName;
File compareFile = ftpUtil.downloadFile(fromPath);
if (Objects.nonNull(compareFile)) {
@ -819,7 +819,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("The comparison file path does not exist");
return result;
}
stripFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + stripFilePath;
stripFilePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + stripFilePath;
File stripFile = ftpUtil.downloadFile(stripFilePath);
if (Objects.isNull(stripFile)) {
result.error500("The comparison file path does not exist");
@ -868,7 +868,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
m_vCount.add(0L);
}
//加载strip文件
String stripFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String stripFilePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String fromPath = stripFilePath + StringPool.SLASH + stripFileName;
File stripFile = ftpUtil.downloadFile(fromPath);
if (Objects.nonNull(stripFile)) {
@ -3937,7 +3937,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (StringUtils.isBlank(reportPath)) {
throw new RuntimeException("The automatic handler generated report does not exist");
}
String pathFileName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt";
String pathFileName = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt";
InputStream inputStream = null;
ServletOutputStream outputStream = null;
try {
@ -3971,7 +3971,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
public void exportARR(Integer sampleId, HttpServletResponse response) {
// 获取自动处理生成的报告地址
String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
String pathFileName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt";
String pathFileName = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt";
InputStream inputStream = null;
ServletOutputStream outputStream = null;
try {
@ -4571,7 +4571,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (StringUtils.isBlank(logPath)) {
throw new RuntimeException("The log generated by the automatic processor does not exist");
}
String pathFileName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath;
String pathFileName = spectrumPathProperties.getRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath;
InputStream inputStream = null;
ServletOutputStream outputStream = null;
try {
@ -4790,7 +4790,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// File baselineFile = new File(rootPath+middleData.analyses_baseline_absolute_filePath);
// try {
// FileInputStream in = new FileInputStream(baselineFile);
// ftpUtil.saveFile(ftpUtil.getFtpRootPath()+middleData.analyses_baseline_absolute_filePath, in);
// ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_baseline_absolute_filePath, in);
// } catch (FileNotFoundException e) {
// throw new RuntimeException(e);
// }
@ -4799,7 +4799,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// File lcFile = new File(rootPath+middleData.analyses_lc_absolute_filePath);
// try {
// FileInputStream in = new FileInputStream(lcFile);
// ftpUtil.saveFile(ftpUtil.getFtpRootPath()+middleData.analyses_lc_absolute_filePath, in);
// ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_lc_absolute_filePath, in);
// } catch (FileNotFoundException e) {
// throw new RuntimeException(e);
// }
@ -4808,7 +4808,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// File scacFile = new File(rootPath+middleData.analyses_scac_absolute_filePath);
// try {
// FileInputStream in = new FileInputStream(scacFile);
// ftpUtil.saveFile(ftpUtil.getFtpRootPath()+middleData.analyses_scac_absolute_filePath, in);
// ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_scac_absolute_filePath, in);
// } catch (FileNotFoundException e) {
// throw new RuntimeException(e);
// }
@ -4819,7 +4819,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
try {
FileUtil.writeString(gammaFileUtil.GetLogContent(middleData), logFile, "UTF-8");
FileInputStream in = new FileInputStream(logFile);
ftpUtil.saveFile(ftpUtil.getFtpRootPath()+middleData.analyses_absolute_LogPath, in);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_LogPath, in);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
@ -4832,7 +4832,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
try {
FileUtil.writeString(gammaFileUtil.GetReportContent(middleData), rptFile, "UTF-8");
FileInputStream in = new FileInputStream(rptFile);
ftpUtil.saveFile(ftpUtil.getFtpRootPath()+middleData.analyses_absolute_ReportPath+".txt", in);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_ReportPath+".txt", in);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {

View File

@ -301,7 +301,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
Result result = new Result();
List<Map<String, Object>> resultList = new LinkedList<>();
String userName = JwtUtil.getUserNameByToken(request);
String filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String filePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String sampleRx = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.PHD";
Pattern regexPattern = Pattern.compile(sampleRx);
String sampleRx1 = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.\\d+\\.PHD";
@ -482,7 +482,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setSampleId(String.valueOf(sampleId));
//判断sample信息是否存在
if (Objects.nonNull(sample)) {
betaDataFile.setSampleFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getSampleFilePath());
betaDataFile.setSampleFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getSampleFilePath());
betaDataFile.setSampleFileName(sampleFileName);
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName());
if (Objects.nonNull(sampleTmp)) {
@ -519,7 +519,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
//判断gas信息是否存在
if (Objects.nonNull(gasBg)) {
betaDataFile.setGasFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getGasBgFilePath());
betaDataFile.setGasFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getGasBgFilePath());
betaDataFile.setGasFileName(gasFileName);
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName());
if (Objects.nonNull(gasTmp)) {
@ -556,7 +556,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
//判断det信息是否存在
if (Objects.nonNull(detBg)) {
betaDataFile.setDetFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getDetBgFilePath());
betaDataFile.setDetFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbSpectrumFilePath.getDetBgFilePath());
betaDataFile.setDetFileName(detFileName);
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName());
if (Objects.nonNull(detTmp)) {
@ -593,7 +593,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
//判断qc信息是否存在
if (Objects.nonNull(qc)) {
betaDataFile.setQcFilePathName(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbQcFilePath);
betaDataFile.setQcFilePathName(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH +dbQcFilePath);
betaDataFile.setQcFileName(qcFileName);
qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName());
if (Objects.nonNull(qcTmp)) {
@ -672,7 +672,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
//获取用户名
String userName = JwtUtil.getUserNameByToken(request);
//上传文件路径
String path = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String path = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> sampleMap = new HashMap<>();
Map<String, Object> gasBgMap = new HashMap<>();
@ -929,7 +929,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
InputStream inputStream = null;
ServletOutputStream outputStream = null;
try {
inputStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt");
inputStream = ftpUtil.downloadFileStream(spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt");
if (Objects.nonNull(inputStream)){
outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
@ -3996,7 +3996,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
InputStream inputStream = null;
ServletOutputStream outputStream = null;
try {
inputStream = ftpUtil.downloadFileStream(ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath);
inputStream = ftpUtil.downloadFileStream(spectrumPathProperties.getRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath);
if (Objects.nonNull(inputStream)){
outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
@ -4277,7 +4277,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
try {
if (StringUtils.isNotBlank(sampleFilePathName)) {
//sample文件的saveFile存储路径
String saveSamplePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName;
String saveSamplePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName;
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath()) && !saveSamplePath.equals(betaDataFile.getSampleTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
File sampleTmp = new File(betaDataFile.getSampleTmpPath());
ftpUtil.saveFile(saveSamplePath, new FileInputStream(sampleTmp));
@ -4285,7 +4285,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (StringUtils.isNotBlank(gasFilePathName)) {
//gas文件的saveFile存储路径
String saveGasPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName;
String saveGasPath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName;
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath()) && !saveGasPath.equals(betaDataFile.getGasTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
File gasTmp = new File(betaDataFile.getGasTmpPath());
ftpUtil.saveFile(saveGasPath, new FileInputStream(gasTmp));
@ -4293,7 +4293,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (StringUtils.isNotBlank(detFilePathName)) {
//det文件的saveFile存储路径
String saveDetPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName;
String saveDetPath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName;
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath()) && !saveDetPath.equals(betaDataFile.getDetTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
File detTmp = new File(betaDataFile.getDetTmpPath());
ftpUtil.saveFile(saveDetPath, new FileInputStream(detTmp));
@ -4301,7 +4301,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
if (StringUtils.isNotBlank(qcFilePathName)) {
//qc文件的saveFile存储路径
String saveQcPath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName;
String saveQcPath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName;
if (StringUtils.isNotBlank(betaDataFile.getQcTmpPath()) && !saveQcPath.equals(betaDataFile.getQcTmpPath().replace(StringPool.BACK_SLASH, StringPool.SLASH))) {
File qcTmp = new File(betaDataFile.getQcTmpPath());
ftpUtil.saveFile(saveQcPath, new FileInputStream(qcTmp));
@ -4324,7 +4324,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
FileUtil.writeString("", logFile, "UTF-8");
}
FileInputStream in = new FileInputStream(logFile);
ftpUtil.saveFile(ftpUtil.getFtpRootPath()+analyses_absolute_LogPath, in);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+analyses_absolute_LogPath, in);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
@ -4336,7 +4336,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
try {
FileUtil.writeString(rptContent, rptFile, "UTF-8");
FileInputStream in = new FileInputStream(rptFile);
ftpUtil.saveFile(ftpUtil.getFtpRootPath()+analyses_absolute_ReportPath+".txt", in);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+analyses_absolute_ReportPath+".txt", in);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {

View File

@ -71,7 +71,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
ZipInputStream zipInputStream = null;
String slash = SymbolConstant.SINGLE_SLASH;
//上传文件夹路径
String filePath = ftpUtil.getFtpRootPath() + slash + spectrumPathProperties.getUploadPath() + slash + username;
String filePath = spectrumPathProperties.getRootPath() + slash + spectrumPathProperties.getUploadPath() + slash + username;
//本地临时文件夹路径
String tempFilePath = System.getProperty("java.io.tmpdir") + username + slash;
//文件名称集合
@ -176,7 +176,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
String username = user.getUsername();
String slash = SymbolConstant.SINGLE_SLASH;
String comma = SymbolConstant.COMMA;
String filePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + slash + username;
String filePath = spectrumPathProperties.getRootPath() + spectrumPathProperties.getUploadPath() + slash + username;
FTPClient ftpClient = null;
List<FileDto> fileDtos = new ArrayList<>();
Page<FileDto> page = new Page<>(pageNo, pageSize);