From e266148da1e42add38408c6f57bd1599a08ea610 Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Wed, 7 Aug 2024 17:24:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=96=B0beta?= =?UTF-8?q?=E7=9A=84=E5=88=86=E6=9E=90=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9roiParams=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/common/util/SelfStationUtil.java | 38 +++--- .../controller/SelfStationController.java | 2 +- .../service/impl/SelfStationServiceImpl.java | 114 ++++++++++-------- 3 files changed, 84 insertions(+), 70 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java index efbce2b4..de6a6225 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java @@ -1582,7 +1582,7 @@ public class SelfStationUtil extends AbstractLogOrReport { * 检查ROI是否更新 * @param sampleVueData * @param ROINum - * @return + * @return true = 内容发生变化 */ public boolean checkROIRenew(SelfStationVueData sampleVueData, String ROINum) { boolean flag = false; @@ -1617,24 +1617,26 @@ public class SelfStationUtil extends AbstractLogOrReport { } break; } + } else { + if (!sampleVueData.getUsedROIOneBetaStart().equals(sampleVueData.getROIOneBetaStart())) { + return true; + } else if (!sampleVueData.getUsedROIOneBetaStop().equals(sampleVueData.getROIOneBetaStop())) { + return true; + } else if (!sampleVueData.getUsedROITwoBetaStart().equals(sampleVueData.getROITwoBetaStart())) { + return true; + } else if (!sampleVueData.getUsedROITwoBetaStop().equals(sampleVueData.getROITwoBetaStop())) { + return true; + } else if (!sampleVueData.getUsedROIThreeBetaStart().equals(sampleVueData.getROIThreeBetaStart())) { + return true; + } else if (!sampleVueData.getUsedROIThreeBetaStop().equals(sampleVueData.getROIThreeBetaStop())) { + return true; + } else if (!sampleVueData.getUsedROIFourBetaStart().equals(sampleVueData.getROIFourBetaStart())) { + return true; + } else if (!sampleVueData.getUsedROIFourBetaStop().equals(sampleVueData.getROIFourBetaStop())) { + return true; + } } - if (!sampleVueData.getUsedROIOneBetaStart().equals(sampleVueData.getROIOneBetaStart())) { - return true; - } else if (!sampleVueData.getUsedROIOneBetaStop().equals(sampleVueData.getROIOneBetaStop())) { - return true; - } else if (!sampleVueData.getUsedROITwoBetaStart().equals(sampleVueData.getROITwoBetaStart())) { - return true; - } else if (!sampleVueData.getUsedROITwoBetaStop().equals(sampleVueData.getROITwoBetaStop())) { - return true; - } else if (!sampleVueData.getUsedROIThreeBetaStart().equals(sampleVueData.getROIThreeBetaStart())) { - return true; - } else if (!sampleVueData.getUsedROIThreeBetaStop().equals(sampleVueData.getROIThreeBetaStop())) { - return true; - } else if (!sampleVueData.getUsedROIFourBetaStart().equals(sampleVueData.getROIFourBetaStart())) { - return true; - } else if (!sampleVueData.getUsedROIFourBetaStop().equals(sampleVueData.getROIFourBetaStop())) { - return true; - } + return flag; } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java index c09405bf..32bda5d5 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java @@ -190,7 +190,7 @@ public class SelfStationController { @PostMapping("Reprocessing") @ApiOperation(value = "analyze菜单下Reprocessing页面数据", notes = "analyze菜单下Reprocessing页面数据") public Result Reprocessing(@RequestParam String fileName, @RequestParam String processKey, - @RequestParam String roiParams, HttpServletRequest request) { + @RequestParam(required = false) String roiParams, HttpServletRequest request) { return selfStationService.Reprocessing(fileName, processKey, roiParams, request); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java index 30c4e902..0290db0f 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java @@ -677,7 +677,7 @@ public class SelfStationServiceImpl implements ISelfStationService { roiBBoundaryStart.add(roiParam.getRoiNum() - 1, roiParam.getStartChannel()); roiBBoundaryStop.add(roiParam.getRoiNum() - 1, roiParam.getEndChannel()); } - selfStationUtil.getGammaByROI(struct.system_type, roiBBoundaryStart, roiBBoundaryStop, selfStationData); + selfStationUtil.getGammaByROI("sample", roiBBoundaryStart, roiBBoundaryStop, selfStationData); } @Override @@ -2140,10 +2140,31 @@ public class SelfStationServiceImpl implements ISelfStationService { boolean bROI2 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI2); boolean bROI3 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI3); boolean bROI4 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI4); - roiMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, bROI1)); - roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, bROI2)); - roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, bROI3)); - roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, bROI4)); + int flag = gammaFileUtil.AnalyseData(phdOne); + // 如果参数没有修改且没有修改任何ROI则不允许分析 + if (flag == 0 && !bROI1 && !bROI2 && !bROI3 && !bROI4) { + String warning = "The spectrum needn't Analyed. Maybe:\n" + + "1. It has already Analyed.\n" + + "2. You didn't change any setting or calibration."; + result.error500(StrUtil.replace(warning, "%s", "ROI")); + return result; + } + // 如果参数修改 或者 修改某个ROI 只重新分析某个gamma + if (flag != 0 || bROI1) { + roiMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, flag)); + } + if (flag != 0 || bROI2) { + roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, flag)); + } + if (flag != 0 || bROI3) { + roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, flag)); + } + if (flag != 0 || bROI4) { + roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, flag)); + } +// roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, bROI2)); +// roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, bROI3)); +// roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, bROI4)); // 用于下次分析判断是否更新 sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart()); sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop()); @@ -2151,7 +2172,7 @@ public class SelfStationServiceImpl implements ISelfStationService { sampleVueData.setUsedROITwoBetaStop(sampleVueData.getROITwoBetaStop()); sampleVueData.setUsedROIThreeBetaStart(sampleVueData.getROIThreeBetaStart()); sampleVueData.setUsedROIThreeBetaStop(sampleVueData.getROIThreeBetaStop()); - sampleVueData.setUsedROIFourBetaStart(sampleVueData.getUsedROIFourBetaStart()); + sampleVueData.setUsedROIFourBetaStart(sampleVueData.getROIFourBetaStart()); sampleVueData.setUsedROIFourBetaStop(sampleVueData.getROIFourBetaStop()); sampleVueData.setUsedEner(phdOne.getUsedEner()); @@ -5484,64 +5505,55 @@ public class SelfStationServiceImpl implements ISelfStationService { * @throws RuntimeException */ private Map gammaAnalyse(String processKey, PHDFile phd, Map nuclideLinesMap, - Map colorMap, boolean bROI) throws RuntimeException{ + Map colorMap, int flag) throws RuntimeException{ phd.setUserId(processKey); // 赋值xml文件存放路径 phd.setXmlFilePath(parameterProperties.getFilePath()); - int flag = gammaFileUtil.AnalyseData(phd); - // bROI = false 表示ROI数据没有被修改 - if (flag == 0 || !bROI) { - String warning = "The spectrum needn't Analyed. Maybe:\n" + - "1. It has already Analyed.\n" + - "2. You didn't change any setting or calibration."; + if (flag == -1) { + //分析时将phd的核素map重置 + phd.setPhdNuclideMap(nuclideLinesMap); + //重新计算核素的活度浓度 + gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); + phd.setEfficiencyParam(phd.getUsedEffiPara().getP()); + phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy()); + phd.setEfficiencyCurRow(0); + // 重新计算峰值 + Map nuclideLinesMDCMap = (Map) redisUtil.get("AllNuclideMap"); + gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap); + String warning = "Finish three tasks:\n" + + "\t1.Update efficiencies of all peaks;\n" + + "\t2.Identify nuclides again;\n" + + "\t3.Test QC again."; throw new RuntimeException(warning); } else { - if (flag == -1) { - //分析时将phd的核素map重置 - phd.setPhdNuclideMap(nuclideLinesMap); - //重新计算核素的活度浓度 - gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); + Map map = new HashMap<>(); + //分析时将phd的核素map重置 + phd.setPhdNuclideMap(nuclideLinesMap); + //读取redis缓存的计算mdc信息 + Map mdcInfoMap = (Map) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type()); + if (CollectionUtils.isNotEmpty(mdcInfoMap)) { + phd.setMdcInfoMap(mdcInfoMap); + } + //调用分析算法 + boolean analyseSpectrum = gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap); + if (analyseSpectrum) { phd.setEfficiencyParam(phd.getUsedEffiPara().getP()); phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy()); phd.setEfficiencyCurRow(0); // 重新计算峰值 Map nuclideLinesMDCMap = (Map) redisUtil.get("AllNuclideMap"); gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap); - String warning = "Finish three tasks:\n" + - "\t1.Update efficiencies of all peaks;\n" + - "\t2.Identify nuclides again;\n" + - "\t3.Test QC again."; - throw new RuntimeException(warning); + gammaFileUtil.UpdateChart(phd, map, colorMap); + map.put("bAnalyed", phd.isBAnalyed()); + map.put("peak", phd.getVPeak()); + map.put("BaseCtrls", phd.getBaseCtrls()); + // Bar Chart 柱状图 + List differance = gammaFileUtil.Differance(phd, phd.getVPeak()); + map.put("barChart", differance); + return map; } else { - Map map = new HashMap<>(); - //分析时将phd的核素map重置 - phd.setPhdNuclideMap(nuclideLinesMap); - //读取redis缓存的计算mdc信息 - Map mdcInfoMap = (Map) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type()); - if (CollectionUtils.isNotEmpty(mdcInfoMap)) { - phd.setMdcInfoMap(mdcInfoMap); - } - //调用分析算法 - boolean analyseSpectrum = gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap); - if (analyseSpectrum) { - phd.setEfficiencyParam(phd.getUsedEffiPara().getP()); - phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy()); - phd.setEfficiencyCurRow(0); - // 重新计算峰值 - Map nuclideLinesMDCMap = (Map) redisUtil.get("AllNuclideMap"); - gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap); - gammaFileUtil.UpdateChart(phd, map, colorMap); - map.put("bAnalyed", phd.isBAnalyed()); - map.put("peak", phd.getVPeak()); - map.put("BaseCtrls", phd.getBaseCtrls()); - // Bar Chart 柱状图 - List differance = gammaFileUtil.Differance(phd, phd.getVPeak()); - map.put("barChart", differance); - return map; - } else { - throw new RuntimeException("There is a problem with the current %s phd file, Analysis failure!"); - } + throw new RuntimeException("There is a problem with the current %s phd file, Analysis failure!"); } } }