From 5835ef954369949032677c83df0d094bdeba96bf Mon Sep 17 00:00:00 2001 From: nieziyan Date: Mon, 18 Sep 2023 19:58:08 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AsaveTo*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/common/constant/DateConstant.java | 2 + .../org/jeecg/common/util/ExportUtil.java | 8 + .../modules/base/dto/ROIChannelsDto.java | 47 +++ .../jeecg/modules/base/dto/ROIResultsDto.java | 74 ++++ .../jeecg/modules/base/dto/XeResultsDto.java | 41 +++ .../modules/base/enums/ExportTemplate.java | 6 +- .../resources/excelTemplate/SaveExcel.xls | Bin 0 -> 32256 bytes .../resources/excelTemplate/SaveHtml.html | 321 ++++++++++++++++++ .../main/resources/excelTemplate/ZeroTime.txt | 19 ++ jeecg-module-spectrum-analysis/pom.xml | 5 + .../java/org/jeecg/common/util/DBUtil.java | 3 +- .../org/jeecg/common/util/PHDFileUtil.java | 95 ++++++ .../modules/controller/GammaController.java | 11 + .../SpectrumAnalysesController.java | 9 + .../jeecg/modules/service/IGammaService.java | 6 + .../service/ISpectrumAnalysisService.java | 5 + .../service/impl/GammaServiceImpl.java | 60 +++- .../impl/SpectrumAnalysisServiceImpl.java | 100 +++++- 18 files changed, 801 insertions(+), 11 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIChannelsDto.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsDto.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsDto.java create mode 100644 jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls create mode 100644 jeecg-boot-base-core/src/main/resources/excelTemplate/SaveHtml.html create mode 100644 jeecg-boot-base-core/src/main/resources/excelTemplate/ZeroTime.txt diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/DateConstant.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/DateConstant.java index 21ad4bae..eb04f2cc 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/DateConstant.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/DateConstant.java @@ -8,6 +8,8 @@ public interface DateConstant { String DATE_TIME = "yyyy-MM-dd HH:mm:ss"; + String DATE_TIME_S = "yyyy/MM/dd-HH:mm:ss"; + String DATE_BIAS = "yyyy/MM/dd"; String DATE_BIAS_TIME = "yyyy/MM/dd HH:mm:ss"; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java index c8e72adb..70063e96 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java @@ -56,6 +56,14 @@ public class ExportUtil { return response.getWriter(); } + public static PrintWriter htmlWriter(HttpServletResponse response, String fileName) throws IOException { + response.setCharacterEncoding(UTF_8); + response.setContentType("text/html"); + String name = URLEncoder.encode(fileName, UTF_8); + response.setHeader("Content-disposition", "attachment;filename=" + name); + return response.getWriter(); + } + public static void exportXls(HttpServletResponse response, Class target, List data, String fileName){ ExportParams params = new ExportParams(); diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIChannelsDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIChannelsDto.java new file mode 100644 index 00000000..6e386e85 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIChannelsDto.java @@ -0,0 +1,47 @@ +package org.jeecg.modules.base.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +public class ROIChannelsDto { + /** + * 感兴趣区ID号 + */ + private Integer roi; + + /** + * 感兴趣区的β能量起始值 + */ + private Integer bChanStart; + + /** + * 感兴趣区的β能量结束值 + */ + private Integer bChanStop; + + /** + * 感兴趣区的γ能量起始值 + */ + private Integer gChanStart; + + /** + * 感兴趣区的γ能量结束值 + */ + private Integer gChanStop; + + private String bChanStr; + + private String gChanStr; + + public void setbChanStr() { + this.bChanStr = this.bChanStart + " to " + this.bChanStop; + } + + public void setgChanStr() { + this.gChanStr = this.gChanStart + " to " + this.gChanStop; + } +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsDto.java new file mode 100644 index 00000000..3cbb170a --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/ROIResultsDto.java @@ -0,0 +1,74 @@ +package org.jeecg.modules.base.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +public class ROIResultsDto { + + /** + * 感兴趣区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 Double lc; + + /** + * 感兴趣区MDC + */ + private Double mdc; + + private String netCount; + + private String concStr; + + public void setNetCount() { + this.netCount = this.net + " +/- " + Math.sqrt(this.netErr); + } + + public void setConcStr() { + this.concStr = this.conc + " +/- " + this.concErr; + } +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsDto.java new file mode 100644 index 00000000..cc3a6d5d --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/XeResultsDto.java @@ -0,0 +1,41 @@ +package org.jeecg.modules.base.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; + +@Data +public class XeResultsDto { + /** + * 核素名称 + */ + private String nuclideName; + /** + * 感兴趣区活度浓度 + */ + private Double conc; + + /** + * 感兴趣区活度浓度不确定度 + */ + private Double concErr; + /** + * 感兴趣区MDC + */ + private Double mdc; + /** + * 感兴趣区LC + */ + private Double lc; + /** + * 感兴趣区识别标示;1:识别到,0,未识别到 + */ + private Integer nidFlag; + + private String concStr; + + public void setConcStr() { + this.concStr = this.conc + " +/- " + this.concErr; + } +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/ExportTemplate.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/ExportTemplate.java index 23b2e163..4c068c88 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/ExportTemplate.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/ExportTemplate.java @@ -13,7 +13,11 @@ public enum ExportTemplate { RadionuclideActivity_G("RadionuclideActivity-G.xls"), SampleInfo_B("SampleInformation-B.xls"), QcResult_B("QcResult-B.xls"), - RLR_B("RLR-B.xls"),RLR_G("Gamma.RLR"); + RLR_B("RLR-B.xls"),RLR_G("Gamma.RLR"), + ZEROTIME_G("ZeroTime.txt"), + SAVETOHTML("SaveHtml.html"), + SAVETOEXCEL("SaveExcel.xls"), + SAVETOTXT("SaveTxt.txt"); ExportTemplate(String name) { this.name = name; diff --git a/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls b/jeecg-boot-base-core/src/main/resources/excelTemplate/SaveExcel.xls new file mode 100644 index 0000000000000000000000000000000000000000..e27a650e614421f3c83776de8e74a1fb34fb3f1c GIT binary patch literal 32256 zcmeHw34Bf07WcWy6^Sv3dAb=8L}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 + +

CNL06 GENERATED REPORT +
REVIEWED RADIONUCLIDE REPORT +
(Noble Gas Version) +
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#FILE INFORMATION
SampleMeasID:
GASBKMeasID:
SRID:
Detector Type:3D b-g
 
#COLLECTION INFORMATION
Station CODE:
Detector CODE:
Collection Start:
Collection Stop:
Collection TIME(h):
Air Volume[cm3]:
Xe Volume[cm3]:
 
#ACQUISITION INFORMATION
Acquisition Start:
Acq Real Time(s):
Acq Live Time:
 
#SOFTWARE
version:1.0.1
 
#SAMPLE Old CALIBRATION
Old BetaOld 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
 
#SAMPLE New CALIBRATION
New BetaNew Gamma
CH(x) = (?1)+(?2)*x+(?3)x*x CH(x) = (?1)+(?2)*x+(?3)x*x
E(x) = (-3.33443)+(0.398048)*x+(-0.000124)x*x E(x) = (0.879727)+(0.365551)*x+(-2.8e-05)x*x
 
#SAMPLE: LIMITS PER ROI
RoiBeta Gamma
 
#DET Old CALIBRATION
Old BetaOld 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
 
#DET New CALIBRATION
New BetaNew Gamma
CH(x) = (?1)+(?2)*x+(?3)x*x CH(x) = (?1)+(?2)*x+(?3)x*x
E(x) = (0.879727)+(0.365551)*x+(-2.8e-05)x*x E(x) = (0.879727)+(0.365551)*x+(-2.8e-05)x*x
 
#DET: LIMITS PER ROI
RoiBeta Gamma
 
#GAS Old CALIBRATION
Old BetaOld 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
 
#GAS New CALIBRATION
New BetaNew Gamma
CH(x) = (?1)+(?2)*x+(?3)x*x CH(x) = (?1)+(?2)*x+(?3)x*x
E(x) = (-3.33443)+(0.398048)*x+(-0.000124)x*x E(x) = (0.879727)+(0.365551)*x+(-2.8e-05)x*x
 
#GAS: LIMITS PER ROI
RoiBeta Gamma
 
#GROSS COUNTS PER ROI
RoiSampleGasBkgndDetBkgnd
 
#NET COUNTS AND LC PER ROI
RoiNet count
 
#CONCENTRATION AND LC PER ROI
RoiConc(mBq/m3)LC(mBq/m3)MDC(mBq/m3):
 
#RESULT SUMMARY
Nuclide NameConcLCMDCNID Flag
 
+ \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/resources/excelTemplate/ZeroTime.txt b/jeecg-boot-base-core/src/main/resources/excelTemplate/ZeroTime.txt new file mode 100644 index 00000000..f4c03cce --- /dev/null +++ b/jeecg-boot-base-core/src/main/resources/excelTemplate/ZeroTime.txt @@ -0,0 +1,19 @@ +#### nuclide1: ${nuclide1} #### +HalfLife: ${halflife1} +Activity(Bq) : ${product1} +Fission_Yield(C): ${FY_N1_C} +Fission_Yield(I): ${FY_N1_I} + +#### nuclide2: ${nuclide2} #### +HalfLife: ${halflife2} +Activity(Bq) : ${product2} +Fission_Yield(C): ${FY_N2_C} +Fission_Yield(I): ${FY_N2_I} + +#### Other Information #### +Fission Target: ${target} +Energy: ${energyTFH}->Thermal_spectrum +Reference Time: ${date} ${time} + +#### Zero Time #### +${zeroTime} \ No newline at end of file diff --git a/jeecg-module-spectrum-analysis/pom.xml b/jeecg-module-spectrum-analysis/pom.xml index 225876d4..1496c748 100644 --- a/jeecg-module-spectrum-analysis/pom.xml +++ b/jeecg-module-spectrum-analysis/pom.xml @@ -42,6 +42,11 @@ sqlite-jdbc 3.34.0 + + + org.springframework.boot + spring-boot-starter-thymeleaf + \ No newline at end of file diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/DBUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/DBUtil.java index 2844baad..5391ba23 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/DBUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/DBUtil.java @@ -25,7 +25,8 @@ public class DBUtil implements Serializable { e.printStackTrace(); } //sqlite3文件的绝对路径 - String db = dbFilePath + StringPool.SLASH + "GammaDatabase.db"; + //String db = dbFilePath + StringPool.SLASH + "GammaDatabase.db"; + String db = "E:\\Code\\RadionuclideAnalysis\\AnalysisSystemForRadionuclide\\jeecg-module-spectrum-analysis\\src\\main\\java\\org\\jeecg\\common\\db\\GammaDatabase.db"; try { conn = DriverManager.getConnection("jdbc:sqlite:" + db); } catch (SQLException throwables) { diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java index 6185b705..03d12aca 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java @@ -999,4 +999,99 @@ public class PHDFileUtil { return xeResultsSpectrumList; } + public Map analyze(File sampleTmp, File gasTmp, File detTmp){ + Map result = new HashMap<>(); + //加载dll工具库 + System.loadLibrary("ReadPHDFile"); + //调用动态库解析文件 + BgAnalyseResult bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath()); + /* GardsROIChannelsSpectrum集合 */ + List roiChannelsSpectrumList = new LinkedList<>(); + for (int i=0; i roiResultsSpectrumList = new LinkedList<>(); + for (int i=0; ibgAnalyseResult.MDC.get(i)) { + roiResults.setNidFlag(1); + } else { + roiResults.setNidFlag(0); + } + roiResultsSpectrumList.add(roiResults); + } + /* GardsXeResultsSpectrum集合 */ + List xeResultsSpectrumList = new LinkedList<>(); + GardsXeResultsSpectrum Xe131m = new GardsXeResultsSpectrum(); + Xe131m.setNuclideName(XeNuclideName.XE_131m.getType()); + Xe131m.setMdc(bgAnalyseResult.MDC_Xe131m); + Xe131m.setConc(bgAnalyseResult.Xe131m_con); + Xe131m.setConcErr(bgAnalyseResult.Xe131m_uncer); + Xe131m.setLc(bgAnalyseResult.LC_Xe131m); + xeResultsSpectrumList.add(Xe131m); + GardsXeResultsSpectrum Xe133 = new GardsXeResultsSpectrum(); + Xe133.setNuclideName(XeNuclideName.XE_133.getType()); + Xe133.setMdc(bgAnalyseResult.MDC_Xe133); + Xe133.setConc(bgAnalyseResult.Xe133_con); + Xe133.setConcErr(bgAnalyseResult.Xe133_uncer); + Xe133.setLc(bgAnalyseResult.LC_Xe133); + xeResultsSpectrumList.add(Xe133); + GardsXeResultsSpectrum Xe133m = new GardsXeResultsSpectrum(); + Xe133m.setNuclideName(XeNuclideName.XE_133m.getType()); + Xe133m.setMdc(bgAnalyseResult.MDC_Xe133m); + Xe133m.setConc(bgAnalyseResult.Xe133m_con); + Xe133m.setConcErr(bgAnalyseResult.Xe133m_uncer); + Xe133m.setLc(bgAnalyseResult.LC_Xe133m); + xeResultsSpectrumList.add(Xe133m); + GardsXeResultsSpectrum Xe135 = new GardsXeResultsSpectrum(); + Xe135.setNuclideName(XeNuclideName.XE_135.getType()); + Xe135.setMdc(bgAnalyseResult.MDC_Xe135); + Xe135.setConc(bgAnalyseResult.Xe135_con); + Xe135.setConcErr(bgAnalyseResult.Xe135_uncer); + Xe135.setLc(bgAnalyseResult.LC_Xe135); + xeResultsSpectrumList.add(Xe135); + result.put("roiChannelsSpectrum", roiChannelsSpectrumList); + result.put("roiResultsSpectrum", roiResultsSpectrumList); + result.put("xeResultsSpectrum", xeResultsSpectrumList); + return result; + } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java index d4b7c751..47ef9ffe 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/GammaController.java @@ -146,6 +146,17 @@ public class GammaController { return gammaService.ZeroTimeAnalyse(nuclide1, nuclide2, product1, product2, target, energyTFH, date, time); } + @GetMapping("exportZeroTimeAnalyse") + @ApiOperation(value = "Zero Time分析导出", notes = "Zero Time分析导出") + public void exportZeroTimeAnalyse(String nuclide1, String nuclide2, + Double product1, Double product2, + String target, String energyTFH, + String date, String time, + HttpServletResponse response) { + gammaService.exportZeroTimeAnalyse(nuclide1, nuclide2, product1, product2, + target, energyTFH, date, time, response); + } + @GetMapping("Korsum") @ApiOperation(value = "Korsum页面数据", notes = "Korsum页面数据") public Result Korsum() { 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 826f8636..d2c33f2b 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 @@ -216,4 +216,13 @@ public class SpectrumAnalysesController { return spectrumAnalysisService.saveToDB(anlyseResultIn, request); } + @GetMapping("saveToHTML") + public void saveToHTML(HttpServletResponse response){ + spectrumAnalysisService.saveToHTML(response); + } + + @GetMapping("saveToExcel") + public void saveToExcel(HttpServletResponse response){ + spectrumAnalysisService.saveToExcel(response); + } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java index abffbb44..cf7c824c 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGammaService.java @@ -53,6 +53,12 @@ public interface IGammaService{ Result ZeroTimeAnalyse(String nuclide1, String nuclide2, Double product1, Double product2, String target, String energyTFH, String date, String time); + void exportZeroTimeAnalyse(String nuclide1, String nuclide2, + Double product1, Double product2, + String target, String energyTFH, + String date, String time, + HttpServletResponse response); + Result Korsum(); List KorSumInput(CoeffData coeffData); 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 72ed5eb2..fba99be4 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 @@ -74,4 +74,9 @@ public interface ISpectrumAnalysisService { Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request); + void saveToHTML(HttpServletResponse response); + + void saveToExcel(HttpServletResponse response); + + void saveToTxt(); } 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 da9bfc23..83312b08 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 @@ -48,8 +48,7 @@ import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; -import static org.jeecg.modules.base.enums.ExportTemplate.RLR_G; -import static org.jeecg.modules.base.enums.ExportTemplate.SampleInfo_G; +import static org.jeecg.modules.base.enums.ExportTemplate.*; @Service(value = "gammaService") @DS("ora") @@ -989,6 +988,63 @@ public class GammaServiceImpl implements IGammaService { return result; } + @Override + public void exportZeroTimeAnalyse(String nuclide1, String nuclide2, + Double product1, Double product2, + String target, String energyTFH, + String date, String time, + HttpServletResponse response) { + Result> result = ZeroTimeAnalyse(nuclide1, nuclide2, + product1, product2, target, energyTFH, date, time); + Map annlyse = result.getResult(); + annlyse.put("nuclide1", nuclide1); + annlyse.put("nuclide2", nuclide2); + annlyse.put("product1", product1); + annlyse.put("product2", product2); + annlyse.put("target", target); + annlyse.put("energyTFH", energyTFH); + annlyse.put("date", date); + annlyse.put("time", time); + + String pathPrefix = "excelTemplate/"; + String path = pathPrefix + ZEROTIME_G.getName(); + String template = ClassUtil.classPath(path); + List lines = FileUtil.readUtf8Lines(template); + // 正则表达式,匹配${}中的内容 + String regex = "\\$\\{([^}]+)}"; + List newLines = new ArrayList<>(); + + for (String line : lines) { + List fieldNames = ReUtil.findAllGroup1(regex, line); + if (CollUtil.isEmpty(fieldNames)){ + newLines.add(line); + continue; + } + // 一行内可能有多个需要替换的变量 + for (String fieldName : fieldNames) { + Object value = annlyse.get(fieldName); + String search = "${" + fieldName + "}"; + String replacement = StrUtil.toString(value); + replacement = StrUtil.isBlank(replacement) ? "null" : replacement; + line = StrUtil.replace(line, search, replacement); + } + newLines.add(line); + } + PrintWriter writer = null; + try { + String export = "ZeroTime-G.txt"; + writer = ExportUtil.streamWriter(response, export); + for (String newLine : newLines) { + writer.println(newLine); + } + } catch (IOException e) { + e.printStackTrace(); + }finally { + if (ObjectUtil.isNotNull(writer)) + writer.close(); + } + } + public long fission_changed(String name) { long halflife = 0; //建立数据库连接 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 650d87c3..ef57c2b4 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 @@ -15,11 +15,13 @@ import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.util.*; import org.jeecg.modules.base.bizVo.BetaRLR; +import org.jeecg.modules.base.dto.ROIChannelsDto; import org.jeecg.modules.base.entity.configuration.GardsDetectors; import org.jeecg.modules.base.entity.original.*; import org.jeecg.modules.base.entity.rnman.*; @@ -33,12 +35,18 @@ import org.jeecg.modules.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.thymeleaf.TemplateEngine; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring5.SpringTemplateEngine; +import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.text.ParseException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -98,6 +106,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService { @Autowired private IGardsHistogramSpectrumService histogramService; + @Override public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String dbName, String[] menuTypes) { Result result = new Result(); @@ -1333,13 +1342,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService { ExportUtil.exportXls(response, template, dataMap,export); } - public static void main(String[] args) { - BetaRLR betaRLR = new BetaRLR(); - Map dataMap = BeanUtil.beanToMap(betaRLR); - dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); - dataMap.forEach((key, value) -> System.out.println(key + "---" + value)); - } - @Override public Result viewGammaDetectorCalibration(Integer sampleId, String qcFileName, HttpServletRequest request) { Result result = new Result(); @@ -2844,6 +2846,90 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService { return result; } + @Override + public void saveToHTML(HttpServletResponse response) { + /*EnergySpectrumStruct energySpectrumStruct = phdFileUtil.analyzeFileSourceData(null, null); + Map analyze = phdFileUtil.analyze(null, null, null); + analyze.putAll(BeanUtil.beanToMap(energySpectrumStruct));*/ + + Map analyze = new HashMap<>(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateConstant.DATE_TIME_S); + analyze.put("now", LocalDateTime.now().format(formatter)); + List roiChannelsSpectrums = new LinkedList<>(); + List roiResultsSpectrumList = new LinkedList<>(); + List xeResultsSpectrumList = new LinkedList<>(); + analyze.put("roiChannelsSpectrum", roiChannelsSpectrums); + analyze.put("roiResultsSpectrum", roiResultsSpectrumList); + analyze.put("xeResultsSpectrum", xeResultsSpectrumList); + EnergySpectrumStruct energySpectrumStruct = new EnergySpectrumStruct(); + analyze.putAll(BeanUtil.beanToMap(energySpectrumStruct)); + + // 解析生成Html字符串并导出为Html文件 + String result = parseHtml(analyze); + PrintWriter writer = null; + try { + String export = "saveToHtml.html"; + writer = ExportUtil.htmlWriter(response, export); + writer.write(result); + } catch (IOException e) { + e.printStackTrace(); + }finally { + if (ObjectUtil.isNotNull(writer)) + writer.close(); + } + } + + private String parseHtml(Map variables) { + TemplateEngine templateEngine = new SpringTemplateEngine(); + ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver(); + resolver.setPrefix("excelTemplate/"); + resolver.setSuffix(".html"); + templateEngine.setTemplateResolver(resolver); + + Context context = new Context(); + context.setVariables(variables); + + return templateEngine.process("SaveHtml", context); + } + + @Override + public void saveToExcel(HttpServletResponse response) { + Map analyze = new HashMap<>(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateConstant.DATE_TIME_S); + analyze.put("now", LocalDateTime.now().format(formatter)); + List roiChannelsSpectrums = new LinkedList<>(); + List roiChannelsDtos = new LinkedList<>(); + for (GardsROIChannelsSpectrum roiChannel : roiChannelsSpectrums) { + ROIChannelsDto roiChannelsDto = new ROIChannelsDto(); + BeanUtil.copyProperties(roiChannel, roiChannelsDto); + roiChannelsDto.setbChanStr();roiChannelsDto.setgChanStr(); + roiChannelsDtos.add(roiChannelsDto); + } + GardsROIChannelsSpectrum roiChannelsSpectrum = new GardsROIChannelsSpectrum(); + roiChannelsSpectrum.setRoi(1); + roiChannelsSpectrum.setBChanStart(1); + roiChannelsSpectrum.setBChanStop(2); + roiChannelsSpectrums.add(roiChannelsSpectrum); + List roiResultsSpectrums = new LinkedList<>(); + List xeResultsSpectrums = new LinkedList<>(); + analyze.put("roiChannelsSpectrum", roiChannelsDtos); + analyze.put("roiResultsSpectrum", roiResultsSpectrums); + analyze.put("xeResultsSpectrum", xeResultsSpectrums); + EnergySpectrumStruct energySpectrumStruct = new EnergySpectrumStruct(); + analyze.putAll(BeanUtil.beanToMap(energySpectrumStruct)); + + // 将Null值替换为"",避免空指针异常(或者在模板中进行判断) + analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value); + String export = "SaveToExcel.xls"; + String template = SAVETOEXCEL.getName(); + ExportUtil.exportXls(response, template, analyze,export); + } + + @Override + public void saveToTxt() { + + } + public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn) { //获取ftp文件路径下临时文件 File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());