From ccb3c892b06ef25455998158f4f1265ff478f825 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Sun, 18 Feb 2024 15:11:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92=E5=88=86?= =?UTF-8?q?=E6=9E=90beta=E9=83=A8=E5=88=86=E6=9F=A5=E8=AF=A2=E7=BB=8F?= =?UTF-8?q?=E8=BF=87=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E7=BB=93=E6=9E=9C=E5=86=8D=E6=AC=A1=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=95=B0=E6=8D=AE=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=88=86=E6=9E=90gamma=E9=83=A8=E5=88=86=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9=20=E4=BA=BA=E5=B7=A5=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E5=88=86=E6=9E=90gamma=E9=83=A8=E5=88=86=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=96=87=E4=BB=B6=E5=90=8D=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/common/util/FTPUtil.java | 5 +- .../org/jeecg/common/util/PHDFileUtil.java | 333 +++++++++++++ .../mapper/SpectrumAnalysisMapper.java | 4 +- .../mapper/xml/SpectrumAnalysisMapper.xml | 2 - .../service/impl/GammaServiceImpl.java | 10 +- .../impl/SpectrumAnalysisServiceImpl.java | 440 ++++++++++++++---- 6 files changed, 692 insertions(+), 102 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java index cb3427fd..0e16b41e 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java @@ -256,6 +256,9 @@ public class FTPUtil { log.error("{},根目录切换失败",rootPath); return false; } + if (path.contains(rootPath)) { + path = path.substring(path.indexOf(rootPath) + rootPath.length()); + } String[] directories = path.split("/"); for(String directory : directories){ if(StringUtils.isEmpty(directory)){ @@ -263,7 +266,7 @@ public class FTPUtil { } if(!ftpClient.changeWorkingDirectory(directory)){ if(!ftpClient.makeDirectory(directory)){ - log.error("{},目录创建失败",directory); + log.error("{},目录创建失败",ftpClient.printWorkingDirectory()+StringPool.SLASH+directory); return false; } if(!ftpClient.changeWorkingDirectory(directory)){ diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java index 82dddbcd..cfb5c2ff 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java @@ -331,6 +331,339 @@ public class PHDFileUtil extends AbstractLogOrReport { return map; } + public void updateBoundary(BetaDataFile betaDataFile, String type, List sampleRoiChannel, Map map) { + List boundaryList = new LinkedList<>(); + for (int i=0; i gammaCalibrationPairs, List betaCalibrationPairs, Map map) { + List channels = new LinkedList<>(); + List> gammaNewEnergyList = new LinkedList<>(); + List> betaNewEnergyList = new LinkedList<>(); + //填充道值数组的数据 + for (int i=0; i<255; i++) { + channels.add(Double.valueOf(i)); + } + //过滤出Gamma对应的表单数据 + List gammaChannelList = gammaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List gammaEnergyList = gammaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //计算gamma对应的数据 + List gammaFittingPara = EnergySpectrumHandler.GetFileFittingPara(gammaChannelList, gammaEnergyList); + //计算道值的能量 + List gammaEnergys = EnergySpectrumHandler.GetFileFittingData(channels,gammaFittingPara); + //将新计算的能量封装到数组 + for (Double calEnergy:gammaEnergys) { + List newEnergy = new LinkedList<>(); + newEnergy.add(calEnergy); + gammaNewEnergyList.add(newEnergy); + } + map.put("gammaEnergyData", gammaNewEnergyList); + + //过滤出Beta对应的表单数据 + List betaChannelList = betaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List betaEnergyList = betaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //计算beta对应的数据 + List betaFittingPara = EnergySpectrumHandler.GetFileFittingPara(betaChannelList, betaEnergyList); + + //计算道值的能量 + List betaEnergys = EnergySpectrumHandler.GetFileFittingData(channels,betaFittingPara); + //将新计算的能量封装到数组 + for (Double calEnergy:betaEnergys) { + List newEnergy = new LinkedList<>(); + newEnergy.add(calEnergy); + betaNewEnergyList.add(newEnergy); + } + map.put("betaEnergyData", betaNewEnergyList); + if (type.equalsIgnoreCase("sample")) { + betaDataFile.setSampleGammaEnergyList(gammaNewEnergyList); + betaDataFile.setSampleBetaEnergyList(betaNewEnergyList); + } else if (type.equalsIgnoreCase("gas")) { + betaDataFile.setGasGammaEnergyList(gammaNewEnergyList); + betaDataFile.setGasBetaEnergyList(betaNewEnergyList); + } else if (type.equalsIgnoreCase("det")) { + betaDataFile.setDetGammaEnergyList(gammaNewEnergyList); + betaDataFile.setDetBetaEnergyList(betaNewEnergyList); + } + } + + public void createBgCalPara(BetaDataFile betaDataFile, List gammaCalibrationSpectrumList,List betaCalibrationSpectrumList, + List gammaCalibrationPairsList,List betaCalibrationPairsList) { + //TODO--新方法用于加载人工交互库数据时处理分析参数用 + SpectrumGroup spectrum_group = new SpectrumGroup(); + //我需要根据 calibration页面对应的数组 及 公式判断是否有勾选sample det gas 这四个文件的操作 + //gammaCalibrationSpectrumList存储的是gamma对应的公式数据 + //betaCalibrationSpectrumList存储的是beta对应的公式数据 + //gammaCalibrationPairsList存储的是gamma对应的表单数据 + //betaCalibrationPairsList存储的是beta对应的表单数据 + //根据数据类型过滤出sample对应的参数 + if (CollectionUtils.isNotEmpty(gammaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(betaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) { + List sampleGammaCalibrationList = gammaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + List sampleBetaCalibrationList = betaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + List sampleGammaCalibrationPairsList = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + List sampleBetaCalibrationPairsList = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + //过滤出sampleGamma对应的表单数据 + List gammaChannelList = sampleGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List gammaEnergyList = sampleGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //过滤出sampleBeta对应的表单数据 + List betaChannelList = sampleBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List betaEnergyList = sampleBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //获取文件中的表单数据 + EnergySpectrumStruct struct = betaDataFile.getSampleStruct(); + List gCentroidChannel = struct.g_centroid_channel; + List gEnergy = struct.g_energy; + List bChannel = struct.b_channel; + List bElectronEnergy = struct.b_electron_energy; + //比较四组表单数据 + if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) { + //将公式参数放入到重新计算的参数内 + List newFittingPara = EnergySpectrumHandler.GetFileFittingPara(gammaChannelList, gammaEnergyList); + //计算E to C公式参数 + List newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList); + List geCal = new LinkedList<>(); + geCal.add(Double.valueOf(newFittingParaToUi.get(0))); + geCal.add(Double.valueOf(newFittingParaToUi.get(1))); + geCal.add(Double.valueOf(newFittingParaToUi.get(2))); + spectrum_group.BgCalPara.g_e_cal = geCal; + //公式C TO E参数 + List fittingPara = new LinkedList<>(); + fittingPara.add(String.valueOf(sampleGammaCalibrationList.get(0).getCoeff1())); + fittingPara.add(String.valueOf(sampleGammaCalibrationList.get(0).getCoeff2())); + fittingPara.add(String.valueOf(sampleGammaCalibrationList.get(0).getCoeff3())); + + List gc2e = new LinkedList<>(); + gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff1())); + gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff2())); + gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff3())); + spectrum_group.g_c2e = gc2e; + //将新的道值对应能量值参数存储 + for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList); + List beCal = new LinkedList<>(); + beCal.add(Double.valueOf(newFittingParaToUi.get(0))); + beCal.add(Double.valueOf(newFittingParaToUi.get(1))); + beCal.add(Double.valueOf(newFittingParaToUi.get(2))); + spectrum_group.BgCalPara.b_e_cal = beCal; + //公式C TO E参数 + List fittingPara = new LinkedList<>(); + fittingPara.add(String.valueOf(sampleBetaCalibrationList.get(0).getCoeff1())); + fittingPara.add(String.valueOf(sampleBetaCalibrationList.get(0).getCoeff2())); + fittingPara.add(String.valueOf(sampleBetaCalibrationList.get(0).getCoeff3())); + + List bc2e = new LinkedList<>(); + bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff1())); + bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff2())); + bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff3())); + spectrum_group.b_c2e = bc2e; + //将新的道值对应能量值参数存储 + for (int i=0; i gasGammaCalibrationList = gammaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + List gasBetaCalibrationList = betaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + List gasGammaCalibrationPairsList = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + List gasBetaCalibrationPairsList = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + //过滤出gasGamma对应的表单数据 + List gammaChannelList = gasGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List gammaEnergyList = gasGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //过滤出gasBeta对应的表单数据 + List betaChannelList = gasBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List betaEnergyList = gasBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //获取文件中的表单数据 + EnergySpectrumStruct struct = betaDataFile.getGasStruct(); + List gCentroidChannel = struct.g_centroid_channel; + List gEnergy = struct.g_energy; + List bChannel = struct.b_channel; + List bElectronEnergy = struct.b_electron_energy; + //比较gamma部分表单数据 + if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) { + //将公式参数放入到重新计算的参数内 + //计算E to C公式参数 + List newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList); + List geCal = new LinkedList<>(); + geCal.add(Double.valueOf(newFittingParaToUi.get(0))); + geCal.add(Double.valueOf(newFittingParaToUi.get(1))); + geCal.add(Double.valueOf(newFittingParaToUi.get(2))); + spectrum_group.BgCalPara.g_e_cal = geCal; + //公式C TO E参数 + List fittingPara = new LinkedList<>(); + fittingPara.add(String.valueOf(gasGammaCalibrationList.get(0).getCoeff1())); + fittingPara.add(String.valueOf(gasGammaCalibrationList.get(0).getCoeff2())); + fittingPara.add(String.valueOf(gasGammaCalibrationList.get(0).getCoeff3())); + + List gc2e = new LinkedList<>(); + gc2e.add(Double.valueOf(gasGammaCalibrationList.get(0).getCoeff1())); + gc2e.add(Double.valueOf(gasGammaCalibrationList.get(0).getCoeff2())); + gc2e.add(Double.valueOf(gasGammaCalibrationList.get(0).getCoeff3())); + spectrum_group.g_c2e = gc2e; + //将新的道值对应能量值参数存储 + for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList); + List beCal = new LinkedList<>(); + beCal.add(Double.valueOf(newFittingParaToUi.get(0))); + beCal.add(Double.valueOf(newFittingParaToUi.get(1))); + beCal.add(Double.valueOf(newFittingParaToUi.get(2))); + spectrum_group.BgCalPara.b_e_cal = beCal; + //公式C TO E参数 + List fittingPara = new LinkedList<>(); + fittingPara.add(String.valueOf(gasBetaCalibrationList.get(0).getCoeff1())); + fittingPara.add(String.valueOf(gasBetaCalibrationList.get(0).getCoeff2())); + fittingPara.add(String.valueOf(gasBetaCalibrationList.get(0).getCoeff3())); + + List bc2e = new LinkedList<>(); + bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff1())); + bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff2())); + bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff3())); + spectrum_group.b_c2e = bc2e; + //将新的道值对应能量值参数存储 + for (int i=0; i detGammaCalibrationList = gammaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + List detBetaCalibrationList = betaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + List detGammaCalibrationPairsList = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + List detBetaCalibrationPairsList = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + //过滤出gasGamma对应的表单数据 + List gammaChannelList = detGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List gammaEnergyList = detGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //过滤出gasBeta对应的表单数据 + List betaChannelList = detBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList()); + List betaEnergyList = detBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList()); + //获取文件中的表单数据 + EnergySpectrumStruct struct = betaDataFile.getDetStruct(); + List gCentroidChannel = struct.g_centroid_channel; + List gEnergy = struct.g_energy; + List bChannel = struct.b_channel; + List bElectronEnergy = struct.b_electron_energy; + //比较四组表单数据 + if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) { + //计算E to C公式参数 + List newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList); + List geCal = new LinkedList<>(); + geCal.add(Double.valueOf(newFittingParaToUi.get(0))); + geCal.add(Double.valueOf(newFittingParaToUi.get(1))); + geCal.add(Double.valueOf(newFittingParaToUi.get(2))); + spectrum_group.BgCalPara.g_e_cal = geCal; + //公式C TO E参数 + List fittingPara = new LinkedList<>(); + fittingPara.add(String.valueOf(detGammaCalibrationList.get(0).getCoeff1())); + fittingPara.add(String.valueOf(detGammaCalibrationList.get(0).getCoeff2())); + fittingPara.add(String.valueOf(detGammaCalibrationList.get(0).getCoeff3())); + + List gc2e = new LinkedList<>(); + gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff1())); + gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff2())); + gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff3())); + spectrum_group.g_c2e = gc2e; + //将新的道值对应能量值参数存储 + for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList); + //将公式参数放入到重新计算的参数内 + List beCal = new LinkedList<>(); + beCal.add(Double.valueOf(newFittingParaToUi.get(0))); + beCal.add(Double.valueOf(newFittingParaToUi.get(1))); + beCal.add(Double.valueOf(newFittingParaToUi.get(2))); + spectrum_group.BgCalPara.b_e_cal = beCal; + //公式C TO E参数 + List fittingPara = new LinkedList<>(); + fittingPara.add(String.valueOf(detBetaCalibrationList.get(0).getCoeff1())); + fittingPara.add(String.valueOf(detBetaCalibrationList.get(0).getCoeff2())); + fittingPara.add(String.valueOf(detBetaCalibrationList.get(0).getCoeff3())); + + List bc2e = new LinkedList<>(); + bc2e.add(Double.valueOf(detBetaCalibrationList.get(0).getCoeff1())); + bc2e.add(Double.valueOf(detBetaCalibrationList.get(0).getCoeff2())); + bc2e.add(Double.valueOf(detBetaCalibrationList.get(0).getCoeff3())); + spectrum_group.b_c2e = bc2e; + //将新的道值对应能量值参数存储 + for (int i=0; i readLine(String filePath) { List allLines = new ArrayList<>(); try { diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java index 7660872d..a43bad2e 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java @@ -86,11 +86,11 @@ public interface SpectrumAnalysisMapper { Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName); - List ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId); + List ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis); List ReadGammaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis); - List ReadBetaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId); + List ReadBetaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis); List ReadBetaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml index 35789a62..d41dab5d 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml @@ -619,7 +619,6 @@ CALIBRATION_PAIRS.SAMPLE_ID = SMAPLE_DATA.SAMPLE_ID AND CALIBRATION_PAIRS.SAMPLE_TYPE = 'G' AND CALIBRATION_PAIRS.IDANALYSIS = #{idAnalysis} - AND CALIBRATION_PAIRS.SAMPLE_ID = #{sampleId} ORDER BY CALIBRATION_PAIRS.IDCALPOINT ASC @@ -651,7 +650,6 @@ CALIBRATION_PAIRS.SAMPLE_ID = SMAPLE_DATA.SAMPLE_ID AND CALIBRATION_PAIRS.SAMPLE_TYPE = 'B' AND CALIBRATION_PAIRS.IDANALYSIS = #{idAnalysis} - AND CALIBRATION_PAIRS.SAMPLE_ID = #{sampleId} ORDER BY CALIBRATION_PAIRS.IDCALPOINT ASC 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 fdafe929..3b472707 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 @@ -5001,8 +5001,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi //格式化名称 Map nameMap = nameStandUtil.NameStandard(phd); String mSaveFileName = nameMap.get("saveFile"); + String dateTimeSubdir = ""; + int pos = mSaveFileName.indexOf('-'); + if(-1 == pos) { + + } else if(fileName.length() >= pos+7) { + dateTimeSubdir+=StringPool.SLASH+fileName.substring(pos+1,pos+5); + dateTimeSubdir+=StringPool.SLASH+fileName.substring(pos+5,pos+7); + } //判断当前分析员是否有过历史分析当前文件 - Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir+ dateTypeSubdir + StringPool.SLASH + mSaveFileName, userName); + Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir+ dateTypeSubdir + dateTimeSubdir + StringPool.SLASH + mSaveFileName, userName); // 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员 if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) { result.error500("You have no permission to save "+phd.getHeader().getSite_code()+" results to DB!"); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java index 1c289c2f..7a1f0b4b 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java @@ -459,8 +459,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements roiChannelsSpectrumList = spectrumAnalysisMapper.ReadROIChannels("RNAUTO", analysisID, sampleId); roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults("RNAUTO", analysisID, sampleId); } else { - gammaCalibrationPairsList = spectrumAnalysisMapper.ReadGammaFitChannelEnergy(analysisID, sampleId); - betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID, sampleId); + gammaCalibrationPairsList = spectrumAnalysisMapper.ReadGammaFitChannelEnergy(analysisID); + betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID); xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults(dbName, analysisID, sampleId); gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam("RNMAN", analysisID); betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam("RNMAN", analysisID); @@ -475,10 +475,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setSampleFileName(sampleFileName); sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma"); if (Objects.nonNull(sampleTmp)) { + //sample临时文件路径存储 betaDataFile.setSampleTmpPath(sampleTmp.getAbsolutePath()); + //获取smaple文件解析结果 EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath()); betaDataFile.setSampleStruct(struct); + //处理解析结果 sampleMap = phdFileUtil.getSourceData(struct, sample.getSampleId(), sample.getStatus(), "sample", betaDataFile); + //更新边界值 + if (CollectionUtils.isNotEmpty(roiChannelsSpectrumList)) { + //将数据库的roi范围重新赋值 + List sampleRoiChannel = roiChannelsSpectrumList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sampleRoiChannel)) { + //更新边界值 + phdFileUtil.updateBoundary(betaDataFile, "sample", sampleRoiChannel, sampleMap); + } + } + //更新gamma道值-能量折线图 + if (CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) { + //过滤出sample的gamma的参数 + List sampleGammaCalibrationPairs = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + //过滤出sample的beta的参数 + List sampleBetaCalibrationPairs = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList()); + //更新道值-能量折线图 + if (CollectionUtils.isNotEmpty(sampleGammaCalibrationPairs) && CollectionUtils.isNotEmpty(sampleBetaCalibrationPairs)) { + phdFileUtil.updateEnergyData(betaDataFile, "sample", sampleGammaCalibrationPairs, sampleBetaCalibrationPairs, sampleMap); + } + } sampleMap.put("fileName", betaDataFile.getSampleFileName()); resultMap.put("sample",sampleMap); } @@ -489,10 +512,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setGasFileName(gasFileName); gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma"); if (Objects.nonNull(gasTmp)) { + //存储gas临时文件路径 betaDataFile.setGasTmpPath(gasTmp.getAbsolutePath()); + //获取gas文件解析结果 EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath()); betaDataFile.setGasStruct(struct); + //处理gas文件解析结果 gasBgMap = phdFileUtil.getSourceData(struct, gasBg.getSampleId(), gasBg.getStatus(), "gas", betaDataFile); + //更新边界值 + if (CollectionUtils.isNotEmpty(roiChannelsSpectrumList)) { + //将数据库的roi范围重新赋值 + List gasRoiChannel = roiChannelsSpectrumList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(gasRoiChannel)) { + //更新边界值 + phdFileUtil.updateBoundary(betaDataFile, "gas", gasRoiChannel, gasBgMap); + } + } + //更新gamma道值-能量折线图 + if (CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) { + //过滤出sample的gamma的参数 + List gasGammaCalibrationPairs = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + //过滤出sample的beta的参数 + List gasBetaCalibrationPairs = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList()); + //更新道值-能量折线图 + if (CollectionUtils.isNotEmpty(gasGammaCalibrationPairs) && CollectionUtils.isNotEmpty(gasBetaCalibrationPairs)) { + phdFileUtil.updateEnergyData(betaDataFile, "gas", gasGammaCalibrationPairs, gasBetaCalibrationPairs, gasBgMap); + } + } gasBgMap.put("fileName", betaDataFile.getGasFileName()); resultMap.put("gasBg",gasBgMap); } @@ -503,10 +549,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setDetFileName(detFileName); detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma"); if (Objects.nonNull(detTmp)) { + //存储det临时文件路径 betaDataFile.setDetTmpPath(detTmp.getAbsolutePath()); + //获取det文件解析结果 EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath()); betaDataFile.setDetStruct(struct); + //处理det文件解析结果 detBgMap = phdFileUtil.getSourceData(struct, detBg.getSampleId(), detBg.getStatus(), "det", betaDataFile); + //更新边界值 + if (CollectionUtils.isNotEmpty(roiChannelsSpectrumList)) { + //将数据库的roi范围重新赋值 + List detRoiChannel = roiChannelsSpectrumList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(detRoiChannel)) { + //更新边界值 + phdFileUtil.updateBoundary(betaDataFile, "det", detRoiChannel, detBgMap); + } + } + //更新gamma道值-能量折线图 + if (CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) { + //过滤出sample的gamma的参数 + List detGammaCalibrationPairs = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + //过滤出sample的beta的参数 + List detBetaCalibrationPairs = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList()); + //更新道值-能量折线图 + if (CollectionUtils.isNotEmpty(detGammaCalibrationPairs) && CollectionUtils.isNotEmpty(detBetaCalibrationPairs)) { + phdFileUtil.updateEnergyData(betaDataFile, "det", detGammaCalibrationPairs, detBetaCalibrationPairs, detBgMap); + } + } detBgMap.put("fileName", betaDataFile.getDetFileName()); resultMap.put("detBg",detBgMap); } @@ -525,6 +594,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements resultMap.put("qc",qcMap); } } + //更新缓存数据对应的缓存数据 + phdFileUtil.createBgCalPara(betaDataFile, gammaCalibrationSpectrumList, betaCalibrationSpectrumList, gammaCalibrationPairsList, betaCalibrationPairsList); } else { xeResultsSpectrumList = betaDataFile.getXeResultsSpectrumList(); sampleMap = loadData("sample", betaDataFile); @@ -549,13 +620,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Double mdc = xeData.getMdc(); if (conc < 0){ xeData.setColor("red"); - xeData.setNidFlag(0); } else if (0 mdc) { xeData.setColor("green"); - xeData.setNidFlag(1); } xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc())))); xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc())))); @@ -679,13 +747,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Double mdc = xeData.getMdc(); if (conc < 0){ xeData.setColor("red"); - xeData.setNidFlag(0); } else if (0 mdc) { xeData.setColor("green"); - xeData.setNidFlag(1); } xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc())))); xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc())))); @@ -1775,6 +1840,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } //获取qc的分析结果数据 EnergySpectrumStruct struct = betaDataFile.getQcStruct(); + //判断qc文件的解析结果是否为空 if (Objects.nonNull(struct)){ //读取Gamma Detector Calibration所需要的参数 long numGChannel = struct.num_g_channel; @@ -1783,7 +1849,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements int gRecordCount = struct.g_record_count; List gCounts = struct.g_counts; List gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); - //计算Calibration Parameter Of Gamma Detector + //根据道值和能量的对应关系 存储表单数据 List oldScatterSeries = new LinkedList<>(); for (int i=0; i fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List fittingParaStr = new LinkedList<>(); for (Double para:fittingPara) { @@ -1805,7 +1871,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements for (int i=0; i<255; ++i) { channel.add(Double.valueOf(i)); } + //计算出新的道值对应能量值 List energy = EnergySpectrumHandler.GetFileFittingData(channel, fittingPara); + //根据道值和能量对应关系 封装折线图数据 List oldLineSeries = new LinkedList<>(); for (int i=0; i fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel); List fittingParaToUiStr = new LinkedList<>(); for (Double para:fittingParaToUi) { fittingParaToUiStr.add(String.valueOf(para)); } map.put("EToC", fittingParaToUiStr); - //Figure of Gamma Detector Calibration + //计算道值对应能量值参数 List gchannels = new ArrayList<>(); List> gammaEnergyList = new LinkedList<>(); for (int i=0; i xs = new LinkedList(); + //存储计算参数能量值 + List ys = new LinkedList<>(); + //存储所有道值 + List channels = new LinkedList<>(); + //存储所有的能量值 + List> energyList = new LinkedList<>(); + //存储新的线点能量值 + List newLineSeries = new LinkedList<>(); + //存储新的表单能量值 + List tableWidgets = new LinkedList(); + //存储新的公式参数C TO E + List newFittingParaStr = new LinkedList<>(); + //存储新的公式参数E TO C + List newFittingParaToUiStr = new LinkedList<>(); + //记录点值数组 + List newSeriseDataList = new LinkedList<>(); + //遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组 + for (int i=0; i newFittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); + for (Double para:newFittingPara) { + newFittingParaStr.add(String.valueOf(para)); + } + map.put("newCToE", newFittingParaStr); + //填充道值数组的数据 + for (int i=0; i<255; i++) { + channels.add(Double.valueOf(i)); + } + //计算道值的能量 + List energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara); + //根据临时点的道值修改对应能量值 + //遍历所有道值 + for (int i=0; i< channels.size(); i++) { + //获取道值 + double newChannel = channels.get(i).doubleValue(); + //遍历临时点数据 + for (int j=0; j newEnergy = new LinkedList<>(); + newEnergy.add(calEnergy); + energyList.add(newEnergy); + } + //遍历道值添加各道值对应点数据到数组 + for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); + for (Double para:newFittingParaToUi) { + newFittingParaToUiStr.add(String.valueOf(para)); + } + map.put("newEToC", newFittingParaToUiStr); + } + //计算得到的 if (betaDataFile.getGammaList().size() <= 0 ) { betaDataFile.setGammaList(oldScatterSeries); @@ -1991,6 +2150,96 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } map.put("EToC", fittingParaToUiStr); + //判断人工交互的道值与能量对应参数数组是否为空 + if (CollectionUtils.isNotEmpty(betaDataFile.getBetaList())) { + //存储计算参数道值 + List xs = new LinkedList(); + //存储计算参数能量值 + List ys = new LinkedList<>(); + //存储所有道值 + List channels = new LinkedList<>(); + //存储所有的能量值 + List> energyList = new LinkedList<>(); + //存储新的线点能量值 + List newLineSeries = new LinkedList<>(); + //存储新的表单能量值 + List tableWidgets = new LinkedList(); + //存储新的公式参数C TO E + List newFittingParaStr = new LinkedList<>(); + //存储新的公式参数E TO C + List newFittingParaToUiStr = new LinkedList<>(); + //记录点值数组 + List newSeriseDataList = new LinkedList<>(); + //遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组 + for (int i=0; i newFittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); + for (Double para:newFittingPara) { + newFittingParaStr.add(String.valueOf(para)); + } + map.put("newCToE", newFittingParaStr); + //填充道值数组的数据 + for (int i=0; i<255; i++) { + channels.add(Double.valueOf(i)); + } + //计算道值的能量 + List energys = EnergySpectrumHandler.GetFileFittingData(channels,fittingPara); + //根据临时点的道值修改对应能量值 + //遍历所有道值 + for (int i=0; i< channels.size(); i++) { + //获取道值 + double newChannel = channels.get(i).doubleValue(); + //遍历临时点数据 + for (int j=0; j newEnergy = new LinkedList<>(); + newEnergy.add(calEnergy); + energyList.add(newEnergy); + } + //遍历道值添加各道值对应点数据到数组 + for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); + for (Double para:newFittingParaToUi) { + newFittingParaToUiStr.add(String.valueOf(para)); + } + map.put("newEToC", newFittingParaToUiStr); + } + if (betaDataFile.getBetaList().size()<=0) { betaDataFile.setBetaList(oldScatterSeries); } @@ -4977,106 +5226,105 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List betaList, List gammaList, BetaDataFile betaDataFile) { - File sampleTmp = null; - File gasTmp = null; - File detTmp = null; - try { - //获取ftp文件路径下临时文件 - sampleTmp = new File(betaDataFile.getSampleTmpPath()); - gasTmp = new File(betaDataFile.getGasTmpPath()); - detTmp = new File(betaDataFile.getDetTmpPath()); - //如果勾选了Energy Calibration页面下sample Data - if (Objects.nonNull(sampleTmp)) { - if(anlyseResultIn.isCheckSample()) { - EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath()); - //没有点击过Energy Calibration页面下Gamma Detector Calibration的fitting按钮 channel/energy数据读取文件 如果点击过数据来源页面 - if (!anlyseResultIn.isBGammaEnergyValidSample()){ - anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel); - anlyseResultIn.setG_energy_sample(sourceData.g_energy); - } else { - List channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList()); - anlyseResultIn.setG_channel_sample(channels); - List energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList()); - anlyseResultIn.setG_energy_sample(energys); - } - //没有点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮 channel/energy数据读取文件 如果点击过数据来源页面 - if (!anlyseResultIn.isBBetaEnergyValidSample()){ - anlyseResultIn.setB_channel_sample(sourceData.b_channel); - anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy); - } else { - List channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList()); - anlyseResultIn.setB_channel_sample(channels); - List energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList()); - anlyseResultIn.setB_energy_sample(energys); - } - } else {//如果没有勾选Energy Calibration页面下sample Data - EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath()); + //获取ftp文件路径下临时文件 + String sampleTmp = betaDataFile.getSampleTmpPath(); + String gasTmp = betaDataFile.getGasTmpPath(); + String detTmp = betaDataFile.getDetTmpPath(); + BgCalibratePara bgPara = betaDataFile.getBgPara(); + //如果勾选了Energy Calibration页面下sample Data + if (StringUtils.isNotBlank(sampleTmp)) { + //判断是否进行了重新分析操作 + if(Objects.nonNull(bgPara) && bgPara.bApplyNewCalicSample) { + EnergySpectrumStruct sourceData = betaDataFile.getSampleStruct(); + //如果gamma的能量分析页面 没有勾选sample 并且gamma数组是空的 存储文件中的数据 + if (!anlyseResultIn.isBGammaEnergyValidSample() && CollectionUtils.isEmpty(gammaList)){ anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel); anlyseResultIn.setG_energy_sample(sourceData.g_energy); + } else { + List channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList()); + anlyseResultIn.setG_channel_sample(channels); + List energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList()); + anlyseResultIn.setG_energy_sample(energys); + } + //如果beta的能量分析页面 没有勾选sample 并且beta数组是空的 存储文件中的数据 + if (!anlyseResultIn.isBBetaEnergyValidSample() && CollectionUtils.isEmpty(betaList)){ anlyseResultIn.setB_channel_sample(sourceData.b_channel); anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy); - } - } - if (Objects.nonNull(gasTmp)) { - if (anlyseResultIn.isCheckGas()) { - EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath()); - if (!anlyseResultIn.isBGammaEnergyValidGas()){ - anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel); - anlyseResultIn.setG_energy_gas(sourceData.g_energy); - } else { - List channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList()); - anlyseResultIn.setG_channel_gas(channels); - List energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList()); - anlyseResultIn.setG_energy_gas(energys); - } - if (!anlyseResultIn.isBBetaEnergyValidGas()){ - anlyseResultIn.setB_channel_gas(sourceData.b_channel); - anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy); - } else { - List channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList()); - anlyseResultIn.setB_channel_gas(channels); - List energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList()); - anlyseResultIn.setB_energy_gas(energys); - } } else { - EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath()); + List channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList()); + anlyseResultIn.setB_channel_sample(channels); + List energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList()); + anlyseResultIn.setB_energy_sample(energys); + } + } else {//如果没有勾选Energy Calibration页面下sample Data + EnergySpectrumStruct sourceData = betaDataFile.getSampleStruct(); + anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel); + anlyseResultIn.setG_energy_sample(sourceData.g_energy); + anlyseResultIn.setB_channel_sample(sourceData.b_channel); + anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy); + } + } + if (StringUtils.isNotBlank(gasTmp)) { + if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicGasBg) { + EnergySpectrumStruct sourceData = betaDataFile.getGasStruct(); + //如果gamma的能量分析页面 没有勾选gas 并且gamma数组是空的 存储文件中的数据 + if (!anlyseResultIn.isBGammaEnergyValidGas() && CollectionUtils.isEmpty(gammaList)){ anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel); anlyseResultIn.setG_energy_gas(sourceData.g_energy); + } else { + List channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList()); + anlyseResultIn.setG_channel_gas(channels); + List energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList()); + anlyseResultIn.setG_energy_gas(energys); + } + //如果beta的能量分析页面 没有勾选gas 并且beta数组是空的 存储文件中的数据 + if (!anlyseResultIn.isBBetaEnergyValidGas() && CollectionUtils.isEmpty(betaList)){ anlyseResultIn.setB_channel_gas(sourceData.b_channel); anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy); - } - } - if (Objects.nonNull(detTmp)) { - if (anlyseResultIn.isCheckDet()) { - EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath()); - if (!anlyseResultIn.isBGammaEnergyValidDet()){ - anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel); - anlyseResultIn.setG_energy_det(sourceData.g_energy); - } else { - List channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList()); - anlyseResultIn.setG_channel_det(channels); - List energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList()); - anlyseResultIn.setG_energy_det(energys); - } - if (!anlyseResultIn.isBBetaEnergyValidDet()){ - anlyseResultIn.setB_channel_det(sourceData.b_channel); - anlyseResultIn.setB_energy_det(sourceData.b_electron_energy); - } else { - List channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList()); - anlyseResultIn.setB_channel_det(channels); - List energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList()); - anlyseResultIn.setB_energy_det(energys); - } } else { - EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath()); + List channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList()); + anlyseResultIn.setB_channel_gas(channels); + List energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList()); + anlyseResultIn.setB_energy_gas(energys); + } + } else { + EnergySpectrumStruct sourceData = betaDataFile.getGasStruct(); + anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel); + anlyseResultIn.setG_energy_gas(sourceData.g_energy); + anlyseResultIn.setB_channel_gas(sourceData.b_channel); + anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy); + } + } + if (StringUtils.isNotBlank(detTmp)) { + if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicDetBg) { + EnergySpectrumStruct sourceData = betaDataFile.getDetStruct(); + //如果gamma的能量分析页面 没有勾选det 并且gamma数组是空的 存储文件中的数据 + if (!anlyseResultIn.isBGammaEnergyValidDet() && CollectionUtils.isEmpty(gammaList)){ anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel); anlyseResultIn.setG_energy_det(sourceData.g_energy); + } else { + List channels = gammaList.stream().map(SeriseData::getX).collect(Collectors.toList()); + anlyseResultIn.setG_channel_det(channels); + List energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList()); + anlyseResultIn.setG_energy_det(energys); + } + //如果beta的能量分析页面 没有勾选det 并且beta数组是空的 存储文件中的数据 + if (!anlyseResultIn.isBBetaEnergyValidDet() && CollectionUtils.isEmpty(betaList)){ anlyseResultIn.setB_channel_det(sourceData.b_channel); anlyseResultIn.setB_energy_det(sourceData.b_electron_energy); + } else { + List channels = betaList.stream().map(SeriseData::getX).collect(Collectors.toList()); + anlyseResultIn.setB_channel_det(channels); + List energys = betaList.stream().map(SeriseData::getY).collect(Collectors.toList()); + anlyseResultIn.setB_energy_det(energys); } + } else { + EnergySpectrumStruct sourceData = betaDataFile.getDetStruct(); + anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel); + anlyseResultIn.setG_energy_det(sourceData.g_energy); + anlyseResultIn.setB_channel_det(sourceData.b_channel); + anlyseResultIn.setB_energy_det(sourceData.b_electron_energy); } - } catch (Exception e) { - e.printStackTrace(); } }