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-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java index 9d2ccbab..84fa7800 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_G_Analysis.java @@ -126,7 +126,7 @@ public class Sample_G_Analysis { spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class); ftpUtil = SpringContextUtils.getBean(FTPUtil.class); String sampleFilePath = sampleData.getInputFileName(); - String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + File.separator + + String pathName = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH)); String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1); @@ -171,7 +171,7 @@ public class Sample_G_Analysis { FileOperation.saveOrAppendFile(savePath, reportContent, false); }catch (Exception e){ e.printStackTrace(); - log.error(e.getMessage()); + log.error("Sample_G_Analysis", e); throw new GAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); }finally { 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 5ec46a17..af22bced 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 @@ -3430,8 +3430,8 @@ public class GammaFileUtil extends AbstractLogOrReport { dvctUPPERTAIL.add(fileAnlyse.getVPeak().get(m).upperTail); dvctUPPERTAILALPHA.add(fileAnlyse.getVPeak().get(m).upperTailAlpha); dvctBWWIDTHCHAN.add(fileAnlyse.getVPeak().get(m).BWWidthChan); - dvctRECOILBETACHAN.add(fileAnlyse.getVPeak().get(m).recoilBetaChan.equalsIgnoreCase("nan")?Double.NaN:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilBetaChan)); - dvctRECOILDELTACHAN.add(fileAnlyse.getVPeak().get(m).recoilDeltaChan.equalsIgnoreCase("nan")?Double.NaN:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilDeltaChan)); + dvctRECOILBETACHAN.add(fileAnlyse.getVPeak().get(m).recoilBetaChan.equalsIgnoreCase("nan")?null:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilBetaChan)); + dvctRECOILDELTACHAN.add(fileAnlyse.getVPeak().get(m).recoilDeltaChan.equalsIgnoreCase("nan")?null:Double.valueOf(fileAnlyse.getVPeak().get(m).recoilDeltaChan)); dvctSTEPRAIO.add(fileAnlyse.getVPeak().get(m).stepRatio); dvctBACKGROUNDAREA.add(fileAnlyse.getVPeak().get(m).backgroundArea); dvctMEANBACKCOUNT.add(fileAnlyse.getVPeak().get(m).meanBackCount); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java index 9c6e5263..555626aa 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SpectrumAnalysesController.java @@ -115,6 +115,11 @@ public class SpectrumAnalysesController { spectrumAnalysisService.exportQCResult(sampleId, dbName, sampleFileName, gasFileName ,detFileName, request,response); } + @GetMapping("exportQCResultTXT") + public void exportQCResultTXT(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response) { + spectrumAnalysisService.exportQCResultTXT(sampleId, dbName, sampleFileName, gasFileName, detFileName, request, response); + } + @GetMapping("viewRLR") @ApiOperation(value = "查看RLR数据", notes = "查看RLR数据") public Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request) { diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java index 361b7234..07a5cdf0 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISpectrumAnalysisService.java @@ -44,6 +44,8 @@ public interface ISpectrumAnalysisService { void exportQCResult(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response); + void exportQCResultTXT(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response); + Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request); void exportRLR(BetaRLR betaRLR, HttpServletResponse response); 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 da35bf3b..0544e81e 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 @@ -779,12 +779,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } } // 从 RNMAN.GARDS_ANALY_SETTING 表读分析设置 - if (dbName.equals("auto")) { + if (!dbName.equals("auto")) { GardsAnalySetting analySetting = spectrumAnalysisMapper.getAnalySetting(analysis.getIdAnalysis()); if (Objects.nonNull(analySetting)) { phd.getUsedSetting().setECutAnalysis_Low(analySetting.getEcutanalysisLow()); - double t_d = analySetting.getEcutanalysisHigh(); - phd.getUsedSetting().setECutAnalysis_High((t_d <= phd.getUsedSetting().getECutAnalysis_Low() ? 0 : t_d)); + phd.getUsedSetting().setECutAnalysis_High((Objects.nonNull(analySetting.getEcutanalysisHigh())?(analySetting.getEcutanalysisHigh() <= phd.getUsedSetting().getECutAnalysis_Low()?-9999:analySetting.getEcutanalysisHigh()):-9999)); phd.getUsedSetting().setEnergyTolerance(analySetting.getEnergytolerance()); phd.getUsedSetting().setCalibrationPSS_high(analySetting.getCalibrationpssHigh()); phd.getUsedSetting().setCalibrationPSS_low(analySetting.getCalibrationpssLow()); 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..b7fbf2e8 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 @@ -53,6 +53,7 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.net.URLEncoder; import java.text.ParseException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -1469,7 +1470,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements String xe133MDCEvaluationMetrics = "0.001 ~ 5"; qcResult.setXe133MDCEvaluationMetrics(xe133MDCEvaluationMetrics); //获取数据信息 - GardsXeResultsSpectrum gardsXeResults = new GardsXeResultsSpectrum(); + GardsXeResultsSpectrum gardsXeResults = null; List xeDataList = new LinkedList<>(); try { xeDataList = betaDataFile.getXeResultsSpectrumList(); @@ -1542,7 +1543,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements qcResult.setXe133MDCStatus("Failed"); } } else { - qcResult.setXe133MDCStatus("Pass"); + qcResult.setXe133MDCValue("None"); + qcResult.setXe133MDCStatus("None"); } } } catch (Exception e) { @@ -1574,6 +1576,56 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements ExportUtil.exportXls(response,template,dataMap,export); } + @Override + public void exportQCResultTXT(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request, HttpServletResponse response) { + Result result = viewQCResult(sampleId, dbName, sampleFileName, gasFileName, detFileName, request); + QCResult qcResult = result.getResult(); + if (ObjectUtil.isNull(qcResult)) return; + StringBuffer strBuffer = new StringBuffer(); + strBuffer.append(System.lineSeparator()); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat("%-25s", "#QC RESULT")); + strBuffer.append(System.lineSeparator()); + String qcTitle = "%s%-24s%-21s%-10s%-9s"; + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "QC Flags", "Evaluation Metrics", "Value", "Status")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Collection Time (h)", StringUtils.isNotBlank(qcResult.getCollectTimeEvaluationMetrics())?qcResult.getCollectTimeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getCollectTimeValue())?qcResult.getCollectTimeValue():"", StringUtils.isNotBlank(qcResult.getCollectTimeStatus())?qcResult.getCollectTimeStatus():"Failed")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Acqusition Time (h)", StringUtils.isNotBlank(qcResult.getAcquisitionTimeEvaluationMetrics())?qcResult.getAcquisitionTimeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getAcquisitionTimeValue())?qcResult.getAcquisitionTimeValue():"", StringUtils.isNotBlank(qcResult.getAcquisitionTimeStatus())?qcResult.getAcquisitionTimeStatus():"Failed")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Xenon Volume (ml)", StringUtils.isNotBlank(qcResult.getXenonVolumeEvaluationMetrics())?qcResult.getXenonVolumeEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getXenonVolumeValue())?qcResult.getXenonVolumeValue():"", StringUtils.isNotBlank(qcResult.getXenonVolumeStatus())?qcResult.getXenonVolumeStatus():"Failed")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Gas Bg", StringUtils.isNotBlank(qcResult.getGasBgEvaluationMetrics())?qcResult.getGasBgEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getGasBgValue())?qcResult.getGasBgValue():"", qcResult.isGasBgValueAndStatus()?"Pass":"Failed")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "Det Bg", StringUtils.isNotBlank(qcResult.getDetBgEvaluationMetrics())?qcResult.getDetBgEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getDetBgValue())?qcResult.getDetBgValue():"", qcResult.isDetBgValueAndStatus()?"Pass":"Failed")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(rowFormat(qcTitle, StringPool.SPACE, "MDC for Xe133 (mBq/m3)", StringUtils.isNotBlank(qcResult.getXe133MDCEvaluationMetrics())?qcResult.getXe133MDCEvaluationMetrics():"", StringUtils.isNotBlank(qcResult.getXe133MDCValue())?qcResult.getXe133MDCValue():"None", StringUtils.isNotBlank(qcResult.getXe133MDCStatus())?qcResult.getXe133MDCStatus():"None")); + strBuffer.append(System.lineSeparator()); + strBuffer.append(System.lineSeparator()); + OutputStream fos = null; + try { + String fileName = sampleFileName.substring(0, sampleFileName.lastIndexOf(StringPool.DOT) - 1); + fileName = fileName + "_QC_Result.txt"; + // 设置响应类型 + response.setContentType("application/octet-stream"); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + // 解决中文不能生成文件 + response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(fileName, "UTF-8")); + fos = response.getOutputStream(); + fos.write(strBuffer.toString().getBytes()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + fos.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + @Override public Result viewRLR(Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request) { Result result = new Result(); @@ -2336,7 +2388,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 +2406,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 +2454,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 +2493,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 +2531,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 +2556,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 +2590,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 +2605,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 +2620,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 +2635,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 +3068,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 +3239,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 +3279,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 +3459,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 +3510,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); } diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/common/CalculateStationData.java b/jeecg-module-station-operation/src/main/java/org/jeecg/common/CalculateStationData.java index 4104f4b0..42561b89 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/common/CalculateStationData.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/common/CalculateStationData.java @@ -814,8 +814,6 @@ public class CalculateStationData { * @param stationInfos 台站信息列表 */ public void mutiThreadGetStationInfo(List stationInfos, RateParam mRateParam) { - // 声明当前开始执行时间 - Date startTime = new Date(); //声明一个数组用于接收最后的结果情况 Map finallySta = Objects.nonNull(redisUtil.get("dataStationInfoList"))? (Map) redisUtil.get("dataStationInfoList"):new HashMap<>(); //声明一个线程池 diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java index 30169a2d..5e8e8c85 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java @@ -1,20 +1,14 @@ package org.jeecg.common.util; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringPool; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; -import org.apache.commons.net.ftp.FTPClient; -import org.apache.commons.net.ftp.FTPFile; import org.jeecg.common.api.vo.Result; -import org.jeecg.common.constant.Prompt; -import org.jeecg.common.constant.SymbolConstant; -import org.jeecg.modules.base.enums.SampleFileHeader; import org.jeecg.common.properties.SpectrumPathProperties; +import org.jeecg.modules.base.enums.SampleFileHeader; import org.jeecg.modules.entity.data.HistogramData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/BetaSpectrum.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/BetaSpectrum.java index 502f51c1..1148d1f0 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/BetaSpectrum.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/BetaSpectrum.java @@ -8,10 +8,10 @@ import java.util.List; @Data public class BetaSpectrum implements Serializable { - private Integer numberBChannels; + private Long numberBChannels; - private Integer energySpan; + private Long energySpan; - private List bSpectrumSubBlock; + private List bSpectrumSubBlock; } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/GammaSpectrum.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/GammaSpectrum.java index 5b4b9b37..084d2ccc 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/GammaSpectrum.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/GammaSpectrum.java @@ -8,10 +8,10 @@ import java.util.List; @Data public class GammaSpectrum implements Serializable { - private Integer numberGChannels; + private Long numberGChannels; - private Integer energySpan; + private Long energySpan; - private List gSpectrumSubBlock; + private List gSpectrumSubBlock; } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/Histogram.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/Histogram.java index b520d577..95df1420 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/Histogram.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/Histogram.java @@ -8,13 +8,13 @@ import java.util.List; @Data public class Histogram implements Serializable { - private Integer BChannels; + private Long BChannels; - private Integer BEnergySpan; + private Long BEnergySpan; - private Integer GChannels; + private Long GChannels; - private Integer GEnergySpan; + private Long GEnergySpan; private List histogramSubBlock; diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java index b2a22057..7c2b498c 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.entity.GardsSampleDataWeb; import org.jeecg.modules.entity.vo.SpectrumFileRecord; diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java index 10af6b84..4e6a7cd5 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java @@ -2,9 +2,6 @@ package org.jeecg.modules.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.base.entity.postgre.SysEmailLog; -import org.jeecg.modules.entity.GardsAlertDataWeb; - -import java.util.Date; public interface SysEmailLogStatMapper extends BaseMapper { diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/native_jni/EnergySpectrumHandler.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/native_jni/EnergySpectrumHandler.java new file mode 100644 index 00000000..bb3b6681 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/native_jni/EnergySpectrumHandler.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.native_jni; + +import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; + +/** + * 能谱处理本地类 + */ +public class EnergySpectrumHandler { + + /** + * 获取能谱原始数据 + * @param path 能谱文件路径 + * @return 能谱原始数据 + */ + public static native EnergySpectrumStruct getSourceData(String path); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/native_jni/struct/EnergySpectrumStruct.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/native_jni/struct/EnergySpectrumStruct.java new file mode 100644 index 00000000..d0279728 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/native_jni/struct/EnergySpectrumStruct.java @@ -0,0 +1,555 @@ +package org.jeecg.modules.native_jni.struct; + +import lombok.Data; + +import java.util.List; + +/** + * 能谱结构体字段信息 + */ +@Data +public class EnergySpectrumStruct { +/************************* Infomations ******************/ + /** + * 消息类型 + */ + public String msg_type; + /** + * 消息id + */ + public String msg_id; + /** + * 数据类型 + */ + public String data_type; + + /************************* Header Black ******************/ + /** + * designator + */ + public String designator; + /** + * site code + */ + public String site_code; + /** + * detector code + */ + public String detector_code; + /** + * system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and + */ + public String system_type; + /** + * sample geometry + */ + public String sample_geometry; + /** + * spectrum qualifier: preliminary ( PREL )or full ( FULL) + */ + public String spectrum_quantity; + /** + * sample reference identification + */ + public String sample_ref_id; + /** + * measurement identification + */ + public String measurement_id; + /** + * detector background measurement identification + */ + public String detector_bk_measurement_id; + /** + * gas background measurement identification (memory effect) + */ + public String gas_bk_measurement_id; + /** + * transmit date (yyyy / mm / dd) + */ + public String transmit_date; + /** + * transmit time (hh : mm : ss . s) + */ + public String transmit_time; + + /************************* Sample ******************/ + public double dimension_1; + public double dimension_2; + + /************************* Comment ******************/ + public String comment; + + /************************* Acquisition Block ******************/ + /** + * acquisition start date (yyyy / mm / dd) + */ + public String acquisition_start_date; + /** + * acquisition start time (hh : mm : ss . s) + */ + public String acquisition_start_time; + /** + * acquisition real time (s) + */ + public double acquisition_real_time; + /** + * acquisition live time (s) + */ + public double acquisition_live_time; + + /************************* Collection Block ******************/ + + /** + * collection start date (yyyy / mm / dd) + */ + public String collection_start_date; + /** + * collection start time (hh : mm : ss . s) + */ + public String collection_start_time; + /** + * collection stop date (yyyy / mm / dd) + */ + public String collection_stop_date; + /** + * collection stop time (hh : mm : ss . s) + */ + public String collection_stop_time; + /** + * total air volume sampled (standard cubic meters [scm]) + */ + public double air_volume; + + /************************* Processing Block ******************/ + /** + * sample volume of Xe (cm 3 ) + */ + public double sample_volume_of_Xe; + /** + * uncertainty (cm 3 ) + */ + public double uncertainty_1; + /** + * Xe collection yield (Xe gas in sample/total Xe gas sampled) + */ + public double Xe_collection_yield; + /** + * uncertainty (Xe gas in sample/total Xe gas sampled) + */ + public double uncertainty_2; + /** + * archive bottle identification + */ + public String archive_bottle_id; + + /************************* Calibration Block ******************/ + /** + * date of last calibration (yyyy / mm / dd) + */ + public String date_calibration; + /** + * time of last calibration (hh : mm : ss) + */ + public String time_calibration; + + /************************* g_Energy Block ******************/ + /** + * γ -energy (keV) + */ + public List g_energy; + /** + * centroid channel + */ + public List g_centroid_channel; + /** + * uncertainty (channels) + */ + public List g_uncertainty; + + public int g_record_count; + + /************************* b_Energy Block ******************/ + /** + * electron energy (keV) + */ + public List b_electron_energy; + /** + * decay mode descriptor: B for β-particle, C for conversion electron (CE) + */ + public List b_decay_mode; + /** + * maximum channel of β-particle distribution or centroid channel of CE (channels) + */ + public List b_channel; + /** + * uncertainty (channels) + */ + public List b_uncertainty; + + public int b_record_count; + + /************************* g_Resolution Block ******************/ + /** + * γ -energy (keV) + */ + public List g_r_energy; + /** + * FWHM (keV) + */ + public List g_r_FWHM; + /** + * uncertainty (keV) + */ + public List g_r_uncertainty; + + public int g_r_record_count; + + /************************* b_Resolution Block ******************/ + /** + * electron energy (keV) + */ + public List b_r_electron_energy; + /** + * FWHM (keV) + */ + public List b_r_FWHM; + /** + * uncertainty (keV) + */ + public List b_r_uncertainty; + + public int b_r_record_count; + + /************************* g_Efficiency Block ******************/ + /** + * γ -energy (keV) + */ + public List g_e_energy; + /** + * efficiency (counts in peak/photon emitted) + */ + public List g_e_efficiency; + /** + * uncertainty (counts in peak/photon emitted) + */ + public List g_e_uncertainty; + + public int g_e_record_count; + + /************************* ROI_Limits Block ******************/ + /** + * ROI number + */ + public List ROI_number; + /** + * 2-D ROI β-range start, x 1 (keV) + */ + public List POI_B_x1; + /** + * 2-D ROI β-range stop, x 2 (keV) + */ + public List POI_B_x2; + /** + * 2-D ROI γ-range start, y 1 (keV) + */ + public List POI_G_y1; + /** + * 2-D ROI γ-range stop, y 2 (keV) + */ + public List POI_G_y2; + + public int roi_record_count; + + /************************* b-gEfficiency Block ******************/ + /** + * nuclide name + */ + public List bg_nuclide_name; + /** + * ROI number + */ + public List bg_ROI_number; + /** + * β-γ coincidence efficiency (counts in ROI/β-γ pair emitted) + */ + public List bg_efficiency; + /** + * uncertainty (counts in ROI/β-γ pair emitted) + */ + public List bg_uncertainty; + + public int bg_record_count; + + /************************* Ratios Block ******************/ + /** + * ratio identifier + */ + public List ratio_id; + /** + * ROI number for the higher γ -energy ROI + */ + public List ROI_num_highter_G_energy_ROI; + /** + * ROI number for the lower γ -energy ROI + */ + public List ROI_num_lower_G_energy_ROI; + /** + * Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI) + */ + public List count_ratio; + /** + * count ratio uncertainty (percent) + */ + public List count_ratio_uncertainty; + + public int ratio_record_count; + + /************************* g_Spectrum Block ******************/ + /** + * number of γ channels + */ + public long num_g_channel; + /** + * γ-energy span (keV) + */ + public long g_energy_span; + /** + * begin of channels + */ + public long g_begin_channel; + /** + * count at channel + */ + public List g_counts; + + /************************* b_Spectrum Block ******************/ + /** + * number of β -channels + */ + public long num_b_channel; + /** + * β -energy span (keV) + */ + public long b_energy_span; + /** + * begin of channels + */ + public long b_begin_channel; + /** + * counts at channels + */ + public List b_counts; + + /************************* Histogram Block ******************/ + /** + * β-channels + */ + public long b_channels; + /** + * γ-channels + */ + public long g_channels; + /** + * β-energy span + */ + public long b_h_energy_span; + /** + * γ-energy span + */ + public long g_h_energy_span; + /** + * counts at channels + */ + public List h_counts; + + /************************* Certificate_Block ******************/ + /** + * total source activity (Bq) + */ + public double total_source_activity; + /** + * assay date (yyyy / mm / dd) + */ + public String assay_date; + /** + * assay time (hh : mm : ss) + */ + public String assay_time; + /** + * units of activity: “B,” “b” for Bq or “[blank]”; if nothing, then “B” is assigned + */ + public String units_activity; + /** + * nuclide name + */ + public List nuclide_name; + /** + * half-life in seconds, hours, days, or years + */ + public List half_life_time; + /** + * time unit(Y, D, H, S) + */ + public List time_unit; + /** + * activity of nuclide at time of assay + */ + public List activity_nuclide_time_assay; + /** + * uncertainty (%) + */ + public List uncertainty; + /** + * γ-energy (keV) + */ + public List cer_g_energy; + /** + * γ-intensity (percent) + */ + public List g_intensity; + /** + * electron decay mode descriptor: B for β particle or C for conversion electron (CE), 0 for none (that is, γ-only source) + */ + public List electron_decay_mode; + /** + * maximum β-particle energy or CE energy (keV) + */ + public List maximum_energy; + /** + * intensity of β-particle (percent) + */ + public List intensity_b_particle; + + public int record_count; + + /************************* Totaleff Block ******************/ + /** + * γ-energy (keV) + */ + public List t_g_energy; + /** + * total efficiency (counts/photon emitted) + */ + public List total_efficiency; + /** + * uncertainty (counts/photon emitted) + */ + public List t_uncertainty; + + public int t_record_count; + + public EnergySpectrumStruct() { + super(); + } + + @Override + public String toString() { + return "EnergySpectrumStruct{" + + "msg_type='" + msg_type + '\'' + + ", msg_id='" + msg_id + '\'' + + ", data_type='" + data_type + '\'' + + ", designator='" + designator + '\'' + + ", site_code='" + site_code + '\'' + + ", detector_code='" + detector_code + '\'' + + ", system_type='" + system_type + '\'' + + ", sample_geometry='" + sample_geometry + '\'' + + ", spectrum_quantity='" + spectrum_quantity + '\'' + + ", sample_ref_id='" + sample_ref_id + '\'' + + ", measurement_id='" + measurement_id + '\'' + + ", detector_bk_measurement_id='" + detector_bk_measurement_id + '\'' + + ", gas_bk_measurement_id='" + gas_bk_measurement_id + '\'' + + ", transmit_date='" + transmit_date + '\'' + + ", transmit_time='" + transmit_time + '\'' + + ", comment='" + comment + '\'' + + ", acquisition_start_date='" + acquisition_start_date + '\'' + + ", acquisition_start_time='" + acquisition_start_time + '\'' + + ", acquisition_real_time=" + acquisition_real_time + + ", acquisition_live_time=" + acquisition_live_time + + ", collection_start_date='" + collection_start_date + '\'' + + ", collection_start_time='" + collection_start_time + '\'' + + ", collection_stop_date='" + collection_stop_date + '\'' + + ", collection_stop_time='" + collection_stop_time + '\'' + + ", air_volume=" + air_volume + + ", sample_volume_of_Xe=" + sample_volume_of_Xe + + ", uncertainty_1=" + uncertainty_1 + + ", Xe_collection_yield=" + Xe_collection_yield + + ", uncertainty_2=" + uncertainty_2 + + ", archive_bottle_id='" + archive_bottle_id + '\'' + + ", date_calibration='" + date_calibration + '\'' + + ", time_calibration='" + time_calibration + '\'' + + ", g_energy=" + g_energy + + ", g_centroid_channel=" + g_centroid_channel + + ", g_uncertainty=" + g_uncertainty + + ", g_record_count=" + g_record_count + + ", b_electron_energy=" + b_electron_energy + + ", b_decay_mode=" + b_decay_mode + + ", b_channel=" + b_channel + + ", b_uncertainty=" + b_uncertainty + + ", b_record_count=" + b_record_count + + ", g_r_energy=" + g_r_energy + + ", g_r_FWHM=" + g_r_FWHM + + ", g_r_uncertainty=" + g_r_uncertainty + + ", g_r_record_count=" + g_r_record_count + + ", b_r_electron_energy=" + b_r_electron_energy + + ", b_r_FWHM=" + b_r_FWHM + + ", b_r_uncertainty=" + b_r_uncertainty + + ", b_r_record_count=" + b_r_record_count + + ", g_e_energy=" + g_e_energy + + ", g_e_efficiency=" + g_e_efficiency + + ", g_e_uncertainty=" + g_e_uncertainty + + ", g_e_record_count=" + g_e_record_count + + ", ROI_number=" + ROI_number + + ", POI_B_x1=" + POI_B_x1 + + ", POI_B_x2=" + POI_B_x2 + + ", POI_G_y1=" + POI_G_y1 + + ", POI_G_y2=" + POI_G_y2 + + ", roi_record_count=" + roi_record_count + + ", bg_nuclide_name=" + bg_nuclide_name + + ", bg_ROI_number=" + bg_ROI_number + + ", bg_efficiency=" + bg_efficiency + + ", bg_uncertainty=" + bg_uncertainty + + ", bg_record_count=" + bg_record_count + + ", ratio_id=" + ratio_id + + ", ROI_num_highter_G_energy_ROI=" + ROI_num_highter_G_energy_ROI + + ", ROI_num_lower_G_energy_ROI=" + ROI_num_lower_G_energy_ROI + + ", count_ratio=" + count_ratio + + ", count_ratio_uncertainty=" + count_ratio_uncertainty + + ", ratio_record_count=" + ratio_record_count + + ", num_g_channel=" + num_g_channel + + ", g_energy_span=" + g_energy_span + + ", g_begin_channel=" + g_begin_channel + + ", g_counts=" + g_counts + + ", num_b_channel=" + num_b_channel + + ", b_energy_span=" + b_energy_span + + ", b_begin_channel=" + b_begin_channel + + ", b_counts=" + b_counts + + ", b_channels=" + b_channels + + ", g_channels=" + g_channels + + ", b_h_energy_span=" + b_h_energy_span + + ", g_h_energy_span=" + g_h_energy_span + + ", h_counts=" + h_counts + + ", total_source_activity=" + total_source_activity + + ", assay_date='" + assay_date + '\'' + + ", assay_time='" + assay_time + '\'' + + ", units_activity='" + units_activity + '\'' + + ", nuclide_name=" + nuclide_name + + ", half_life_time=" + half_life_time + + ", time_unit=" + time_unit + + ", activity_nuclide_time_assay=" + activity_nuclide_time_assay + + ", uncertainty=" + uncertainty + + ", cer_g_energy=" + cer_g_energy + + ", g_intensity=" + g_intensity + + ", electron_decay_mode=" + electron_decay_mode + + ", maximum_energy=" + maximum_energy + + ", intensity_b_particle=" + intensity_b_particle + + ", record_count=" + record_count + + '}'; + } + + public static void main(String[] args) { + EnergySpectrumStruct s = new EnergySpectrumStruct(); + System.out.println(s); + System.out.println(s.gas_bk_measurement_id); + } +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java index 66d4af30..52ca749c 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java @@ -1,7 +1,6 @@ package org.jeecg.modules.service; import com.baomidou.mybatisplus.extension.service.IService; -import io.swagger.models.auth.In; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.entity.GardsSampleDataWeb; diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java index 736ece6d..7d866cb8 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java @@ -2,6 +2,7 @@ package org.jeecg.modules.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.base.entity.postgre.SysEmailLog; + import java.util.Date; public interface ISysEmailLogStatService extends IService { diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java index e6f90467..024d972b 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java @@ -18,6 +18,7 @@ import org.jeecg.modules.service.IGardsMetDataService; import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.entity.ExportParams; import org.springframework.stereotype.Service; + import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java index a861f26f..4b2eee65 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java @@ -20,12 +20,15 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.common.properties.ParameterProperties; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.util.*; -import org.jeecg.modules.base.enums.SampleFileHeader; -import org.jeecg.modules.base.entity.original.*; +import org.jeecg.modules.base.entity.original.GardsSampleAux; +import org.jeecg.modules.base.entity.original.GardsSampleData; +import org.jeecg.modules.base.entity.original.GardsSampleDescription; import org.jeecg.modules.entity.GardsSampleDataWeb; import org.jeecg.modules.entity.data.*; import org.jeecg.modules.entity.vo.SpectrumFileRecord; import org.jeecg.modules.mapper.*; +import org.jeecg.modules.native_jni.EnergySpectrumHandler; +import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; import org.jeecg.modules.service.IGardsSampleDataWebService; import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -37,7 +40,6 @@ import java.io.*; import java.net.URLEncoder; import java.text.ParseException; import java.util.*; -import java.util.stream.Collectors; import static org.jeecg.modules.base.enums.PageType.*; @@ -138,32 +140,43 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl gEnergySubBlock = null; - LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G"); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); - calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); - List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); - gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ +// LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G"); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); +// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); +// List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); +// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sourceData.g_energy) && CollectionUtils.isNotEmpty(sourceData.g_centroid_channel) && CollectionUtils.isNotEmpty(sourceData.g_uncertainty)){ gEnergySubBlock = new LinkedList<>(); - for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + for (int i=0; i bEnergySubBlock = null; - LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B"); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); - calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); - List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); - gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ +// LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B"); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); +// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); +// List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); +// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sourceData.b_electron_energy) && CollectionUtils.isNotEmpty(sourceData.b_channel) && CollectionUtils.isNotEmpty(sourceData.b_uncertainty) && CollectionUtils.isNotEmpty(sourceData.b_decay_mode)){ bEnergySubBlock = new LinkedList<>(); - for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + for (int i=0; i gResolutionSubBlock = null; - LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G"); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); - calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); - List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); - gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ +// LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G"); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); +// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); +// List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); +// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sourceData.g_r_energy) && CollectionUtils.isNotEmpty(sourceData.g_r_FWHM) && CollectionUtils.isNotEmpty(sourceData.g_r_uncertainty)){ gResolutionSubBlock = new LinkedList<>(); - for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + for (int i=0; i bResolutionSubBlock = null; - LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B"); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); - calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); - List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); - gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ +// LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B"); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); +// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); +// List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); +// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sourceData.b_r_electron_energy) && CollectionUtils.isNotEmpty(sourceData.b_r_FWHM) && CollectionUtils.isNotEmpty(sourceData.b_r_uncertainty)){ bResolutionSubBlock = new LinkedList<>(); - for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + for (int i=0; i gEfficiencySubBlock = null; - LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G"); - calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); - calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); - List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); - gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ +// LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G"); +// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); +// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint); +// List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); +// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(sourceData.g_e_energy) && CollectionUtils.isNotEmpty(sourceData.g_e_efficiency) && CollectionUtils.isNotEmpty(sourceData.g_e_uncertainty)){ gEfficiencySubBlock = new LinkedList<>(); - for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + for (int i=0; i bgEfficiencySubBlock = null; - LambdaQueryWrapper bgEfficiencyPairsQueryWrapper = new LambdaQueryWrapper<>(); - bgEfficiencyPairsQueryWrapper.eq(GardsBgEfficiencyPairs::getSampleId, sampleId); - List gardsBgEfficiencyPairs = gardsBgEfficiencyPairsMapper.selectList(bgEfficiencyPairsQueryWrapper); - if (CollectionUtils.isNotEmpty(gardsBgEfficiencyPairs)){ +// LambdaQueryWrapper bgEfficiencyPairsQueryWrapper = new LambdaQueryWrapper<>(); +// bgEfficiencyPairsQueryWrapper.eq(GardsBgEfficiencyPairs::getSampleId, sampleId); +// List gardsBgEfficiencyPairs = gardsBgEfficiencyPairsMapper.selectList(bgEfficiencyPairsQueryWrapper); + if (CollectionUtils.isNotEmpty(sourceData.bg_ROI_number) && CollectionUtils.isNotEmpty(sourceData.bg_nuclide_name) && CollectionUtils.isNotEmpty(sourceData.bg_efficiency) && CollectionUtils.isNotEmpty(sourceData.bg_uncertainty)){ bgEfficiencySubBlock = new LinkedList<>(); - for (GardsBgEfficiencyPairs pairs:gardsBgEfficiencyPairs) { + for (int i=0; i roiLimitsSubBlock = null; - LambdaQueryWrapper roiLimitsQueryWrapper = new LambdaQueryWrapper<>(); - roiLimitsQueryWrapper.eq(GardsRoiLimits::getSampleId, sampleId); - roiLimitsQueryWrapper.orderByAsc(GardsRoiLimits::getRoi); - List gardsRoiLimitsList = gardsRoiLimitsMapper.selectList(roiLimitsQueryWrapper); - if (CollectionUtils.isNotEmpty(gardsRoiLimitsList)){ +// LambdaQueryWrapper roiLimitsQueryWrapper = new LambdaQueryWrapper<>(); +// roiLimitsQueryWrapper.eq(GardsRoiLimits::getSampleId, sampleId); +// roiLimitsQueryWrapper.orderByAsc(GardsRoiLimits::getRoi); +// List gardsRoiLimitsList = gardsRoiLimitsMapper.selectList(roiLimitsQueryWrapper); + if (CollectionUtils.isNotEmpty(sourceData.ROI_number) && CollectionUtils.isNotEmpty(sourceData.POI_B_x1) && CollectionUtils.isNotEmpty(sourceData.POI_B_x2) && CollectionUtils.isNotEmpty(sourceData.POI_G_y1) && CollectionUtils.isNotEmpty(sourceData.POI_G_y2)){ roiLimitsSubBlock = new LinkedList<>(); - for (GardsRoiLimits roiLimits:gardsRoiLimitsList) { + for (int i=0; i ratiosSubBlock = null; - LambdaQueryWrapper ratiosQueryWrapper = new LambdaQueryWrapper<>(); - ratiosQueryWrapper.eq(GardsSampleRatios::getSampleId, sampleId); - ratiosQueryWrapper.orderByAsc(GardsSampleRatios::getRatioId); - List sampleRatiosList = gardsSampleRatiosMapper.selectList(ratiosQueryWrapper); - if (CollectionUtils.isNotEmpty(sampleRatiosList)){ +// LambdaQueryWrapper ratiosQueryWrapper = new LambdaQueryWrapper<>(); +// ratiosQueryWrapper.eq(GardsSampleRatios::getSampleId, sampleId); +// ratiosQueryWrapper.orderByAsc(GardsSampleRatios::getRatioId); +// List sampleRatiosList = gardsSampleRatiosMapper.selectList(ratiosQueryWrapper); + if (CollectionUtils.isNotEmpty(sourceData.count_ratio) && CollectionUtils.isNotEmpty(sourceData.ratio_id) && CollectionUtils.isNotEmpty(sourceData.count_ratio_uncertainty) && CollectionUtils.isNotEmpty(sourceData.ROI_num_lower_G_energy_ROI) && CollectionUtils.isNotEmpty(sourceData.ROI_num_highter_G_energy_ROI)){ ratiosSubBlock = new LinkedList<>(); - for (GardsSampleRatios sampleRatios:sampleRatiosList) { + for (int i=0; i spectrumQueryWrapper = new LambdaQueryWrapper<>(); - spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "G"); - spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId); - GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper); - if (Objects.nonNull(gardsSpectrum)){ +// LambdaQueryWrapper spectrumQueryWrapper = new LambdaQueryWrapper<>(); +// spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "G"); +// spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId); +// GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper); + if (Objects.nonNull(sourceData)){ gSpectrumBlock = new GammaSpectrum(); - Map map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.GSPECTRUM.getMessage()); - List gSpectrumSubBlock = new LinkedList<>(); - if (CollectionUtils.isNotEmpty(map)){ - gSpectrumSubBlock = (List)map.get(SampleFileHeader.GSPECTRUM.getMessage()); +// Map map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.GSPECTRUM.getMessage()); +// List gSpectrumSubBlock = new LinkedList<>(); +// if (CollectionUtils.isNotEmpty(map)){ +// gSpectrumSubBlock = (List)map.get(SampleFileHeader.GSPECTRUM.getMessage()); +// } + gSpectrumBlock.setGSpectrumSubBlock(sourceData.g_counts); + if (Objects.nonNull(sourceData.g_energy_span)){ + gSpectrumBlock.setEnergySpan(sourceData.g_energy_span); } - gSpectrumBlock.setGSpectrumSubBlock(gSpectrumSubBlock); - if (Objects.nonNull(gardsSpectrum.getEnergySpan())){ - gSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan()); - } - if (Objects.nonNull(gardsSpectrum.getChannels())){ - gSpectrumBlock.setNumberGChannels(gardsSpectrum.getChannels()); + if (Objects.nonNull(sourceData.num_g_channel)){ + gSpectrumBlock.setNumberGChannels(sourceData.num_g_channel); } } report.setGSpectrumBlock(gSpectrumBlock); } - private void findBSpectrum(Integer sampleId, Report report) { + private void findBSpectrum(EnergySpectrumStruct sourceData, Report report) { BetaSpectrum bSpectrumBlock = null; - LambdaQueryWrapper spectrumQueryWrapper = new LambdaQueryWrapper<>(); - spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "B"); - spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId); - GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper); - if (Objects.nonNull(gardsSpectrum)){ +// LambdaQueryWrapper spectrumQueryWrapper = new LambdaQueryWrapper<>(); +// spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "B"); +// spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId); +// GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper); + if (Objects.nonNull(sourceData)){ bSpectrumBlock = new BetaSpectrum(); - Map map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.BSPECTRUM.getMessage()); - List bSpectrumSubBlock = new LinkedList<>(); - if (CollectionUtils.isNotEmpty(map)) { - bSpectrumSubBlock = (List)map.get(SampleFileHeader.BSPECTRUM.getMessage()); +// Map map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.BSPECTRUM.getMessage()); +// List bSpectrumSubBlock = new LinkedList<>(); +// if (CollectionUtils.isNotEmpty(map)) { +// bSpectrumSubBlock = (List)map.get(SampleFileHeader.BSPECTRUM.getMessage()); +// } + bSpectrumBlock.setBSpectrumSubBlock(sourceData.b_counts); + if (Objects.nonNull(sourceData.b_energy_span)){ + bSpectrumBlock.setEnergySpan(sourceData.b_energy_span); } - bSpectrumBlock.setBSpectrumSubBlock(bSpectrumSubBlock); - if (Objects.nonNull(gardsSpectrum.getEnergySpan())){ - bSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan()); - } - if (Objects.nonNull(gardsSpectrum.getChannels())){ - bSpectrumBlock.setNumberBChannels(gardsSpectrum.getChannels()); + if (Objects.nonNull(sourceData.num_b_channel)){ + bSpectrumBlock.setNumberBChannels(sourceData.num_b_channel); } } report.setBSpectrumBlock(bSpectrumBlock); } - private void findHistogram(Integer sampleId, Report report) { + private void findHistogram(EnergySpectrumStruct sourceData, Report report) { Histogram histogramBlock = null; - LambdaQueryWrapper histogramQueryWrapper = new LambdaQueryWrapper<>(); - histogramQueryWrapper.eq(GardsHistogram::getSampleId, sampleId); - GardsHistogram gardsHistogram = gardsHistogramMapper.selectOne(histogramQueryWrapper); - if (Objects.nonNull(gardsHistogram)){ +// LambdaQueryWrapper histogramQueryWrapper = new LambdaQueryWrapper<>(); +// histogramQueryWrapper.eq(GardsHistogram::getSampleId, sampleId); +// GardsHistogram gardsHistogram = gardsHistogramMapper.selectOne(histogramQueryWrapper); + if (Objects.nonNull(sourceData)){ histogramBlock = new Histogram(); - Map map = readLineUtil.readLine(gardsHistogram.getFilename(), SampleFileHeader.HISTOGRAM.getMessage()); - List histogramSubBlock = new LinkedList<>(); - if (CollectionUtils.isNotEmpty(map)) { - histogramSubBlock = (List)map.get(SampleFileHeader.HISTOGRAM.getMessage()); - } + List histogramSubBlock = readValue(sourceData); +// Map map = readLineUtil.readLine(gardsHistogram.getFilename(), SampleFileHeader.HISTOGRAM.getMessage()); +// List histogramSubBlock = new LinkedList<>(); +// if (CollectionUtils.isNotEmpty(map)) { +// histogramSubBlock = (List)map.get(SampleFileHeader.HISTOGRAM.getMessage()); +// } histogramBlock.setHistogramSubBlock(histogramSubBlock); - if (Objects.nonNull(gardsHistogram.getBChannels())){ - histogramBlock.setBChannels(gardsHistogram.getBChannels()); + if (Objects.nonNull(sourceData.b_channels)){ + histogramBlock.setBChannels(sourceData.b_channels); } - if (Objects.nonNull(gardsHistogram.getBEnergySpan())){ - histogramBlock.setBEnergySpan(gardsHistogram.getBEnergySpan()); + if (Objects.nonNull(sourceData.b_h_energy_span)){ + histogramBlock.setBEnergySpan(sourceData.b_h_energy_span); } - if (Objects.nonNull(gardsHistogram.getGChannels())){ - histogramBlock.setGChannels(gardsHistogram.getGChannels()); + if (Objects.nonNull(sourceData.g_channels)){ + histogramBlock.setGChannels(sourceData.g_channels); } - if (Objects.nonNull(gardsHistogram.getGEnergySpan())){ - histogramBlock.setGEnergySpan(gardsHistogram.getGEnergySpan()); + if (Objects.nonNull(sourceData.g_h_energy_span)){ + histogramBlock.setGEnergySpan(sourceData.g_h_energy_span); } } report.setHistogramBlock(histogramBlock); } - private void findCertificate(Integer sampleId, Report report) { + private void findCertificate(EnergySpectrumStruct sourceData, Report report) { Certificate certificateBlock = null; - LambdaQueryWrapper sampleCertQueryWrapper = new LambdaQueryWrapper<>(); - sampleCertQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId); - GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper); - if (Objects.nonNull(gardsSampleCert)) { - certificateBlock = new Certificate(); - if (Objects.nonNull(gardsSampleCert.getQuantity())){ - certificateBlock.setTotalSourceActivity(gardsSampleCert.getQuantity()); - } - if (Objects.nonNull(gardsSampleCert.getAssayDate())){ - certificateBlock.setAssayDate(DateUtils.formatDate(gardsSampleCert.getAssayDate(), "yyyy-MM-dd HH:mm:ss")); - } - - if (StringUtils.isNotBlank(gardsSampleCert.getUnit())){ - certificateBlock.setUnitsOfActivity(gardsSampleCert.getUnit()); - } - } - LambdaQueryWrapper sampleCertLineQueryWrapper = new LambdaQueryWrapper<>(); - sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId); - List gardsSampleCertLines = gardsSampleCertLineMapper.selectList(sampleCertLineQueryWrapper); - if (CollectionUtils.isNotEmpty(gardsSampleCertLines)) { - if (Objects.isNull(certificateBlock)){ +// LambdaQueryWrapper sampleCertQueryWrapper = new LambdaQueryWrapper<>(); +// sampleCertQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId); +// GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper); + try { + if (Objects.nonNull(sourceData)) { certificateBlock = new Certificate(); + if (Objects.nonNull(sourceData.total_source_activity)){ + certificateBlock.setTotalSourceActivity(sourceData.total_source_activity); + } + if (StringUtils.isNotBlank(sourceData.assay_date) && StringUtils.isNotBlank(sourceData.assay_time)){ + Date assayDate = DateUtils.parseDate(sourceData.assay_date + " " + sourceData.assay_time); + certificateBlock.setAssayDate(DateUtils.formatDate(assayDate, "yyyy-MM-dd HH:mm:ss")); + } + + if (StringUtils.isNotBlank(sourceData.units_activity)){ + certificateBlock.setUnitsOfActivity(sourceData.units_activity); + } } - List certificateSubBlock = new LinkedList<>(); - for (GardsSampleCertLine sampleCertLine:gardsSampleCertLines) { - CertificateLine certificateLine = new CertificateLine(); - if (StringUtils.isNotBlank(sampleCertLine.getNuclName())){ - certificateLine.setNuclideName(sampleCertLine.getNuclName()); +// LambdaQueryWrapper sampleCertLineQueryWrapper = new LambdaQueryWrapper<>(); +// sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId); +// List gardsSampleCertLines = gardsSampleCertLineMapper.selectList(sampleCertLineQueryWrapper); + if (CollectionUtils.isNotEmpty(sourceData.nuclide_name) && CollectionUtils.isNotEmpty(sourceData.half_life_time) && CollectionUtils.isNotEmpty(sourceData.activity_nuclide_time_assay) + && CollectionUtils.isNotEmpty(sourceData.uncertainty) && CollectionUtils.isNotEmpty(sourceData.cer_g_energy) && CollectionUtils.isNotEmpty(sourceData.g_intensity) + && CollectionUtils.isNotEmpty(sourceData.electron_decay_mode) && CollectionUtils.isNotEmpty(sourceData.maximum_energy) && CollectionUtils.isNotEmpty(sourceData.intensity_b_particle)) { + if (Objects.isNull(certificateBlock)){ + certificateBlock = new Certificate(); } - if (StringUtils.isNotBlank(sampleCertLine.getHalflife())){ - certificateLine.setHalfLife(sampleCertLine.getHalflife()); + List certificateSubBlock = new LinkedList<>(); + for (int i=0; i readValue(EnergySpectrumStruct sourceData) { + List result = new LinkedList<>(); + if (CollectionUtils.isNotEmpty(sourceData.h_counts) && Objects.nonNull(sourceData.g_channels) && Objects.nonNull(sourceData.b_channels)) { + for (int i=0; i subList = sourceData.h_counts.subList((int) (i * sourceData.b_channels), (int) ((i + 1) * sourceData.b_channels)); + if (!"0".equals(String.valueOf(subList.get(j)))){ + HistogramData histogramData = new HistogramData(); + histogramData.setG(i); + histogramData.setB(j); + histogramData.setC(subList.get(j).intValue()); + result.add(histogramData); + } + } + } + } + return result; } @Override diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java index fa823cf0..cd9ce9fe 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java @@ -7,7 +7,6 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.apache.commons.codec.language.bm.Lang; import org.apache.poi.ss.usermodel.Workbook; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result;