自动处理增加逻辑判断,调用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;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.Setter;
import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties;
@ -47,6 +48,12 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
@Setter
private boolean analysisDataStoreFlag = false;
/**
* 分析数据是否成功
*/
@Setter
private boolean analysisResultFlag = false;
/**
* 能谱处理父类
*/
@ -163,6 +170,23 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
analysisLog.append(System.lineSeparator()).append(System.lineSeparator());
this.setDetAndGasIdLog();
//获取analyseResult
BgAnalyseResult analyseResult = sample_B_Analysis.analyseResult;
if (StringUtils.isNotBlank(analyseResult.error_log) && !analyseResult.error_log.equalsIgnoreCase("no error.")) {
analysisResultFlag = true;
}
//如果分析结果错误
if (analysisResultFlag) {
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();
@ -184,6 +208,7 @@ public class ParsingProcessLog extends AbstractAutoLogOrReport{
analysisLog.append(titleFormat(analysisResultsEnd,25,StringConstant.DASH,storeFlag,endAnalysisTime,StringConstant.DASH));
analysisLog.append(System.lineSeparator()).append(System.lineSeparator()).append(System.lineSeparator());
}
}
/**
* 处理获取Det和Gas文件日志

View File

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