From d91947b181a79e6d3a7390d9e2d861497dfaa60e Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Tue, 15 Jul 2025 15:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9QCFlag=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/PHDFileUtil.java | 606 +++++++++++------- 1 file changed, 370 insertions(+), 236 deletions(-) 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 439fe821..8fe4e95b 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 @@ -15,9 +15,11 @@ import org.jeecg.modules.base.abstracts.AbstractLogOrReport; import org.jeecg.modules.base.entity.rnman.GardsXeResults; import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.DataTypeAbbr; +import org.jeecg.modules.base.enums.StationDetailType; import org.jeecg.modules.base.enums.XeNuclideName; import org.jeecg.modules.entity.*; import org.jeecg.modules.entity.vo.*; +import org.jeecg.modules.entity.vo.QCFlagParmData.Rule; import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.struct.BgAnalyseResult; import org.jeecg.modules.native_jni.struct.BgBoundary; @@ -55,22 +57,22 @@ public class PHDFileUtil extends AbstractLogOrReport { String dataType = struct.data_type; //Collection Start Date CollectionStart = null; - if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){ + if (StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time)) { CollectionStart = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time); } //Collection Stop Date CollectionStop = null; - if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){ + if (StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time)) { CollectionStop = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time); } //Collection Time String CollectionTime = ""; - if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){ - CollectionTime = String.format ("%.2f",Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime())/ 1000)); + if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) { + CollectionTime = String.format("%.2f", Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime()) / 1000)); } //Acquisition Start Date AcquisitionStart = null; - if ( StringUtils.isNotBlank(struct.acquisition_start_date) && StringUtils.isNotBlank(struct.acquisition_start_time) ){ + if (StringUtils.isNotBlank(struct.acquisition_start_date) && StringUtils.isNotBlank(struct.acquisition_start_time)) { AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time); } //Acq Real Time @@ -116,18 +118,18 @@ public class PHDFileUtil extends AbstractLogOrReport { List hCounts = struct.h_counts; List histogramDataList = new LinkedList<>(); List histogramDataDList = new LinkedList<>(); - for (int i=0; i 0){ + if (count > 0) { HistogramData his = new HistogramData(); his.setG(i); his.setB(j); his.setC(count); histogramDataList.add(his); histogramDataDList.add(his); - }else { + } else { HistogramData his = new HistogramData(); his.setG(i); his.setB(j); @@ -142,7 +144,7 @@ public class PHDFileUtil extends AbstractLogOrReport { long numGChannel = struct.num_g_channel; List gCounts = struct.g_counts; List gammaOriginalSeriseData = new LinkedList<>(); - for (int i=0; i gammaProjectedData = new LinkedList<>(); - for (int i=0; i gammaProjectedSeriseData = new LinkedList<>(); - for (int i=0; i gammaFittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List gammaFittingParaStr = new LinkedList<>(); - for (Double para:gammaFittingPara) { + for (Double para : gammaFittingPara) { gammaFittingParaStr.add(String.valueOf(para)); } //E to C List gammaFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel); List gammaFittingParaToUiStr = new LinkedList<>(); - for (Double para:gammaFittingParaToUi) { + for (Double para : gammaFittingParaToUi) { gammaFittingParaToUiStr.add(String.valueOf(para)); } betaDataFile.setGammaFittingParaOld(gammaFittingParaStr); betaDataFile.setGammaFittingParaToUiOld(gammaFittingParaToUiStr); List gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List gchannels = new ArrayList<>(); - for (int i=0; i gammaEnergy = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam); @@ -199,7 +201,7 @@ public class PHDFileUtil extends AbstractLogOrReport { long numBChannel = struct.num_b_channel; List bCounts = struct.b_counts; List betaOriginalSeriseData = new LinkedList<>(); - for (int i=0; i betaProjectedData = new LinkedList<>(); - for (int j=0; j betaProjectedSeriseData = new LinkedList<>(); - for (int i=0; i betaFittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List betaFittingParaStr = new LinkedList<>(); - for (Double para:betaFittingPara) { + for (Double para : betaFittingPara) { betaFittingParaStr.add(String.valueOf(para)); } //E to C List betaFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel); List betaFittingParaToUiStr = new LinkedList<>(); - for (Double para:betaFittingParaToUi) { + for (Double para : betaFittingParaToUi) { betaFittingParaToUiStr.add(String.valueOf(para)); } betaDataFile.setBetaFittingParaOld(betaFittingParaStr); betaDataFile.setBetaFittingParaToUiOld(betaFittingParaToUiStr); List betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List bchannels = new ArrayList<>(); - for (int i=0; i betaEnergy = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam); @@ -271,7 +272,7 @@ public class PHDFileUtil extends AbstractLogOrReport { List roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop; List roiGBoundaryStart = bgBoundary.ROI_G_Boundary_start; List roiGBoundaryStop = bgBoundary.ROI_G_Boundary_stop; - for (int i=0; i sampleRoiChannel, Map map) { List boundaryList = new LinkedList<>(); - for (int i=0; i> gammaNewEnergyList = new LinkedList<>(); List> betaNewEnergyList = new LinkedList<>(); //填充道值数组的数据 - for (int i=0; i<255; i++) { + for (int i = 0; i < 255; i++) { channels.add(Double.valueOf(i)); } //过滤出Gamma对应的表单数据 @@ -366,9 +367,9 @@ public class PHDFileUtil extends AbstractLogOrReport { //计算gamma对应的数据 List gammaFittingPara = EnergySpectrumHandler.GetFileFittingPara(gammaChannelList, gammaEnergyList); //计算道值的能量 - List gammaEnergys = EnergySpectrumHandler.GetFileFittingData(channels,gammaFittingPara); + List gammaEnergys = EnergySpectrumHandler.GetFileFittingData(channels, gammaFittingPara); //将新计算的能量封装到数组 - for (Double calEnergy:gammaEnergys) { + for (Double calEnergy : gammaEnergys) { List newEnergy = new LinkedList<>(); newEnergy.add(calEnergy); gammaNewEnergyList.add(newEnergy); @@ -382,9 +383,9 @@ public class PHDFileUtil extends AbstractLogOrReport { List betaFittingPara = EnergySpectrumHandler.GetFileFittingPara(betaChannelList, betaEnergyList); //计算道值的能量 - List betaEnergys = EnergySpectrumHandler.GetFileFittingData(channels,betaFittingPara); + List betaEnergys = EnergySpectrumHandler.GetFileFittingData(channels, betaFittingPara); //将新计算的能量封装到数组 - for (Double calEnergy:betaEnergys) { + for (Double calEnergy : betaEnergys) { List newEnergy = new LinkedList<>(); newEnergy.add(calEnergy); betaNewEnergyList.add(newEnergy); @@ -402,20 +403,9 @@ public class PHDFileUtil extends AbstractLogOrReport { } } - public List readLine(String filePath) { - List allLines = new ArrayList<>(); - try { - File file = new File(filePath); - return FileUtils.readLines(file, "UTF-8"); - }catch (IOException e){ - e.printStackTrace(); - return allLines; - } - } - - public void createBgCalPara(BetaDataFile betaDataFile, List gammaCalibrationSpectrumList,List betaCalibrationSpectrumList, - List gammaCalibrationPairsList,List betaCalibrationPairsList) { - SpectrumGroup spectrum_group = new SpectrumGroup(); + public void createBgCalPara(BetaDataFile betaDataFile, List gammaCalibrationSpectrumList, List betaCalibrationSpectrumList, + List gammaCalibrationPairsList, List betaCalibrationPairsList) { + SpectrumGroup spectrum_group = new SpectrumGroup(); //我需要根据 calibration页面对应的数组 及 公式判断是否有勾选sample det gas 这四个文件的操作 //gammaCalibrationSpectrumList存储的是gamma对应的公式数据 //betaCalibrationSpectrumList存储的是beta对应的公式数据 @@ -440,7 +430,7 @@ public class PHDFileUtil extends AbstractLogOrReport { List bChannel = struct.b_channel; List bElectronEnergy = struct.b_electron_energy; //比较四组表单数据 - if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) { + if (!gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy)) { //将公式参数放入到重新计算的参数内 List newFittingPara = EnergySpectrumHandler.GetFileFittingPara(gammaChannelList, gammaEnergyList); //计算E to C公式参数 @@ -462,7 +452,7 @@ public class PHDFileUtil extends AbstractLogOrReport { gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff3())); spectrum_group.g_c2e = gc2e; //将新的道值对应能量值参数存储 - for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList); @@ -494,7 +484,7 @@ public class PHDFileUtil extends AbstractLogOrReport { bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff3())); spectrum_group.b_c2e = bc2e; //将新的道值对应能量值参数存储 - for (int i=0; i bChannel = struct.b_channel; List bElectronEnergy = struct.b_electron_energy; //比较gamma部分表单数据 - if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) { + if (!gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy)) { //将公式参数放入到重新计算的参数内 //计算E to C公式参数 List newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList); @@ -546,7 +536,7 @@ public class PHDFileUtil extends AbstractLogOrReport { 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<>(); @@ -577,7 +567,7 @@ public class PHDFileUtil extends AbstractLogOrReport { bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff3())); spectrum_group.b_c2e = bc2e; //将新的道值对应能量值参数存储 - for (int i=0; i bChannel = struct.b_channel; List bElectronEnergy = struct.b_electron_energy; //比较四组表单数据 - if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) { + if (!gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy)) { //计算E to C公式参数 List newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList); List geCal = new LinkedList<>(); @@ -627,7 +617,7 @@ public class PHDFileUtil extends AbstractLogOrReport { gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff3())); spectrum_group.g_c2e = gc2e; //将新的道值对应能量值参数存储 - for (int i=0; i newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList); //将公式参数放入到重新计算的参数内 @@ -658,7 +648,7 @@ public class PHDFileUtil extends AbstractLogOrReport { 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 { + File file = new File(filePath); + return FileUtils.readLines(file, "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + return allLines; + } + } + public void getLightColor(Map sampleMap, Map gasBgMap, Map detBgMap, Map qcMap) { - SpectrumData sampleSpectrumData = (SpectrumData)sampleMap.get("spectrumData"); - SpectrumData gasBgSpectrumData = (SpectrumData)gasBgMap.get("spectrumData"); - SpectrumData detBgSpectrumData = (SpectrumData)detBgMap.get("spectrumData"); + SpectrumData sampleSpectrumData = (SpectrumData) sampleMap.get("spectrumData"); + SpectrumData gasBgSpectrumData = (SpectrumData) gasBgMap.get("spectrumData"); + SpectrumData detBgSpectrumData = (SpectrumData) detBgMap.get("spectrumData"); //灯颜色 Sections sections = new Sections(); List airVolumeSections = sections.getAirVolumeSections(); @@ -685,7 +686,7 @@ public class PHDFileUtil extends AbstractLogOrReport { List acquisitionTimeSections = sections.getAcquisitionTimeSections(); List xeVolumeSections = sections.getXeVolumeSections(); double airVolume = Double.parseDouble(sampleSpectrumData.getAirVolume()); - if (Objects.nonNull(airVolume)){ + if (Objects.nonNull(airVolume)) { // air volume check if (airVolumeSections.get(0) < airVolume && airVolume <= airVolumeSections.get(1)) { // red sampleMap.put("SampleVolumeBtn", "RedLight"); @@ -705,9 +706,9 @@ public class PHDFileUtil extends AbstractLogOrReport { } } String collectionTime = sampleSpectrumData.getCollectionTime(); - if (StringUtils.isNotBlank(collectionTime)){ + if (StringUtils.isNotBlank(collectionTime)) { double collection_time = Double.parseDouble(collectionTime); - collection_time = collection_time/3600; + collection_time = collection_time / 3600; // collection time check if (collectionTimeSections.get(0) < collection_time && collection_time <= collectionTimeSections.get(1)) { // red sampleMap.put("CollectTimeBtn", "RedLight"); @@ -737,8 +738,8 @@ public class PHDFileUtil extends AbstractLogOrReport { } } double acquisitionLiveTime = Double.parseDouble(sampleSpectrumData.getAcquisitionLiveTime()); - if (Objects.nonNull(acquisitionLiveTime)){ - acquisitionLiveTime = acquisitionLiveTime/3600; + if (Objects.nonNull(acquisitionLiveTime)) { + acquisitionLiveTime = acquisitionLiveTime / 3600; // acquisition time check if (acquisitionTimeSections.get(0) < acquisitionLiveTime && acquisitionLiveTime <= acquisitionTimeSections.get(1)) { // red sampleMap.put("AcqTimeBtn", "RedLight"); @@ -787,24 +788,24 @@ public class PHDFileUtil extends AbstractLogOrReport { } } - if (gasBgSpectrumData.getMeasurementId().equals(sampleSpectrumData.getGasBkMeasurementId())){ + if (gasBgSpectrumData.getMeasurementId().equals(sampleSpectrumData.getGasBkMeasurementId())) { sampleMap.put("GasBgBtn", "GreenLight"); gasBgMap.put("GasBgBtn", "GreenLight"); detBgMap.put("GasBgBtn", "GreenLight"); qcMap.put("GasBgBtn", "GreenLight"); - }else { + } else { sampleMap.put("GasBgBtn", "RedLight"); gasBgMap.put("GasBgBtn", "RedLight"); detBgMap.put("GasBgBtn", "RedLight"); qcMap.put("GasBgBtn", "RedLight"); } - if (detBgSpectrumData.getMeasurementId().equals(sampleSpectrumData.getDetectorBkMeasurementId())){ + if (detBgSpectrumData.getMeasurementId().equals(sampleSpectrumData.getDetectorBkMeasurementId())) { sampleMap.put("DetBgBtn", "GreenLight"); gasBgMap.put("DetBgBtn", "GreenLight"); detBgMap.put("DetBgBtn", "GreenLight"); qcMap.put("DetBgBtn", "GreenLight"); - }else { + } else { sampleMap.put("DetBgBtn", "RedLight"); gasBgMap.put("DetBgBtn", "RedLight"); detBgMap.put("DetBgBtn", "RedLight"); @@ -812,6 +813,139 @@ public class PHDFileUtil extends AbstractLogOrReport { } } + + public void getLightColor(StationDetailType stationType, Map sampleMap, Map gasBgMap, Map detBgMap, Map qcMap) { + + String pathname = parameterProperties.getFilePath() + File.separator + "parameter.xml"; + SpectrumData sampleSpectrumData = (SpectrumData) sampleMap.get("spectrumData"); + SpectrumData gasBgSpectrumData = (SpectrumData) gasBgMap.get("spectrumData"); + SpectrumData detBgSpectrumData = (SpectrumData) detBgMap.get("spectrumData"); + + //灯颜色 + Sections sections = new Sections(stationType, pathname); + List airVolumeRules = sections.getAirVolumeRules(); + List collectionTimeRules = sections.getCollectionTimeRules(); + List acquisitionTimeRules = sections.getAcquisitionTimeRules(); + List xeVolumeRules = sections.getXeVolumeRules(); + + //region air volume check + double airVolume = Double.parseDouble(sampleSpectrumData.getAirVolume()); + if (Objects.nonNull(airVolume) && Objects.nonNull(airVolumeRules)) { + // air volume check + for (Rule rule : airVolumeRules) { + if (Objects.isNull(rule.getMax())) { + if (rule.getMin() < airVolume) { + sampleMap.put("SampleVolumeBtn", rule.getColor()); + gasBgMap.put("SampleVolumeBtn", rule.getColor()); + detBgMap.put("SampleVolumeBtn", rule.getColor()); + qcMap.put("SampleVolumeBtn", rule.getColor()); + break; + } + } + if (rule.getMin() < airVolume && airVolume <= rule.getMax()) { + sampleMap.put("SampleVolumeBtn", rule.getColor()); + gasBgMap.put("SampleVolumeBtn", rule.getColor()); + detBgMap.put("SampleVolumeBtn", rule.getColor()); + qcMap.put("SampleVolumeBtn", rule.getColor()); + break; + } + } + } + //endregion + + //region collection time check + String collectionTime = sampleSpectrumData.getCollectionTime(); + if (StringUtils.isNotBlank(collectionTime) && Objects.nonNull(collectionTimeRules)) { + double collection_time = Double.parseDouble(collectionTime); + collection_time = collection_time / 3600; + for (Rule rule : collectionTimeRules) { + if (Objects.isNull(rule.getMax())) { + if (rule.getMin() < collection_time) { + sampleMap.put("CollectTimeBtn", rule.getColor()); + gasBgMap.put("CollectTimeBtn", rule.getColor()); + detBgMap.put("CollectTimeBtn", rule.getColor()); + qcMap.put("CollectTimeBtn", rule.getColor()); + break; + } + } + if (rule.getMin() < collection_time && collection_time <= rule.getMax()) { + sampleMap.put("CollectTimeBtn", rule.getColor()); + gasBgMap.put("CollectTimeBtn", rule.getColor()); + detBgMap.put("CollectTimeBtn", rule.getColor()); + qcMap.put("CollectTimeBtn", rule.getColor()); + break; + } + } + } + + //endregion + + //region acquisition time check + double acquisitionLiveTime = Double.parseDouble(sampleSpectrumData.getAcquisitionLiveTime()); + if (Objects.nonNull(acquisitionLiveTime) && Objects.nonNull(acquisitionTimeRules)) { + acquisitionLiveTime = acquisitionLiveTime / 3600; + for (Rule rule : acquisitionTimeRules) { + if (Objects.isNull(rule.getMax())) { + if (rule.getMin() < acquisitionLiveTime) { + sampleMap.put("AcqTimeBtn", rule.getColor()); + gasBgMap.put("AcqTimeBtn", rule.getColor()); + detBgMap.put("AcqTimeBtn", rule.getColor()); + qcMap.put("AcqTimeBtn", rule.getColor()); + break; + } + } + if (rule.getMin() < acquisitionLiveTime && acquisitionLiveTime <= rule.getMax()) { + sampleMap.put("AcqTimeBtn", rule.getColor()); + gasBgMap.put("AcqTimeBtn", rule.getColor()); + detBgMap.put("AcqTimeBtn", rule.getColor()); + qcMap.put("AcqTimeBtn", rule.getColor()); + break; + } + } + } + //endregion + + //region XeVolume + double xeVolume = Double.parseDouble(sampleSpectrumData.getXeVolume()); + if (Objects.nonNull(xeVolumeRules)) { + for (Rule rule : xeVolumeRules) { + if (Objects.isNull(rule.getMax())) { + if (rule.getMin() < xeVolume) { + sampleMap.put("XeVolumeBtn", rule.getColor()); + gasBgMap.put("XeVolumeBtn", rule.getColor()); + detBgMap.put("XeVolumeBtn", rule.getColor()); + qcMap.put("XeVolumeBtn", rule.getColor()); + break; + } + } + if (rule.getMin() < xeVolume && xeVolume <= rule.getMax()) { + sampleMap.put("XeVolumeBtn", rule.getColor()); + gasBgMap.put("XeVolumeBtn", rule.getColor()); + detBgMap.put("XeVolumeBtn", rule.getColor()); + qcMap.put("XeVolumeBtn", rule.getColor()); + break; + } + } + } + //endregion + + //region GasBgBtn、DetBgBtn + String gasBgColor = gasBgSpectrumData.getMeasurementId().equals(sampleSpectrumData.getGasBkMeasurementId()) ? "GreenLight" : "RedLight"; + sampleMap.put("GasBgBtn", gasBgColor); + gasBgMap.put("GasBgBtn", gasBgColor); + detBgMap.put("GasBgBtn", gasBgColor); + qcMap.put("GasBgBtn", gasBgColor); + + String detBgColor = detBgSpectrumData.getMeasurementId().equals(sampleSpectrumData.getDetectorBkMeasurementId()) ? "GreenLight" : "RedLight"; + sampleMap.put("DetBgBtn", detBgColor); + gasBgMap.put("DetBgBtn", detBgColor); + detBgMap.put("DetBgBtn", detBgColor); + qcMap.put("DetBgBtn", detBgColor); + + //endregion + } + + public Map getFileData(String filePath, String sampleFileName) { Map map = new HashMap<>(); File file = null; @@ -838,7 +972,7 @@ public class PHDFileUtil extends AbstractLogOrReport { map.put("detaFileName", detaFileName); map.put("sampleSystemType", systemType); return map; - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return map; } @@ -853,77 +987,78 @@ public class PHDFileUtil extends AbstractLogOrReport { EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath()); String systemType = sourceData.system_type; String dataType = sourceData.data_type; - if(systemType.contains("B")) { + if (systemType.contains("B")) { path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Sauna"); - } else if(systemType.contains("G")) { + path.append(StringPool.SLASH + "Xenon"); + path.append(StringPool.SLASH + "Sauna"); + } else if (systemType.contains("G")) { path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Spalax"); + path.append(StringPool.SLASH + "Xenon"); + path.append(StringPool.SLASH + "Spalax"); } else if (systemType.contains("C")) { path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Self"); + path.append(StringPool.SLASH + "Xenon"); + path.append(StringPool.SLASH + "Self"); } - if(dataType.contains("SAMPLEPHD")) { - path.append(StringPool.SLASH+"Samplephd"); - } else if(dataType.contains("DETBKPHD")) { - path.append(StringPool.SLASH+"Detbkphd"); - } else if(dataType.contains("GASBKPHD")) { - path.append(StringPool.SLASH+"Gasbkphd"); - } else if(dataType.contains("QCPHD")) { - path.append(StringPool.SLASH+"Qcphd"); + if (dataType.contains("SAMPLEPHD")) { + path.append(StringPool.SLASH + "Samplephd"); + } else if (dataType.contains("DETBKPHD")) { + path.append(StringPool.SLASH + "Detbkphd"); + } else if (dataType.contains("GASBKPHD")) { + path.append(StringPool.SLASH + "Gasbkphd"); + } else if (dataType.contains("QCPHD")) { + path.append(StringPool.SLASH + "Qcphd"); } int pos = fileName.indexOf('-'); - if(-1 == pos) { + if (-1 == pos) { - } else if(fileName.length() >= pos+7) { - path.append(StringPool.SLASH+fileName.substring(pos+1,pos+5)); - path.append(StringPool.SLASH+fileName.substring(pos+5,pos+7)); + } else if (fileName.length() >= pos + 7) { + path.append(StringPool.SLASH + fileName.substring(pos + 1, pos + 5)); + path.append(StringPool.SLASH + fileName.substring(pos + 5, pos + 7)); } - path.append(StringPool.SLASH+fileName); + path.append(StringPool.SLASH + fileName); return path.toString(); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return path.toString(); } } - public String NameStandardBy(String fileName, String systemType,String dataType) { + + public String NameStandardBy(String fileName, String systemType, String dataType) { StringBuffer path = new StringBuffer(); try { - if(systemType.contains("B")) { + if (systemType.contains("B")) { path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Sauna"); - } else if(systemType.contains("G")) { + path.append(StringPool.SLASH + "Xenon"); + path.append(StringPool.SLASH + "Sauna"); + } else if (systemType.contains("G")) { path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Spalax"); + path.append(StringPool.SLASH + "Xenon"); + path.append(StringPool.SLASH + "Spalax"); } else if (systemType.contains("C")) { path.append("Spectrum"); - path.append(StringPool.SLASH+"Xenon"); - path.append(StringPool.SLASH+"Self"); + path.append(StringPool.SLASH + "Xenon"); + path.append(StringPool.SLASH + "Self"); } - if(dataType.contains("SAMPLEPHD")) { - path.append(StringPool.SLASH+"Samplephd"); - } else if(dataType.contains("DETBKPHD")) { - path.append(StringPool.SLASH+"Detbkphd"); - } else if(dataType.contains("GASBKPHD")) { - path.append(StringPool.SLASH+"Gasbkphd"); - } else if(dataType.contains("QCPHD")) { - path.append(StringPool.SLASH+"Qcphd"); + if (dataType.contains("SAMPLEPHD")) { + path.append(StringPool.SLASH + "Samplephd"); + } else if (dataType.contains("DETBKPHD")) { + path.append(StringPool.SLASH + "Detbkphd"); + } else if (dataType.contains("GASBKPHD")) { + path.append(StringPool.SLASH + "Gasbkphd"); + } else if (dataType.contains("QCPHD")) { + path.append(StringPool.SLASH + "Qcphd"); } int pos = fileName.indexOf('-'); - if(-1 == pos) { + if (-1 == pos) { - } else if(fileName.length() >= pos+7) { - path.append(StringPool.SLASH+fileName.substring(pos+1,pos+5)); - path.append(StringPool.SLASH+fileName.substring(pos+5,pos+7)); + } else if (fileName.length() >= pos + 7) { + path.append(StringPool.SLASH + fileName.substring(pos + 1, pos + 5)); + path.append(StringPool.SLASH + fileName.substring(pos + 5, pos + 7)); } - path.append(StringPool.SLASH+fileName); + path.append(StringPool.SLASH + fileName); return path.toString(); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return path.toString(); } @@ -952,8 +1087,8 @@ public class PHDFileUtil extends AbstractLogOrReport { // List ftpFiles = Arrays.asList(ftpClient.listFiles()); File file = new File(filePath); List ftpFiles = Arrays.asList(file.listFiles()); - if (CollectionUtils.isNotEmpty(ftpFiles)){ - fileNames = ftpFiles.stream().filter(item-> item.getName().contains(station)).map(File::getName).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(ftpFiles)) { + fileNames = ftpFiles.stream().filter(item -> item.getName().contains(station)).map(File::getName).collect(Collectors.toList()); } } catch (Exception e) { throw new RuntimeException(e); @@ -972,10 +1107,10 @@ public class PHDFileUtil extends AbstractLogOrReport { if (StringUtils.isBlank(tmpFileName)) { return matchFileName; } - fileNames = fileNames.stream().filter(item-> item.contains(type)).sorted().collect(Collectors.toList()); + fileNames = fileNames.stream().filter(item -> item.contains(type)).sorted().collect(Collectors.toList()); //用于比较的字符串 - String fileCompare = tmpFileName.substring(0,23); - for (String fileName:fileNames) { + String fileCompare = tmpFileName.substring(0, 23); + for (String fileName : fileNames) { String compare = fileName.substring(0, 23); if (compare.equals(fileCompare) && fileName.contains("FULL")) { matchFileName = fileName; @@ -986,13 +1121,13 @@ public class PHDFileUtil extends AbstractLogOrReport { public String GetQCPHD(String sampleName, List fileNames) { //过滤出所有包含Q的文件 - fileNames = fileNames.stream().filter(item-> item.contains(DataTypeAbbr.QCPHD.getType())).sorted().collect(Collectors.toList()); + fileNames = fileNames.stream().filter(item -> item.contains(DataTypeAbbr.QCPHD.getType())).sorted().collect(Collectors.toList()); Long dateTime = Long.valueOf(sampleName.substring(10, 23).replace("_", "")); String rData = ""; - for(int pos=0;posdateTime) { + if (qcphdDateTime > dateTime) { break; } else { if (fileNames.get(pos).contains("FULL")) { @@ -1016,7 +1151,7 @@ public class PHDFileUtil extends AbstractLogOrReport { //新计算得到的边界值 if (CollectionUtils.isNotEmpty(analyseResult.S_ROI_B_Boundary_start)) { List boundaryList = new LinkedList<>(); - for (int i=0; i boundaryList = new LinkedList<>(); - for (int i=0; i boundaryList = new LinkedList<>(); - for (int i=0; i boundaryList = new LinkedList<>(); - for (int i=0; i boundaryList = new LinkedList<>(); - for (int i=0; i boundaryList = new LinkedList<>(); - for (int i=0; i roiChannelsSpectrumList = new LinkedList<>(); - for (int i=0; i roiResultsSpectrumList = new LinkedList<>(); - for (int i=0; ibgAnalyseResult.MDC.get(i)) { + if (bgAnalyseResult.ROI_con_uncer.get(i) > bgAnalyseResult.MDC.get(i)) { roiResults.setNidFlag(1); } else { roiResults.setNidFlag(0); @@ -1557,7 +1692,7 @@ public class PHDFileUtil extends AbstractLogOrReport { public List StringToDouble(List datas) { List result = new LinkedList<>(); - for (String data: datas) { + for (String data : datas) { result.add(Double.valueOf(data)); } return result; @@ -1599,7 +1734,7 @@ public class PHDFileUtil extends AbstractLogOrReport { List roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop; List roiGBoundaryStart = bgBoundary.ROI_G_Boundary_start; List roiGBoundaryStop = bgBoundary.ROI_G_Boundary_stop; - for (int i=0; i 0) { out.append(rowFormat("energy to channel equation: CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(0))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(1))), NumberFormatUtil.numberFormat(String.valueOf(bgAnalyseResult.s_g_fitting_e_c.get(2))))); } else { @@ -2340,16 +2475,16 @@ public class PHDFileUtil extends AbstractLogOrReport { StringBuffer strBuffer = new StringBuffer(); //对分析后的内容进行数据获取 - List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); + List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); List roiChannelsSpectrumsSample = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("S")).collect(Collectors.toList()); List roiChannelsSpectrumsGas = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("G")).collect(Collectors.toList()); List roiChannelsSpectrumsDet = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("D")).collect(Collectors.toList()); - List resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); - List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); + List resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); + List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); //#SAMPLE: LIMITS PER ROI GAMMA List gammaCalibrationParamList = betaDataFile.getGammaCalibrationSpectrumList(); List gammaCalibrationSpectrumEList = betaDataFile.getGammaCalibrationSpectrumEList(); - for (int i=0; i betaCalibrationParamList = betaDataFile.getBetaCalibrationSpectrumList(); List betaCalibrationSpectrumEList = betaDataFile.getBetaCalibrationSpectrumEList(); - for (int i=0; i viewXeData(List xeResultsSpectrumList) { List xeResultsViewList = new LinkedList<>(); if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)) { - for (GardsXeResultsSpectrum xeResultsSpectrum:xeResultsSpectrumList) { + for (GardsXeResultsSpectrum xeResultsSpectrum : xeResultsSpectrumList) { GardsXeResultsView xeResultsView = new GardsXeResultsView(); xeResultsView.setNuclideName(xeResultsSpectrum.getNuclideName()); xeResultsView.setConc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))); @@ -2784,5 +2919,4 @@ public class PHDFileUtil extends AbstractLogOrReport { } - }