Beta保存时qc文件路径不存在导致空问题修改
This commit is contained in:
parent
fba4ac0915
commit
e012393bb1
|
@ -1036,6 +1036,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
String gasFilePath = "";
|
String gasFilePath = "";
|
||||||
String detFilePath = "";
|
String detFilePath = "";
|
||||||
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
|
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
|
||||||
|
File sampleTmp = null;
|
||||||
|
File gasTmp = null;
|
||||||
|
File detTmp = null;
|
||||||
|
try {
|
||||||
//判断是否有sampleId和dbName 如果有则说明数据来源DB
|
//判断是否有sampleId和dbName 如果有则说明数据来源DB
|
||||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||||
Integer analysisID = null;
|
Integer analysisID = null;
|
||||||
|
@ -1059,9 +1063,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
sampleFilePath = path;
|
sampleFilePath = path;
|
||||||
gasFilePath = path;
|
gasFilePath = path;
|
||||||
detFilePath = path;
|
detFilePath = path;
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(path, sampleFileName);
|
sampleTmp = phdFileUtil.analyzeFile(path, sampleFileName);
|
||||||
File gasTmp = phdFileUtil.analyzeFile(path, gasFileName);
|
gasTmp = phdFileUtil.analyzeFile(path, gasFileName);
|
||||||
File detTmp = phdFileUtil.analyzeFile(path, detFileName);
|
detTmp = phdFileUtil.analyzeFile(path, detFileName);
|
||||||
if ( Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp) ) {
|
if ( Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp) ) {
|
||||||
result.error500("ftp下文件不存在");
|
result.error500("ftp下文件不存在");
|
||||||
return result;
|
return result;
|
||||||
|
@ -1126,6 +1130,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
qcResult.setXe133MDCStatus("Failed");
|
qcResult.setXe133MDCStatus("Failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
gasTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(qcResult);
|
result.setResult(qcResult);
|
||||||
return result;
|
return result;
|
||||||
|
@ -1159,28 +1176,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||||
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
|
List<GardsXeResultsSpectrum> xeDataList = new LinkedList<>();
|
||||||
if (Objects.nonNull(sampleId)) {
|
|
||||||
sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
|
||||||
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
|
||||||
//查询数据库中结果的Xe数据
|
|
||||||
xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
|
|
||||||
} else {
|
|
||||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(path, sampleFileName);
|
|
||||||
File gasTmp = phdFileUtil.analyzeFile(path, gasFileName);
|
|
||||||
File detTmp = phdFileUtil.analyzeFile(path, detFileName);
|
|
||||||
if ( Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp) ) {
|
|
||||||
result.error500("ftp下文件不存在");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
xeDataList = phdFileUtil.analyzeQCResultXe(sampleTmp, gasTmp, detTmp);
|
|
||||||
}
|
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
if (Objects.isNull(ftpClient)){
|
if (Objects.isNull(ftpClient)){
|
||||||
result.error500("ftp连接失败");
|
result.error500("ftp连接失败");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
|
File sampleTmp = null;
|
||||||
|
File gasTmp = null;
|
||||||
|
File detTmp = null;
|
||||||
try {
|
try {
|
||||||
//切换被动模式
|
//切换被动模式
|
||||||
ftpClient.enterLocalPassiveMode();
|
ftpClient.enterLocalPassiveMode();
|
||||||
|
@ -1188,6 +1192,22 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
ftpClient.setControlEncoding("UTF-8");
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||||
|
if (Objects.nonNull(sampleId)) {
|
||||||
|
sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
|
||||||
|
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||||
|
//查询数据库中结果的Xe数据
|
||||||
|
xeDataList = spectrumAnalysisMapper.getXeDataList(sampleId);
|
||||||
|
} else {
|
||||||
|
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||||
|
sampleTmp = phdFileUtil.analyzeFile(path, sampleFileName);
|
||||||
|
gasTmp = phdFileUtil.analyzeFile(path, gasFileName);
|
||||||
|
detTmp = phdFileUtil.analyzeFile(path, detFileName);
|
||||||
|
if ( Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp) ) {
|
||||||
|
result.error500("ftp下文件不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
xeDataList = phdFileUtil.analyzeQCResultXe(sampleTmp, gasTmp, detTmp);
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(sampleFilePath)){
|
if (StringUtils.isNotBlank(sampleFilePath)){
|
||||||
ftpClient.changeWorkingDirectory(sampleFilePath);
|
ftpClient.changeWorkingDirectory(sampleFilePath);
|
||||||
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
inputStream = ftpClient.retrieveFileStream(sampleFileName);
|
||||||
|
@ -1248,6 +1268,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if (Objects.nonNull(inputStream)){
|
if (Objects.nonNull(inputStream)){
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
gasTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -2442,6 +2471,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
String samplePath = "";
|
String samplePath = "";
|
||||||
String gasPath = "";
|
String gasPath = "";
|
||||||
String detPath = "";
|
String detPath = "";
|
||||||
|
File sampleTmp = null;
|
||||||
|
File gasTmp = null;
|
||||||
|
File detTmp = null;
|
||||||
|
try {
|
||||||
//如果sampleId不为空 说明数据来源数据库 查询出对应的文件路径
|
//如果sampleId不为空 说明数据来源数据库 查询出对应的文件路径
|
||||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
|
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
|
||||||
if (dbName.equalsIgnoreCase("auto")){
|
if (dbName.equalsIgnoreCase("auto")){
|
||||||
|
@ -2464,9 +2497,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
detPath = path;
|
detPath = path;
|
||||||
}
|
}
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
|
sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
|
||||||
File gasTmp = phdFileUtil.analyzeFile(gasPath, gasFileName);
|
gasTmp = phdFileUtil.analyzeFile(gasPath, gasFileName);
|
||||||
File detTmp = phdFileUtil.analyzeFile(detPath, detFileName);
|
detTmp = phdFileUtil.analyzeFile(detPath, detFileName);
|
||||||
if (Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp)) {
|
if (Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp)) {
|
||||||
result.error500("ftp文件获取失败!");
|
result.error500("ftp文件获取失败!");
|
||||||
return result;
|
return result;
|
||||||
|
@ -2494,6 +2527,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
}
|
}
|
||||||
map.put("savedAnalysisResult", true);
|
map.put("savedAnalysisResult", true);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
gasTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
return result;
|
return result;
|
||||||
|
@ -2504,6 +2550,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
List<Map<String, Object>> mapList = new LinkedList<>();
|
List<Map<String, Object>> mapList = new LinkedList<>();
|
||||||
|
File sampleTmp = null;
|
||||||
|
File gasTmp = null;
|
||||||
|
File detTmp = null;
|
||||||
|
try {
|
||||||
if (CollectionUtils.isNotEmpty(sampleFileNames)) {
|
if (CollectionUtils.isNotEmpty(sampleFileNames)) {
|
||||||
for (int i=0; i<sampleFileNames.size(); i++) {
|
for (int i=0; i<sampleFileNames.size(); i++) {
|
||||||
String dbName = dbNames.get(i);
|
String dbName = dbNames.get(i);
|
||||||
|
@ -2545,9 +2595,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
detPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
|
detPath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||||
}
|
}
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
|
sampleTmp = phdFileUtil.analyzeFile(samplePath, sampleFileName);
|
||||||
File gasTmp = phdFileUtil.analyzeFile(gasPath, gasFileName);
|
gasTmp = phdFileUtil.analyzeFile(gasPath, gasFileName);
|
||||||
File detTmp = phdFileUtil.analyzeFile(detPath, detFileName);
|
detTmp = phdFileUtil.analyzeFile(detPath, detFileName);
|
||||||
map.put("sampleFileName", sampleFileName);
|
map.put("sampleFileName", sampleFileName);
|
||||||
BgDataAnlyseResultIn resultIn = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, map);
|
BgDataAnlyseResultIn resultIn = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, map);
|
||||||
List<GardsXeResultsSpectrum> xeDataList = getXeDataList(resultIn, sampleId, analysisID);
|
List<GardsXeResultsSpectrum> xeDataList = getXeDataList(resultIn, sampleId, analysisID);
|
||||||
|
@ -2572,6 +2622,19 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
mapList.add(map);
|
mapList.add(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
gasTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(mapList);
|
result.setResult(mapList);
|
||||||
return result;
|
return result;
|
||||||
|
@ -2642,9 +2705,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
|
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
|
||||||
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
|
||||||
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
String qcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
|
||||||
|
if (StringUtils.isNotBlank(qcFilePath)) {
|
||||||
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
|
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + qcFilePath.substring(0, qcFilePath.lastIndexOf(StringPool.SLASH)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
|
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
|
||||||
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
|
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
|
||||||
|
@ -2791,16 +2856,23 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//上传本次文件到ftp人工交互存储路径下
|
//上传本次文件到ftp人工交互存储路径下
|
||||||
// File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
File sampleTmp = null;
|
||||||
// File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
File gasTmp = null;
|
||||||
// File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
File detTmp = null;
|
||||||
// try {
|
try {
|
||||||
// ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||||
// ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||||
// ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||||
// } catch (FileNotFoundException e) {
|
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
||||||
// throw new RuntimeException(e);
|
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
||||||
// }
|
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
sampleTmp.delete();
|
||||||
|
gasTmp.delete();
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2836,7 +2908,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
|
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
|
||||||
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
|
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(anlyseResultIn.getDbName())) {
|
if (StringUtils.isNotBlank(anlyseResultIn.getDbName())) {
|
||||||
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
|
||||||
Integer analysisID = null;
|
Integer analysisID = null;
|
||||||
|
@ -2874,7 +2945,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
||||||
//分析文件内容
|
//分析文件内容
|
||||||
analyzeSavePHDFile(anlyseResultIn, betaFittingPara, gammaFittingPara, betaFittingParaToUi, gammaFittingParaToUi);
|
analyzeSavePHDFile(anlyseResultIn, betaFittingPara, gammaFittingPara, betaFittingParaToUi, gammaFittingParaToUi);
|
||||||
|
|
||||||
// 返回需要Save的数据
|
// 返回需要Save的数据
|
||||||
return anlyseResultIn;
|
return anlyseResultIn;
|
||||||
}
|
}
|
||||||
|
@ -2890,7 +2960,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
roiChannels = ObjectUtil.isNotNull(roiChannels) ? roiChannels : new LinkedList<>();
|
roiChannels = ObjectUtil.isNotNull(roiChannels) ? roiChannels : new LinkedList<>();
|
||||||
roiResults = ObjectUtil.isNotNull(roiResults) ? roiResults : new LinkedList<>();
|
roiResults = ObjectUtil.isNotNull(roiResults) ? roiResults : new LinkedList<>();
|
||||||
xeResults = ObjectUtil.isNotNull(xeResults) ? xeResults : new LinkedList<>();
|
xeResults = ObjectUtil.isNotNull(xeResults) ? xeResults : new LinkedList<>();
|
||||||
|
|
||||||
// 转换ROIChannels数据
|
// 转换ROIChannels数据
|
||||||
List<ROIChannelsDto> roiChannelsDtosS = new LinkedList<>();
|
List<ROIChannelsDto> roiChannelsDtosS = new LinkedList<>();
|
||||||
List<ROIChannelsDto> roiChannelsDtosD = new LinkedList<>();
|
List<ROIChannelsDto> roiChannelsDtosD = new LinkedList<>();
|
||||||
|
@ -2932,7 +3001,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
xeResultsDto.shift();
|
xeResultsDto.shift();
|
||||||
xeResultsDtos.add(xeResultsDto);
|
xeResultsDtos.add(xeResultsDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put("gammaCalibrationSCE", anlyseResultIn.getGammaCalibrationSCE());
|
result.put("gammaCalibrationSCE", anlyseResultIn.getGammaCalibrationSCE());
|
||||||
result.put("gammaCalibrationSEC", anlyseResultIn.getGammaCalibrationSEC());
|
result.put("gammaCalibrationSEC", anlyseResultIn.getGammaCalibrationSEC());
|
||||||
result.put("gammaCalibrationGCE", anlyseResultIn.getGammaCalibrationGCE());
|
result.put("gammaCalibrationGCE", anlyseResultIn.getGammaCalibrationGCE());
|
||||||
|
@ -2961,10 +3029,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
||||||
resolver.setPrefix("excelTemplate/");
|
resolver.setPrefix("excelTemplate/");
|
||||||
templateEngine.setTemplateResolver(resolver);
|
templateEngine.setTemplateResolver(resolver);
|
||||||
|
|
||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
context.setVariables(variables);
|
context.setVariables(variables);
|
||||||
|
|
||||||
return templateEngine.process(SAVETOHTML.getName(), context);
|
return templateEngine.process(SAVETOHTML.getName(), context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3008,7 +3074,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response) {
|
public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response) {
|
||||||
// 解析文件,生成导出数据
|
// 解析文件,生成导出数据
|
||||||
Map<String, Object> analyze = exportData(anlyseResultIn);
|
Map<String, Object> analyze = exportData(anlyseResultIn);
|
||||||
|
|
||||||
// 将Null值替换为"",避免空指针异常(集合为空集合,不能为null)
|
// 将Null值替换为"",避免空指针异常(集合为空集合,不能为null)
|
||||||
analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
|
||||||
String export = "SaveToExcel.xls";
|
String export = "SaveToExcel.xls";
|
||||||
|
@ -3199,10 +3264,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List<SeriseData> betaList, List<SeriseData> gammaList) {
|
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List<SeriseData> betaList, List<SeriseData> gammaList) {
|
||||||
|
File sampleTmp = null;
|
||||||
|
File gasTmp = null;
|
||||||
|
File detTmp = null;
|
||||||
|
try {
|
||||||
//获取ftp文件路径下临时文件
|
//获取ftp文件路径下临时文件
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||||
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||||
System.loadLibrary("ReadPHDFile");
|
System.loadLibrary("ReadPHDFile");
|
||||||
//如果勾选了Energy Calibration页面下sample Data
|
//如果勾选了Energy Calibration页面下sample Data
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
@ -3294,17 +3363,33 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
anlyseResultIn.setB_energy_det(sourceData.b_electron_energy);
|
anlyseResultIn.setB_energy_det(sourceData.b_electron_energy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
gasTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara,List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi) {
|
public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara,List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi) {
|
||||||
|
File sampleTmp = null;
|
||||||
|
File gasTmp = null;
|
||||||
|
File detTmp = null;
|
||||||
|
try {
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||||
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||||
//加载dll工具库
|
//加载dll工具库
|
||||||
System.loadLibrary("ReadPHDFile");
|
System.loadLibrary("ReadPHDFile");
|
||||||
//调用动态库解析文件
|
//调用动态库解析文件
|
||||||
|
|
||||||
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
||||||
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
||||||
BgAnalyseResult bgAnalyseResult = null;
|
BgAnalyseResult bgAnalyseResult = null;
|
||||||
|
@ -3347,7 +3432,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
|
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
|
||||||
xeResultsSpectrumList.add(xe135);
|
xeResultsSpectrumList.add(xe135);
|
||||||
anlyseResultIn.setXeData(xeResultsSpectrumList);
|
anlyseResultIn.setXeData(xeResultsSpectrumList);
|
||||||
|
|
||||||
if (anlyseResultIn.isBGammaEnergyValidSample()) {
|
if (anlyseResultIn.isBGammaEnergyValidSample()) {
|
||||||
GardsCalibrationSpectrum gammaCalibrationSCE = new GardsCalibrationSpectrum();
|
GardsCalibrationSpectrum gammaCalibrationSCE = new GardsCalibrationSpectrum();
|
||||||
gammaCalibrationSCE.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
|
gammaCalibrationSCE.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
|
||||||
|
@ -3417,7 +3501,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
anlyseResultIn.setGammaCalibrationDCE(gammaCalibrationDCE);
|
anlyseResultIn.setGammaCalibrationDCE(gammaCalibrationDCE);
|
||||||
anlyseResultIn.setGammaCalibrationDEC(gammaCalibrationDEC);
|
anlyseResultIn.setGammaCalibrationDEC(gammaCalibrationDEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anlyseResultIn.isBBetaEnergyValidSample()) {
|
if (anlyseResultIn.isBBetaEnergyValidSample()) {
|
||||||
GardsCalibrationSpectrum betaCalibrationSCE = new GardsCalibrationSpectrum();
|
GardsCalibrationSpectrum betaCalibrationSCE = new GardsCalibrationSpectrum();
|
||||||
betaCalibrationSCE.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
|
betaCalibrationSCE.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
|
||||||
|
@ -3487,7 +3570,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
anlyseResultIn.setBetaCalibrationDCE(betaCalibrationDCE);
|
anlyseResultIn.setBetaCalibrationDCE(betaCalibrationDCE);
|
||||||
anlyseResultIn.setBetaCalibrationDEC(betaCalibrationDEC);
|
anlyseResultIn.setBetaCalibrationDEC(betaCalibrationDEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
|
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
|
||||||
for (int i=0; i<bgAnalyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
for (int i=0; i<bgAnalyseResult.S_ROI_B_Boundary_start.size(); i++) {
|
||||||
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
||||||
|
@ -3545,9 +3627,23 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
roiResultsSpectrumList.add(roiResults);
|
roiResultsSpectrumList.add(roiResults);
|
||||||
}
|
}
|
||||||
anlyseResultIn.setRoiResultsSpectrumList(roiResultsSpectrumList);
|
anlyseResultIn.setRoiResultsSpectrumList(roiResultsSpectrumList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
sampleTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
gasTmp.delete();
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
detTmp.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void analyzePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara) {
|
public void analyzePHDFile(BgDataAnlyseResultIn anlyseResultIn,List<String> betaFittingPara, List<String> gammaFittingPara) {
|
||||||
|
try {
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||||
|
@ -3555,7 +3651,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
//加载dll工具库
|
//加载dll工具库
|
||||||
System.loadLibrary("ReadPHDFile");
|
System.loadLibrary("ReadPHDFile");
|
||||||
//调用动态库解析文件
|
//调用动态库解析文件
|
||||||
|
|
||||||
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
||||||
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
||||||
BgAnalyseResult bgAnalyseResult = null;
|
BgAnalyseResult bgAnalyseResult = null;
|
||||||
|
@ -3598,7 +3693,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
|
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
|
||||||
xeResultsSpectrumList.add(xe135);
|
xeResultsSpectrumList.add(xe135);
|
||||||
anlyseResultIn.setXeData(xeResultsSpectrumList);
|
anlyseResultIn.setXeData(xeResultsSpectrumList);
|
||||||
|
|
||||||
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList = new LinkedList<>();
|
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList = new LinkedList<>();
|
||||||
if (anlyseResultIn.isBGammaEnergyValidSample()) {
|
if (anlyseResultIn.isBGammaEnergyValidSample()) {
|
||||||
GardsCalibrationSpectrum gammaCalibrationS = new GardsCalibrationSpectrum();
|
GardsCalibrationSpectrum gammaCalibrationS = new GardsCalibrationSpectrum();
|
||||||
|
@ -3646,7 +3740,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
gammaCalibrationSpectrumList.add(gammaCalibrationD);
|
gammaCalibrationSpectrumList.add(gammaCalibrationD);
|
||||||
}
|
}
|
||||||
anlyseResultIn.setGammaCalibrationSpectrumList(gammaCalibrationSpectrumList);
|
anlyseResultIn.setGammaCalibrationSpectrumList(gammaCalibrationSpectrumList);
|
||||||
|
|
||||||
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
|
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
|
||||||
if (anlyseResultIn.isBBetaEnergyValidSample()) {
|
if (anlyseResultIn.isBBetaEnergyValidSample()) {
|
||||||
GardsCalibrationSpectrum betaCalibrationS = new GardsCalibrationSpectrum();
|
GardsCalibrationSpectrum betaCalibrationS = new GardsCalibrationSpectrum();
|
||||||
|
@ -3751,7 +3844,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
roiResultsSpectrumList.add(roiResults);
|
roiResultsSpectrumList.add(roiResults);
|
||||||
}
|
}
|
||||||
anlyseResultIn.setRoiResultsSpectrumList(roiResultsSpectrumList);
|
anlyseResultIn.setRoiResultsSpectrumList(roiResultsSpectrumList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<GardsCalibrationPairs> getCalibrationPairs(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
|
public List<GardsCalibrationPairs> getCalibrationPairs(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
|
||||||
List<GardsCalibrationPairs> calibrationPairsList = new LinkedList<>();
|
List<GardsCalibrationPairs> calibrationPairsList = new LinkedList<>();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user