格式化代码

This commit is contained in:
duwenyuan 2025-07-15 15:33:25 +08:00
parent d91947b181
commit 36edd72930

View File

@ -12,6 +12,8 @@ import org.jeecg.modules.exception.AnalyseException;
import org.jeecg.modules.exception.GAnalyseException; import org.jeecg.modules.exception.GAnalyseException;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.sql.SQLIntegrityConstraintViolationException; import java.sql.SQLIntegrityConstraintViolationException;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
@ -27,9 +29,9 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
@Override @Override
protected void setChina() { protected void setChina() {
AbstractSpectrumHandler spectrumHandler = new DetbkphdSpectrum(); AbstractSpectrumHandler spectrumHandler = new DetbkphdSpectrum();
spectrumHandler.initNext(super.spectrumServiceQuotes,super.spectrumFile,super.sourceFilePath, spectrumHandler.initNext(super.spectrumServiceQuotes, super.spectrumFile, super.sourceFilePath,
super.currDataType,super.mailContent,super.emlFileName, super.currDataType, super.mailContent, super.emlFileName,
super.spectrumSource,super.returnFileName,super.batchesCounter); super.spectrumSource, super.returnFileName, super.batchesCounter);
spectrumHandler.setPrevious(this); spectrumHandler.setPrevious(this);
super.setNext(spectrumHandler); super.setNext(spectrumHandler);
} }
@ -39,8 +41,8 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
*/ */
@Override @Override
public void handler() throws Exception { public void handler() throws Exception {
if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())){ if (DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())) {
try{ try {
//前置检查 //前置检查
this.preCheck(); this.preCheck();
//声明日志处理对象 //声明日志处理对象
@ -55,7 +57,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
super.updateSpectrumFileName(); super.updateSpectrumFileName();
//保存PHD文件到savefile //保存PHD文件到savefile
//如果文件来自于邮箱或filesource则在存储原始库之前需移动到savefile便于和input_file_name字段对应 //如果文件来自于邮箱或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(); super.saveFileToSavefile();
} }
//结构体数据入库 //结构体数据入库
@ -64,7 +66,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
this.autoAnalysis(); this.autoAnalysis();
//保存PHD文件到savefile //保存PHD文件到savefile
//如果文件来自于undel必须到分析结束后才能移动到savefile否则可能导致本次处理再次失败然后就移动到savefile了 //如果文件来自于undel必须到分析结束后才能移动到savefile否则可能导致本次处理再次失败然后就移动到savefile了
if(SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(super.spectrumSource)){ if (SpectrumSource.FORM_FILE_UNDEL.getSourceType().equals(super.spectrumSource)) {
super.saveFileToSavefile(); super.saveFileToSavefile();
} }
//修改状态为解析完成 //修改状态为解析完成
@ -72,7 +74,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
super.updateStatus(); super.updateStatus();
//若本次文件来自于undel目录解析成功则删除 //若本次文件来自于undel目录解析成功则删除
deleteIfFromUndelFile(); deleteIfFromUndelFile();
}catch (Exception e){ } catch (Exception e) {
//异常返回文件名称用于报错日志 //异常返回文件名称用于报错日志
super.returnFileName.append(super.spectrumFile.getName()); super.returnFileName.append(super.spectrumFile.getName());
@ -82,7 +84,7 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
AnalyseException exception = (AnalyseException) e; AnalyseException exception = (AnalyseException) e;
if (exception.isDuplicateKeyException()) { if (exception.isDuplicateKeyException()) {
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), ErrorType.INSERT_ERROR, super.spectrumFile.getName(), String.valueOf(this.sampleData.getSampleId()))); ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), ErrorType.INSERT_ERROR, super.spectrumFile.getName(), String.valueOf(this.sampleData.getSampleId())));
}else{ } else {
super.updateStatus(); super.updateStatus();
} }
} else { } else {
@ -91,34 +93,35 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
//处理解析失败的文件 //处理解析失败的文件
super.handleParseingFailFile(e); super.handleParseingFailFile(e);
throw e; throw e;
}finally { } finally {
if(Objects.nonNull(this.parsingProcessLog)){ if (Objects.nonNull(this.parsingProcessLog)) {
this.parsingProcessLog.handleLog(); this.parsingProcessLog.handleLog();
} }
} }
}else{ } else {
super.next.handler(); super.next.handler();
} }
} }
/** /**
* 进行BG(P)谱分析 * 进行BG(P)谱分析
*
* @throws Exception * @throws Exception
*/ */
protected void autoAnalysis() 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); Sample_B_Analysis bAnalysis = new Sample_B_Analysis(this);
bAnalysis.analysis(); bAnalysis.analysis();
} }
if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType()) if (this.sourceData.system_type.equals(SystemType.PARTICULATE.getType())
|| this.sourceData.system_type.equals(SystemType.GAMMA.getType()) || this.sourceData.system_type.equals(SystemType.GAMMA.getType())
|| this.sourceData.system_type.equals(SystemType.WATER.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 sample_g_analysis = new Sample_G_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData);
sample_g_analysis.analysis(); sample_g_analysis.analysis();
} }
if (this.sourceData.system_type.equals(SystemType.SELFSTATION.getType())) { 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 sample_c_analysis = new Sample_C_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData);
sample_c_analysis.analysis(); sample_c_analysis.analysis();
} }
} }
} }