GammaFileUtil中计算活度浓度方法提前插入实体类对象导致下标越界问题修改

gamma功能删除峰值重新计算活度浓度位置移动
This commit is contained in:
qiaoqinzheng 2023-11-02 11:53:45 +08:00
parent af7825d761
commit 3db390ec22
2 changed files with 18 additions and 26 deletions

View File

@ -1568,7 +1568,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
double sum_found = 0; // 所有匹配的γ射线能量处效率乘以分支比的和
int mainPeakIdx = -1; // 记录核素主γ峰的索引下标
for (int i=0, j=0; i<vEnergy.size(); i++) {
for(; j<peakNum; ++j) {
for(; j<peakNum; j++) {
if(phd.getVPeak().get(j).energy >= 510 && phd.getVPeak().get(j).energy <= 512) {
continue; // 峰中心道能量为511的峰不进行核素识别
}
@ -1606,11 +1606,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
if(mainPeakIdx < 0) continue;
}
if (Objects.isNull(phd.getMapNucActMda().get(iter.getKey()))) {
Map<String, NuclideActMda> mapNucActMda = phd.getMapNucActMda();
mapNucActMda.put(iter.getKey(), new NuclideActMda());
}
NuclideActMda ActMda = phd.getMapNucActMda().get(iter.getKey());
NuclideActMda ActMda = new NuclideActMda();
boolean bActBigger = CalculateMDCs(phd, ActMda, mainPeakIdx, lambda, maxFoundYield, 1.0);
if(rate > 0.8 || bActBigger) {

View File

@ -196,14 +196,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
result.error500("Please select the parse file first");
return result;
}
// 查询当前用户关联的核素信息
List<String> nuclides = new LinkedList<>();
// 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, systemType);
if (CollectionUtils.isEmpty(nuclides)) {
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", systemType);
}
Map<String, NuclideLines> nuclideLinesMap = GetNuclideLines(nuclides);
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(fileName+"-"+userName);//GetNuclideLines(nuclides);
// 解析获取临时文件信息
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
ObjectMapper mapper = new ObjectMapper();
@ -377,16 +370,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedTotEPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapNucActMda")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, NuclideActMda> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
NuclideActMda entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), NuclideActMda.class);
value.put(key, entryValue);
}
phd.setMapNucActMda(value);
}
// if (entry.getKey().equalsIgnoreCase("mapNucActMda")) {
// HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
// Map<String, NuclideActMda> value = new HashMap<>();
// for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
// String key = objectEntry.getKey();
// NuclideActMda entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), NuclideActMda.class);
// value.put(key, entryValue);
// }
// phd.setMapNucActMda(value);
// }
}
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
@ -398,6 +391,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
peak.recoilDeltaChan = "1";
}
}
// 重新分析各峰值对应的核素信息
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
gammaFileUtil.RunQC(phd);
result.setResult(phd);
} catch (JsonProcessingException e) {
@ -1479,11 +1474,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
nuclideMap.remove(nuclideName);
}
}
//重新计算核素活度浓度
gammaFileUtil.NuclidesIdent(phd, nuclideMap);
}
//将当前行从峰数组中移除
phd.getVPeak().remove(curRow);
//重新计算核素活度浓度
gammaFileUtil.NuclidesIdent(phd, nuclideMap);
//重新分析数据
gammaFileUtil.PeaksChanged(phd);
for (int i = 0; i < phd.getVPeak().size(); i++) {