beta,gamma增加文件不存在时返回的提示语句
beta分析功能当分析结果有错误时,返回空数组
This commit is contained in:
parent
61f7c20cba
commit
602345508e
|
@ -65,6 +65,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
phd.setFilename(fileName);
|
||||
String fromPath = pathName + StringPool.SLASH + fileName;
|
||||
File file = ftpUtil.downloadFile(fromPath, "betaGamma");
|
||||
if (Objects.isNull(file)) {
|
||||
result.error500("ftp file can't find");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
//读取文件信息
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
|
|
|
@ -605,7 +605,8 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
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;
|
||||
if (Objects.isNull(BgCalPara)) {
|
||||
|
@ -614,7 +615,8 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara);
|
||||
}
|
||||
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
|
||||
return;
|
||||
bRet = false;
|
||||
return bRet;
|
||||
} else {
|
||||
EnergySpectrumStruct sample = analyzeFileSourceData(sampleTmp);
|
||||
EnergySpectrumStruct gas = analyzeFileSourceData(gasTmp);
|
||||
|
@ -695,6 +697,7 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
}
|
||||
map.put("DetBoundary", boundaryList);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -834,6 +834,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd = new PHDFile();
|
||||
// 加载文件内容
|
||||
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
|
||||
if (!bRet) {
|
||||
return result;
|
||||
}
|
||||
if (!redisUtil.hasKey(fileName+"-"+userName)) {
|
||||
// 查询当前用户关联的核素信息
|
||||
List<String> userLib = new LinkedList<>();
|
||||
|
@ -845,9 +848,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
Map<String, NuclideLines> nuclideMap = GetNuclideLines(userLib);
|
||||
redisUtil.set(fileName+"-"+userName, nuclideMap);
|
||||
}
|
||||
if (!bRet) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// 更新 ‘QC Flags’ 状态
|
||||
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.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
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.extension.plugins.pagination.Page;
|
||||
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.IOUtils;
|
||||
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.XeResultsDto;
|
||||
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.enums.*;
|
||||
import org.jeecg.modules.entity.*;
|
||||
|
@ -59,13 +56,10 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.*;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -563,6 +557,9 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (Objects.nonNull(inputStream)){
|
||||
//声明一个临时文件
|
||||
file = File.createTempFile("betaGamma", null);
|
||||
if (Objects.isNull(file)) {
|
||||
throw new RuntimeException("ftp file can't find!");
|
||||
}
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
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.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("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
}
|
||||
map.put("XeData", analyseResult);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
result.setSuccess(true);
|
||||
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.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("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
}
|
||||
map.put("XeData", analyseResultList);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
}
|
||||
|
@ -3549,7 +3546,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||
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.")) {
|
||||
continue;
|
||||
analyseResultMap.put(sampleFileName, Collections.EMPTY_LIST);
|
||||
} else {
|
||||
//生成分析操作日志
|
||||
EnergySpectrumStruct sample = phdFileUtil.analyzeFileSourceData(sampleTmp);
|
||||
|
@ -3745,40 +3742,45 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
BgCalPara = (BgCalibratePara) reAnalyseParam.get("reAnalyseParam");
|
||||
}
|
||||
//调用分析方法
|
||||
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(map)) {
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
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())));
|
||||
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
if (bRet) {
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
if (CollectionUtils.isNotEmpty(map)) {
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
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())));
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
}
|
||||
} else {
|
||||
map.clear();
|
||||
map.put("XeData", Collections.EMPTY_LIST);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -3891,40 +3893,46 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||
//调用分析方法
|
||||
phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
}
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map);
|
||||
if (bRet) {
|
||||
//分析qc文件信息并重新计算qc边界值
|
||||
if (StringUtils.isNotBlank(qcPath)) {
|
||||
EnergySpectrumStruct struct = phdFileUtil.analyzeFileSourceData(qcPath, qcFileName);
|
||||
if (Objects.nonNull(struct)) {
|
||||
phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
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())));
|
||||
}
|
||||
List<GardsXeResultsSpectrum> xeDataList = (List<GardsXeResultsSpectrum>) map.get("XeData");
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(String.format("%."+(6 - String.valueOf(Math.abs(xeData.getMdc())).substring(0, String.valueOf(Math.abs(xeData.getMdc())).lastIndexOf(StringPool.DOT)).length())+"f", xeData.getMdc())));
|
||||
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())));
|
||||
}
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
mapList.put(sampleFileName, map);
|
||||
} else {
|
||||
map.clear();
|
||||
map.put("XeData", Collections.EMPTY_LIST);
|
||||
mapList.put(sampleFileName, map);
|
||||
}
|
||||
//更新分析后的缓存信息
|
||||
cache.put(sampleFileName + "-" + userName + "-xeData", map);
|
||||
betaCache.setBetaCache(cache);
|
||||
map.put("bProcessed", true);
|
||||
map.put("savedAnalysisResult", true);
|
||||
mapList.put(sampleFileName, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user