From 23fa01ba57569b39124922d6888b62899e793dd2 Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Mon, 20 Jul 2026 18:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=9F=E6=88=90html?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E7=9A=84RRR=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/email/EmailServiceManager.java | 4 +- .../org/jeecg/common/util/GammaFileUtil.java | 17 + .../modules/controller/GammaController.java | 6 +- .../mapper/GardsAnalysesManMapper.java | 2 +- .../service/impl/GammaServiceImpl.java | 45 +- .../resources/templates/basic-report.html | 4131 +++-------------- .../src/main/resources/templates/reportP.html | 272 ++ .../mapper/xml/GardsAlertDataMapper.xml | 2 +- 8 files changed, 891 insertions(+), 3588 deletions(-) create mode 100644 jeecg-module-spectrum-analysis/src/main/resources/templates/reportP.html diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java index 574c45e3..8d42c8d3 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java @@ -253,7 +253,7 @@ public class EmailServiceManager { properties.put("mail.imap.host", email.getEmailServerAddress()); properties.put("mail.imap.port", email.getPort()); properties.put("mail.imap.ssl.enable", "false"); - properties.put("mail.imap.starttls.enable", "true"); + properties.put("mail.imap.starttls.enable", "false"); properties.put("mail.imap.auth", "true"); // 超时设置(毫秒) properties.put("mail.imap.connectiontimeout", "10000"); @@ -299,7 +299,7 @@ public class EmailServiceManager { store.connect(host, username, password); return store.isConnected(); } catch (Exception e) { - log.error("收件邮箱服务[Host: {}, Port: {}, Username: {}]连接异常: {}", host, port, username, e.getMessage()); + log.error("收件邮箱服务[Host: {}, Port: {}, Username: {}]连接异常:", host, port, username, e); return false; } } 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 4951e68a..3d220f40 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 @@ -6474,4 +6474,21 @@ public class GammaFileUtil extends AbstractLogOrReport { mdcInfo.setYield(nuclideLines.vyield.get(maxIndex)); } + /** + * 生成RRR报告HTML格式 + * @param middleData + * @return + */ + public Map OutPutRrrHtml(GStoreMiddleProcessData middleData){ + Map result = new HashMap<>(); + result.put("middleData",middleData); + return result; + } + + public Map OutPutRrrHtml(PHDFile phd, String userName, String flag){ + GStoreMiddleProcessData middleData = new GStoreMiddleProcessData(); + GetInterMiddlData(phd, userName, middleData, flag); + return OutPutRrrHtml(middleData); + } + } 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 30bc0fc4..f85e4942 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 @@ -446,7 +446,11 @@ public class GammaController { public Result viewRRR(Integer sampleId, String fileName, HttpServletRequest request) { return gammaService.viewRRR(sampleId, fileName, request); } - + @GetMapping("viewRRRHtml") + @ApiOperation(value = "查看RRR页面数据", notes = "查看RRR页面数据") + public Result viewRRRHtml(Integer sampleId, String fileName, HttpServletRequest request) { + return gammaService.viewRRRHtml(sampleId, fileName, request); + } @GetMapping("exportRRR") public void exportRRR(Integer sampleId, String fileName, HttpServletRequest request, HttpServletResponse response) { gammaService.exportRRR(sampleId, fileName, request, response); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/GardsAnalysesManMapper.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/GardsAnalysesManMapper.java index d85ce577..bae15811 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/GardsAnalysesManMapper.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/GardsAnalysesManMapper.java @@ -7,6 +7,6 @@ import org.jeecg.modules.entity.GardsAnalysesSpectrum; public interface GardsAnalysesManMapper extends BaseMapper { - void updateEntity(@Param(value = "analyses") GardsAnalysesSpectrum analyses); + void updateEntity(@Param(value = "analyses") GardsAnalysesSpectrum analyses,@Param("dbType") String dbType); } 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 1365a38e..d3e17a32 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 @@ -67,6 +67,9 @@ import javax.xml.parsers.ParserConfigurationException; import java.io.*; import java.math.BigDecimal; import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -157,14 +160,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi private ISysDictSpectrumService sysDictService; @Autowired private IDataService dataService; - /// 样品等级服务 @Autowired private ISampleGradingService sampleGradingService; // 获取阈值信息 @Autowired private IRnManGardsThresholdService gardsThresholdService; - + @Autowired + private HtmlReportGenerator reportByThymeleaf; @Override public void initValue(Integer sampleId, String dbName, String analyst, String samfileName, @@ -4451,6 +4454,23 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi return result; } + public Result viewRRRHtml(Integer sampleId, String fileName, HttpServletRequest request) + { + Result result = new Result(); + String userName = JwtUtil.getUserNameByToken(request); + Cache phdCache = localCache.getPHDCache(); + PHDFile phd = phdCache.getIfPresent(fileName + StringPool.DASH + userName); + if (Objects.isNull(phd)) { + result.error500("Please select the parse file first!"); + return result; + } + String templatePath = "templates/reportP.html"; + Map rrrMap = gammaFileUtil.OutPutRrrHtml(phd,userName,"log"); + String html= reportByThymeleaf.generateHtmlReportWithTemplate(rrrMap,templatePath); + result.setSuccess(true); + result.setResult(html); + return new Result<>(); + } @Override public void exportRRR(Integer sampleId, String fileName, HttpServletRequest request, HttpServletResponse response) { @@ -5362,6 +5382,27 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi FileInputStream in = new FileInputStream(rptFile); ftpUtil.saveFile(spectrumPathProperties.getRootPath() + middleData.analyses_absolute_ReportPath + ".txt", in); + + Map rrrMap = gammaFileUtil.OutPutRrrHtml(middleData); + String targetDir = + spectrumPathProperties.getRootPath() + middleData.analyses_absolute_ReportPath; + Path destinationDir = Paths.get(targetDir); + try { + // 创建目录(及所有不存在的父目录) + // 模板文件放在 src/main/resources/templates/my-report.html + String templatePath = "templates/reportP.html"; + if (!Files.exists(destinationDir)) { + Files.createDirectories(destinationDir); + } + // 完整文件路径 + Path htmlFile = + destinationDir.resolve(destinationDir.getFileName() + ".html"); + reportByThymeleaf.generateHtmlReportWithTemplateToFile(rrrMap,templatePath, htmlFile.toString()); + } catch (IOException e) { + System.err.println("目录创建失败: " + e.getMessage()); + e.printStackTrace(); + } + } catch (FileNotFoundException e) { throw new RuntimeException(e); } finally { diff --git a/jeecg-module-spectrum-analysis/src/main/resources/templates/basic-report.html b/jeecg-module-spectrum-analysis/src/main/resources/templates/basic-report.html index d9e7b942..983064a9 100644 --- a/jeecg-module-spectrum-analysis/src/main/resources/templates/basic-report.html +++ b/jeecg-module-spectrum-analysis/src/main/resources/templates/basic-report.html @@ -4,7 +4,7 @@ - CNL06 GENERATED REPORT - AUTO RADIONUCLIDE REPORT + CNL06 GENERATED REPORT - AUTO RADIONUCLIDE REPORT + + + +
+ +

CNL06 GENERATED REPORT

+

SAMPLE RADIONUCLIDE REPORT

+ + +

+ (Particulates Version) + (Noble Gas Version) +

+ + +

+ + +
#SAMPLE INFORMATION
+ + + + + + + + + + + + + + + + + +
Station ID:
Detector ID:
Sample ID:
Sample Geometry:
Sample Quantity[m3]:
Sample Type:
Collection Start:
Collection Stop:
Sampling Time[h]:
Decay Time[h]:
Acquisition Start:
Acquisition Stop:
Acquisition Time[s]:
Avg Flow Rate[m3/h]:
Collection Station Comments:
Analysis General Comments:
+ + +
#ACTIVITY SUMMARY
+ + + + + + + + + +
Nuclides Identified:
Keyline Activities for Nuclides:with defined Reference Line
Activity Reference Time:
Concentration Reference Time:
+ + + + + + + + + + + + + + + + + + + + + + +
NuclideHalflife(s)Activity(Bq)RelErr%MDA(Bq)Conc(uBq/m^3)MDC
+ + +
#MINIMUM DETECTABLE CONCENTRATION FOR KEY NUCLIDES
+ + + + + + + + + + + + + + + + + + +
NuclideHalflifeMDC(uBq/m3)MDA(uBq)
+ + +
#PEAK SEARCH RESULTS
+ + +
+

0 peaks reported:

+

0 peaks with ID (0%):

+

0 peaks without ID (0%):

+
+ + + + + + + + + + + + + + + + + + + + + +
PeakIDEnergy[kev]CentroidFWHM[kev]NetAreaNAErr%SignifSensitNuclide
+ + +
#PROCESSING PARAMETERS
+ + + + + + + + + + + + + + + +
ECutAnalysis_Low:
ECutAnalysis_High:
EnergyTolerance:
BaseImprovePSS:
Pss_low:
k_back:
k_alpha:
k_beta:
RiskLevelK:
refTime_act:
refTime_conc:
+ + +
#CALIBRATION PARAMETERS
+ + + + + +
CalibrationPSS_low:
CalibrationPSS_high:
bUpdateCal:
KeepCalPeakSearchPeaks:
+ + +
+
#Calibration (Energy Calibration)
+ + + + + + +
Function:
E:
P:
Err:
Data:
+
+ +
+
Resolution Calibration
+ + + + + + +
Function:
E:
P:
Err:
Data:
+
+ +
+
Efficiency Calibration
+ + + + + + +
Function:
E:
P:
Err:
Data:
+
+ + +
#DATA QUALITY FLAGS
+ + + + + + + + + + + + + + + + +
NamePass/FailValueTest
+ Fail + Pass + + + null +
+ +
+ + + + + + \ No newline at end of file diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsAlertDataMapper.xml b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsAlertDataMapper.xml index 50341681..fe7c5892 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsAlertDataMapper.xml +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsAlertDataMapper.xml @@ -15,7 +15,7 @@ #{stationId} - AND d.TIME BETWEEN to_timestamp(#{params.startTime}, 'YYYY-MM-DD HH24:MI:SS') AND to_timestamp(#{params.endTime}, 'YYYY-MM-DD HH24:MI:SS') + AND d.TIME BETWEEN #{params.startTime} AND #{params.endTime} ORDER BY d.TIME DESC