自动处理增加逻辑判断,调用C++进行分析如果分析结果是错误的,日志内容将分析错误信息添加到日志中并且不走其他的日志逻辑,分析结果是没有错误的正常的参与到日志内容的书写中

This commit is contained in:
qiaoqinzheng 2024-01-02 14:03:28 +08:00
parent a48f162d1d
commit 11f942072b
2 changed files with 43 additions and 18 deletions

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.Setter; import lombok.Setter;
import org.jeecg.common.constant.StringConstant; import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
@ -47,6 +48,12 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
@Setter @Setter
private boolean analysisDataStoreFlag = false; private boolean analysisDataStoreFlag = false;
/**
* 分析数据是否成功
*/
@Setter
private boolean analysisResultFlag = false;
/** /**
* 能谱处理父类 * 能谱处理父类
*/ */
@ -163,26 +170,44 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
analysisLog.append(System.lineSeparator()).append(System.lineSeparator()); analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
this.setDetAndGasIdLog(); this.setDetAndGasIdLog();
if(fileNotExist){ //获取analyseResult
// Gas谱或Det谱文件找不到异常结束 BgAnalyseResult analyseResult = sample_B_Analysis.analyseResult;
fileNotExistException(); if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
}else{ analysisResultFlag = true;
this.readCalibrationData();
this.reading_roi_limits();
this.reading_roi_ratios();
this.reading_B_G_Efficiency();
this.NCC_analysis();
} }
//如果分析结果错误
if(fileRepeat || fileNotExist || analysisDataStoreFlag){ if (analysisResultFlag) {
storeFlag = "Error"; storeFlag = "Error";
analysisLog.append(rowFormat(storeResult,storeFlag));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(rowFormat(storeStatus,storeFlag,spectrumHandler.status));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(analyseResult.error_log);
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(titleFormat(analysisResultsEnd,25,StringConstant.DASH,storeFlag,endAnalysisTime,StringConstant.DASH));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
} else {
if (fileNotExist){
// Gas谱或Det谱文件找不到异常结束
fileNotExistException();
} else {
this.readCalibrationData();
this.reading_roi_limits();
this.reading_roi_ratios();
this.reading_B_G_Efficiency();
this.NCC_analysis();
}
if(fileRepeat || fileNotExist || analysisDataStoreFlag){
storeFlag = "Error";
}
analysisLog.append(rowFormat(storeResult,storeFlag));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(rowFormat(storeStatus,storeFlag,spectrumHandler.status));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(titleFormat(analysisResultsEnd,25,StringConstant.DASH,storeFlag,endAnalysisTime,StringConstant.DASH));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
} }
analysisLog.append(rowFormat(storeResult,storeFlag));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(rowFormat(storeStatus,storeFlag,spectrumHandler.status));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
analysisLog.append(titleFormat(analysisResultsEnd,25,StringConstant.DASH,storeFlag,endAnalysisTime,StringConstant.DASH));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
} }
/** /**

View File

@ -225,10 +225,10 @@ public class Sample_B_Analysis implements BlockConstant {
private void autoAnalyse() throws BAnalyseException, FileNotExistException { private void autoAnalyse() throws BAnalyseException, FileNotExistException {
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgAnalyse(this.sampleFileFinalPath,this.gasFileFinalPath,this.detFileFinalPath); BgAnalyseResult analyseResult = EnergySpectrumHandler.bgAnalyse(this.sampleFileFinalPath,this.gasFileFinalPath,this.detFileFinalPath);
System.out.println(analyseResult); System.out.println(analyseResult);
this.analyseResult = analyseResult;
if(Objects.isNull(analyseResult) || !analyseResult.analyse_flag){ if(Objects.isNull(analyseResult) || !analyseResult.analyse_flag){
throw new BAnalyseException("THE PHD file cannot be parsed:"+this.sampleFileFinalPath+","+this.gasFileFinalPath+","+this.detFileFinalPath); throw new BAnalyseException("THE PHD file cannot be parsed:"+this.sampleFileFinalPath+","+this.gasFileFinalPath+","+this.detFileFinalPath);
} }
this.analyseResult = analyseResult;
} }
/** /**