From 36edd729309ac4bc3bcffca84e61a247a6e07649 Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Tue, 15 Jul 2025 15:33:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/spectrum/SamplephdSpectrum.java | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) 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 113d7765..fbae951e 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 @@ -12,6 +12,8 @@ import org.jeecg.modules.exception.AnalyseException; import org.jeecg.modules.exception.GAnalyseException; import org.springframework.dao.DuplicateKeyException; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.sql.SQLIntegrityConstraintViolationException; import java.util.Date; import java.util.Objects; @@ -27,9 +29,9 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { @Override protected void setChina() { AbstractSpectrumHandler spectrumHandler = new DetbkphdSpectrum(); - spectrumHandler.initNext(super.spectrumServiceQuotes,super.spectrumFile,super.sourceFilePath, - super.currDataType,super.mailContent,super.emlFileName, - super.spectrumSource,super.returnFileName,super.batchesCounter); + spectrumHandler.initNext(super.spectrumServiceQuotes, super.spectrumFile, super.sourceFilePath, + super.currDataType, super.mailContent, super.emlFileName, + super.spectrumSource, super.returnFileName, super.batchesCounter); spectrumHandler.setPrevious(this); super.setNext(spectrumHandler); } @@ -39,8 +41,8 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { */ @Override public void handler() throws Exception { - if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())){ - try{ + if (DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())) { + try { //前置检查 this.preCheck(); //声明日志处理对象 @@ -55,7 +57,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.updateSpectrumFileName(); //保存PHD文件到savefile //如果文件来自于邮箱或filesource则在存储原始库之前需移动到savefile,便于和input_file_name字段对应 - if(!SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(super.spectrumSource)){ + if (!SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(super.spectrumSource)) { super.saveFileToSavefile(); } //结构体数据入库 @@ -64,7 +66,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { this.autoAnalysis(); //保存PHD文件到savefile //如果文件来自于undel必须到分析结束后才能移动到savefile,否则可能导致本次处理再次失败然后就移动到savefile了 - if(SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(super.spectrumSource)){ + if (SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(super.spectrumSource)) { super.saveFileToSavefile(); } //修改状态为解析完成 @@ -72,7 +74,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { super.updateStatus(); //若本次文件来自于undel目录,解析成功则删除 deleteIfFromUndelFile(); - }catch (Exception e){ + } catch (Exception e) { //异常返回文件名称用于报错日志 super.returnFileName.append(super.spectrumFile.getName()); @@ -82,7 +84,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { AnalyseException exception = (AnalyseException) e; if (exception.isDuplicateKeyException()) { ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), ErrorType.INSERT_ERROR, super.spectrumFile.getName(), String.valueOf(this.sampleData.getSampleId()))); - }else{ + } else { super.updateStatus(); } } else { @@ -91,34 +93,35 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler { //处理解析失败的文件 super.handleParseingFailFile(e); throw e; - }finally { - if(Objects.nonNull(this.parsingProcessLog)){ + } finally { + if (Objects.nonNull(this.parsingProcessLog)) { this.parsingProcessLog.handleLog(); } } - }else{ + } else { super.next.handler(); } } /** * 进行B、G(P)谱分析 + * * @throws Exception */ protected void autoAnalysis() throws Exception { - if(this.sourceData.system_type.equals(SystemType.BETA.getType())){ + if (this.sourceData.system_type.equals(SystemType.BETA.getType())) { Sample_B_Analysis bAnalysis = new Sample_B_Analysis(this); bAnalysis.analysis(); } - if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType()) - || this.sourceData.system_type.equals(SystemType.GAMMA.getType()) - || this.sourceData.system_type.equals(SystemType.WATER.getType())) { - Sample_G_Analysis sample_g_analysis = new Sample_G_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData); - sample_g_analysis.analysis(); - } - if (this.sourceData.system_type.equals(SystemType.SELFSTATION.getType())) { - Sample_C_Analysis sample_c_analysis = new Sample_C_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData); - sample_c_analysis.analysis(); - } + if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType()) + || this.sourceData.system_type.equals(SystemType.GAMMA.getType()) + || this.sourceData.system_type.equals(SystemType.WATER.getType())) { + Sample_G_Analysis sample_g_analysis = new Sample_G_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData); + sample_g_analysis.analysis(); + } + if (this.sourceData.system_type.equals(SystemType.SELFSTATION.getType())) { + Sample_C_Analysis sample_c_analysis = new Sample_C_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData); + sample_c_analysis.analysis(); + } } }