From a3dee8432cc0350272f78fd28febc8d9a560b765 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Fri, 17 Nov 2023 17:27:48 +0800 Subject: [PATCH] =?UTF-8?q?beta=E5=8A=9F=E8=83=BDstatistics=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20beta=E5=8A=9F=E8=83=BD=E5=85=A8=E9=83=A8=E5=88=86=E6=9E=90?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E8=B5=8B=E5=80=BC=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/modules/entity/vo/StcGraph.java | 2 +- .../impl/SpectrumAnalysisServiceImpl.java | 147 +++++++++++++----- 2 files changed, 110 insertions(+), 39 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StcGraph.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StcGraph.java index 7d6a2926..88032cd4 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StcGraph.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StcGraph.java @@ -13,7 +13,7 @@ public class StcGraph implements Serializable { private String m_strGraphName; - private List m_Keys; + private List m_Keys; private List m_Values; 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 6ef9ad0e..0031f0d8 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 @@ -2336,7 +2336,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } //根据类型判断查询对应数据 List statisticsData = spectrumAnalysisMapper.statisticsQueryNuclides(statisticsQueryData); + Map resultMap = new HashMap<>(); List stcGraphList = new LinkedList<>(); + List allDate = new LinkedList<>(); + for (StatisticsData data:statisticsData) { + Date collectStart = data.getCollectStart(); + String formatDate = DateUtils.formatDate(collectStart, "yyyy-MM-dd HH:mm:ss"); + allDate.add(formatDate); + } + allDate = allDate.stream().distinct().sorted().collect(Collectors.toList()); + //判断查询结果是否包含Xe131m的信息 if (statisticsQueryData.getNuclidesList().contains(XeNuclideName.XE_131m.getType())){ StcGraph stcGraphMDC = new StcGraph(); stcGraphMDC.setM_strGraphName("Xe131m MDC"); @@ -2345,25 +2354,32 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphAct.setM_strGraphName("Xe131m Activity Concentration"); stcGraphAct.setM_GraphPen("#f89c1f"); List xe131m = new LinkedList<>(); + //提取出Xe131m相关数据 if (CollectionUtils.isNotEmpty(statisticsData)) { xe131m = statisticsData.stream().filter(item -> item.getNuclideName().equals(XeNuclideName.XE_131m.getType())).collect(Collectors.toList()); } + //判断数据是否为空 if (CollectionUtils.isNotEmpty(xe131m)){ + //判断是否有勾选MDC数据进行返回 if (statisticsQueryData.isMDC()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); + //遍历xe11m的数据 for (StatisticsData data:xe131m) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getMdc()); } stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } if (statisticsQueryData.isActivity()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); + //遍历xe131m数据 for (StatisticsData data:xe131m) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getConc()); } stcGraphAct.setM_Keys(keys); @@ -2386,20 +2402,23 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } if (CollectionUtils.isNotEmpty(xe133m)){ if (statisticsQueryData.isMDC()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); + //遍历xe133m数据 for (StatisticsData data:xe133m) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getMdc()); } stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } if (statisticsQueryData.isActivity()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:xe133m) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getConc()); } stcGraphAct.setM_Keys(keys); @@ -2422,20 +2441,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } if (CollectionUtils.isNotEmpty(xe133)){ if (statisticsQueryData.isMDC()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:xe133) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getMdc()); } stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } if (statisticsQueryData.isActivity()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:xe133) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getConc()); } stcGraphAct.setM_Keys(keys); @@ -2458,20 +2479,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } if (CollectionUtils.isNotEmpty(xe135)){ if (statisticsQueryData.isMDC()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:xe135) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getMdc()); } stcGraphMDC.setM_Keys(keys); stcGraphMDC.setM_Values(values); } if (statisticsQueryData.isActivity()){ - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:xe135) { - keys.add(data.getCollectStart()); + String formatDate = DateUtils.formatDate(data.getCollectStart(), "yyyy-MM-dd HH:mm:ss"); + keys.add(formatDate); values.add(data.getConc()); } stcGraphAct.setM_Keys(keys); @@ -2481,8 +2504,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements stcGraphList.add(stcGraphMDC); stcGraphList.add(stcGraphAct); } + resultMap.put("allDate", allDate); + resultMap.put("allList", stcGraphList); result.setSuccess(true); - result.setResult(stcGraphList); + result.setResult(resultMap); return result; } @@ -2513,10 +2538,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements StcGraph stcGraph = new StcGraph(); stcGraph.setM_strGraphName("Colloction Time"); stcGraph.setM_GraphPen("green"); - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:statisticsData) { - keys.add(data.getDateTime()); + keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } stcGraph.setM_Keys(keys); @@ -2528,10 +2553,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements StcGraph stcGraph = new StcGraph(); stcGraph.setM_strGraphName("Acquisition Time"); stcGraph.setM_GraphPen("green"); - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:statisticsData) { - keys.add(data.getDateTime()); + keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } stcGraph.setM_Keys(keys); @@ -2543,10 +2568,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements StcGraph stcGraph = new StcGraph(); stcGraph.setM_strGraphName("Xe Volumn"); stcGraph.setM_GraphPen("green"); - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:statisticsData) { - keys.add(data.getDateTime()); + keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } stcGraph.setM_Keys(keys); @@ -2558,10 +2583,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements StcGraph stcGraph = new StcGraph(); stcGraph.setM_strGraphName("Sample Volumn"); stcGraph.setM_GraphPen("green"); - List keys = new LinkedList<>(); + List keys = new LinkedList<>(); List values = new LinkedList<>(); for (StatisticsData data:statisticsData) { - keys.add(data.getDateTime()); + keys.add(DateUtils.formatDate(data.getDateTime(), "yyyy-MM-dd HH:mm:ss")); values.add(data.getDataValue()); } stcGraph.setM_Keys(keys); @@ -2991,6 +3016,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements betaDataFile.setBgPara(spectrum_group.BgCalPara); } } else { + List sampleBoundary = (List) xeMap.get("SampleBoundary"); + if(CollectionUtils.isNotEmpty(sampleBoundary)) { + betaDataFile.setSampleBoundary(sampleBoundary); + } + List gasBoundary = (List) xeMap.get("GasBoundary"); + if(CollectionUtils.isNotEmpty(gasBoundary)) { + betaDataFile.setGasBoundary(gasBoundary); + } + List detBoundary = (List) xeMap.get("DetBoundary"); + if(CollectionUtils.isNotEmpty(detBoundary)) { + betaDataFile.setDetBoundary(detBoundary); + } + List qcBoundary = (List) xeMap.get("QCBoundary"); + if(CollectionUtils.isNotEmpty(qcBoundary)) { + betaDataFile.setQcBoundary(qcBoundary); + } xeMap.put("XeData", Collections.EMPTY_LIST); } } @@ -3146,19 +3187,19 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if (bRet) { List sampleBoundary = (List) xeMap.get("SampleBoundary"); if(CollectionUtils.isNotEmpty(sampleBoundary)) { - betaDataFile.setSampleBoundary(sampleBoundary); + sampleBetaData.setSampleBoundary(sampleBoundary); } List gasBoundary = (List) xeMap.get("GasBoundary"); if(CollectionUtils.isNotEmpty(gasBoundary)) { - betaDataFile.setGasBoundary(gasBoundary); + sampleBetaData.setGasBoundary(gasBoundary); } List detBoundary = (List) xeMap.get("DetBoundary"); if(CollectionUtils.isNotEmpty(detBoundary)) { - betaDataFile.setDetBoundary(detBoundary); + sampleBetaData.setDetBoundary(detBoundary); } List qcBoundary = (List) xeMap.get("QCBoundary"); if(CollectionUtils.isNotEmpty(qcBoundary)) { - betaDataFile.setQcBoundary(qcBoundary); + sampleBetaData.setQcBoundary(qcBoundary); } List xeResultsSpectrumList = (List) xeMap.get("XeData"); if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ @@ -3186,7 +3227,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } analyseResultMap.put(sampleFileName, xeMap); } else { - xeMap.clear(); + List sampleBoundary = (List) xeMap.get("SampleBoundary"); + if(CollectionUtils.isNotEmpty(sampleBoundary)) { + sampleBetaData.setSampleBoundary(sampleBoundary); + } + List gasBoundary = (List) xeMap.get("GasBoundary"); + if(CollectionUtils.isNotEmpty(gasBoundary)) { + sampleBetaData.setGasBoundary(gasBoundary); + } + List detBoundary = (List) xeMap.get("DetBoundary"); + if(CollectionUtils.isNotEmpty(detBoundary)) { + sampleBetaData.setDetBoundary(detBoundary); + } + List qcBoundary = (List) xeMap.get("QCBoundary"); + if(CollectionUtils.isNotEmpty(qcBoundary)) { + sampleBetaData.setQcBoundary(qcBoundary); + } xeMap.put("XeData", Collections.EMPTY_LIST); analyseResultMap.put(sampleFileName, xeMap); } @@ -3351,14 +3407,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements if(Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) { //调用分析方法 boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, BgCalPara, map, betaDataFile); - if (bRet) { - //分析qc文件信息并重新计算qc边界值 - if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) { - EnergySpectrumStruct struct = betaDataFile.getQcStruct(); - if (Objects.nonNull(struct)) { - phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map, betaDataFile); - } + //分析qc文件信息并重新计算qc边界值 + if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) { + EnergySpectrumStruct struct = betaDataFile.getQcStruct(); + if (Objects.nonNull(struct)) { + phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, map, betaDataFile); } + } + if (bRet) { List sampleBoundary = (List) map.get("SampleBoundary"); if(CollectionUtils.isNotEmpty(sampleBoundary)) { betaDataFile.setSampleBoundary(sampleBoundary); @@ -3402,7 +3458,22 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements map.put("savedAnalysisResult", true); mapList.put(sampleFileName, map); } else { - map.clear(); + List sampleBoundary = (List) map.get("SampleBoundary"); + if(CollectionUtils.isNotEmpty(sampleBoundary)) { + betaDataFile.setSampleBoundary(sampleBoundary); + } + List gasBoundary = (List) map.get("GasBoundary"); + if(CollectionUtils.isNotEmpty(gasBoundary)) { + betaDataFile.setGasBoundary(gasBoundary); + } + List detBoundary = (List) map.get("DetBoundary"); + if(CollectionUtils.isNotEmpty(detBoundary)) { + betaDataFile.setDetBoundary(detBoundary); + } + List qcBoundary = (List) map.get("QCBoundary"); + if(CollectionUtils.isNotEmpty(qcBoundary)) { + betaDataFile.setQcBoundary(qcBoundary); + } map.put("XeData", Collections.EMPTY_LIST); mapList.put(sampleFileName, map); }