From 9f8d730a6f347f27eca844afe126a6925a3abbde Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 28 Nov 2023 15:19:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=88=86=E6=9E=90=E6=A8=A1=E5=9D=97beta=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=BF=9B=E5=85=A5energyCalibration=E9=A1=B5=E9=9D=A2beta?= =?UTF-8?q?=E9=83=A8=E5=88=86tab=E9=A1=B5E=20TO=20C=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=8F=82=E6=95=B0=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92=E5=88=86=E6=9E=90=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=97=B6=E9=97=B4=E5=B7=AE=E5=80=BC=E7=B2=BE=E5=BA=A6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=20=E5=8F=B0=E7=AB=99?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=AE=A1=E7=90=86=E6=97=B6=E9=97=B4=E9=97=B4?= =?UTF-8?q?=E9=9A=94=E7=B2=BE=E5=BA=A6=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/PHDFileUtil.java | 2 +- .../impl/SpectrumAnalysisServiceImpl.java | 87 +++++++++++-------- .../org/jeecg/DataReceivingStatusManager.java | 4 +- 3 files changed, 53 insertions(+), 40 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 47c0697b..4e9b3589 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 @@ -68,7 +68,7 @@ public class PHDFileUtil extends AbstractLogOrReport { //Collection Time String CollectionTime = ""; if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){ - CollectionTime = String.format ("%.2f",Double.valueOf(CollectionStop.getTime()/1000 - CollectionStart.getTime()/ 1000)); + CollectionTime = String.format ("%.2f",Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime())/ 1000)); } //Acquisition Start Date AcquisitionStart = null; 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 e9416526..777d4aa3 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 @@ -1015,7 +1015,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sCollection Stop:%-35s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(information.getCollect_stop(), "yyyy/MM/dd HH:mm:ss"))); strBuffer.append(System.lineSeparator()); - strBuffer.append(rowFormat("%sCollection TIME(h):%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf((information.getCollect_stop().getTime()/1000-information.getCollect_start().getTime()/1000)/3600))); + strBuffer.append(rowFormat("%sCollection TIME(h):%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(((information.getCollect_stop().getTime()-information.getCollect_start().getTime())/1000)/3600))); strBuffer.append(System.lineSeparator()); strBuffer.append(rowFormat("%sAir Volume[cm3]:%-35s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getS_xe_stable_volume()))); strBuffer.append(System.lineSeparator()); @@ -1380,7 +1380,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements Date collectStopDate = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time.substring(0, struct.collection_stop_time.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"); String collect_start = DateUtils.formatDate(collectStartDate, "yyyy/MM/dd HH:mm:ss"); String collect_stop = DateUtils.formatDate(collectStopDate, "yyyy/MM/dd HH:mm:ss"); - String collection_time_value = String.format ("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)); + String collection_time_value = String.format ("%.2f",Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime())/ 1000)); String s_volume_of_Xe = String.valueOf(struct.air_volume); String s_xe_stable_volume = String.valueOf(struct.sample_volume_of_Xe); Date acquisitionStartDate = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time.substring(0, struct.acquisition_start_time.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"); @@ -1487,10 +1487,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (Objects.nonNull(sampleSourceData) && Objects.nonNull(gasSourceData) && Objects.nonNull(detSourceData)) { Date collectStartDate = DateUtils.parseDate(sampleSourceData.collection_start_date + StringPool.SPACE + sampleSourceData.collection_start_time); Date collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time); - Double collection_time = Double.valueOf(collectStopDate.getTime() / 1000 - collectStartDate.getTime() / 1000); - String collection_time_value = String.format("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)/3600.0); + Double collection_time = Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime()) / 1000); + String collection_time_value = String.format("%.4f",collection_time/3600.0); qcResult.setCollectTimeValue(collection_time_value); - if (collectionTimeSections.get(1) < collection_time/3600 && collection_time/3600 < collectionTimeSections.get(4)){ + if (collectionTimeSections.get(1) < collection_time/3600.0 && collection_time/3600.0 < collectionTimeSections.get(4)){ qcResult.setCollectTimeStatus("Pass"); }else { qcResult.setCollectTimeStatus("Failed"); @@ -1728,21 +1728,28 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements oldScatterSeries.add(temp); } map.put("oldScatterSeries", oldScatterSeries); - List xs = new LinkedList<>(); - List ys = new LinkedList<>(); - for (int i=0; i< oldScatterSeries.size(); i++){ - xs.add(oldScatterSeries.get(i).getX()); - ys.add(oldScatterSeries.get(i).getY()); - } //C to E - List fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); + List fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List fittingParaStr = new LinkedList<>(); for (Double para:fittingPara) { fittingParaStr.add(String.valueOf(para)); } map.put("CToE", fittingParaStr); + List channel = new LinkedList<>(); + 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(ys, xs); + List fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel); List fittingParaToUiStr = new LinkedList<>(); for (Double para:fittingParaToUi) { fittingParaToUiStr.add(String.valueOf(para)); @@ -1821,9 +1828,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (Objects.nonNull(struct)){ //Figure of Beta Detector Calibration long numBChannel = struct.num_b_channel; - List> betaEnergyList = new LinkedList<>(); List bChannel = struct.b_channel; List bElectronEnergy = struct.b_electron_energy; + long numGChannel = struct.num_g_channel; + List gCentroidChannel = struct.g_centroid_channel; + List gEnergy = struct.g_energy; + long bChannels = struct.b_channels; + long gChannels = struct.g_channels; + List hCounts = struct.h_counts; + int bRecordCount = struct.b_record_count; + //散点图坐标点关联beta部分相关数据 + List> betaEnergyList = new LinkedList<>(); List betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List bchannels = new ArrayList<>(); for (int i=0; i gCentroidChannel = struct.g_centroid_channel; - List gEnergy = struct.g_energy; + //gamma Energy 散点图坐标点关联gamma部分相关数据 List gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List gchannels = new ArrayList<>(); List> gammaEnergyList = new LinkedList<>(); @@ -1847,10 +1859,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements gammaEnergyList.add(gammaEnergy); } map.put("gammaEnergy", gammaEnergyList); - //Beta-Gamma Spectrum: QC - long bChannels = struct.b_channels; - long gChannels = struct.g_channels; - List hCounts = struct.h_counts; + //Beta-Gamma Spectrum: QC 散点图相关数据 List histogramDataList = new LinkedList<>(); for (int column=0; column bChannelList = struct.b_channel; - List bEnergy = struct.b_electron_energy; - int bRecordCount = struct.b_record_count; + //计算Calibration Parameter Of Gamma Detector 拟合线图数据 List oldScatterSeries = new LinkedList<>(); for (int i=0; i xs = new LinkedList<>(); - List ys = new LinkedList<>(); - for (int i=0; i< oldScatterSeries.size(); i++){ - xs.add(oldScatterSeries.get(i).getX()); - ys.add(oldScatterSeries.get(i).getY()); - } - //C to E - List fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); + //计算得到C to E公式数据 + List fittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List fittingParaStr = new LinkedList<>(); for (Double para:fittingPara) { fittingParaStr.add(String.valueOf(para)); } map.put("CToE", fittingParaStr); + List channel = new LinkedList<>(); + 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(ys, xs); + List fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(energy, channel); List fittingParaToUiStr = new LinkedList<>(); for (Double para:fittingParaToUi) { fittingParaToUiStr.add(String.valueOf(para)); diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java b/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java index 75cfd78b..12ff5d54 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java @@ -159,7 +159,7 @@ public class DataReceivingStatusManager { Date acquisitionStop = sampleData.getAcquisitionStop(); dataInfo.setEndTime(Double.valueOf(acquisitionStop.getTime() / 1000)); //时间间隔 - Double span = Double.valueOf(acquisitionStop.getTime() / 1000) - Double.valueOf(acquisitionStart.getTime() / 1000); + Double span = Double.valueOf((acquisitionStop.getTime() - acquisitionStart.getTime()) / 1000); dataInfo.setSpanTime(span); dataInfoList.add(dataInfo); } @@ -191,7 +191,7 @@ public class DataReceivingStatusManager { dataInfo.setBeginTime(Double.valueOf(startTime.getTime() / 1000)); Date endTime = metData.getEndTime(); dataInfo.setEndTime(Double.valueOf(endTime.getTime() / 1000)); - Double span = Double.valueOf(startTime.getTime() / 1000) - Double.valueOf(endTime.getTime() / 1000); + Double span = Double.valueOf( (endTime.getTime() - startTime.getTime()) / 1000); dataInfo.setSpanTime(span); dataInfoList.add(dataInfo); } From 8bdb7b57b1121ce19683c849e6d57a12250a250c Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 28 Nov 2023 17:15:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=88=86=E6=9E=90gamma=E6=A8=A1=E5=9D=97=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=97=B6=E6=97=A0=E6=B3=95=E8=AF=BB=E5=8F=96=E5=88=B0txt?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98=E5=AF=BC?= =?UTF-8?q?=E8=87=B4mapNucActMda=E6=95=B0=E6=8D=AE=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=88=86=E6=9E=90gamma=E6=A8=A1=E5=9D=97CollectTime=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=B2=BE=E5=BA=A6=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/GammaFileUtil.java | 10 +++++----- .../modules/service/impl/GammaServiceImpl.java | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java index f38f81f7..ef18043e 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -496,11 +496,11 @@ public class GammaFileUtil extends AbstractLogOrReport { //获取phdFile的 分析开始时间 Date acq = DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time()); //计算得到采集耗时 - double collect_hour = (end.getTime()/1000 - start.getTime()/1000) / 3600.0; + double collect_hour = ((end.getTime() - start.getTime())/1000) / 3600.0; //获取 实际分析时长 double acq_hour = phd.getAcq().getAcquisition_real_time() / 3600.0; //计算得到衰减耗时 - double Decay_hour = (acq.getTime()/1000 - end.getTime()/1000) / 3600.0; + double Decay_hour = ((acq.getTime() - end.getTime())/1000) / 3600.0; //声明一个double数据 List Be7Value = new LinkedList<>(); //声明一个map用于存储计算数据 @@ -640,9 +640,9 @@ public class GammaFileUtil extends AbstractLogOrReport { //获取能谱获取时间 Date acqStart = DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time().substring(0,phd.getAcq().getAcquisition_start_time().indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"); //计算采样时间 - double Ts = (collectStop.getTime()/1000 - collectStart.getTime()/1000); + double Ts = ((collectStop.getTime() - collectStart.getTime())/1000); //计算衰变时间 - double Td = (acqStart.getTime()/1000 - collectStop.getTime()/1000); + double Td = ((acqStart.getTime() - collectStop.getTime())/1000); //获取能谱获取实时间 double Ta = phd.getAcq().getAcquisition_real_time(); //获取能谱获取活时间 @@ -670,7 +670,7 @@ public class GammaFileUtil extends AbstractLogOrReport { DCF3 = lambda * Ta / (1-Math.exp(-lambda*Ta)); } //计算得到DCF_conc - double DCF_conc = Math.exp(lambda * (collectStart.getTime()/1000 - phd.getUsedSetting().getRefTime_conc().getTime()/1000)); + double DCF_conc = Math.exp(lambda * ((collectStart.getTime() - phd.getUsedSetting().getRefTime_conc().getTime())/1000)); //声明一个集合 List energy = new LinkedList<>(); energy.add(vMdcInfo.get(0)); 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 bbf00720..26ec68ab 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 @@ -1089,7 +1089,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi Map nuclideLinesMap = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap); // 重新分析各峰值对应的核素信息 - gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); +// gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap); Map map = new HashMap<>(); gammaFileUtil.UpdateChart(phd, map, colorMap); // 更新 ‘QC Flags’ 状态 @@ -2304,7 +2304,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi // date of Zero Time Date datetime = DateUtils.parseDate(date + StringPool.SPACE + time, "yyyy-MM-dd HH:mm:ss"); Date oriDate = DateUtils.parseDate("1970-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss"); - double second = (datetime.getTime() / 1000 - oriDate.getTime() / 1000) - t - 8 * 60 * 60; + double second = ((datetime.getTime() - oriDate.getTime()) / 1000) - t - 8 * 60 * 60; Date resultDateTime = DateUtils.getDate((long) second * 1000); @@ -3571,6 +3571,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi max = editEnergyDou + err; } List nuclideLines = spectrumAnalysisMapper.getNuclideLine(min, max, name); + nuclideLines.stream().forEach(item -> { + if (Objects.nonNull(item.getYield())) { + item.setYield(Double.valueOf(String.format("%.3f", item.getYield()))); + } + if (Objects.nonNull(item.getYieldUncert())) { + item.setYieldUncert(Double.valueOf(String.format("%.3f", item.getYieldUncert()))); + } + }); return nuclideLines; } @@ -3996,10 +4004,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi String acq_start = phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time(); Date collect_stop_dt = DateUtils.parseDate(collect_stop); Date collect_start_dt = DateUtils.parseDate(collect_start); - double Sampling_Time = (collect_stop_dt.getTime() / 1000 - collect_start_dt.getTime() / 1000) / 3600.0; + double Sampling_Time = ((collect_stop_dt.getTime() - collect_start_dt.getTime()) / 1000) / 3600.0; Date acq_start_dt = DateUtils.parseDate(acq_start); - double Decay_Time = (acq_start_dt.getTime() / 1000 - collect_stop_dt.getTime() / 1000) / 3600.0; + double Decay_Time = ((acq_start_dt.getTime() - collect_stop_dt.getTime()) / 1000) / 3600.0; long secs = (long) (acq_start_dt.getTime() + (phd.getAcq().getAcquisition_live_time() * 1000)); String acq_stop = DateUtils.formatDate(new Date(secs), "yyyy/MM/dd HH:mm:ss.S");