beta,gamma新增字段缓存临时文件全路径,删除候选列表数据时删除临时文件,不再频繁调用ftp
This commit is contained in:
parent
702b4c3d0f
commit
e85d0ad2e8
|
@ -65,6 +65,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
phd.setFilename(fileName);
|
phd.setFilename(fileName);
|
||||||
String fromPath = pathName + StringPool.SLASH + fileName;
|
String fromPath = pathName + StringPool.SLASH + fileName;
|
||||||
File file = ftpUtil.downloadFile(fromPath, "betaGamma");
|
File file = ftpUtil.downloadFile(fromPath, "betaGamma");
|
||||||
|
phd.setTmpFilePath(file.getAbsolutePath());
|
||||||
if (Objects.isNull(file)) {
|
if (Objects.isNull(file)) {
|
||||||
result.error500("ftp file can't find");
|
result.error500("ftp file can't find");
|
||||||
return false;
|
return false;
|
||||||
|
@ -235,9 +236,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
|
|
||||||
}catch (ParseException e) {
|
}catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(file))
|
|
||||||
file.delete();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -274,9 +272,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
|
|
||||||
String baselineFileName = prefixName+"_"+subFileName + ".baseline";
|
String baselineFileName = prefixName+"_"+subFileName + ".baseline";
|
||||||
String fromPathBase = pathName + StringPool.SLASH + baselineFileName;
|
String fromPathBase = pathName + StringPool.SLASH + baselineFileName;
|
||||||
File file = ftpUtil.downloadFile(fromPathBase, "betaGamma");
|
inputStreamBase = ftpUtil.downloadFileStream(fromPathBase);
|
||||||
inputStreamBase = new FileInputStream(file);
|
|
||||||
// inputStreamBase = ftpUtil.downloadFileStream(fromPathBase);
|
|
||||||
// 调用处理BaseCtrl的方法
|
// 调用处理BaseCtrl的方法
|
||||||
ReadBaseCtrlInfo(phd, inputStreamBase);
|
ReadBaseCtrlInfo(phd, inputStreamBase);
|
||||||
// 将phdFile的BaseCtrls的BaseLine部分数据 赋值给 phdFile的vBase
|
// 将phdFile的BaseCtrls的BaseLine部分数据 赋值给 phdFile的vBase
|
||||||
|
@ -1262,8 +1258,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean AnalyseSpectrum(PHDFile phd, Map<String, NuclideLines> mapLines){
|
public boolean AnalyseSpectrum(PHDFile phd, Map<String, NuclideLines> mapLines){
|
||||||
//解析获取临时文件信息
|
|
||||||
File tmpFile = analyzeFile(phd.getFilepath(), phd.getFilename());
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
try {
|
try {
|
||||||
String phdStr = mapper.writeValueAsString(phd);
|
String phdStr = mapper.writeValueAsString(phd);
|
||||||
|
@ -1271,7 +1265,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
if (ObjectUtil.isNull(analysisProcess)){
|
if (ObjectUtil.isNull(analysisProcess)){
|
||||||
analysisProcess = ApplicationContextUtil.getContext().getBean(AnalysisProcess.class);
|
analysisProcess = ApplicationContextUtil.getContext().getBean(AnalysisProcess.class);
|
||||||
}
|
}
|
||||||
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, tmpFile.getAbsolutePath(), analysisProcess);
|
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, phd.getTmpFilePath(), analysisProcess);
|
||||||
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
|
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
|
||||||
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
|
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
|
||||||
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
|
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
|
||||||
|
@ -1465,10 +1459,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("AnalyseSpectrum(): {}", e.getMessage());
|
log.error("AnalyseSpectrum(): {}", e.getMessage());
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(tmpFile)) {
|
|
||||||
tmpFile.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3031,7 +3021,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
||||||
//上传本次文件到ftp人工交互存储路径下
|
//上传本次文件到ftp人工交互存储路径下
|
||||||
File sampleTmp = null;
|
File sampleTmp = null;
|
||||||
try {
|
try {
|
||||||
sampleTmp = analyzeFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + fileAnlyse.getFilepath(), fileAnlyse.getFilename());
|
sampleTmp = new File(fileAnlyse.getTmpFilePath());
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
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));
|
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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,17 +281,13 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> readLine(String filePath) {
|
public List<String> readLine(String filePath) {
|
||||||
File file = null;
|
|
||||||
List<String> allLines = new ArrayList<>();
|
List<String> allLines = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
file = ftpUtil.downloadFile(filePath, "betaGamma");
|
File file = new File(filePath);
|
||||||
return FileUtils.readLines(file, ftpUtil.getEncoding());
|
return FileUtils.readLines(file, "UTF-8");
|
||||||
}catch (IOException e){
|
}catch (IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return allLines;
|
return allLines;
|
||||||
} finally {
|
|
||||||
if (ObjectUtil.isNotNull(file))
|
|
||||||
file.delete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +427,6 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
detBgMap.put("DetBgBtn", "RedLight");
|
detBgMap.put("DetBgBtn", "RedLight");
|
||||||
qcMap.put("DetBgBtn", "RedLight");
|
qcMap.put("DetBgBtn", "RedLight");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getFileData(String filePath, String sampleFileName) {
|
public Map<String, String> getFileData(String filePath, String sampleFileName) {
|
||||||
|
@ -583,47 +578,46 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
return rData;
|
return rData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File analyzeFile(String path, String fileName) {
|
// public File analyzeFile(String path, String fileName) {
|
||||||
//连接ftp
|
// //连接ftp
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
// FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||||
InputStream inputStream = null;
|
// InputStream inputStream = null;
|
||||||
File file = null;
|
// File file = null;
|
||||||
try {
|
// try {
|
||||||
//被动模式
|
// //被动模式
|
||||||
ftpClient.enterLocalPassiveMode();
|
// ftpClient.enterLocalPassiveMode();
|
||||||
//设置文件类型--二进制文件
|
// //设置文件类型--二进制文件
|
||||||
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
// ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
||||||
//
|
// //
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
// ftpClient.setControlEncoding("UTF-8");
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
// ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||||
//切换文件路径
|
// //切换文件路径
|
||||||
ftpClient.changeWorkingDirectory(path);
|
// ftpClient.changeWorkingDirectory(path);
|
||||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
// inputStream = ftpClient.retrieveFileStream(fileName);
|
||||||
if (Objects.nonNull(inputStream)){
|
// if (Objects.nonNull(inputStream)){
|
||||||
file = File.createTempFile("betaGamma", null);
|
// file = File.createTempFile("betaGamma", null);
|
||||||
//将ftp文件的输入流复制给临时文件
|
// //将ftp文件的输入流复制给临时文件
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
// FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
}
|
// }
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
} finally {
|
// } finally {
|
||||||
try {
|
// try {
|
||||||
if (Objects.nonNull(ftpClient)){
|
// if (Objects.nonNull(ftpClient)){
|
||||||
ftpClient.disconnect();
|
// ftpClient.disconnect();
|
||||||
}
|
// }
|
||||||
if (Objects.nonNull(inputStream)){
|
// if (Objects.nonNull(inputStream)){
|
||||||
inputStream.close();
|
// inputStream.close();
|
||||||
}
|
// }
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return file;
|
// return file;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public boolean analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, BgCalibratePara BgCalPara, Map<String, Object> map, BetaDataFile betaDataFile) {
|
public boolean analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, BgCalibratePara BgCalPara, Map<String, Object> map, BetaDataFile betaDataFile) {
|
||||||
boolean bRet = true;
|
boolean bRet = true;
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
//调用动态库解析文件
|
//调用动态库解析文件
|
||||||
BgAnalyseResult analyseResult = null;
|
BgAnalyseResult analyseResult = null;
|
||||||
if (Objects.isNull(BgCalPara)) {
|
if (Objects.isNull(BgCalPara)) {
|
||||||
|
@ -723,47 +717,6 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnergySpectrumStruct analyzeFileSourceData(String filePath, String fileName) {
|
|
||||||
EnergySpectrumStruct struct = null;
|
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
InputStream inputStream = null;
|
|
||||||
File file = null;
|
|
||||||
try {
|
|
||||||
//切换被动模式
|
|
||||||
ftpClient.enterLocalPassiveMode();
|
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
||||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
|
||||||
ftpClient.changeWorkingDirectory(filePath);
|
|
||||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
|
||||||
if (Objects.nonNull(inputStream)){
|
|
||||||
//声明一个临时文件
|
|
||||||
file = File.createTempFile("betaGamma", null);
|
|
||||||
//将ftp文件的输入流复制给临时文件
|
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
|
||||||
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (Objects.nonNull(ftpClient)){
|
|
||||||
ftpClient.disconnect();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(inputStream)){
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(file)) {
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return struct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnergySpectrumStruct analyzeFileSourceData(File uploadFile) {
|
public EnergySpectrumStruct analyzeFileSourceData(File uploadFile) {
|
||||||
EnergySpectrumStruct struct = null;
|
EnergySpectrumStruct struct = null;
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
|
|
|
@ -226,21 +226,21 @@ public class SpectrumAnalysesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("saveToHTML")
|
@PostMapping("saveToHTML")
|
||||||
public void saveToHTML(HttpServletResponse response,
|
public void saveToHTML(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
||||||
spectrumAnalysisService.saveToHTML(anlyseResultIn, response);
|
spectrumAnalysisService.saveToHTML(anlyseResultIn, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("saveToExcel")
|
@PostMapping("saveToExcel")
|
||||||
public void saveToExcel(HttpServletResponse response,
|
public void saveToExcel(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
||||||
spectrumAnalysisService.saveToExcel(anlyseResultIn, response);
|
spectrumAnalysisService.saveToExcel(anlyseResultIn, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("saveToTxt")
|
@PostMapping("saveToTxt")
|
||||||
public void saveToTxt(HttpServletResponse response,
|
public void saveToTxt(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
|
||||||
spectrumAnalysisService.saveToTxt(anlyseResultIn, response);
|
spectrumAnalysisService.saveToTxt(anlyseResultIn, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,9 @@ public interface ISpectrumAnalysisService {
|
||||||
|
|
||||||
Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request);
|
Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request);
|
||||||
|
|
||||||
void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
|
void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response);
|
||||||
|
|
||||||
void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
|
void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response);
|
||||||
|
|
||||||
void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response);
|
void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -890,6 +890,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
String username = loginUser.getUsername();
|
String username = loginUser.getUsername();
|
||||||
String key = fileName + StrUtil.DASHED + username;
|
String key = fileName + StrUtil.DASHED + username;
|
||||||
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
PHDFile phdFile = phdCache.getIfPresent(key);
|
||||||
|
if (StringUtils.isNotBlank(phdFile.getTmpFilePath())) {
|
||||||
|
File file = new File(phdFile.getTmpFilePath());
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
// 删除指定key的Cache
|
// 删除指定key的Cache
|
||||||
localCache.deletePHDCache(key);
|
localCache.deletePHDCache(key);
|
||||||
}
|
}
|
||||||
|
@ -3728,24 +3734,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (StringUtils.isBlank(reportPath)) {
|
if (StringUtils.isBlank(reportPath)) {
|
||||||
throw new RuntimeException("The automatic handler generated report does not exist!");
|
throw new RuntimeException("The automatic handler generated report does not exist!");
|
||||||
}
|
}
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
String pathFileName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt";
|
||||||
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
|
|
||||||
// 连接ftp
|
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
if (Objects.isNull(ftpClient)) {
|
|
||||||
throw new RuntimeException("ftp connection failed");
|
|
||||||
}
|
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
ServletOutputStream outputStream = null;
|
ServletOutputStream outputStream = null;
|
||||||
try {
|
try {
|
||||||
// 切换被动模式
|
inputStream = ftpUtil.downloadFileStream(pathFileName);
|
||||||
ftpClient.enterLocalPassiveMode();
|
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
||||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
|
||||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
|
||||||
if (Objects.nonNull(inputStream)) {
|
if (Objects.nonNull(inputStream)) {
|
||||||
outputStream = response.getOutputStream();
|
outputStream = response.getOutputStream();
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
@ -3759,9 +3752,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (Objects.nonNull(ftpClient)) {
|
|
||||||
ftpClient.disconnect();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotNull(inputStream)) {
|
if (ObjectUtil.isNotNull(inputStream)) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
@ -3778,24 +3768,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
public void exportARR(Integer sampleId, HttpServletResponse response) {
|
public void exportARR(Integer sampleId, HttpServletResponse response) {
|
||||||
// 获取自动处理生成的报告地址
|
// 获取自动处理生成的报告地址
|
||||||
String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
|
String reportPath = spectrumAnalysisMapper.viewARR(sampleId);
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath.substring(0, reportPath.lastIndexOf(StringPool.SLASH));
|
String pathFileName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + reportPath + ".txt";
|
||||||
String fileName = reportPath.substring(reportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
|
|
||||||
// 连接ftp
|
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
if (Objects.isNull(ftpClient)) {
|
|
||||||
throw new RuntimeException("ftp connection failed");
|
|
||||||
}
|
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
ServletOutputStream outputStream = null;
|
ServletOutputStream outputStream = null;
|
||||||
try {
|
try {
|
||||||
// 切换被动模式
|
inputStream = ftpUtil.downloadFileStream(pathFileName);
|
||||||
ftpClient.enterLocalPassiveMode();
|
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
||||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
|
||||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
|
||||||
if (Objects.nonNull(inputStream)) {
|
if (Objects.nonNull(inputStream)) {
|
||||||
// 设置响应类型
|
// 设置响应类型
|
||||||
response.setContentType("application/octet-stream");
|
response.setContentType("application/octet-stream");
|
||||||
|
@ -3813,9 +3790,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (Objects.nonNull(ftpClient)) {
|
|
||||||
ftpClient.disconnect();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotNull(inputStream)) {
|
if (ObjectUtil.isNotNull(inputStream)) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
@ -4317,24 +4291,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
if (StringUtils.isBlank(logPath)) {
|
if (StringUtils.isBlank(logPath)) {
|
||||||
throw new RuntimeException("The log generated by the automatic processor does not exist!");
|
throw new RuntimeException("The log generated by the automatic processor does not exist!");
|
||||||
}
|
}
|
||||||
String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath.substring(0, logPath.lastIndexOf(StringPool.SLASH));
|
String pathFileName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getLogPath() + StringPool.SLASH + logPath;
|
||||||
String fileName = logPath.substring(logPath.lastIndexOf(StringPool.SLASH) + 1);
|
|
||||||
// 连接ftp
|
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
|
||||||
if (Objects.isNull(ftpClient)) {
|
|
||||||
throw new RuntimeException("ftp connection failed");
|
|
||||||
}
|
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
ServletOutputStream outputStream = null;
|
ServletOutputStream outputStream = null;
|
||||||
try {
|
try {
|
||||||
// 切换被动模式
|
inputStream = ftpUtil.downloadFileStream(pathFileName);
|
||||||
ftpClient.enterLocalPassiveMode();
|
|
||||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
||||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
|
||||||
ftpClient.changeWorkingDirectory(pathName);
|
|
||||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
|
||||||
if (Objects.nonNull(inputStream)) {
|
if (Objects.nonNull(inputStream)) {
|
||||||
outputStream = response.getOutputStream();
|
outputStream = response.getOutputStream();
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
@ -4348,9 +4309,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (Objects.nonNull(ftpClient)) {
|
|
||||||
ftpClient.disconnect();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotNull(inputStream)) {
|
if (ObjectUtil.isNotNull(inputStream)) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,6 +412,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
betaDataFile.setSampleFileName(sampleFileName);
|
betaDataFile.setSampleFileName(sampleFileName);
|
||||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
|
betaDataFile.setSampleTmpPath(sampleTmp.getAbsolutePath());
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||||
betaDataFile.setSampleStruct(struct);
|
betaDataFile.setSampleStruct(struct);
|
||||||
sampleMap = phdFileUtil.getSourceData(struct, sample.getSampleId(), sample.getStatus(), "sample", betaDataFile);
|
sampleMap = phdFileUtil.getSourceData(struct, sample.getSampleId(), sample.getStatus(), "sample", betaDataFile);
|
||||||
|
@ -425,6 +426,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
betaDataFile.setGasFileName(gasFileName);
|
betaDataFile.setGasFileName(gasFileName);
|
||||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
||||||
if (Objects.nonNull(gasTmp)) {
|
if (Objects.nonNull(gasTmp)) {
|
||||||
|
betaDataFile.setGasTmpPath(gasTmp.getAbsolutePath());
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
||||||
betaDataFile.setGasStruct(struct);
|
betaDataFile.setGasStruct(struct);
|
||||||
gasBgMap = phdFileUtil.getSourceData(struct, gasBg.getSampleId(), gasBg.getStatus(), "gas", betaDataFile);
|
gasBgMap = phdFileUtil.getSourceData(struct, gasBg.getSampleId(), gasBg.getStatus(), "gas", betaDataFile);
|
||||||
|
@ -438,6 +440,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
betaDataFile.setDetFileName(detFileName);
|
betaDataFile.setDetFileName(detFileName);
|
||||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
||||||
if (Objects.nonNull(detTmp)) {
|
if (Objects.nonNull(detTmp)) {
|
||||||
|
betaDataFile.setDetTmpPath(detTmp.getAbsolutePath());
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
||||||
betaDataFile.setDetStruct(struct);
|
betaDataFile.setDetStruct(struct);
|
||||||
detBgMap = phdFileUtil.getSourceData(struct, detBg.getSampleId(), detBg.getStatus(), "det", betaDataFile);
|
detBgMap = phdFileUtil.getSourceData(struct, detBg.getSampleId(), detBg.getStatus(), "det", betaDataFile);
|
||||||
|
@ -451,6 +454,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
betaDataFile.setQcFileName(qcFileName);
|
betaDataFile.setQcFileName(qcFileName);
|
||||||
qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName(), "betaGamma");
|
qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName(), "betaGamma");
|
||||||
if (Objects.nonNull(qcTmp)) {
|
if (Objects.nonNull(qcTmp)) {
|
||||||
|
betaDataFile.setQcTmpPath(qcTmp.getAbsolutePath());
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(qcTmp.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(qcTmp.getAbsolutePath());
|
||||||
betaDataFile.setQcStruct(struct);
|
betaDataFile.setQcStruct(struct);
|
||||||
qcMap = phdFileUtil.getSourceData(struct, qc.getSampleId(), qc.getStatus(), "qc", betaDataFile);
|
qcMap = phdFileUtil.getSourceData(struct, qc.getSampleId(), qc.getStatus(), "qc", betaDataFile);
|
||||||
|
@ -509,19 +513,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
|
||||||
sampleTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(gasTmp)) {
|
|
||||||
gasTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(detTmp)) {
|
|
||||||
detTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(qcTmp)) {
|
|
||||||
qcTmp.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(resultMap);
|
result.setResult(resultMap);
|
||||||
|
@ -554,7 +545,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
String detBgFilePath = path + StringPool.SLASH + detFileName;
|
String detBgFilePath = path + StringPool.SLASH + detFileName;
|
||||||
String dbQcFilePath = path + StringPool.SLASH + qcFileName;
|
String dbQcFilePath = path + StringPool.SLASH + qcFileName;
|
||||||
if(StringUtils.isNotBlank(sampleFileName)){
|
if(StringUtils.isNotBlank(sampleFileName)){
|
||||||
EnergySpectrumStruct struct = getSourceData(sampleFilePath);
|
EnergySpectrumStruct struct = getSourceData(sampleFilePath, "sample", betaDataFile);
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
betaDataFile.setSampleStruct(struct);
|
betaDataFile.setSampleStruct(struct);
|
||||||
betaDataFile.setSampleFilePathName(sampleFilePath);
|
betaDataFile.setSampleFilePathName(sampleFilePath);
|
||||||
|
@ -565,7 +556,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(gasFileName)){
|
if(StringUtils.isNotBlank(gasFileName)){
|
||||||
EnergySpectrumStruct struct = getSourceData(gasBgFilePath);
|
EnergySpectrumStruct struct = getSourceData(gasBgFilePath, "gas", betaDataFile);
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
betaDataFile.setGasStruct(struct);
|
betaDataFile.setGasStruct(struct);
|
||||||
betaDataFile.setGasFilePathName(gasBgFilePath);
|
betaDataFile.setGasFilePathName(gasBgFilePath);
|
||||||
|
@ -576,7 +567,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(detFileName)){
|
if(StringUtils.isNotBlank(detFileName)){
|
||||||
EnergySpectrumStruct struct = getSourceData(detBgFilePath);
|
EnergySpectrumStruct struct = getSourceData(detBgFilePath, "det", betaDataFile);
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
betaDataFile.setDetStruct(struct);
|
betaDataFile.setDetStruct(struct);
|
||||||
betaDataFile.setDetFilePathName(detBgFilePath);
|
betaDataFile.setDetFilePathName(detBgFilePath);
|
||||||
|
@ -587,7 +578,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(qcFileName)){
|
if(StringUtils.isNotBlank(qcFileName)){
|
||||||
EnergySpectrumStruct struct = getSourceData(dbQcFilePath);
|
EnergySpectrumStruct struct = getSourceData(dbQcFilePath, "qc", betaDataFile);
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
betaDataFile.setQcStruct(struct);
|
betaDataFile.setQcStruct(struct);
|
||||||
betaDataFile.setQcFilePathName(dbQcFilePath);
|
betaDataFile.setQcFilePathName(dbQcFilePath);
|
||||||
|
@ -640,20 +631,27 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取文件解析结果
|
//获取文件解析结果
|
||||||
public EnergySpectrumStruct getSourceData(String filePathName) {
|
public EnergySpectrumStruct getSourceData(String filePathName, String type, BetaDataFile betaDataFile) {
|
||||||
EnergySpectrumStruct struct = null;
|
EnergySpectrumStruct struct = null;
|
||||||
File file = null;
|
File file = null;
|
||||||
try {
|
try {
|
||||||
//根据完整的文件路径 获取临时文件
|
//根据完整的文件路径 获取临时文件
|
||||||
file = ftpUtil.downloadFile(filePathName, "betaGamma");
|
file = ftpUtil.downloadFile(filePathName, "betaGamma");
|
||||||
|
if (Objects.nonNull(file)) {
|
||||||
|
if (type.equalsIgnoreCase("sample")) {
|
||||||
|
betaDataFile.setSampleTmpPath(file.getAbsolutePath());
|
||||||
|
} else if (type.equalsIgnoreCase("gas")) {
|
||||||
|
betaDataFile.setGasTmpPath(file.getAbsolutePath());
|
||||||
|
} else if (type.equalsIgnoreCase("det")) {
|
||||||
|
betaDataFile.setDetTmpPath(file.getAbsolutePath());
|
||||||
|
} else if (type.equalsIgnoreCase("qc")) {
|
||||||
|
betaDataFile.setQcTmpPath(file.getAbsolutePath());
|
||||||
|
}
|
||||||
//解析文件内容
|
//解析文件内容
|
||||||
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(file)) {
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return struct;
|
return struct;
|
||||||
}
|
}
|
||||||
|
@ -697,6 +695,28 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
public void deleteSpectrumCacheData(String sampleFileName, HttpServletRequest request) {
|
public void deleteSpectrumCacheData(String sampleFileName, HttpServletRequest request) {
|
||||||
String userName = JwtUtil.getUserNameByToken(request);
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
String betaKey = sampleFileName + "-" + userName;
|
String betaKey = sampleFileName + "-" + userName;
|
||||||
|
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||||
|
BetaDataFile betaDataFile = cache.getIfPresent(betaKey);
|
||||||
|
String sampleTmpPath = betaDataFile.getSampleTmpPath();
|
||||||
|
if (StringUtils.isNotBlank(sampleTmpPath)) {
|
||||||
|
File file = new File(sampleTmpPath);
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
String gasTmpPath = betaDataFile.getGasTmpPath();
|
||||||
|
if (StringUtils.isNotBlank(gasTmpPath)) {
|
||||||
|
File file = new File(gasTmpPath);
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
String detTmpPath = betaDataFile.getDetTmpPath();
|
||||||
|
if (StringUtils.isNotBlank(detTmpPath)) {
|
||||||
|
File file = new File(detTmpPath);
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
String qcTmpPath = betaDataFile.getQcTmpPath();
|
||||||
|
if (StringUtils.isNotBlank(qcTmpPath)) {
|
||||||
|
File file = new File(qcTmpPath);
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
betaCache.deleteBetaCache(betaKey);
|
betaCache.deleteBetaCache(betaKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,20 +1188,20 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Map<String, List<String>> map = new HashMap<>();
|
Map<String, List<String>> map = new HashMap<>();
|
||||||
if(StringUtils.isNotBlank(betaDataFile.getSampleFilePathName())) {
|
if(StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||||
List<String> lines = phdFileUtil.readLine(betaDataFile.getSampleFilePathName());
|
List<String> lines = phdFileUtil.readLine(betaDataFile.getSampleTmpPath());
|
||||||
map.put("sample", lines);
|
map.put("sample", lines);
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(betaDataFile.getGasFilePathName())) {
|
if(StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) {
|
||||||
List<String> lines = phdFileUtil.readLine(betaDataFile.getGasFilePathName());
|
List<String> lines = phdFileUtil.readLine(betaDataFile.getGasTmpPath());
|
||||||
map.put("gasBg", lines);
|
map.put("gasBg", lines);
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(betaDataFile.getDetFilePathName())) {
|
if(StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) {
|
||||||
List<String> lines = phdFileUtil.readLine(betaDataFile.getDetFilePathName());
|
List<String> lines = phdFileUtil.readLine(betaDataFile.getDetTmpPath());
|
||||||
map.put("detBg", lines);
|
map.put("detBg", lines);
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) {
|
if (StringUtils.isNotBlank(betaDataFile.getQcTmpPath())) {
|
||||||
List<String> lines = phdFileUtil.readLine(betaDataFile.getQcFilePathName());
|
List<String> lines = phdFileUtil.readLine(betaDataFile.getQcTmpPath());
|
||||||
map.put("qc", lines);
|
map.put("qc", lines);
|
||||||
}
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
|
@ -2644,10 +2664,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, BetaDataFile betaDataFile) {
|
private Map<String, Object> BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, BetaDataFile betaDataFile) {
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
|
||||||
File sampleTmp = null;
|
|
||||||
File gasTmp = null;
|
|
||||||
File detTmp = null;
|
|
||||||
//声明一个map 缓存xeData计算后的结果
|
//声明一个map 缓存xeData计算后的结果
|
||||||
Map<String, Object> xeMap = new HashMap<>();
|
Map<String, Object> xeMap = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
@ -2721,13 +2737,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
//判断是否勾选了qc
|
//判断是否勾选了qc
|
||||||
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
|
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
|
||||||
betaDataFile.setBgPara(spectrum_group.BgCalPara);
|
betaDataFile.setBgPara(spectrum_group.BgCalPara);
|
||||||
//获取sample文件
|
File sampleTmp = null;
|
||||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
File gasTmp = null;
|
||||||
//获取gas文件
|
File detTmp = null;
|
||||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||||
//获取det文件
|
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) {
|
||||||
|
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) {
|
||||||
|
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
|
}
|
||||||
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||||
//调用分析方法进行分析操作
|
//调用分析方法进行分析操作
|
||||||
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, betaDataFile);
|
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, betaDataFile);
|
||||||
|
@ -2785,16 +2806,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
|
||||||
sampleTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(gasTmp)) {
|
|
||||||
gasTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(detTmp)) {
|
|
||||||
detTmp.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return xeMap;
|
return xeMap;
|
||||||
}
|
}
|
||||||
|
@ -2804,9 +2815,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||||
//返回最终结果用的map
|
//返回最终结果用的map
|
||||||
Map<String, Map<String, Object>> analyseResultMap = new HashMap<>();
|
Map<String, Map<String, Object>> analyseResultMap = new HashMap<>();
|
||||||
File sampleTmp = null;
|
|
||||||
File gasTmp = null;
|
|
||||||
File detTmp = null;
|
|
||||||
try {
|
try {
|
||||||
//需要操作的数据集合
|
//需要操作的数据集合
|
||||||
for (String sampleFileName: analyseData.getSampleFileNames()){
|
for (String sampleFileName: analyseData.getSampleFileNames()){
|
||||||
|
@ -2887,9 +2895,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
|
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
|
||||||
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
|
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
|
||||||
sampleBetaData.setBgPara(spectrum_group.BgCalPara);
|
sampleBetaData.setBgPara(spectrum_group.BgCalPara);
|
||||||
sampleTmp = ftpUtil.downloadFile(sampleBetaData.getSampleFilePathName(), "betaGamma");
|
File sampleTmp = null;
|
||||||
gasTmp = ftpUtil.downloadFile(sampleBetaData.getGasFilePathName(), "betaGamma");
|
File gasTmp = null;
|
||||||
detTmp = ftpUtil.downloadFile(sampleBetaData.getDetFilePathName(), "betaGamma");
|
File detTmp = null;
|
||||||
|
if (StringUtils.isNotBlank(sampleBetaData.getSampleTmpPath())) {
|
||||||
|
sampleTmp = new File(sampleBetaData.getSampleTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(sampleBetaData.getGasTmpPath())) {
|
||||||
|
gasTmp = new File(sampleBetaData.getGasTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(sampleBetaData.getDetTmpPath())) {
|
||||||
|
detTmp = new File(sampleBetaData.getDetTmpPath());
|
||||||
|
}
|
||||||
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||||
//调用分析方法进行分析操作
|
//调用分析方法进行分析操作
|
||||||
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, sampleBetaData);
|
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, sampleBetaData);
|
||||||
|
@ -2951,16 +2968,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
|
||||||
sampleTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(gasTmp)) {
|
|
||||||
gasTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(detTmp)) {
|
|
||||||
detTmp.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return analyseResultMap.get(currentFileName);
|
return analyseResultMap.get(currentFileName);
|
||||||
}
|
}
|
||||||
|
@ -2978,16 +2985,21 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//生成临时文件
|
|
||||||
File sampleTmp = null;
|
|
||||||
File gasTmp = null;
|
|
||||||
File detTmp = null;
|
|
||||||
BgCalibratePara BgCalPara = null;
|
BgCalibratePara BgCalPara = null;
|
||||||
try {
|
try {
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
File sampleTmp = null;
|
||||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
File gasTmp = null;
|
||||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
File detTmp = null;
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||||
|
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) {
|
||||||
|
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) {
|
||||||
|
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
|
}
|
||||||
if (Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp)) {
|
if (Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp)) {
|
||||||
result.error500("Failed to obtain the ftp file. Procedure!");
|
result.error500("Failed to obtain the ftp file. Procedure!");
|
||||||
return result;
|
return result;
|
||||||
|
@ -3063,16 +3075,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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);
|
||||||
|
@ -3087,9 +3089,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
//获取本地缓存
|
//获取本地缓存
|
||||||
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||||
Map<String, Map<String, Object>> mapList = new HashMap<>();
|
Map<String, Map<String, Object>> mapList = new HashMap<>();
|
||||||
File sampleTmp = null;
|
|
||||||
File gasTmp = null;
|
|
||||||
File detTmp = null;
|
|
||||||
try {
|
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++) {
|
||||||
|
@ -3099,9 +3098,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
//获取缓存数据
|
//获取缓存数据
|
||||||
BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
|
BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
File sampleTmp = null;
|
||||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
File gasTmp = null;
|
||||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
File detTmp = null;
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||||
|
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) {
|
||||||
|
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) {
|
||||||
|
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
|
}
|
||||||
//获取缓存内容
|
//获取缓存内容
|
||||||
List<SeriseData> betaList = new LinkedList<>();
|
List<SeriseData> betaList = new LinkedList<>();
|
||||||
List<String> betaFittingParaToUi = new LinkedList<>();
|
List<String> betaFittingParaToUi = new LinkedList<>();
|
||||||
|
@ -3177,16 +3185,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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.get(currentFileName));
|
result.setResult(mapList.get(currentFileName));
|
||||||
|
@ -3333,26 +3331,26 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//处理数据 获取对应的channel/energy值
|
//处理数据 获取对应的channel/energy值
|
||||||
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
getChannelAndEnergy(anlyseResultIn, betaList, gammaList, betaDataFile);
|
||||||
//分析文件内容
|
//分析文件内容
|
||||||
analyzePHDFile(anlyseResultIn, BgCalPara, betaFittingPara, gammaFittingPara);
|
analyzePHDFile(anlyseResultIn, BgCalPara, betaFittingPara, gammaFittingPara, betaDataFile);
|
||||||
//判断文件是否存储过 如果没有则解析文件并进行存储
|
//判断文件是否存储过 如果没有则解析文件并进行存储
|
||||||
if ( !OriginalDataStore(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName(), gasFilePathName, anlyseResultIn.getUserName()) ){
|
if ( !OriginalDataStore(betaDataFile, "gas", gasFilePathName) ){
|
||||||
result.error500("gasFile save failed");
|
result.error500("gasFile save failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if ( !OriginalDataStore(anlyseResultIn.getDetFilePath(), anlyseResultIn.getGasFileName(), detFilePathName, anlyseResultIn.getUserName()) ){
|
if ( !OriginalDataStore(betaDataFile, "det", detFilePathName) ){
|
||||||
result.error500("detFile save failed");
|
result.error500("detFile save failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(anlyseResultIn.getQcFileName())) {
|
if (StringUtils.isNotBlank(anlyseResultIn.getQcFileName())) {
|
||||||
if ( !OriginalDataStore(anlyseResultIn.getQcFilePath(), anlyseResultIn.getQcFileName(), qcFilePathName, anlyseResultIn.getUserName()) ){
|
if ( !OriginalDataStore(betaDataFile, "qc", qcFilePathName) ){
|
||||||
result.error500("qcFile save failed");
|
result.error500("qcFile save failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
qcId = spectrumAnalysisMapper.getSampleId(qcFilePathName);
|
qcId = spectrumAnalysisMapper.getSampleId(qcFilePathName);
|
||||||
}
|
}
|
||||||
if ( !OriginalDataStore(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName(), sampleFilePathName, anlyseResultIn.getUserName()) ){
|
if ( !OriginalDataStore(betaDataFile, "sample", sampleFilePathName) ){
|
||||||
result.error500("sampleFile save failed");
|
result.error500("sampleFile save failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3465,44 +3463,43 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//上传本次文件到ftp人工交互存储路径下
|
//上传本次文件到ftp人工交互存储路径下
|
||||||
File sampleTmp = null;
|
|
||||||
File gasTmp = null;
|
|
||||||
File detTmp = null;
|
|
||||||
File qcTmp = null;
|
|
||||||
try {
|
try {
|
||||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
File sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
|
||||||
qcTmp = ftpUtil.downloadFile(betaDataFile.getQcFilePathName(), "betaGamma");
|
|
||||||
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 + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getGasTmpPath())) {
|
||||||
|
File gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
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 + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getDetTmpPath())) {
|
||||||
|
File detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + 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));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(betaDataFile.getQcTmpPath())) {
|
||||||
|
File qcTmp = new File(betaDataFile.getQcTmpPath());
|
||||||
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName.substring(0, qcFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getQcFileName(), new FileInputStream(qcTmp));
|
ftpUtil.saveFile(StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + qcFilePathName.substring(0, qcFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getQcFileName(), new FileInputStream(qcTmp));
|
||||||
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
|
||||||
sampleTmp.delete();
|
|
||||||
gasTmp.delete();
|
|
||||||
detTmp.delete();
|
|
||||||
qcTmp.delete();
|
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(sampleId)) {
|
if (Objects.nonNull(sampleId)) {
|
||||||
SpectrumData sampleData = getSpectrumData(sampleId);
|
SpectrumData sampleData = getSpectrumData(sampleId, betaDataFile, "sample");
|
||||||
betaDataFile.setSampleSpectrumData(sampleData);
|
betaDataFile.setSampleSpectrumData(sampleData);
|
||||||
map.put("sample", sampleData);
|
map.put("sample", sampleData);
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(gasId)) {
|
if (Objects.nonNull(gasId)) {
|
||||||
SpectrumData gasData = getSpectrumData(gasId);
|
SpectrumData gasData = getSpectrumData(gasId, betaDataFile, "gas");
|
||||||
betaDataFile.setGasSpectrumData(gasData);
|
betaDataFile.setGasSpectrumData(gasData);
|
||||||
map.put("gas", gasData);
|
map.put("gas", gasData);
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(detId)) {
|
if (Objects.nonNull(detId)) {
|
||||||
SpectrumData detData = getSpectrumData(detId);
|
SpectrumData detData = getSpectrumData(detId, betaDataFile, "det");
|
||||||
betaDataFile.setDetSpectrumData(detData);
|
betaDataFile.setDetSpectrumData(detData);
|
||||||
map.put("det", detData);
|
map.put("det", detData);
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(qcId)) {
|
if (Objects.nonNull(qcId)) {
|
||||||
SpectrumData qcData = getSpectrumData(qcId);
|
SpectrumData qcData = getSpectrumData(qcId, betaDataFile, "qc");
|
||||||
betaDataFile.setQcSpectrumData(qcData);
|
betaDataFile.setQcSpectrumData(qcData);
|
||||||
map.put("qc", qcData);
|
map.put("qc", qcData);
|
||||||
}
|
}
|
||||||
|
@ -3551,9 +3548,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
anlyseResultIn.setDetFilePath(betaDataFile.getDetFilePathName().substring(0, betaDataFile.getDetFilePathName().lastIndexOf(StringPool.SLASH)));
|
anlyseResultIn.setDetFilePath(betaDataFile.getDetFilePathName().substring(0, betaDataFile.getDetFilePathName().lastIndexOf(StringPool.SLASH)));
|
||||||
anlyseResultIn.setQcFilePath(betaDataFile.getQcFilePathName().substring(0, betaDataFile.getQcFilePathName().lastIndexOf(StringPool.SLASH)));
|
anlyseResultIn.setQcFilePath(betaDataFile.getQcFilePathName().substring(0, betaDataFile.getQcFilePathName().lastIndexOf(StringPool.SLASH)));
|
||||||
//处理数据 获取对应的channel/energy值
|
//处理数据 获取对应的channel/energy值
|
||||||
getChannelAndEnergy(anlyseResultIn, betaList, gammaList);
|
getChannelAndEnergy(anlyseResultIn, betaList, gammaList, betaDataFile);
|
||||||
//分析文件内容
|
//分析文件内容
|
||||||
analyzeSavePHDFile(anlyseResultIn, BgCalPara, betaFittingPara, gammaFittingPara, betaFittingParaToUi, gammaFittingParaToUi);
|
analyzeSavePHDFile(anlyseResultIn, BgCalPara, betaFittingPara, gammaFittingPara, betaFittingParaToUi, gammaFittingParaToUi, betaDataFile);
|
||||||
// 返回需要Save的数据
|
// 返回需要Save的数据
|
||||||
return anlyseResultIn;
|
return anlyseResultIn;
|
||||||
}
|
}
|
||||||
|
@ -3646,11 +3643,13 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
/*
|
/*
|
||||||
* 提取(saveToHtml|saveToTxt|saveToExcel)公共部分
|
* 提取(saveToHtml|saveToTxt|saveToExcel)公共部分
|
||||||
* */
|
* */
|
||||||
private Map<String, Object> exportData(BgDataAnlyseResultIn anlyseResultIn){
|
private Map<String, Object> exportData(BgDataAnlyseResultIn anlyseResultIn, String userName){
|
||||||
// 解析文件,生成导出数据
|
// 解析文件,生成导出数据
|
||||||
Map<String, Object> analyze = shiftSaveData(getSaveData(anlyseResultIn));
|
Map<String, Object> analyze = shiftSaveData(getSaveData(anlyseResultIn));
|
||||||
|
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
|
||||||
|
BetaDataFile betaDataFile = cache.getIfPresent(anlyseResultIn.getSampleFileName() + "-" + userName);
|
||||||
// 转换能谱结构数据
|
// 转换能谱结构数据
|
||||||
EnergySpectrumStruct energySpectrumStruct = phdFileUtil.analyzeFileSourceData(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
EnergySpectrumStruct energySpectrumStruct = betaDataFile.getSampleStruct();
|
||||||
ESStructDto esStructDto = new ESStructDto();
|
ESStructDto esStructDto = new ESStructDto();
|
||||||
ClassUtil.copyProperties(energySpectrumStruct, esStructDto);
|
ClassUtil.copyProperties(energySpectrumStruct, esStructDto);
|
||||||
analyze.putAll(BeanUtil.beanToMap(esStructDto));
|
analyze.putAll(BeanUtil.beanToMap(esStructDto));
|
||||||
|
@ -3661,9 +3660,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response) {
|
public void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
// 解析文件,生成导出数据
|
// 解析文件,生成导出数据
|
||||||
Map<String, Object> analyze = exportData(anlyseResultIn);
|
Map<String, Object> analyze = exportData(anlyseResultIn, userName);
|
||||||
// 解析生成Html字符串并导出为Html文件
|
// 解析生成Html字符串并导出为Html文件
|
||||||
String result = parseHtml(analyze);
|
String result = parseHtml(analyze);
|
||||||
PrintWriter writer = null;
|
PrintWriter writer = null;
|
||||||
|
@ -3685,9 +3685,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response) {
|
public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
// 解析文件,生成导出数据
|
// 解析文件,生成导出数据
|
||||||
Map<String, Object> analyze = exportData(anlyseResultIn);
|
Map<String, Object> analyze = exportData(anlyseResultIn, userName);
|
||||||
// 将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";
|
||||||
|
@ -3701,9 +3702,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletResponse response) {
|
public void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
String userName = JwtUtil.getUserNameByToken(request);
|
||||||
// 解析文件,生成导出数据
|
// 解析文件,生成导出数据
|
||||||
Map<String, Object> analyze = exportData(anlyseResultIn);
|
Map<String, Object> analyze = exportData(anlyseResultIn, userName);
|
||||||
|
|
||||||
// 生成指定格式的导出数据备用
|
// 生成指定格式的导出数据备用
|
||||||
List<ROIChannelsDto> roiChannelsDtosS = (List<ROIChannelsDto>) analyze.get("roiChannelsS");
|
List<ROIChannelsDto> roiChannelsDtosS = (List<ROIChannelsDto>) analyze.get("roiChannelsS");
|
||||||
|
@ -3890,15 +3892,15 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return xeResultStrs;
|
return xeResultStrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List<SeriseData> betaList, List<SeriseData> gammaList) {
|
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List<SeriseData> betaList, List<SeriseData> gammaList, BetaDataFile betaDataFile) {
|
||||||
File sampleTmp = null;
|
File sampleTmp = null;
|
||||||
File gasTmp = null;
|
File gasTmp = null;
|
||||||
File detTmp = null;
|
File detTmp = null;
|
||||||
try {
|
try {
|
||||||
//获取ftp文件路径下临时文件
|
//获取ftp文件路径下临时文件
|
||||||
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
//如果勾选了Energy Calibration页面下sample Data
|
//如果勾选了Energy Calibration页面下sample Data
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
if (Objects.nonNull(sampleTmp)) {
|
||||||
if(anlyseResultIn.isCheckSample()) {
|
if(anlyseResultIn.isCheckSample()) {
|
||||||
|
@ -3991,28 +3993,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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, BgCalibratePara BgCalPara, List<String> betaFittingPara, List<String> gammaFittingPara,List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi) {
|
public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn, BgCalibratePara BgCalPara, List<String> betaFittingPara, List<String> gammaFittingPara,List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi, BetaDataFile betaDataFile) {
|
||||||
File sampleTmp = null;
|
File sampleTmp = null;
|
||||||
File gasTmp = null;
|
File gasTmp = null;
|
||||||
File detTmp = null;
|
File detTmp = null;
|
||||||
try {
|
try {
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
//调用动态库解析文件
|
//调用动态库解析文件
|
||||||
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
||||||
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
||||||
|
@ -4255,28 +4247,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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, BgCalibratePara BgCalPara, List<String> betaFittingPara, List<String> gammaFittingPara) {
|
public void analyzePHDFile(BgDataAnlyseResultIn anlyseResultIn, BgCalibratePara BgCalPara, List<String> betaFittingPara, List<String> gammaFittingPara, BetaDataFile betaDataFile) {
|
||||||
File sampleTmp = null;
|
File sampleTmp = null;
|
||||||
File gasTmp = null;
|
File gasTmp = null;
|
||||||
File detTmp = null;
|
File detTmp = null;
|
||||||
try {
|
try {
|
||||||
//根据文件路径 文件名称获取对应的临时文件
|
//根据文件路径 文件名称获取对应的临时文件
|
||||||
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||||
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||||
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||||
//调用动态库解析文件
|
//调用动态库解析文件
|
||||||
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
|
||||||
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
|
||||||
|
@ -4480,16 +4462,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
|
||||||
sampleTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(gasTmp)) {
|
|
||||||
gasTmp.delete();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(detTmp)) {
|
|
||||||
detTmp.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4574,74 +4546,74 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return calibrationPairsList;
|
return calibrationPairsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getROILimit(BgDataAnlyseResultIn anlyseResultIn) {
|
// public void getROILimit(BgDataAnlyseResultIn anlyseResultIn) {
|
||||||
File sampleTmp = null;
|
// File sampleTmp = null;
|
||||||
try {
|
// try {
|
||||||
//获取ftp文件路径下临时文件
|
// //获取ftp文件路径下临时文件
|
||||||
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
// sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||||
if (Objects.nonNull(sampleTmp)){
|
// if (Objects.nonNull(sampleTmp)){
|
||||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
// EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||||
List<Double> poiBX1 = sourceData.POI_B_x1;
|
// List<Double> poiBX1 = sourceData.POI_B_x1;
|
||||||
List<Double> poiBX2 = sourceData.POI_B_x2;
|
// List<Double> poiBX2 = sourceData.POI_B_x2;
|
||||||
List<Double> poiGY1 = sourceData.POI_G_y1;
|
// List<Double> poiGY1 = sourceData.POI_G_y1;
|
||||||
List<Double> poiGY2 = sourceData.POI_G_y2;
|
// List<Double> poiGY2 = sourceData.POI_G_y2;
|
||||||
//ROI Limit
|
// //ROI Limit
|
||||||
List<String> report_limit_roi = new LinkedList<>();
|
// List<String> report_limit_roi = new LinkedList<>();
|
||||||
for(int pos=1;pos<=poiBX1.size();pos++) {
|
// for(int pos=1;pos<=poiBX1.size();pos++) {
|
||||||
report_limit_roi.add(String.valueOf(pos));
|
// report_limit_roi.add(String.valueOf(pos));
|
||||||
}
|
// }
|
||||||
List<String> beginB = new LinkedList<>();
|
// List<String> beginB = new LinkedList<>();
|
||||||
for(int pos=1;pos<=poiBX1.size();pos++) {
|
// for(int pos=1;pos<=poiBX1.size();pos++) {
|
||||||
beginB.add(String.valueOf(poiBX1.get(pos)));
|
// beginB.add(String.valueOf(poiBX1.get(pos)));
|
||||||
}
|
// }
|
||||||
List<String> endB = new LinkedList<>();
|
// List<String> endB = new LinkedList<>();
|
||||||
for(int pos=0;pos<poiBX2.size();pos++) {
|
// for(int pos=0;pos<poiBX2.size();pos++) {
|
||||||
endB.add(String.valueOf(poiBX2.get(pos)));
|
// endB.add(String.valueOf(poiBX2.get(pos)));
|
||||||
}
|
// }
|
||||||
List<String> beginG = new LinkedList<>();
|
// List<String> beginG = new LinkedList<>();
|
||||||
for(int pos=1;pos<=poiGY1.size();pos++) {
|
// for(int pos=1;pos<=poiGY1.size();pos++) {
|
||||||
beginG.add(String.valueOf(poiGY1.get(pos)));
|
// beginG.add(String.valueOf(poiGY1.get(pos)));
|
||||||
}
|
// }
|
||||||
List<String> endG = new LinkedList<>();
|
// List<String> endG = new LinkedList<>();
|
||||||
for(int pos=0;pos<poiGY2.size();pos++) {
|
// for(int pos=0;pos<poiGY2.size();pos++) {
|
||||||
endG.add(String.valueOf(poiGY2.get(pos)));
|
// endG.add(String.valueOf(poiGY2.get(pos)));
|
||||||
}
|
// }
|
||||||
//ratios
|
// //ratios
|
||||||
List<String> ratio_id = sourceData.ratio_id;
|
// List<String> ratio_id = sourceData.ratio_id;
|
||||||
List<String> ROI_num_highter_G_energy_ROI = sourceData.ROI_num_highter_G_energy_ROI;
|
// List<String> ROI_num_highter_G_energy_ROI = sourceData.ROI_num_highter_G_energy_ROI;
|
||||||
List<String> ROI_num_lower_G_energy_ROI = sourceData.ROI_num_lower_G_energy_ROI;
|
// List<String> ROI_num_lower_G_energy_ROI = sourceData.ROI_num_lower_G_energy_ROI;
|
||||||
List<Double> count_ratio = sourceData.count_ratio;
|
// List<Double> count_ratio = sourceData.count_ratio;
|
||||||
List<Double> count_ratio_uncertainty = sourceData.count_ratio_uncertainty;
|
// List<Double> count_ratio_uncertainty = sourceData.count_ratio_uncertainty;
|
||||||
List<String> countRatioList = new LinkedList<>();
|
// List<String> countRatioList = new LinkedList<>();
|
||||||
for(int pos=0;pos<count_ratio.size();pos++) {
|
// for(int pos=0;pos<count_ratio.size();pos++) {
|
||||||
countRatioList.add(String.valueOf(count_ratio.get(pos)));
|
// countRatioList.add(String.valueOf(count_ratio.get(pos)));
|
||||||
}
|
// }
|
||||||
List<String> countRatioUncertaintyList = new LinkedList<>();
|
// List<String> countRatioUncertaintyList = new LinkedList<>();
|
||||||
for(int pos=0;pos<count_ratio_uncertainty.size();pos++) {
|
// for(int pos=0;pos<count_ratio_uncertainty.size();pos++) {
|
||||||
countRatioUncertaintyList.add(String.valueOf(count_ratio_uncertainty.get(pos)));
|
// countRatioUncertaintyList.add(String.valueOf(count_ratio_uncertainty.get(pos)));
|
||||||
}
|
// }
|
||||||
//bg_efficiency
|
// //bg_efficiency
|
||||||
List<Double> bg_efficiency = sourceData.bg_efficiency;
|
// List<Double> bg_efficiency = sourceData.bg_efficiency;
|
||||||
List<String> nuclide_name = sourceData.nuclide_name;
|
// List<String> nuclide_name = sourceData.nuclide_name;
|
||||||
List<String> ROI_number = sourceData.ROI_number;
|
// List<String> ROI_number = sourceData.ROI_number;
|
||||||
List<Double> uncertainty = sourceData.uncertainty;
|
// List<Double> uncertainty = sourceData.uncertainty;
|
||||||
List<String> efficiencyList = new LinkedList<>();
|
// List<String> efficiencyList = new LinkedList<>();
|
||||||
for(int pos=0;pos<bg_efficiency.size();pos++) {
|
// for(int pos=0;pos<bg_efficiency.size();pos++) {
|
||||||
efficiencyList.add(String.valueOf(bg_efficiency.get(pos)));
|
// efficiencyList.add(String.valueOf(bg_efficiency.get(pos)));
|
||||||
}
|
// }
|
||||||
List<String> uncertaintyList = new LinkedList<>();
|
// List<String> uncertaintyList = new LinkedList<>();
|
||||||
for(int pos=0;pos<uncertainty.size();pos++) {
|
// for(int pos=0;pos<uncertainty.size();pos++) {
|
||||||
uncertaintyList.add(String.valueOf(uncertainty.get(pos)));
|
// uncertaintyList.add(String.valueOf(uncertainty.get(pos)));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (Exception e){
|
// } catch (Exception e){
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} finally {
|
// } finally {
|
||||||
if (Objects.nonNull(sampleTmp)) {
|
// if (Objects.nonNull(sampleTmp)) {
|
||||||
sampleTmp.delete();
|
// sampleTmp.delete();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public List<GardsCalibration> getCalibration(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
|
public List<GardsCalibration> getCalibration(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
|
||||||
List<GardsCalibration> calibrationSpectrumList = new LinkedList<>();
|
List<GardsCalibration> calibrationSpectrumList = new LinkedList<>();
|
||||||
|
@ -4823,7 +4795,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean OriginalDataStore(String filePath, String fileName, String filePathName, String userName) {
|
public boolean OriginalDataStore(BetaDataFile betaDataFile, String type, String filePathName) {
|
||||||
//根据新的文件路径名称查询数据是否存在
|
//根据新的文件路径名称查询数据是否存在
|
||||||
GardsSampleData isExist = spectrumAnalysisMapper.findSampleByFile(filePathName);
|
GardsSampleData isExist = spectrumAnalysisMapper.findSampleByFile(filePathName);
|
||||||
//如果数据已经存入过数据库 则 修改状态后返回
|
//如果数据已经存入过数据库 则 修改状态后返回
|
||||||
|
@ -4832,27 +4804,25 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//连接ftp
|
//读取文件内容
|
||||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
EnergySpectrumStruct sourceData = null;
|
||||||
InputStream inputStream = null;
|
|
||||||
File file = null;
|
File file = null;
|
||||||
try {
|
try {
|
||||||
//被动模式
|
if (Objects.nonNull(betaDataFile)){
|
||||||
ftpClient.enterLocalPassiveMode();
|
|
||||||
//设置文件类型--二进制文件
|
if (type.equalsIgnoreCase("sample")) {
|
||||||
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
file = new File(betaDataFile.getSampleTmpPath());
|
||||||
//
|
sourceData = betaDataFile.getSampleStruct();
|
||||||
ftpClient.setControlEncoding("UTF-8");
|
} else if (type.equalsIgnoreCase("gas")) {
|
||||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
file = new File(betaDataFile.getGasTmpPath());
|
||||||
//切换文件路径
|
sourceData = betaDataFile.getGasStruct();
|
||||||
ftpClient.changeWorkingDirectory(filePath);
|
} else if (type.equalsIgnoreCase("det")) {
|
||||||
inputStream = ftpClient.retrieveFileStream(fileName);
|
file = new File(betaDataFile.getDetTmpPath());
|
||||||
if (Objects.nonNull(inputStream)){
|
sourceData = betaDataFile.getDetStruct();
|
||||||
file = File.createTempFile("betaGamma", null);
|
} else if (type.equalsIgnoreCase("qc")) {
|
||||||
//将ftp文件的输入流复制给临时文件
|
file = new File(betaDataFile.getQcTmpPath());
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
sourceData = betaDataFile.getQcStruct();
|
||||||
//读取文件内容
|
}
|
||||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
|
||||||
//获取文件中块名信息
|
//获取文件中块名信息
|
||||||
List<String> readLines = getFileBlockList(file);
|
List<String> readLines = getFileBlockList(file);
|
||||||
//查询台站id
|
//查询台站id
|
||||||
|
@ -4903,22 +4873,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (Objects.nonNull(ftpClient)){
|
|
||||||
ftpClient.disconnect();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(inputStream)){
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(file)) {
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4961,15 +4917,24 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
||||||
return roiResultsList;
|
return roiResultsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpectrumData getSpectrumData(Integer sampleId) {
|
public SpectrumData getSpectrumData(Integer sampleId, BetaDataFile betaDataFile, String type) {
|
||||||
//根据 sampleId获取sampleData的数据内容
|
//根据 sampleId获取sampleData的数据内容
|
||||||
GardsSampleDataSpectrum sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
|
GardsSampleDataSpectrum sampleData = spectrumAnalysisMapper.getSampleData(sampleId);
|
||||||
//获取文件存储路径
|
File file = null;
|
||||||
String inputFileName = sampleData.getInputFileName();
|
EnergySpectrumStruct struct = null;
|
||||||
//拼接完整的ftp路径
|
if (type.equalsIgnoreCase("sample")) {
|
||||||
String filePath = StringPool.SLASH + ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + inputFileName;
|
file = new File(betaDataFile.getSampleTmpPath());
|
||||||
File file = ftpUtil.downloadFile(filePath, "betaGamma");
|
struct = betaDataFile.getSampleStruct();
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
} else if (type.equalsIgnoreCase("gas")) {
|
||||||
|
file = new File(betaDataFile.getGasTmpPath());
|
||||||
|
struct = betaDataFile.getGasStruct();
|
||||||
|
} else if (type.equalsIgnoreCase("det")) {
|
||||||
|
file = new File(betaDataFile.getDetTmpPath());
|
||||||
|
struct = betaDataFile.getDetStruct();
|
||||||
|
} else if (type.equalsIgnoreCase("qc")) {
|
||||||
|
file = new File(betaDataFile.getQcTmpPath());
|
||||||
|
struct = betaDataFile.getQcStruct();
|
||||||
|
}
|
||||||
SpectrumData spectrumData = new SpectrumData();
|
SpectrumData spectrumData = new SpectrumData();
|
||||||
try {
|
try {
|
||||||
//封装散点图下的基础数据信息
|
//封装散点图下的基础数据信息
|
||||||
|
|
Loading…
Reference in New Issue
Block a user