diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java index 2fd05653..0baccfa7 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java @@ -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){ diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java index 205d57ec..642e9145 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java @@ -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); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java index 8671de66..54484465 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java @@ -164,215 +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 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 nuclideLinesMap = (Map) 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 parseMap = JSON.parseObject(strValue, Map.class); - for (Map.Entry 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 jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); - for (Map.Entry 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 jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); - for (Map.Entry 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 jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); - for (Map.Entry 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 jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); - for (Map.Entry 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 jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); - for (Map.Entry 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 jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class); - Map value = new HashMap<>(); - for (Map.Entry 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 value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class); - phd.setVEnergy(value); - } - if (entry.getKey().equalsIgnoreCase("vBase")) { - List value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class); - phd.setVBase(value); - } - if (entry.getKey().equalsIgnoreCase("vLc")) { - List value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class); - phd.setVLc(value); - } - if (entry.getKey().equalsIgnoreCase("vScac")) { - List value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class); - phd.setVScac(value); - } - if (entry.getKey().equalsIgnoreCase("vPeak")) { - List 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); - } - result.setSuccess(true); - return result; - } - @Override public Result gammaByDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) { Result result = new Result();