fix: 人工交互模块Beta分析失败的情况下返回内容修改

人工交互模块Gamma部分无效的接口删除
This commit is contained in:
xiaoguangbin 2024-03-15 11:57:33 +08:00
parent ba7bd409f3
commit 797552ea9c
4 changed files with 20 additions and 227 deletions

View File

@ -33,12 +33,6 @@ public class GammaController {
gammaService.initValue(sampleId, dbName, analyst, fileName, request);
}
@GetMapping("testFun")
public Result testFun(String fileName,HttpServletRequest request){
return gammaService.testFun(fileName, request);
}
@GetMapping("gammaByDB")
@ApiOperation(value = "gamma页面loadFromDB加载数据", notes = "gamma页面loadFromDB加载数据")
public Result gammaByDB(Integer sampleId, String dbName, String analyst, HttpServletRequest request){

View File

@ -17,8 +17,6 @@ public interface IGammaService{
void initValue(Integer sampleId, String dbName, String analyst, String fileName, HttpServletRequest request);
Result testFun(String fileName, HttpServletRequest request);
Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request);
Result gammaByFile(String fileName, HttpServletRequest request);

View File

@ -164,219 +164,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
}
@Override
public Result testFun(String fileName, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName);
phd.setUserId("1");
phd.setXmlFilePath(parameterProperties.getFilePath());
String systemType = fileName.substring(2, 3);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
return result;
}
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
// 解析获取临时文件信息
File tmpFile = gammaFileUtil.analyzeFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(phd);
String mapLines = mapper.writeValueAsString(nuclideLinesMap);
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, tmpFile.getAbsolutePath(), new AnalysisProcess());
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry : parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
phd.setBAnalyed(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapEnerPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapResoPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapResoPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapEffiPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapEffiPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapTotEPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapTotEPara(value);
}
if (entry.getKey().equalsIgnoreCase("para_stepRatio")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_stepRatio(value);
}
if (entry.getKey().equalsIgnoreCase("para_tail")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tail(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailAlpha")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailAlpha(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailRight")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailRight(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailRightAlpha")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailRightAlpha(value);
}
if (entry.getKey().equalsIgnoreCase("newEner")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewEner(value);
}
if (entry.getKey().equalsIgnoreCase("newReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewReso(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GEnergyBlock> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
GEnergyBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GEnergyBlock.class);
value.put(key, entryValue);
}
phd.setMapEnerKD(value);
}
if (entry.getKey().equalsIgnoreCase("mapResoKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GResolutionBlock> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry : jsonMap.entrySet()) {
String key = objectEntry.getKey();
GResolutionBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GResolutionBlock.class);
value.put(key, entryValue);
}
phd.setMapResoKD(value);
}
if (entry.getKey().equalsIgnoreCase("vEnergy")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVEnergy(value);
}
if (entry.getKey().equalsIgnoreCase("vBase")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVBase(value);
}
if (entry.getKey().equalsIgnoreCase("vLc")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVLc(value);
}
if (entry.getKey().equalsIgnoreCase("vScac")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVScac(value);
}
if (entry.getKey().equalsIgnoreCase("vPeak")) {
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
phd.setVPeak(value);
}
if (entry.getKey().equalsIgnoreCase("baseCtrls")) {
BaseControls value = JSON.parseObject(JSON.toJSONString(entry.getValue()), BaseControls.class);
phd.setBaseCtrls(value);
}
if (entry.getKey().equalsIgnoreCase("usedEner")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedEner(value);
}
if (entry.getKey().equalsIgnoreCase("usedEnerKD")) {
GEnergyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEnergyBlock.class);
phd.setUsedEnerKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedEnerPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedEnerPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedReso(value);
}
if (entry.getKey().equalsIgnoreCase("usedResoKD")) {
GResolutionBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GResolutionBlock.class);
phd.setUsedResoKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedResoPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedResoPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffi")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedEffi(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffiKD")) {
GEfficiencyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEfficiencyBlock.class);
phd.setUsedEffiKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffiPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedEffiPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotE")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedTotE(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotEKD")) {
TotaleffBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), TotaleffBlock.class);
phd.setUsedTotEKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotEPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedTotEPara(value);
}
}
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
for (PeakInfo info:phd.getVPeak()) {
if (Objects.isNull(info.recoilBetaChan)) {
info.recoilBetaChan = "nan";
}
if (Objects.isNull(info.recoilDeltaChan)) {
info.recoilDeltaChan = "nan";
}
}
// 重新分析各峰值对应的核素信息
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
gammaFileUtil.RunQC(phd);
result.setResult(phd);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} finally {
if (Objects.nonNull(tmpFile)) {
tmpFile.delete();
}
}
result.setSuccess(true);
return result;
}
@Override
public Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) {
Result result = new Result();

View File

@ -3268,17 +3268,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
return result;
}
map = BetaGammaAnalyzeCurrentProcess(analyseData, betaDataFile);
map.put("bProcessed", true);
map.put("savedAnalysisResult", true);
result.setSuccess(true);
result.setResult(map);
} else if ("AllSpectrum".equals(analyseData.getApplyType())) {
//获取当前选中的文件名称
map = BetaGammaAnalyzeAllProcess(analyseData, userName, currentFileName);
if (CollectionUtils.isNotEmpty(map)) {
map.put("bProcessed", true);
map.put("savedAnalysisResult", true);
}
result.setSuccess(true);
result.setResult(map);
}
@ -3473,6 +3467,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setSaveAnalysisResult(true);
betaDataFile.setBgPara(spectrum_group.BgCalPara);
}
xeMap.put("bProcessed", true);
xeMap.put("savedAnalysisResult", true);
} else {
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
if(CollectionUtils.isNotEmpty(sampleBoundary)) {
@ -3490,7 +3486,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if(CollectionUtils.isNotEmpty(qcBoundary)) {
betaDataFile.setQcBoundary(qcBoundary);
}
betaDataFile.setBProcessed(false);
betaDataFile.setSaveAnalysisResult(false);
xeMap.put("XeData", Collections.EMPTY_LIST);
xeMap.put("bProcessed", false);
xeMap.put("savedAnalysisResult", false);
}
}
} catch (Exception e) {
@ -3704,6 +3704,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
sampleBetaData.setSaveAnalysisResult(true);
sampleBetaData.setBgPara(spectrum_group.BgCalPara);
}
xeMap.put("bProcessed", true);
xeMap.put("savedAnalysisResult", true);
analyseResultMap.put(sampleFileName, xeMap);
} else {
List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
@ -3722,7 +3724,11 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if(CollectionUtils.isNotEmpty(qcBoundary)) {
sampleBetaData.setQcBoundary(qcBoundary);
}
sampleBetaData.setBProcessed(false);
sampleBetaData.setSaveAnalysisResult(false);
xeMap.put("XeData", Collections.EMPTY_LIST);
xeMap.put("bProcessed", false);
xeMap.put("savedAnalysisResult", false);
analyseResultMap.put(sampleFileName, xeMap);
}
}
@ -3848,6 +3854,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setQcBoundary(qcBoundary);
}
map.put("XeData", Collections.EMPTY_LIST);
betaDataFile.setBProcessed(false);
betaDataFile.setSaveAnalysisResult(false);
map.put("bProcessed", false);
map.put("savedAnalysisResult", false);
}
} catch (Exception e) {
e.printStackTrace();
@ -3969,6 +3979,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaDataFile.setQcBoundary(qcBoundary);
}
map.put("XeData", Collections.EMPTY_LIST);
betaDataFile.setBProcessed(false);
betaDataFile.setSaveAnalysisResult(false);
map.put("bProcessed", false);
map.put("savedAnalysisResult", false);
mapList.put(sampleFileName, map);
}
}