人工交互模块gamma算法崩溃问题修改,新增字段判断分析是否异常结束,并接收分析异常信息

This commit is contained in:
qiaoqinzheng 2024-03-07 16:37:40 +08:00
parent 6abe41c743
commit 3f4e184c82
3 changed files with 231 additions and 208 deletions

View File

@ -16,6 +16,10 @@ public class PHDFile implements Serializable {
private String tmpFilePath;
private String analyMessage;
private boolean analyFlag;
private boolean isValid; // 是否有效谱
private boolean bAnalyed; // 记录是否被分析
@ -181,6 +185,8 @@ public class PHDFile implements Serializable {
userId = "";
xmlFilePath = "";
tmpFilePath = "";
analyMessage = "";
analyFlag = true;
bAnalyed = false;
isValid = true;
analy_start_time = "";

View File

@ -1335,6 +1335,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, phd.getTmpFilePath(), analysisProcess);
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
boolean analyFlag = JSON.parseObject(JSON.toJSONString(parseMap.get("analyFlag")), Boolean.class);
phd.setAnalyFlag(analyFlag);
String analyMessage = JSON.parseObject(JSON.toJSONString(parseMap.get("analyMessage")), String.class);
phd.setAnalyMessage(analyMessage);
if (analyFlag) {
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
@ -1521,6 +1526,10 @@ public class GammaFileUtil extends AbstractLogOrReport {
peak.recoilDeltaChan = "nan";
}
}
} else {
log.error("AnalyseSpectrum(): {}", analyMessage);
return false;
}
} catch (JsonProcessingException e){
e.printStackTrace();
log.error("AnalyseSpectrum(): {}", e.getMessage());
@ -3206,6 +3215,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
String anylseEnd;
anylseBegin = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
bRet = AnalyseSpectrum(fileAnlyse,nucline);
if (bRet) {
RunQC(fileAnlyse);
fileAnlyse.setEfficiencyParam(fileAnlyse.getUsedEffiPara().getP());
fileAnlyse.setEfficiencyEnergy(fileAnlyse.getUsedEffiKD().getG_energy());
@ -3216,6 +3226,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
middleData.analyses_analysisBegin = anylseBegin;
middleData.analyses_analysisEnd = anylseEnd;
} else {
return bRet;
}
} else if (type.equals(MiddleDataType.InterAction.getType()) && flag.equalsIgnoreCase("save")){ //如果是人工交互分析 则先上传phd对应文件信息
//上传本次文件到ftp人工交互存储路径下
File sampleTmp = null;

View File

@ -1252,7 +1252,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//分析时将phd的核素map重置
phd.setPhdNuclideMap(nuclideLinesMap);
//调用分析算法
gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
boolean analyseSpectrum = gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
if (analyseSpectrum) {
// 重新分析各峰值对应的核素信息
// gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
phd.setEfficiencyParam(phd.getUsedEffiPara().getP());
@ -1275,6 +1276,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
map.put("barChart", differance);
result.setSuccess(true);
result.setResult(map);
} else {
result.error500("There is a problem with the current phd file, Analysis failure!");
}
}
return result;
}