beta,gamma增加文件不存在时返回的提示语句
beta分析功能当分析结果有错误时,返回空数组
This commit is contained in:
parent
61f7c20cba
commit
602345508e
|
@ -65,6 +65,10 @@ 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");
|
||||||
|
if (Objects.isNull(file)) {
|
||||||
|
result.error500("ftp file can't find");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
//读取文件信息
|
//读取文件信息
|
||||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
|
|
|
@ -605,7 +605,8 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, BgCalibratePara BgCalPara, Map<String, Object> map) {
|
public boolean analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, BgCalibratePara BgCalPara, Map<String, Object> map) {
|
||||||
|
boolean bRet = true;
|
||||||
//调用动态库解析文件
|
//调用动态库解析文件
|
||||||
BgAnalyseResult analyseResult = null;
|
BgAnalyseResult analyseResult = null;
|
||||||
if (Objects.isNull(BgCalPara)) {
|
if (Objects.isNull(BgCalPara)) {
|
||||||
|
@ -614,7 +615,8 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara);
|
analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara);
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
||||||
return;
|
bRet = false;
|
||||||
|
return bRet;
|
||||||
} else {
|
} else {
|
||||||
EnergySpectrumStruct sample = analyzeFileSourceData(sampleTmp);
|
EnergySpectrumStruct sample = analyzeFileSourceData(sampleTmp);
|
||||||
EnergySpectrumStruct gas = analyzeFileSourceData(gasTmp);
|
EnergySpectrumStruct gas = analyzeFileSourceData(gasTmp);
|
||||||
|
@ -695,6 +697,7 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
||||||
}
|
}
|
||||||
map.put("DetBoundary", boundaryList);
|
map.put("DetBoundary", boundaryList);
|
||||||
}
|
}
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -834,6 +834,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
phd = new PHDFile();
|
phd = new PHDFile();
|
||||||
// 加载文件内容
|
// 加载文件内容
|
||||||
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
|
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
|
||||||
|
if (!bRet) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
||||||
// 查询当前用户关联的核素信息
|
// 查询当前用户关联的核素信息
|
||||||
List<String> userLib = new LinkedList<>();
|
List<String> userLib = new LinkedList<>();
|
||||||
|
@ -845,9 +848,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
||||||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||||
}
|
}
|
||||||
if (!bRet) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 更新 ‘QC Flags’ 状态
|
// 更新 ‘QC Flags’ 状态
|
||||||
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.jeecg.modules.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
@ -13,8 +12,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import kotlin.collections.EmptyList;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.net.ftp.FTP;
|
import org.apache.commons.net.ftp.FTP;
|
||||||
|
@ -36,7 +33,7 @@ import org.jeecg.modules.base.dto.ROIChannelsDto;
|
||||||
import org.jeecg.modules.base.dto.ROIResultsDto;
|
import org.jeecg.modules.base.dto.ROIResultsDto;
|
||||||
import org.jeecg.modules.base.dto.XeResultsDto;
|
import org.jeecg.modules.base.dto.XeResultsDto;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
||||||
import org.jeecg.modules.base.entity.original.*;
|
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||||
import org.jeecg.modules.base.entity.rnman.*;
|
import org.jeecg.modules.base.entity.rnman.*;
|
||||||
import org.jeecg.modules.base.enums.*;
|
import org.jeecg.modules.base.enums.*;
|
||||||
import org.jeecg.modules.entity.*;
|
import org.jeecg.modules.entity.*;
|
||||||
|
@ -59,13 +56,10 @@ import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -563,6 +557,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if (Objects.nonNull(inputStream)){
|
if (Objects.nonNull(inputStream)){
|
||||||
//声明一个临时文件
|
//声明一个临时文件
|
||||||
file = File.createTempFile("betaGamma", null);
|
file = File.createTempFile("betaGamma", null);
|
||||||
|
if (Objects.isNull(file)) {
|
||||||
|
throw new RuntimeException("ftp file can't find!");
|
||||||
|
}
|
||||||
//将ftp文件的输入流复制给临时文件
|
//将ftp文件的输入流复制给临时文件
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||||
map = phdFileUtil.getSourceData(file.getAbsolutePath(), sampleId, status);
|
map = phdFileUtil.getSourceData(file.getAbsolutePath(), sampleId, status);
|
||||||
|
@ -3115,10 +3112,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
map.put("XeData", analyseResult);
|
|
||||||
map.put("bProcessed", true);
|
map.put("bProcessed", true);
|
||||||
map.put("savedAnalysisResult", true);
|
map.put("savedAnalysisResult", true);
|
||||||
|
}
|
||||||
|
map.put("XeData", analyseResult);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
}
|
}
|
||||||
|
@ -3196,10 +3193,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
xeData.setConc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getConc())).substring(0, String.valueOf(Math.abs(xeData.getConc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getConc())));
|
||||||
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
xeData.setConcErr(Double.valueOf(String.format("%."+((6 - String.valueOf(Math.abs(xeData.getConcErr())).substring(0, String.valueOf(Math.abs(xeData.getConcErr())).lastIndexOf(StringPool.DOT)).length()))+"f", xeData.getConcErr())));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
map.put("XeData", analyseResultList);
|
|
||||||
map.put("bProcessed", true);
|
map.put("bProcessed", true);
|
||||||
map.put("savedAnalysisResult", true);
|
map.put("savedAnalysisResult", true);
|
||||||
|
}
|
||||||
|
map.put("XeData", analyseResultList);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
}
|
}
|
||||||
|
@ -3549,7 +3546,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||||
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
||||||
continue;
|
analyseResultMap.put(sampleFileName, Collections.EMPTY_LIST);
|
||||||
} else {
|
} else {
|
||||||
//生成分析操作日志
|
//生成分析操作日志
|
||||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||||
|
@ -3745,7 +3742,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
BgCalPara = (BgCalibratePara) reAnalyseParam.get("reAnalyseParam");
|
BgCalPara = (BgCalibratePara) reAnalyseParam.get("reAnalyseParam");
|
||||||
}
|
}
|
||||||
//调用分析方法
|
//调用分析方法
|
||||||
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||||
|
if (bRet) {
|
||||||
//分析qc文件信息并重新计算qc边界值
|
//分析qc文件信息并重新计算qc边界值
|
||||||
if (StringUtils.isNotBlank(qcPath)) {
|
if (StringUtils.isNotBlank(qcPath)) {
|
||||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||||
|
@ -3780,6 +3778,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
map.put("bProcessed", true);
|
map.put("bProcessed", true);
|
||||||
map.put("savedAnalysisResult", true);
|
map.put("savedAnalysisResult", true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
map.clear();
|
||||||
|
map.put("XeData", Collections.EMPTY_LIST);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -3891,7 +3893,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||||
//调用分析方法
|
//调用分析方法
|
||||||
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||||
|
if (bRet) {
|
||||||
//分析qc文件信息并重新计算qc边界值
|
//分析qc文件信息并重新计算qc边界值
|
||||||
if (StringUtils.isNotBlank(qcPath)) {
|
if (StringUtils.isNotBlank(qcPath)) {
|
||||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||||
|
@ -3925,6 +3928,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
||||||
map.put("bProcessed", true);
|
map.put("bProcessed", true);
|
||||||
map.put("savedAnalysisResult", true);
|
map.put("savedAnalysisResult", true);
|
||||||
mapList.put(sampleFileName, map);
|
mapList.put(sampleFileName, map);
|
||||||
|
} else {
|
||||||
|
map.clear();
|
||||||
|
map.put("XeData", Collections.EMPTY_LIST);
|
||||||
|
mapList.put(sampleFileName, map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user