fix:gamma自动处理增加注释;解决出现异常,数据库中分析状态还是P的问题
This commit is contained in:
parent
4f040ebd4f
commit
3cddd5d18c
|
@ -29,13 +29,12 @@ import org.jeecg.modules.base.entity.rnauto.*;
|
|||
import org.jeecg.modules.base.enums.MiddleDataType;
|
||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.exception.GAnalyseException;
|
||||
import org.jeecg.modules.file.FileOperation;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
@ -111,15 +110,17 @@ public class Sample_G_Analysis {
|
|||
sampleData.getInputFileName().lastIndexOf((StringConstant.SLASH)+1));
|
||||
}
|
||||
|
||||
public void analysis(){
|
||||
public void analysis() throws GAnalyseException{
|
||||
log.info("Gamma自动处理分析--Start");
|
||||
try {
|
||||
/* 准备Gamma分析需要的数据 */
|
||||
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
||||
Integer sampleId = sampleData.getSampleId();
|
||||
|
||||
// 获取配置文件
|
||||
GammaFileUtil gammaFileUtil = ApplicationContextUtil.getContext().getBean(GammaFileUtil.class);
|
||||
parameterProperties = ApplicationContextUtil.getContext().getBean(ParameterProperties.class);
|
||||
|
||||
PHDFile phdFile = new PHDFile();
|
||||
phdFile.setXmlFilePath(parameterProperties.getFilePath());
|
||||
// 解析PHD文件
|
||||
|
@ -128,16 +129,20 @@ public class Sample_G_Analysis {
|
|||
String pathName = File.separator + spectrumPathProperties.getSaveFilePath() + File.separator +
|
||||
sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
|
||||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
|
||||
// 解析能谱文件
|
||||
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phdFile, new Result());
|
||||
// todo 测试阶段暂时注释掉,获取数据库 Gamma 默认参数
|
||||
|
||||
// 获取数据库 Gamma 默认参数
|
||||
getSettingFromDB(phdFile);
|
||||
|
||||
// 文件路径
|
||||
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
// 读取文件内容并附值
|
||||
this.setPHDFile(phdFile, this.energySpectrumStruct);
|
||||
phdFile.getSetting().setRefTime_act(DateUtils.parseDate(phdFile.getAcq().getAcquisition_start_date()+" "+phdFile.getAcq().getAcquisition_start_time()));
|
||||
phdFile.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile.getCollect().getCollection_start_date()+" "+phdFile.getCollect().getCollection_start_time()));
|
||||
// todo 根据系统类型传入不同的核素参数
|
||||
// 根据能谱的系统类型传入不同的核素参数
|
||||
Map<String, NuclideLines> nuclideLibs = new HashMap<>();
|
||||
if (this.systemType.equals(SpectrumSystemType.P.name())) {
|
||||
nuclideLibs = this.getNuclideLinesP();
|
||||
|
@ -145,6 +150,8 @@ public class Sample_G_Analysis {
|
|||
if (this.systemType.equals(SpectrumSystemType.G.name())) {
|
||||
nuclideLibs = this.getNuclideLinesG();
|
||||
}
|
||||
|
||||
// 执行分析业务代码
|
||||
gammaFileUtil.GetMiddleData(phdFile, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData, MiddleDataType.Auto.getType());
|
||||
|
||||
// 数据插入数据库
|
||||
|
@ -152,7 +159,8 @@ public class Sample_G_Analysis {
|
|||
|
||||
// 生成日志文件
|
||||
writeLog(middleData.getAnalyses_LogPath(), middleData);
|
||||
// todo 报告文件
|
||||
|
||||
// 生成报告文件
|
||||
String reportContent = gammaFileUtil.GetReportContent(middleData);
|
||||
String reportPath = StringUtils.substringBeforeLast(middleData.getAnalyses_ReportPath(), StringPool.SLASH);
|
||||
String reportName = StringUtils.substringAfterLast(middleData.getAnalyses_ReportPath(), StringPool.SLASH) + ".txt";
|
||||
|
@ -160,14 +168,11 @@ public class Sample_G_Analysis {
|
|||
spectrumPathProperties.getSaveFilePath() + File.separator + reportPath +
|
||||
File.separator + reportName;
|
||||
// 保存文件
|
||||
try {
|
||||
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
log.error(e.getMessage());
|
||||
throw new GAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
}finally {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user