From 862db910809bd287bce9afafe10bc0a18e57d1e2 Mon Sep 17 00:00:00 2001 From: nieziyan Date: Fri, 10 Nov 2023 20:17:24 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E9=87=8D=E6=96=B0=E7=BC=96?= =?UTF-8?q?=E5=86=99save?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/modules/base/dto/Calibration.java | 11 + .../modules/base/dto/ROIResultsStrDto.java | 66 +++ .../modules/base/dto/XeResultsStrDto.java | 35 ++ .../resources/excelTemplate/SaveExcel.xls | Bin 29696 -> 26624 bytes .../resources/excelTemplate/SaveHtml.html | 67 +-- .../SpectrumAnalysesController.java | 8 +- .../service/ISpectrumAnalysisService.java | 4 +- .../impl/SpectrumAnalysisServiceImpl.java | 438 +++++++++++++++++- 8 files changed, 564 insertions(+), 65 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java new file mode 100644 index 00000000..5f739322 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/Calibration.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; + +@Data +public class Calibration { + + private String beta; + + private String gamma; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java new file mode 100644 index 00000000..4eff1545 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsStrDto.java @@ -0,0 +1,66 @@ +package org.jeecg.modules.base.dto; + +import cn.hutool.core.util.ObjectUtil; +import lombok.Data; +import org.jeecg.common.util.NumUtil; + +@Data +public class ROIResultsStrDto { + + /** + * 感兴趣区ID号 + */ + private Integer roi; + + + /** + * 样品谱感兴趣区总计数 + */ + private Double sGross; + + /** + * 气体本底谱感兴趣区总计数 + */ + private Double gGross; + + /** + * 探测器本底谱感兴趣区总计数 + */ + private Double bGross; + + /** + * 感兴趣区净计数 + */ + private Double net; + + /** + * 感兴趣区净计数不确定度 + */ + private Double netErr; + + /** + * 感兴趣区活度浓度 + */ + private Double conc; + + /** + * 感兴趣区活度浓度不确定度 + */ + private Double concErr; + + /** + * 感兴趣区LC + */ + private String lc; + + private String lcCts = ""; + + /** + * 感兴趣区MDC + */ + private String mdc; + + private String netCount; + + private String concStr; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java new file mode 100644 index 00000000..754f8261 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsStrDto.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; +import org.jeecg.common.util.NumUtil; + +@Data +public class XeResultsStrDto { + /** + * 核素名称 + */ + private String nuclideName; + /** + * 感兴趣区活度浓度 + */ + private Double conc; + + /** + * 感兴趣区活度浓度不确定度 + */ + private Double concErr; + /** + * 感兴趣区MDC + */ + private String mdc; + /** + * 感兴趣区LC + */ + private String lc; + /** + * 感兴趣区识别标示;1:识别到,0,未识别到 + */ + private Integer nidFlag; + + private String concStr; +} diff --git a/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls b/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls index 22c3e55673c9db9e4c0cbcc2ddd5535c31977ab9..80e4219c429c054ded1428aa52320c68298d0cd8 100644 GIT binary patch delta 3163 zcmaJ@T})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*x + + +   @@ -116,13 +112,9 @@ New Beta New Gamma - - CH(x) = ([[${betaCalibrationSEC.coeff1}]])+([[${betaCalibrationSEC.coeff2}]])*x+([[${betaCalibrationSEC.coeff3}]])x*x - CH(x) = ([[${gammaCalibrationSEC.coeff1}]])+([[${gammaCalibrationSEC.coeff2}]])*x+([[${gammaCalibrationSEC.coeff3}]])x*x - - - E(x) = ([[${betaCalibrationSCE.coeff1}]])+([[${betaCalibrationSCE.coeff2}]])*x+([[${betaCalibrationSCE.coeff3}]])x*x - E(x) = ([[${gammaCalibrationSCE.coeff1}]])+([[${gammaCalibrationSCE.coeff2}]])*x+([[${gammaCalibrationSCE.coeff3}]])x*x + + +   @@ -150,13 +142,9 @@ Old Beta Old Gamma - - CH(x) = (?1)+(?2)*x+(?3)x*x - CH(x) = (?1)+(?2)*x+(?3)x*x - - - E(x) = (?1)+(?2)*x+(?3)x*x - E(x) = (?1)+(?2)*x+(?3)x*x + + +   @@ -168,13 +156,9 @@ New Beta New Gamma - - CH(x) = ([[${betaCalibrationDEC.coeff1}]])+([[${betaCalibrationDEC.coeff2}]])*x+([[${betaCalibrationDEC.coeff3}]])x*x - CH(x) = ([[${gammaCalibrationDEC.coeff1}]])+([[${gammaCalibrationDEC.coeff2}]])*x+([[${gammaCalibrationDEC.coeff3}]])x*x - - - E(x) = ([[${betaCalibrationDCE.coeff1}]])+([[${betaCalibrationDCE.coeff2}]])*x+([[${betaCalibrationDCE.coeff3}]])x*x - E(x) = ([[${gammaCalibrationDCE.coeff1}]])+([[${gammaCalibrationDCE.coeff2}]])*x+([[${gammaCalibrationDCE.coeff3}]])x*x + + +   @@ -203,13 +187,9 @@ Old Beta Old Gamma - - CH(x) = (?1)+(?2)*x+(?3)x*x - CH(x) = (?1)+(?2)*x+(?3)x*x - - - E(x) = (?1)+(?2)*x+(?3)x*x - E(x) = (?1)+(?2)*x+(?3)x*x + + +   @@ -221,13 +201,9 @@ New Beta New Gamma - - CH(x) = ([[${betaCalibrationGEC.coeff1}]])+([[${betaCalibrationGEC.coeff2}]])*x+([[${betaCalibrationGEC.coeff3}]])x*x - CH(x) = ([[${gammaCalibrationGEC.coeff1}]])+([[${gammaCalibrationGEC.coeff2}]])*x+([[${gammaCalibrationGEC.coeff3}]])x*x - - - E(x) = ([[${betaCalibrationGCE.coeff1}]])+([[${betaCalibrationGCE.coeff2}]])*x+([[${betaCalibrationGCE.coeff3}]])x*x - E(x) = ([[${gammaCalibrationGCE.coeff1}]])+([[${gammaCalibrationGCE.coeff2}]])*x+([[${gammaCalibrationGCE.coeff3}]])x*x + + +   @@ -276,6 +252,7 @@ +   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 30d48380..312732e4 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 @@ -227,14 +227,14 @@ public class SpectrumAnalysesController { @PostMapping("saveToHTML") public void saveToHTML(HttpServletRequest request, HttpServletResponse response, - @RequestBody BgDataAnlyseResultIn anlyseResultIn){ - spectrumAnalysisService.saveToHTML(anlyseResultIn, request, response); + @RequestBody RRRLogInfo rrrLogInfo){ + spectrumAnalysisService.saveToHTML(rrrLogInfo, request, response); } @PostMapping("saveToExcel") public void saveToExcel(HttpServletRequest request, HttpServletResponse response, - @RequestBody BgDataAnlyseResultIn anlyseResultIn){ - spectrumAnalysisService.saveToExcel(anlyseResultIn, request, response); + @RequestBody RRRLogInfo rrrLogInfo){ + spectrumAnalysisService.saveToExcel(rrrLogInfo, request, response); } @PostMapping("saveToTxt") 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 32baead2..9a57ecc5 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 @@ -80,9 +80,9 @@ public interface ISpectrumAnalysisService { Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request); - void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response); + void saveToHTML(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response); - void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response); + void saveToExcel(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response); void saveToTxt(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response); } 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 79d1d436..7325feff 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 @@ -3,7 +3,6 @@ package org.jeecg.modules.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.ListUtil; -import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; @@ -15,8 +14,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.cache.Cache; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.net.ftp.FTP; -import org.apache.commons.net.ftp.FTPClient; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; @@ -30,10 +27,7 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.*; import org.jeecg.modules.base.abstracts.AbstractLogOrReport; import org.jeecg.modules.base.bizVo.BetaRLR; -import org.jeecg.modules.base.dto.ESStructDto; -import org.jeecg.modules.base.dto.ROIChannelsDto; -import org.jeecg.modules.base.dto.ROIResultsDto; -import org.jeecg.modules.base.dto.XeResultsDto; +import org.jeecg.modules.base.dto.*; import org.jeecg.modules.base.entity.configuration.GardsDetectors; import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.base.entity.rnman.*; @@ -65,7 +59,6 @@ import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; -import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path; import static org.jeecg.modules.base.enums.ExportTemplate.*; @Service("spectrumAnalysisService") @@ -3690,17 +3683,434 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements return analyze; } + private Map exportDataNew(RRRLogInfo rrrLogInfo){ + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = sysUser.getUsername(); + Map result = new HashMap<>(); + //获取本地缓存 + Cache cache = betaCache.getBetaCache(); + BetaDataFile betaDataFile = cache.getIfPresent(rrrLogInfo.getSampleFileName() + "-" + username); + if (Objects.isNull(betaDataFile)) { + return result; + } + GardsCalibrationSpectrum gammaCalibrationParamS = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamD = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamES = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamEG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum gammaCalibrationParamED = new GardsCalibrationSpectrum(); + + GardsCalibrationSpectrum betaCalibrationParamS = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamD = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamES = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamEG = new GardsCalibrationSpectrum(); + GardsCalibrationSpectrum betaCalibrationParamED = new GardsCalibrationSpectrum(); + + StringBuffer strBuffer = new StringBuffer(); + //判断 + if (betaDataFile.isSaveAnalysisResult()) { + //对分析后的内容进行数据获取 + List channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList(); + List roiChannelsSpectrumsSample = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("S")).collect(Collectors.toList()); + List roiChannelsSpectrumsGas = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("G")).collect(Collectors.toList()); + List roiChannelsSpectrumsDet = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("D")).collect(Collectors.toList()); + List resultsSpectrums = betaDataFile.getRoiResultsSpectrumList(); + List xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList(); + for (int i=0; i gammaCalibrationParamList = betaDataFile.getGammaCalibrationSpectrumList(); + List gammaCalibrationSpectrumEList = betaDataFile.getGammaCalibrationSpectrumEList(); + for (int i=0; i betaCalibrationParamList = betaDataFile.getBetaCalibrationSpectrumList(); + List betaCalibrationSpectrumEList = betaDataFile.getBetaCalibrationSpectrumEList(); + for (int i=0; i samplOldCalibrations = new ArrayList<>(); + Calibration samplOldCalibrationCH = new Calibration(); + Calibration samplOldCalibrationE = new Calibration(); + if (betaDataFile.isBBetaEnergyValidSample() || betaDataFile.isBGammaEnergyValidSample()){ + if (betaDataFile.isBBetaEnergyValidSample()) { + samplOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidSample()) { + samplOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBBetaEnergyValidSample()) { + samplOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidSample()) { + samplOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + } else { + samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + samplOldCalibrations.add(samplOldCalibrationCH); + samplOldCalibrations.add(samplOldCalibrationE); + result.put("samplOldCalibrations",samplOldCalibrations); + + // #SAMPLE New CALIBRATION + List samplNewCalibrations = new ArrayList<>(); + Calibration samplNewCalibrationCH = new Calibration(); + Calibration samplNewCalibrationE = new Calibration(); + samplNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3()))) + +")x*x"); + samplNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3()))) + +")x*x"); + samplNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3()))) + +")x*x"); + samplNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3()))) + +")x*x"); + samplNewCalibrations.add(samplNewCalibrationCH); + samplNewCalibrations.add(samplNewCalibrationE); + result.put("samplNewCalibrations",samplNewCalibrations); + + // #SAMPLE: LIMITS PER ROI + List roiChannelsDtosS = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsSample) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannels, roiChannelsDto); + roiChannelsDto.shift(); + roiChannelsDtosS.add(roiChannelsDto); + } + result.put("roiChannelsS",roiChannelsDtosS); + + /* + * DET + * */ + // #DET Old CALIBRATION + List detOldCalibrations = new ArrayList<>(); + Calibration detOldCalibrationCH = new Calibration(); + Calibration detOldCalibrationE = new Calibration(); + if (betaDataFile.isBBetaEnergyValidDet() || betaDataFile.isBGammaEnergyValidDet()){ + if (betaDataFile.isBBetaEnergyValidDet()) { + detOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidDet()) { + detOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBBetaEnergyValidDet()) { + detOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidDet()) { + detOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + } else { + detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + detOldCalibrations.add(detOldCalibrationCH); + detOldCalibrations.add(detOldCalibrationE); + result.put("detOldCalibrations", detOldCalibrations); + + // DET New CALIBRATION + List detNewCalibrations = new ArrayList<>(); + Calibration detNewCalibrationCH = new Calibration(); + Calibration detNewCalibrationE = new Calibration(); + detNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3()))) + +")x*x"); + detNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3()))) + +")x*x"); + detNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3()))) + +")x*x"); + detNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3()))) + +")x*x"); + detNewCalibrations.add(detNewCalibrationCH); + detNewCalibrations.add(detNewCalibrationE); + result.put("detNewCalibrations", detNewCalibrations); + + // DET: LIMITS PER ROI + List roiChannelsDtosD = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsDet) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannels, roiChannelsDto); + roiChannelsDto.shift(); + roiChannelsDtosD.add(roiChannelsDto); + } + result.put("roiChannelsD",roiChannelsDtosD); + + /* + * GAS + * */ + // #GAS Old CALIBRATION + List gasOldCalibrations = new ArrayList<>(); + Calibration gasOldCalibrationCH = new Calibration(); + Calibration gasOldCalibrationE = new Calibration(); + if (betaDataFile.isBBetaEnergyValidGas() || betaDataFile.isBGammaEnergyValidGas()){ + if (betaDataFile.isBBetaEnergyValidGas()) { + gasOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2)))); + } else { + gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidGas()) { + gasOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2)))); + } else { + gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBBetaEnergyValidGas()) { + gasOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2)))); + } else { + gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + if (betaDataFile.isBGammaEnergyValidGas()) { + gasOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2)))); + } else { + gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + } else { + gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x"); + gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x"); + gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x"); + gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x"); + } + gasOldCalibrations.add(gasOldCalibrationCH); + gasOldCalibrations.add(gasOldCalibrationE); + result.put("gasOldCalibrations",gasOldCalibrations); + + // #GAS New CALIBRATION + List gasNewCalibrations = new ArrayList<>(); + Calibration gasNewCalibrationCH = new Calibration(); + Calibration gasNewCalibrationE = new Calibration(); + gasNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3()))) + +")x*x"); + gasNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3()))) + +")x*x"); + gasNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1()))) + +")+("+ (Objects.isNull(betaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2()))) + +")*x+("+ (Objects.isNull(betaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3()))) + +")x*x"); + gasNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1()))) + +")+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2()))) + +")*x+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3()))) + +")x*x"); + gasNewCalibrations.add(gasNewCalibrationCH); + gasNewCalibrations.add(gasNewCalibrationE); + result.put("gasNewCalibrations",gasNewCalibrations); + + // #GAS: LIMITS PER ROI + List roiChannelsDtosG = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsGas) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannels, roiChannelsDto); + roiChannelsDto.shift(); + roiChannelsDtosG.add(roiChannelsDto); + } + result.put("roiChannelsG",roiChannelsDtosG); + + /* + * GardsROIResultsSpectrum + * */ + // #GROSS COUNTS PER ROI + // #NET COUNTS AND LC PER ROI + // #CONCENTRATION AND LC PER ROI + List roiResults = new ArrayList<>(); + for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums) { + ROIResultsStrDto roiResultsStrDto = new ROIResultsStrDto(); + roiResultsStrDto.setRoi(resultsSpectrum.getRoi()); + roiResultsStrDto.setSGross(resultsSpectrum.getSGross()); + roiResultsStrDto.setGGross(resultsSpectrum.getGGross()); + roiResultsStrDto.setBGross(resultsSpectrum.getBGross()); + roiResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc()))); + roiResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc()))); + if (betaDataFile.isBProcessed()) { + roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); + roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr()))); + if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) { + roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))); + } + }else { + roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))); + roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr())))); + if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) { + roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts()))); + } + } + roiResults.add(roiResultsStrDto); + } + result.put("roiResults", roiResults); + + /* + * GardsXeResultsSpectrum + * */ + // #RESULT SUMMARY + List xeResults = new ArrayList<>(); + for (GardsXeResultsSpectrum xeResultsSpectrum : xeResultsSpectrums) { + XeResultsStrDto xeResultsStrDto = new XeResultsStrDto(); + xeResultsStrDto.setNuclideName(xeResultsSpectrum.getNuclideName()); + xeResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr()))); + xeResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getLc()))); + xeResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getMdc()))); + xeResultsStrDto.setNidFlag(xeResultsSpectrum.getNidFlag()); + xeResults.add(xeResultsStrDto); + } + result.put("xeResults", xeResults); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + return result; + } + @Override - public void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) { + public void saveToHTML(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) { String userName = JwtUtil.getUserNameByToken(request); // 解析文件,生成导出数据 - Map analyze = exportData(anlyseResultIn, userName); + Map analyze = exportDataNew(rrrLogInfo); // 解析生成Html字符串并导出为Html文件 String result = parseHtml(analyze); PrintWriter writer = null; try { String export = "saveToHtml.html"; - String sampleFileName = anlyseResultIn.getSampleFileName(); + String sampleFileName = rrrLogInfo.getSampleFileName(); if (StrUtil.isNotBlank(sampleFileName)){ if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".html"); @@ -3716,14 +4126,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } @Override - public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) { + public void saveToExcel(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) { String userName = JwtUtil.getUserNameByToken(request); // 解析文件,生成导出数据 - Map analyze = exportData(anlyseResultIn, userName); + Map analyze = exportDataNew(rrrLogInfo); // 将Null值替换为"",避免空指针异常(集合为空集合,不能为null) analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); String export = "SaveToExcel.xls"; - String sampleFileName = anlyseResultIn.getSampleFileName(); + String sampleFileName = rrrLogInfo.getSampleFileName(); if (StrUtil.isNotBlank(sampleFileName)){ if (StrUtil.contains(sampleFileName, ".PHD")) export = StrUtil.replace(sampleFileName, ".PHD", ".xls");