From 32ebf4915c7b6a3a914978b9381df6f43fe8d15c Mon Sep 17 00:00:00 2001 From: panbaolin <123456> Date: Sat, 7 Oct 2023 18:42:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:1.=E5=AE=8C=E6=88=90=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E6=9E=90=E6=88=90=E5=8A=9F=E5=8F=91=E9=80=81=E7=BB=99?= =?UTF-8?q?redis=202.=E8=A7=A3=E5=86=B3=E8=8E=B7=E5=8F=96=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E6=8C=89=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/email/EmailServiceManager.java | 4 +-- .../java/org/jeecg/modules/ftp/FTPUtils.java | 2 +- .../modules/spectrum/Sample_B_Analysis.java | 36 ++++++++++++++++--- .../modules/spectrum/SamplephdSpectrum.java | 2 +- .../spectrum/SpectrumServiceQuotes.java | 3 ++ 5 files changed, 39 insertions(+), 8 deletions(-) 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 7c6cec83..b7ca04b3 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 @@ -126,7 +126,7 @@ public class EmailServiceManager { //如果邮箱邮件数量 > 0 final int messageCount = folder.getMessageCount(); if(messageCount > 0){ - SearchTerm searchTerm = new ReceivedDateTerm(ComparisonTerm.GT,this.systemStartupTime); + SearchTerm searchTerm = new ReceivedDateTerm(ComparisonTerm.GE,this.systemStartupTime); Message[] messages = folder.search(searchTerm); Arrays.sort(messages, (o1, o2) -> { try { @@ -296,7 +296,7 @@ public class EmailServiceManager { public void close(){ try { if(null != folder){ - folder.close(); + folder.close(true); } if(null != store){ store.close(); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ftp/FTPUtils.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ftp/FTPUtils.java index aa44cb15..8a14d548 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ftp/FTPUtils.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ftp/FTPUtils.java @@ -300,7 +300,7 @@ public class FTPUtils { public void close(){ try{ if (client != null){ - client.logout(); +// client.logout(); client.disconnect(); } }catch (IOException e){ diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java index 232c92fe..d4db2a98 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java @@ -2,17 +2,17 @@ package org.jeecg.modules.spectrum; import cn.hutool.core.io.FileUtil; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.constant.StringConstant; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.base.dto.Info; import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; -import org.jeecg.modules.base.enums.DataType; -import org.jeecg.modules.base.enums.DataTypeAbbr; -import org.jeecg.modules.base.enums.SampleStatus; +import org.jeecg.modules.base.enums.*; import org.jeecg.modules.config.datasource.DataSourceSwitcher; import org.jeecg.modules.exception.BAnalyseException; import org.jeecg.modules.exception.FileNotExistException; @@ -25,6 +25,9 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.transaction.TransactionStatus; import java.io.*; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -148,7 +151,7 @@ public class Sample_B_Analysis implements BlockConstant { /** * 执行解析过程 */ - public void start() throws BAnalyseException { + public void analysis() throws BAnalyseException { //标记整个分析过程是否分析失败 boolean analyseFail = false; try{ @@ -168,6 +171,8 @@ public class Sample_B_Analysis implements BlockConstant { //生成报告 Sample_B_Analysis.B_AnalysisReport report = new Sample_B_Analysis.B_AnalysisReport(); report.start(); + //发送数据到redis + pushToRedis(); }catch (Exception e){ analyseFail = true; e.printStackTrace(); @@ -332,6 +337,29 @@ public class Sample_B_Analysis implements BlockConstant { } } + /** + * 分析成功数据发送到Redis + */ + private void pushToRedis(){ + Info info = new Info(); + info.setStationId(this.sampleData.getStationId().toString()); + info.setSampleId(this.sampleData.getSampleId().toString()); + info.setSampleName(this.phdFileName); + final Instant instant = this.sampleData.getCollectStart().toInstant(); + final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); + info.setCollectionDate(collectTime); + info.setDatasource(DSType.ARMDARR.getType()); + info.setFullOrPrel(this.sampleData.getSpectralQualifie()); + info.setBetaOrGamma(SpectrumType.BETA.getType()); + Map nuclides = Maps.newHashMap(); + nuclides.put(XE_131m,String.valueOf(analyseResult.Xe131m_con)); + nuclides.put(XE_133,String.valueOf(analyseResult.Xe133_con)); + nuclides.put(XE_133m,String.valueOf(analyseResult.Xe133m_con)); + nuclides.put(XE_135,String.valueOf(analyseResult.Xe135_con)); + info.setNuclides(nuclides); + spectrumServiceQuotes.getRedisStreamUtil().pushAnalysis(info); + } + public Sample_B_Analysis.B_AnalysisReport getReport(){ return new Sample_B_Analysis.B_AnalysisReport(); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java index 9379e202..32e527df 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SamplephdSpectrum.java @@ -76,7 +76,7 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{ protected void autoAnalysis() throws Exception { if(this.sourceData.system_type.equals(SystemType.BETA.getType())){ Sample_B_Analysis bAnalysis = new Sample_B_Analysis(this); - bAnalysis.start(); + bAnalysis.analysis(); } if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType()) || this.sourceData.system_type.equals(SystemType.GAMMA.getType())) { Sample_G_Analysis sample_g_analysis = new Sample_G_Analysis(super.sourceData, super.spectrumServiceQuotes, super.sampleData,super.ftpUtil); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SpectrumServiceQuotes.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SpectrumServiceQuotes.java index 621d6a67..e4961f44 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SpectrumServiceQuotes.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/SpectrumServiceQuotes.java @@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor; import org.jeecg.common.properties.SoftwareProperties; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.TaskProperties; +import org.jeecg.common.util.RedisStreamUtil; import org.jeecg.modules.datasource.OraDataSourceProperties; import org.jeecg.modules.ftp.FTPProperties; import org.jeecg.modules.service.*; @@ -70,4 +71,6 @@ public class SpectrumServiceQuotes { private final SoftwareProperties softwareProperties; + private final RedisStreamUtil redisStreamUtil; + }