From 108f2db587370e8895308fa82b398e25b41ddeae Mon Sep 17 00:00:00 2001 From: nieziyan Date: Fri, 19 Jul 2024 16:11:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat=EF=BC=9A=E8=87=AA=E5=BB=BA=E5=8F=B0?= =?UTF-8?q?=E7=AB=99AUX=E8=A1=A8=E5=A2=9E=E5=8A=A0GPS=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/NameStandUtil.java | 23 +++++++++++-------- .../base/entity/original/GardsSampleAux.java | 6 +++++ .../impl/SpectrumBaseBlockServiceImpl.java | 11 +++++++++ .../modules/spectrum/SamplephdSpectrum.java | 4 +++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java index 778d06e3..9ef9dbaa 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java @@ -1,9 +1,11 @@ package org.jeecg.common.util; import com.baomidou.mybatisplus.core.toolkit.StringPool; +import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.SystemType; import org.jeecg.modules.entity.vo.PHDFile; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.math.BigDecimal; @@ -18,21 +20,22 @@ import java.util.Map; @Component public class NameStandUtil { + @Autowired + private SpectrumPathProperties pathProperties; + public String GetSysTemSubdir(String systemType) { - StringBuffer path = new StringBuffer(); + String path = null; + Map pathMap = pathProperties.getFilePathMap(); if(systemType.contains(SystemType.BETA.getType())) { - path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Sauna"); + path = pathMap.getOrDefault(SystemType.BETA.getType(), "Spectrum/Xenon/Sauna"); } else if(systemType.contains(SystemType.GAMMA.getType())) { - path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Spalax"); + path = pathMap.getOrDefault(SystemType.GAMMA.getType(), "Spectrum/Xenon/Spalax"); } else if(systemType.contains(SystemType.PARTICULATE.getType())) { - path.append("Spectrum"); - path.append(StringPool.SLASH+"Particulates"); + path = pathMap.getOrDefault(SystemType.PARTICULATE.getType(), "Spectrum/Particulates"); + } else if(systemType.contains(SystemType.WATER.getType())) { + path = pathMap.getOrDefault(SystemType.WATER.getType(), "Spectrum/Water"); } - return path.toString(); + return path; } public String GetDateTypeSubdir(String dataType){ diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/original/GardsSampleAux.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/original/GardsSampleAux.java index 81e55cdb..4202d0be 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/original/GardsSampleAux.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/original/GardsSampleAux.java @@ -97,4 +97,10 @@ public class GardsSampleAux implements Serializable { */ @TableField(value = "XE_COLLECTION_YIED_UNCER") private Double xeCollectionYiedUncer; + + @TableField("LON") + private Double lon; + + @TableField("LAT") + private Double lat; } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SpectrumBaseBlockServiceImpl.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SpectrumBaseBlockServiceImpl.java index 9c33e2f9..0e64f153 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SpectrumBaseBlockServiceImpl.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SpectrumBaseBlockServiceImpl.java @@ -1,5 +1,7 @@ package org.jeecg.modules.service.impl; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.constant.StringConstant; @@ -8,6 +10,7 @@ import org.jeecg.modules.base.entity.configuration.GardsDetectors; import org.jeecg.modules.base.entity.configuration.GardsStations; import org.jeecg.modules.base.entity.original.GardsSampleAux; import org.jeecg.modules.base.entity.original.GardsSampleData; +import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.file.FileOperation; import org.jeecg.modules.mapper.GardsSampleAuxMapper; import org.jeecg.modules.mapper.GardsSampleDataMapper; @@ -122,6 +125,14 @@ public class SpectrumBaseBlockServiceImpl implements ISpectrumBaseBlockService { gardsSampleAux.setXeCollectionYied(struct.Xe_collection_yield); gardsSampleAux.setXeCollectionYiedUncer(struct.uncertainty_2); + // 如果是样品谱类型 自建台站谱需要存储GPS坐标信息 其它样品谱GPS坐标为0 + String dataType = struct.data_type; + if (StrUtil.contains(dataType, DataType.SAMPLEPHD.getType()) + || StrUtil.contains(dataType, DataType.SPHDF.getType()) + || StrUtil.contains(dataType, DataType.SPHDP.getType())){ + gardsSampleAux.setLon(struct.lon); + gardsSampleAux.setLat(struct.lat); + } this.sampleAuxMapper.insert(gardsSampleAux); } } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java index 1cdbd361..1f7432ac 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java @@ -110,7 +110,9 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { Sample_B_Analysis bAnalysis = new Sample_B_Analysis(this); bAnalysis.analysis(); } - if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType()) || this.sourceData.system_type.equals(SystemType.GAMMA.getType())) { + if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType()) + || this.sourceData.system_type.equals(SystemType.GAMMA.getType()) + || this.sourceData.system_type.equals(SystemType.WATER.getType())) { Sample_G_Analysis sample_g_analysis = new Sample_G_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData); sample_g_analysis.analysis(); } From 2a6a38c28610551cf2ddc8c17cfabd5239aefe3f Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Fri, 19 Jul 2024 17:14:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=96=B0beta?= =?UTF-8?q?=E8=B0=B1=E7=9A=84gamma=20reprocessing=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/common/util/SelfStationUtil.java | 101 ++++++------ .../service/impl/SelfStationServiceImpl.java | 155 ++++++++---------- 2 files changed, 115 insertions(+), 141 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 e1dc6c1f..61b27367 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 @@ -113,9 +113,13 @@ public class SelfStationUtil extends AbstractLogOrReport { map.put("spectrumData", spectrumData); //计算边界值 + //gamma能量部分的计算参数 道值对应能量 List gEnergy = struct.g_energy; + //gamma能量部分的计算参数 道值 List gCentroidChannel = struct.g_centroid_channel; + //beta能量部分的计算参数 道值对应的能量 List bElectronEnergy = struct.b_electron_energy; + //beta能量部分的计算参数 道值 List bChannel = struct.b_channel; CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam(); calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel); @@ -133,6 +137,8 @@ public class SelfStationUtil extends AbstractLogOrReport { List roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start; List roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop; + SelfStationVueData sampleVueData = selfStationData.getSampleVueData(); + SelfStationVueData detVueData = selfStationData.getDetVueData(); //根据范围1划分 范围1对应的折线图 Map oneMap = statisticsROIList(roiBBoundaryStart.get(0), roiBBoundaryStop.get(0), struct.b_channels, struct.g_channels, struct.h_counts); @@ -141,57 +147,57 @@ public class SelfStationUtil extends AbstractLogOrReport { Integer endChannel = (Integer) oneMap.get("endChannel"); List seriseDataList = (List) oneMap.get("dataList"); if (systemType.equals("sample")) { - selfStationData.getSampleVueData().setROIOneBetaStart(startChannel); - selfStationData.getSampleVueData().setROIOneBetaStop(endChannel); - selfStationData.getSampleVueData().setROIOneList(seriseDataList); - selfStationData.getSampleVueData().setROIOneCounts((List)oneMap.get("counts")); + sampleVueData.setROIOneBetaStart(startChannel); + sampleVueData.setROIOneBetaStop(endChannel); + sampleVueData.setROIOneList(seriseDataList); + sampleVueData.setROIOneCounts((List)oneMap.get("counts")); } else if (systemType.equals("det")) { - selfStationData.getDetVueData().setROIOneBetaStart(startChannel); - selfStationData.getDetVueData().setROIOneBetaStop(endChannel); - selfStationData.getDetVueData().setROIOneList(seriseDataList); - selfStationData.getSampleVueData().setROIOneCounts((List)oneMap.get("counts")); + detVueData.setROIOneBetaStart(startChannel); + detVueData.setROIOneBetaStop(endChannel); + detVueData.setROIOneList(seriseDataList); } map.put("ROIOneStart", roiBBoundaryStart.get(0)); map.put("ROIOneStop", roiBBoundaryStop.get(0)); map.put("ROIOneList", seriseDataList); } //根据范围2划分 范围2对应的折线图 - Map twoMap = statisticsROIList(roiBBoundaryStart.get(1), roiBBoundaryStop.get(1), struct.b_channels, struct.g_channels, struct.h_counts); + Map twoMap = statisticsROIList(roiBBoundaryStart.get(1), roiBBoundaryStop.get(1), + struct.b_channels, struct.g_channels, struct.h_counts); if ( CollectionUtils.isNotEmpty(twoMap) ) { Integer startChannel = (Integer) twoMap.get("startChannel"); Integer endChannel = (Integer) twoMap.get("endChannel"); List seriseDataList = (List) twoMap.get("dataList"); if (systemType.equals("sample")) { - selfStationData.getSampleVueData().setROITwoBetaStart(startChannel); - selfStationData.getSampleVueData().setROITwoBetaStop(endChannel); - selfStationData.getSampleVueData().setROITwoList(seriseDataList); - selfStationData.getSampleVueData().setROITwoCounts((List)twoMap.get("counts")); + sampleVueData.setROITwoBetaStart(startChannel); + sampleVueData.setROITwoBetaStop(endChannel); + sampleVueData.setROITwoList(seriseDataList); + sampleVueData.setROITwoCounts((List)twoMap.get("counts")); } else if (systemType.equals("det")) { - selfStationData.getDetVueData().setROITwoBetaStart(startChannel); - selfStationData.getDetVueData().setROITwoBetaStop(endChannel); - selfStationData.getDetVueData().setROITwoList(seriseDataList); - selfStationData.getSampleVueData().setROITwoCounts((List)twoMap.get("counts")); + detVueData.setROITwoBetaStart(startChannel); + detVueData.setROITwoBetaStop(endChannel); + detVueData.setROITwoList(seriseDataList); + sampleVueData.setROITwoCounts((List)twoMap.get("counts")); } map.put("ROITwoStart", roiBBoundaryStart.get(1)); map.put("ROITwoStop", roiBBoundaryStop.get(1)); map.put("ROITwoList", seriseDataList); } //根据范围3划分 范围3对应的折线图 - Map threeMap = statisticsROIList(roiBBoundaryStart.get(2), roiBBoundaryStop.get(2), struct.b_channels, struct.g_channels, struct.h_counts); + Map threeMap = statisticsROIList(roiBBoundaryStart.get(2), roiBBoundaryStop.get(2), + struct.b_channels, struct.g_channels, struct.h_counts); if ( CollectionUtils.isNotEmpty(threeMap) ) { Integer startChannel = (Integer) threeMap.get("startChannel"); Integer endChannel = (Integer) threeMap.get("endChannel"); List seriseDataList = (List) threeMap.get("dataList"); if (systemType.equals("sample")) { - selfStationData.getSampleVueData().setROIThreeBetaStart(startChannel); - selfStationData.getSampleVueData().setROIThreeBetaStop(endChannel); - selfStationData.getSampleVueData().setROIThreeList(seriseDataList); - selfStationData.getSampleVueData().setROIThreeCounts((List)threeMap.get("counts")); + sampleVueData.setROIThreeBetaStart(startChannel); + sampleVueData.setROIThreeBetaStop(endChannel); + sampleVueData.setROIThreeList(seriseDataList); + sampleVueData.setROIThreeCounts((List)threeMap.get("counts")); } else if (systemType.equals("det")) { - selfStationData.getDetVueData().setROIThreeBetaStart(startChannel); - selfStationData.getDetVueData().setROIThreeBetaStop(endChannel); - selfStationData.getDetVueData().setROIThreeList(seriseDataList); - selfStationData.getSampleVueData().setROIThreeCounts((List)threeMap.get("counts")); + detVueData.setROIThreeBetaStart(startChannel); + detVueData.setROIThreeBetaStop(endChannel); + detVueData.setROIThreeList(seriseDataList); } map.put("ROIThreeStart", roiBBoundaryStart.get(2)); map.put("ROIThreeStop", roiBBoundaryStop.get(2)); @@ -204,15 +210,14 @@ public class SelfStationUtil extends AbstractLogOrReport { Integer endChannel = (Integer) fourMap.get("endChannel"); List seriseDataList = (List) fourMap.get("dataList"); if (systemType.equals("sample")) { - selfStationData.getSampleVueData().setROIFourBetaStart(startChannel); - selfStationData.getSampleVueData().setROIFourBetaStop(endChannel); - selfStationData.getSampleVueData().setROIFourList(seriseDataList); - selfStationData.getSampleVueData().setROIFourCounts((List)fourMap.get("counts")); + sampleVueData.setROIFourBetaStart(startChannel); + sampleVueData.setROIFourBetaStop(endChannel); + sampleVueData.setROIFourList(seriseDataList); + sampleVueData.setROIFourCounts((List)fourMap.get("counts")); } else if (systemType.equals("det")) { - selfStationData.getDetVueData().setROIFourBetaStart(startChannel); - selfStationData.getDetVueData().setROIFourBetaStop(endChannel); - selfStationData.getDetVueData().setROIFourList(seriseDataList); - selfStationData.getSampleVueData().setROIFourCounts((List)fourMap.get("counts")); + detVueData.setROIFourBetaStart(startChannel); + detVueData.setROIFourBetaStop(endChannel); + detVueData.setROIFourList(seriseDataList); } map.put("ROIFourStart", roiBBoundaryStart.get(3)); map.put("ROIFourStop", roiBBoundaryStop.get(3)); @@ -234,15 +239,15 @@ public class SelfStationUtil extends AbstractLogOrReport { Long count = hCounts.get(index.intValue()); if (count > 0){ HistogramData his = new HistogramData(); - his.setG(j); - his.setB(i); + his.setG(i); + his.setB(j); his.setC(count); histogramDataList.add(his); histogramDataDList.add(his); }else { HistogramData his = new HistogramData(); - his.setG(j); - his.setB(i); + his.setG(i); + his.setB(j); his.setC(count); histogramDataDList.add(his); } @@ -250,10 +255,6 @@ public class SelfStationUtil extends AbstractLogOrReport { } map.put("histogramDataList", histogramDataList); // map.put("histogramDataDList", histogramDataDList); - //gamma能量部分的计算参数 道值 -// List gCentroidChannel = struct.g_centroid_channel; - //gamma能量部分的计算参数 道值对应能量 -// List gEnergy = struct.g_energy; //调用算法 传入道值和道值对应的能量 得到计算gamma能量公式的参数 List gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); //存储需要计算gamma能量的道值 @@ -265,10 +266,6 @@ public class SelfStationUtil extends AbstractLogOrReport { List gammaEnergyList = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam); //将gamma能量折线图进行赋值返回 map.put("gammaEnergyData", gammaEnergyList); - //beta能量部分的计算参数 道值 -// List bChannel = struct.b_channel; - //beta能量部分的计算参数 道值对应的能量 -// List bElectronEnergy = struct.b_electron_energy; //调用算法 传入道值和道值对应的能量 得到计算beta能量公式的参数 List betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List bchannels = new ArrayList<>(); @@ -288,12 +285,12 @@ public class SelfStationUtil extends AbstractLogOrReport { gEnergyBlock.setCentroid_channel(struct.g_centroid_channel); gEnergyBlock.setUncertainty(struct.g_uncertainty); gEnergyBlock.setRecord_count(struct.g_record_count); - selfStationData.getSampleVueData().getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock); + sampleVueData.getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock); //计算得到公式的参数 List calEnergyParam = CalValuesHandler.calFitPara("Cal_Energy", 2, struct.g_centroid_channel, struct.g_energy, struct.g_uncertainty); ParameterInfo parameterInfo = new ParameterInfo(); parameterInfo.setP(calEnergyParam); - selfStationData.getSampleVueData().getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo); + sampleVueData.getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo); } } //g_Resolution @@ -304,12 +301,12 @@ public class SelfStationUtil extends AbstractLogOrReport { gResolutionBlock.setFWHM(struct.g_r_FWHM); gResolutionBlock.setUncertainty(struct.g_r_uncertainty); gResolutionBlock.setRecord_count(struct.g_r_record_count); - selfStationData.getSampleVueData().getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock); + sampleVueData.getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock); //计算得到公式的参数 List calEnergyParam = CalValuesHandler.calFitPara("Cal_Resolution", 4, struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty); ParameterInfo parameterInfo = new ParameterInfo(); parameterInfo.setP(calEnergyParam); - selfStationData.getSampleVueData().getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo); + sampleVueData.getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo); } } //g_Efficiency @@ -320,12 +317,12 @@ public class SelfStationUtil extends AbstractLogOrReport { gEfficiencyBlock.setEfficiency(struct.g_e_efficiency); gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty); gEfficiencyBlock.setRecord_count(struct.g_e_record_count); - selfStationData.getSampleVueData().getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock); + sampleVueData.getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock); //计算得到公式的参数 List calEnergyParam = CalValuesHandler.calFitPara("Cal_Efficiency", 1, struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty); ParameterInfo parameterInfo = new ParameterInfo(); parameterInfo.setP(calEnergyParam); - selfStationData.getSampleVueData().getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo); + sampleVueData.getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo); } } } catch (ParseException e) { 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 5053419b..61805845 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 @@ -1856,6 +1856,9 @@ public class SelfStationServiceImpl implements ISelfStationService { Result result = new Result(); String userName = JwtUtil.getUserNameByToken(request); + // 获取当前角色的颜色配置 + Map colorMap = sysUserColorService.initColor(userName); + //获取自建台站缓存信息 Cache selfCache = selfStationCache.getSelfCache(); SelfStationData selfStationData = selfCache.getIfPresent(fileName + StringPool.DASH + userName); @@ -1864,76 +1867,24 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } - SelfStationVueData sampleVueData = selfStationData.getSampleVueData(); - // Gamma文件内容转换为PHD实体 + SelfStationVueData sampleVueData = selfStationData.getSampleVueData(); PHDFile phdOne = sampleVueData.getROIOnePHDFile(); PHDFile phdTwo = sampleVueData.getROITwoPHDFile(); PHDFile phdThree = sampleVueData.getROIThreePHDFile(); PHDFile phdFour = sampleVueData.getROIFourPHDFile(); + Map nuclideLinesMap = (Map) redisUtil.get(userName+StringPool.DASH+phdOne.getHeader().getSystem_type()+"-self"); - phdOne.setUserId(processKey); - // 赋值xml文件存放路径 - phdOne.setXmlFilePath(parameterProperties.getFilePath()); - // 获取当前角色的颜色配置 - Map colorMap = sysUserColorService.initColor(userName); - // 分析文件数据 - int flag = gammaFileUtil.AnalyseData(phdOne); - if (flag == 0) { - 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(warning); - } else { - Map nuclideLinesMap = (Map) redisUtil.get(userName+StringPool.DASH+phdOne.getHeader().getSystem_type()+"-self"); - if (flag == -1) { - //分析时将phd的核素map重置 - phdOne.setPhdNuclideMap(nuclideLinesMap); - //重新计算核素的活度浓度 - gammaFileUtil.NuclidesIdent(phdOne, nuclideLinesMap); - phdOne.setEfficiencyParam(phdOne.getUsedEffiPara().getP()); - phdOne.setEfficiencyEnergy(phdOne.getUsedEffiKD().getG_energy()); - phdOne.setEfficiencyCurRow(0); - // 重新计算峰值 - Map nuclideLinesMDCMap = (Map) redisUtil.get("AllNuclideMap"); - gammaFileUtil.getNuclideMDCValue(phdOne, phdOne.getMdcInfoMap(), nuclideLinesMDCMap); - String warning = "Finish three tasks:\n" + - "\t1.Update efficiencies of all peaks;\n" + - "\t2.Identify nuclides again;\n" + - "\t3.Test QC again."; - result.error500(warning); - } else { - - try { - Map gammaResult = Maps.newHashMap(); - Map map1 = this.gammaAnalyse(phdOne, nuclideLinesMap, colorMap); - Map map2 = this.gammaAnalyse(phdTwo, nuclideLinesMap, colorMap); - Map map3 = this.gammaAnalyse(phdThree, nuclideLinesMap, colorMap); - Map map4 = this.gammaAnalyse(phdFour, nuclideLinesMap, colorMap); - gammaResult.put("ROI1", map1); - gammaResult.put("ROI2", map2); - gammaResult.put("ROI3", map3); - gammaResult.put("ROI4", map4); - - sampleVueData.setUsedEnerKD(phdOne.getUsedEnerKD()); - sampleVueData.setUsedEffiKD(phdOne.getUsedEffiKD()); - sampleVueData.setUsedResoKD(phdOne.getUsedResoKD()); - sampleVueData.setMapEnerKD(phdOne.getMapEnerKD()); - sampleVueData.setMapResoKD(phdOne.getMapResoKD()); - sampleVueData.setMapEffiKD(phdOne.getMapEffiKD()); - sampleVueData.setUsedEnerPara(phdOne.getUsedEnerPara()); - sampleVueData.setUsedEffiPara(phdOne.getUsedEffiPara()); - sampleVueData.setUsedResoPara(phdOne.getUsedResoPara()); - sampleVueData.setMapEnerPara(phdOne.getMapEnerPara()); - sampleVueData.setMapResoPara(phdOne.getMapResoPara()); - sampleVueData.setMapEffiPara(phdOne.getMapEffiPara()); - - result.setSuccess(true); - result.setResult(gammaResult); - } catch (RuntimeException e) { - result.error500(StrUtil.replace(e.getMessage(), "%s", "ROI")); - } - } + Map roiMap = new HashMap<>(); + try { + roiMap.put("ROI1", this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap)); + roiMap.put("ROI2", this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap)); + roiMap.put("ROI3", this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap)); + roiMap.put("ROI4", this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap)); + result.setSuccess(true); + result.setResult(roiMap); + } catch (RuntimeException e) { + result.error500(StrUtil.replace(e.getMessage(), "%s", "ROI")); } return result; } @@ -3309,34 +3260,60 @@ public class SelfStationServiceImpl implements ISelfStationService { * @return * @throws RuntimeException */ - private Map gammaAnalyse(PHDFile phd, Map nuclideLinesMap, + private Map gammaAnalyse(String processKey, PHDFile phd, Map nuclideLinesMap, Map colorMap) throws RuntimeException{ - Map map = new HashMap<>(); - - //分析时将phd的核素map重置 - phd.setPhdNuclideMap(nuclideLinesMap); - //调用分析算法 - 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); + phd.setUserId(processKey); + // 赋值xml文件存放路径 + phd.setXmlFilePath(parameterProperties.getFilePath()); + int flag = gammaFileUtil.AnalyseData(phd); + if (flag == 0) { + String warning = "The spectrum needn't Analyed. Maybe:\n" + + "1. It has already Analyed.\n" + + "2. You didn't change any setting or calibration."; + throw new RuntimeException(warning); } else { - throw new RuntimeException("There is a problem with the current %s phd file, Analysis failure!"); + 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 { + Map map = new HashMap<>(); + //分析时将phd的核素map重置 + phd.setPhdNuclideMap(nuclideLinesMap); + //调用分析算法 + 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!"); + } + } } - return map; } }