beta,gamma上传文件代码修改
This commit is contained in:
parent
a4883b0384
commit
14543eb4a5
|
@ -3020,9 +3020,21 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
|
anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
|
||||||
middleData.analyses_analysisBegin = anylseBegin;
|
middleData.analyses_analysisBegin = anylseBegin;
|
||||||
middleData.analyses_analysisEnd = anylseEnd;
|
middleData.analyses_analysisEnd = anylseEnd;
|
||||||
|
} else if (type.equals(MiddleDataType.InterAction.getType())){ //如果是人工交互分析 则先上传phd对应文件信息
|
||||||
|
//上传本次文件到ftp人工交互存储路径下
|
||||||
|
File sampleTmp = null;
|
||||||
|
try {
|
||||||
|
sampleTmp = analyzeFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + fileAnlyse.getFilepath(), fileAnlyse.getFilename());
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
bRet = ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + middleData.analyses_save_filePath.substring(0, middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)), middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)+1), new FileInputStream(sampleTmp));
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//gards_analyses
|
//gards_analyses
|
||||||
String qsBaseLinePath = path+StringPool.SLASH+middleData.analyses_analyst+"_"+baselineName;
|
String qsBaseLinePath = path+StringPool.SLASH+middleData.analyses_analyst+"_"+baselineName;
|
||||||
qsBaseLinePath = qsBaseLinePath.replace(StringPool.BACK_SLASH, StringPool.SLASH);
|
qsBaseLinePath = qsBaseLinePath.replace(StringPool.BACK_SLASH, StringPool.SLASH);
|
||||||
|
|
|
@ -4357,7 +4357,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
public Result saveToDB(String fileName, HttpServletRequest request) {
|
public Result saveToDB(String fileName, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
boolean bRet = true;
|
boolean bRet = false;
|
||||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName);
|
||||||
if (Objects.isNull(phd)) {
|
if (Objects.isNull(phd)) {
|
||||||
|
@ -4405,7 +4405,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
phd.setStatus(sampleData.getStatus());
|
phd.setStatus(sampleData.getStatus());
|
||||||
} else {
|
} else {
|
||||||
// 如果sampleData为空 存储数据
|
// 如果sampleData为空 存储数据
|
||||||
SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
bRet = SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||||
}
|
}
|
||||||
if (!bRet) {
|
if (!bRet) {
|
||||||
result.error500("The Database hasn't this Spectrum(" + phd.getFilename() + ") and Insert it to Database failed.");
|
result.error500("The Database hasn't this Spectrum(" + phd.getFilename() + ") and Insert it to Database failed.");
|
||||||
|
@ -4466,7 +4466,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
paths.add(middleData.analyses_lc_filePath);
|
paths.add(middleData.analyses_lc_filePath);
|
||||||
paths.add(middleData.analyses_scac_filePath);
|
paths.add(middleData.analyses_scac_filePath);
|
||||||
paths.add(middleData.analyses_baseline_filePath);
|
paths.add(middleData.analyses_baseline_filePath);
|
||||||
if (false) paths.add(middleData.analyses_save_filePath);
|
if (bRet) {
|
||||||
|
paths.add(middleData.analyses_save_filePath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.error500("Save analysis results to DB failed.");
|
result.error500("Save analysis results to DB failed.");
|
||||||
return result;
|
return result;
|
||||||
|
@ -4475,18 +4477,31 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void SaveSampleToDB(PHDFile phd, String input_file_name) {
|
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||||
|
boolean bRet = false;
|
||||||
String sit_det_code = phd.getHeader().getSite_code();
|
String sit_det_code = phd.getHeader().getSite_code();
|
||||||
String detect_code = phd.getHeader().getDetector_code();
|
String detect_code = phd.getHeader().getDetector_code();
|
||||||
// 查询 station_id 和 detect_id
|
// 查询 station_id 和 detect_id
|
||||||
Integer station_id = spectrumAnalysisMapper.getStationId(sit_det_code);
|
Integer station_id = spectrumAnalysisMapper.getStationId(sit_det_code);
|
||||||
Integer detect_id = spectrumAnalysisMapper.getDetectorId(detect_code);
|
Integer detect_id = spectrumAnalysisMapper.getDetectorId(detect_code);
|
||||||
// ORIGINAL.GARDS_SAMPLE_DATA 表数据
|
// ORIGINAL.GARDS_SAMPLE_DATA 表数据
|
||||||
sampleDataSpectrumService.saveSampleDataGamma(phd, input_file_name, station_id, detect_id);
|
Integer saveSampleDataGamma = sampleDataSpectrumService.saveSampleDataGamma(phd, input_file_name, station_id, detect_id);
|
||||||
|
if (saveSampleDataGamma > 0) {
|
||||||
|
bRet = true;
|
||||||
|
} else {
|
||||||
|
bRet = false;
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
// 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID
|
// 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID
|
||||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name);
|
Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name);
|
||||||
// ORIGINAL.GARDS_SAMPLE_AUX 表数据
|
// ORIGINAL.GARDS_SAMPLE_AUX 表数据
|
||||||
sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
Integer saveSampleAuxGamma = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||||
|
if (saveSampleAuxGamma > 0) {
|
||||||
|
bRet = true;
|
||||||
|
} else {
|
||||||
|
bRet = false;
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
// ORIGINAL.gards_sample_description 数据表
|
// ORIGINAL.gards_sample_description 数据表
|
||||||
sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
||||||
// ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表
|
// ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表
|
||||||
|
@ -4495,17 +4510,18 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
||||||
}
|
}
|
||||||
// gards_ calibration_pairs_orig数据表
|
// gards_ calibration_pairs_orig数据表
|
||||||
calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
Integer saveCalibrationPairsOrigGamma = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||||
// gards_total_efficiency _pairs数据表(IDC没有)
|
// gards_total_efficiency _pairs数据表(IDC没有)
|
||||||
totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
Integer saveTotalEfficiencyPairsGamma = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||||
// gards_spectrum数据表
|
// gards_spectrum数据表
|
||||||
spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
Integer saveSpectrumGamma = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||||
// 根据文件名称获取sample基础数据信息
|
// 根据文件名称获取sample基础数据信息
|
||||||
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
||||||
if (Objects.nonNull(samplData)) {
|
if (Objects.nonNull(samplData)) {
|
||||||
phd.setId_sample(samplData.getSampleId().toString());
|
phd.setId_sample(samplData.getSampleId().toString());
|
||||||
phd.setStatus(samplData.getStatus());
|
phd.setStatus(samplData.getStatus());
|
||||||
}
|
}
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4291,9 +4291,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||||
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||||
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||||
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
||||||
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
||||||
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user