添加关联波形事件数据表

This commit is contained in:
duwenyuan 2026-04-23 17:22:49 +08:00
parent 036e94823b
commit 9d4639f3a9
6 changed files with 393 additions and 111 deletions

View File

@ -0,0 +1,56 @@
package org.jeecg.modules.base.entity.rnauto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 关联波形事件数据表
*/
@Data
@TableName("RNAUTO.GARDS_WAVEFORM_EVENT")
public class GardsWaveformEvent implements Serializable {
/**
* '样品id'
*/
@TableId(value = "SAMPLE_ID", type = IdType.INPUT)
private Integer sampleId;
/**
* IDC SRS文件关联的波形事件数
*/
@TableField(value = "IDC_EVENTS")
private Integer idcEvents;
/**
* 输运模拟产出的SRS文件关联的波形事件数
*/
@TableField(value = "NDC_EVENTS")
private Integer ndcEvents;
/**
* -1关联未成功0未关联1排队中2执行中3已关联
*/
@TableField(value = "STATUS")
private Integer status;
/**
* 说明
*/
@TableField(value = "DESCRIPTION")
private String description;
/**
* 更新时间
*/
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
}

View File

@ -0,0 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.rnauto.GardsWaveformEvent;
@Mapper
public interface GardsWaveformEventMapper extends BaseMapper<GardsWaveformEvent> {
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnauto.GardsWaveformEvent;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
public interface GardsWaveformEventService extends IService<GardsWaveformEvent> {
/**
* 存储关联波形事件数据表
*
* @param sampleId
*/
public void create( Integer sampleId);
}

View File

@ -0,0 +1,26 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.entity.rnauto.GardsWaveformEvent;
import org.jeecg.modules.mapper.GardsWaveformEventMapper;
import org.jeecg.modules.service.GardsWaveformEventService;
import org.springframework.stereotype.Service;
import java.util.Date;
@DS("ora")
@Service
public class GardsWaveformEventServiceImpl
extends ServiceImpl<GardsWaveformEventMapper, GardsWaveformEvent>
implements GardsWaveformEventService {
@Override
public void create(Integer sampleId) {
GardsWaveformEvent data = new GardsWaveformEvent();
data.setSampleId(sampleId);
data.setStatus(0);
data.setModdate(new Date());
this.save(data);
}
}

View File

@ -188,7 +188,8 @@ public class Sample_B_Analysis implements BlockConstant {
this.endAnalysisTime = new Date();
//如果分析成功并且analyses对象不为空
if (!analyseFail && Objects.nonNull(this.analyses)) {
spectrumServiceQuotes.getAnalysesService().updateAnalysesEndTime(this.analyses.getIdAnalysis(), this.endAnalysisTime);
spectrumServiceQuotes.getAnalysesService()
.updateAnalysesEndTime(this.analyses.getIdAnalysis(), this.endAnalysisTime);
}
}
}
@ -200,15 +201,26 @@ public class Sample_B_Analysis implements BlockConstant {
*/
private void queryPHDFile() throws FileNotExistException {
//查询det和gas能谱文
this.detSampleData = spectrumServiceQuotes.getSampleDataService().getSampleIdAndInputFileName(this.sampleStruct.detector_bk_measurement_id, DataTypeAbbr.DETBKPHD.getType(), this.sampleStruct.system_type);
this.gasSampleData = spectrumServiceQuotes.getSampleDataService().getSampleIdAndInputFileName(this.sampleStruct.gas_bk_measurement_id, DataTypeAbbr.GASBKPHD.getType(), this.sampleStruct.system_type);
this.detSampleData = spectrumServiceQuotes.getSampleDataService()
.getSampleIdAndInputFileName(this.sampleStruct.detector_bk_measurement_id,
DataTypeAbbr.DETBKPHD.getType(), this.sampleStruct.system_type);
this.gasSampleData = spectrumServiceQuotes.getSampleDataService()
.getSampleIdAndInputFileName(this.sampleStruct.gas_bk_measurement_id,
DataTypeAbbr.GASBKPHD.getType(), this.sampleStruct.system_type);
//如果找不到sampledetgas谱文件数据则解析失败修改记录状态
if (StringUtils.isEmpty(this.sampleData.getInputFileName()) || Objects.isNull(this.detSampleData) || StringUtils.isEmpty(this.detSampleData.getInputFileName()) || Objects.isNull(this.gasSampleData) || StringUtils.isEmpty(this.gasSampleData.getInputFileName())) {
if (StringUtils.isEmpty(this.sampleData.getInputFileName()) ||
Objects.isNull(this.detSampleData) ||
StringUtils.isEmpty(this.detSampleData.getInputFileName()) ||
Objects.isNull(this.gasSampleData) ||
StringUtils.isEmpty(this.gasSampleData.getInputFileName())) {
parsingProcessLog.setFileNotExist(true);
this.spectrumServiceQuotes.getSampleDataService().updateStatus(SampleStatus.FAIL.getValue(), this.sampleData.getInputFileName());
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), ErrorType.GAS_OR_DET_ERROR, this.phdFileName));
this.spectrumServiceQuotes.getSampleDataService()
.updateStatus(SampleStatus.FAIL.getValue(), this.sampleData.getInputFileName());
ErrorLogManager.getInstance()
.write(new SpectrumErrorEvent(new Date(), ErrorType.GAS_OR_DET_ERROR,
this.phdFileName));
throw new FileNotExistException("gas or det file is no exist or is error..");
}
}
@ -217,7 +229,8 @@ public class Sample_B_Analysis implements BlockConstant {
* 创建报告文件路径
*/
private void structureLogAndArrFilePath() {
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
final SpectrumPathProperties properties =
this.spectrumServiceQuotes.getSpectrumPathProperties();
//构造报告文件路径
StringBuilder relativePath = new StringBuilder();
// relativePath.append(properties.getSaveFilePath());
@ -230,19 +243,28 @@ public class Sample_B_Analysis implements BlockConstant {
this.arrFileName = this.phdFileName.replace(DataType.SAMPLEPHD.getSuffix(), arrFileTail);
//构造日志文件路径不包括log前缀
this.logFilePath = this.spectrumFileRelativePath;
this.logFileName = this.phdFileName.replace(DataType.SAMPLEPHD.getSuffix(), AbstractSpectrumHandler.LOG_FILE_SUFFIX);
this.logFileName = this.phdFileName.replace(DataType.SAMPLEPHD.getSuffix(),
AbstractSpectrumHandler.LOG_FILE_SUFFIX);
}
/**
* 调用dll库的分析B谱结果
*/
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);
this.analyseResult = analyseResult;
if (Objects.isNull(analyseResult) || !analyseResult.analyse_flag) {
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), analyseResult.error_log, this.phdFileName));
throw new BAnalyseException("THE PHD file cannot be parsed:" + this.sampleFileFinalPath + "," + this.gasFileFinalPath + ","
+ this.detFileFinalPath + "analyseResult.analyse_flag:" + analyseResult.analyse_flag + "analyseResult.error_log:" + analyseResult.error_log);
ErrorLogManager.getInstance()
.write(new SpectrumErrorEvent(new Date(), analyseResult.error_log,
this.phdFileName));
throw new BAnalyseException(
"THE PHD file cannot be parsed:" + this.sampleFileFinalPath + "," +
this.gasFileFinalPath + ","
+ this.detFileFinalPath + "analyseResult.analyse_flag:" +
analyseResult.analyse_flag + "analyseResult.error_log:" +
analyseResult.error_log);
}
}
@ -255,9 +277,11 @@ public class Sample_B_Analysis implements BlockConstant {
boolean flag = false;
//gas谱PHD文件本地路径
StringBuilder gasFileFinalPath = new StringBuilder();
gasFileFinalPath.append(this.spectrumServiceQuotes.getSpectrumPathProperties().getRootPath());
gasFileFinalPath.append(
this.spectrumServiceQuotes.getSpectrumPathProperties().getRootPath());
// gasFileFinalPath.append(File.separator);
gasFileFinalPath.append(this.spectrumServiceQuotes.getSpectrumPathProperties().getSaveFilePath());
gasFileFinalPath.append(
this.spectrumServiceQuotes.getSpectrumPathProperties().getSaveFilePath());
gasFileFinalPath.append(File.separator);
gasFileFinalPath.append(gasSampleData.getInputFileName());
this.gasFileFinalPath = gasFileFinalPath.toString();
@ -268,9 +292,11 @@ public class Sample_B_Analysis implements BlockConstant {
//det谱PHD文件本地路径
StringBuilder detFileFinalPath = new StringBuilder();
detFileFinalPath.append(this.spectrumServiceQuotes.getSpectrumPathProperties().getRootPath());
detFileFinalPath.append(
this.spectrumServiceQuotes.getSpectrumPathProperties().getRootPath());
// detFileFinalPath.append(File.separator);
detFileFinalPath.append(this.spectrumServiceQuotes.getSpectrumPathProperties().getSaveFilePath());
detFileFinalPath.append(
this.spectrumServiceQuotes.getSpectrumPathProperties().getSaveFilePath());
detFileFinalPath.append(File.separator);
detFileFinalPath.append(detSampleData.getInputFileName());
this.detFileFinalPath = detFileFinalPath.toString();
@ -281,7 +307,9 @@ public class Sample_B_Analysis implements BlockConstant {
if (flag) {
parsingProcessLog.setFileNotExist(true);
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), ErrorType.GAS_OR_DET_ERROR, this.phdFileName));
ErrorLogManager.getInstance()
.write(new SpectrumErrorEvent(new Date(), ErrorType.GAS_OR_DET_ERROR,
this.phdFileName));
throw new FileNotExistException("gas or det file is no exist or is error..");
}
this.detStruct = EnergySpectrumHandler.getSourceData(this.detFileFinalPath);
@ -294,24 +322,31 @@ public class Sample_B_Analysis implements BlockConstant {
private void storageDataToDatabase() {
String logFileRelativePath = this.logFilePath + StringConstant.SLASH + this.logFileName;
//报告路径存储到数据库时不包括后缀.txtC++原来是这样做的并且历史大量数据都是这样暂时还保持这样
String arrFileRelativePath = this.arrFilePath + StringConstant.SLASH + this.arrFileName.substring(0, this.arrFileName.lastIndexOf(StringConstant.DOT));
String arrFileRelativePath = this.arrFilePath + StringConstant.SLASH +
this.arrFileName.substring(0, this.arrFileName.lastIndexOf(StringConstant.DOT));
//如果数据已经存储不在重复存储
final Integer idAnalysis = spectrumServiceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
final Integer idAnalysis = spectrumServiceQuotes.getAnalysesService()
.getIdAnalysis(this.sampleData.getSampleId());
if (Objects.nonNull(idAnalysis)) {
log.warn("{} file analysis data has been stored", new File(this.sampleFileFinalPath).getName());
log.warn("{} file analysis data has been stored",
new File(this.sampleFileFinalPath).getName());
return;
}
DataSourceSwitcher.switchToOracle();
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager()
.getTransaction(spectrumServiceQuotes.getTransactionDefinition());
try {
Integer category = 1;
try {
//TODO 获取样品级别
//获取阈值结果
List<GardsThresholdResult> thresholds = spectrumServiceQuotes.getGardsThresholdService().findThresholdResults(this.sampleData.getStationId().toString());
List<GardsThresholdResult> thresholds =
spectrumServiceQuotes.getGardsThresholdService()
.findThresholdResults(this.sampleData.getStationId().toString());
//样品分级
category = spectrumServiceQuotes.getSampleGradingService().processAutoTypeB(getSampleInfo(), thresholds);
category = spectrumServiceQuotes.getSampleGradingService()
.processAutoTypeB(getSampleInfo(), thresholds);
if (category >= 3) {
GardsTransportStatus transportStatus = new GardsTransportStatus();
@ -320,7 +355,8 @@ public class Sample_B_Analysis implements BlockConstant {
transportStatus.setTransportStatus(0);
transportStatus.setCloseStatus(0);
transportStatus.setModdate(new Date());
boolean result = spectrumServiceQuotes.getGardsTransportStatusService().save(transportStatus);
boolean result = spectrumServiceQuotes.getGardsTransportStatusService()
.save(transportStatus);
}
} catch (Exception e) {
@ -329,27 +365,56 @@ public class Sample_B_Analysis implements BlockConstant {
//存储基础数据
this.analyses = spectrumServiceQuotes.getAnalysesService().create(this.sampleData.getSampleId(), this.detSampleData,
this.gasSampleData, this.startAnalysisTime, this.endAnalysisTime, logFileRelativePath, arrFileRelativePath, category);
this.analyses = spectrumServiceQuotes.getAnalysesService()
.create(this.sampleData.getSampleId(), this.detSampleData,
this.gasSampleData, this.startAnalysisTime, this.endAnalysisTime,
logFileRelativePath, arrFileRelativePath, category);
//调用原始数据dll获取gasdet谱数据入库sample已有数据直接入库
//存储sample谱B_Energy和G_Energy块数据
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(sampleData.getSampleId(), analyses.getIdAnalysis(), this.sampleStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(sampleData.getSampleId(), analyses.getIdAnalysis(), this.sampleStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService()
.createB_EnergyRecord(sampleData.getSampleId(), analyses.getIdAnalysis(),
this.sampleStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService()
.createG_EnergyRecord(sampleData.getSampleId(), analyses.getIdAnalysis(),
this.sampleStruct);
//存储det谱B_Energy和G_Energy块数据
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(detSampleData.getSampleId(), analyses.getIdAnalysis(), this.detStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(detSampleData.getSampleId(), analyses.getIdAnalysis(), this.detStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService()
.createB_EnergyRecord(detSampleData.getSampleId(), analyses.getIdAnalysis(),
this.detStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService()
.createG_EnergyRecord(detSampleData.getSampleId(), analyses.getIdAnalysis(),
this.detStruct);
//存储gas谱B_Energy和G_Energy块数据
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(gasSampleData.getSampleId(), analyses.getIdAnalysis(), this.gasStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(gasSampleData.getSampleId(), analyses.getIdAnalysis(), this.gasStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService()
.createB_EnergyRecord(gasSampleData.getSampleId(), analyses.getIdAnalysis(),
this.gasStruct);
spectrumServiceQuotes.getGardsCalibrationPairsService()
.createG_EnergyRecord(gasSampleData.getSampleId(), analyses.getIdAnalysis(),
this.gasStruct);
//存储gards_calibration表数据sampledetgas谱B_Energy和G_Energy块数据
spectrumServiceQuotes.getGardsCalibrationService().create(this.analyseResult, sampleData.getSampleId(), gasSampleData.getSampleId(), detSampleData.getSampleId(), analyses.getIdAnalysis());
spectrumServiceQuotes.getGardsCalibrationService()
.create(this.analyseResult, sampleData.getSampleId(),
gasSampleData.getSampleId(), detSampleData.getSampleId(),
analyses.getIdAnalysis());
//gards_roi_channels数据表存储sampledetgas谱数据
spectrumServiceQuotes.getRoiChannelsService().create(this.analyseResult, sampleData.getSampleId(), gasSampleData.getSampleId(), detSampleData.getSampleId(), analyses.getIdAnalysis());
spectrumServiceQuotes.getRoiChannelsService()
.create(this.analyseResult, sampleData.getSampleId(),
gasSampleData.getSampleId(), detSampleData.getSampleId(),
analyses.getIdAnalysis());
//gards_Xe_results数据表XE_131mXE_133XE_133mXE_135数据
spectrumServiceQuotes.getXeResultsService().create(this.analyseResult, sampleData.getSampleId(), analyses.getIdAnalysis());
spectrumServiceQuotes.getXeResultsService()
.create(this.analyseResult, sampleData.getSampleId(), analyses.getIdAnalysis());
//gards_ roi_results数据表
spectrumServiceQuotes.getRoiResultsService().create(this.analyseResult, sampleData.getSampleId(), analyses.getIdAnalysis());
spectrumServiceQuotes.getRoiResultsService()
.create(this.analyseResult, sampleData.getSampleId(), analyses.getIdAnalysis());
//判断 样品普全谱
if (this.sampleData.getDataType().equals("S") &&
this.sampleData.getSpectralQualifie().equals("FULL")) {
//关联波形事件数据表
spectrumServiceQuotes.getGardsWaveformEventService()
.create(sampleData.getSampleId());
}
//提交事务
spectrumServiceQuotes.getTransactionManager().commit(transactionStatus);
} catch (Exception e) {
@ -481,13 +546,17 @@ public class Sample_B_Analysis implements BlockConstant {
String detectorType = " Detector Type:%-35s %s";
reportContent.append(fileBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(sampleMeasId, StringConstant.SPACE, sampleStruct.measurement_id));
reportContent.append(super.rowFormat(sampleMeasId, StringConstant.SPACE,
sampleStruct.measurement_id));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(gasMeasId, StringConstant.SPACE, sampleStruct.gas_bk_measurement_id));
reportContent.append(super.rowFormat(gasMeasId, StringConstant.SPACE,
sampleStruct.gas_bk_measurement_id));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(detMeasId, StringConstant.SPACE, sampleStruct.detector_bk_measurement_id));
reportContent.append(super.rowFormat(detMeasId, StringConstant.SPACE,
sampleStruct.detector_bk_measurement_id));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(srId, StringConstant.SPACE, sampleStruct.sample_ref_id));
reportContent.append(
super.rowFormat(srId, StringConstant.SPACE, sampleStruct.sample_ref_id));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(detectorType, StringConstant.SPACE, "3D b-g"));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
@ -508,21 +577,32 @@ public class Sample_B_Analysis implements BlockConstant {
String xeVolume = " Xe Volume[cm3]:%-34s %s";
reportContent.append(collectionInfoBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(stationId, StringConstant.SPACE, sampleStruct.site_code));
reportContent.append(
super.rowFormat(stationId, StringConstant.SPACE, sampleStruct.site_code));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(detectorId, StringConstant.SPACE, sampleStruct.detector_code));
reportContent.append(
super.rowFormat(detectorId, StringConstant.SPACE, sampleStruct.detector_code));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(sampleId, StringConstant.SPACE, sampleData.getSampleId().toString()));
reportContent.append(super.rowFormat(sampleId, StringConstant.SPACE,
sampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(collectionStart, StringConstant.SPACE, sampleStruct.collection_start_date + StringConstant.SPACE + sampleStruct.collection_start_time));
reportContent.append(super.rowFormat(collectionStart, StringConstant.SPACE,
sampleStruct.collection_start_date + StringConstant.SPACE +
sampleStruct.collection_start_time));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(collectionStop, StringConstant.SPACE, sampleStruct.collection_stop_date + StringConstant.SPACE + sampleStruct.collection_stop_time));
reportContent.append(super.rowFormat(collectionStop, StringConstant.SPACE,
sampleStruct.collection_stop_date + StringConstant.SPACE +
sampleStruct.collection_stop_time));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(collectionTime, StringConstant.SPACE, String.valueOf((sampleData.getCollectStop().getTime() - sampleData.getCollectStart().getTime()) / 1000)));
reportContent.append(super.rowFormat(collectionTime, StringConstant.SPACE,
String.valueOf((sampleData.getCollectStop().getTime() -
sampleData.getCollectStart().getTime()) / 1000)));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(airVolume, StringConstant.SPACE, String.valueOf(sampleStruct.air_volume)));
reportContent.append(super.rowFormat(airVolume, StringConstant.SPACE,
String.valueOf(sampleStruct.air_volume)));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(xeVolume, StringConstant.SPACE, String.valueOf(sampleStruct.sample_volume_of_Xe)));
reportContent.append(super.rowFormat(xeVolume, StringConstant.SPACE,
String.valueOf(sampleStruct.sample_volume_of_Xe)));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -536,11 +616,15 @@ public class Sample_B_Analysis implements BlockConstant {
String acqLiveTime = " Acq Live Time(s):%-32s %s";
reportContent.append(acqInfoBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(acquisitionStart, StringConstant.SPACE, sampleStruct.acquisition_start_date + StringConstant.SPACE + sampleStruct.acquisition_start_time));
reportContent.append(super.rowFormat(acquisitionStart, StringConstant.SPACE,
sampleStruct.acquisition_start_date + StringConstant.SPACE +
sampleStruct.acquisition_start_time));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(acqRealTime, StringConstant.SPACE, String.valueOf(sampleStruct.acquisition_real_time)));
reportContent.append(super.rowFormat(acqRealTime, StringConstant.SPACE,
String.valueOf(sampleStruct.acquisition_real_time)));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(acqLiveTime, StringConstant.SPACE, String.valueOf(sampleStruct.acquisition_live_time)));
reportContent.append(super.rowFormat(acqLiveTime, StringConstant.SPACE,
String.valueOf(sampleStruct.acquisition_live_time)));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -552,7 +636,8 @@ public class Sample_B_Analysis implements BlockConstant {
String version = " version:%-42s %s";
reportContent.append(softwareBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(version, StringConstant.SPACE, spectrumServiceQuotes.getSoftwareProperties().getSwVersion()));
reportContent.append(super.rowFormat(version, StringConstant.SPACE,
spectrumServiceQuotes.getSoftwareProperties().getSwVersion()));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -564,12 +649,17 @@ public class Sample_B_Analysis implements BlockConstant {
String rowTitle = " Beta %-45s Gamma";
String rowValue = " %-50s %s";
String beta_ch = CH_Contant + this.calibration(analyseResult.s_b_fitting_type, analyseResult.s_b_fitting_e_c);
String gamma_ch = CH_Contant + this.calibration(analyseResult.s_g_fitting_type, analyseResult.s_g_fitting_e_c);
String beta_e = E_Contant + super.calibration(analyseResult.s_b_fitting_type, analyseResult.s_b_fitting_c_e);
String gamma_e = E_Contant + super.calibration(analyseResult.s_g_fitting_type, analyseResult.s_g_fitting_c_e);
String beta_ch = CH_Contant +
this.calibration(analyseResult.s_b_fitting_type, analyseResult.s_b_fitting_e_c);
String gamma_ch = CH_Contant +
this.calibration(analyseResult.s_g_fitting_type, analyseResult.s_g_fitting_e_c);
String beta_e = E_Contant + super.calibration(analyseResult.s_b_fitting_type,
analyseResult.s_b_fitting_c_e);
String gamma_e = E_Contant + super.calibration(analyseResult.s_g_fitting_type,
analyseResult.s_g_fitting_c_e);
reportContent.append(super.rowFormat(sampleCalibrationBlock, sampleData.getSampleId().toString()));
reportContent.append(
super.rowFormat(sampleCalibrationBlock, sampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
@ -592,9 +682,11 @@ public class Sample_B_Analysis implements BlockConstant {
List<Integer> g_chan_start = analyseResult.S_ROI_G_Boundary_start;
List<Integer> g_chan_stop = analyseResult.S_ROI_G_Boundary_stop;
reportContent.append(super.rowFormat(sampleLimitsBlock, sampleData.getSampleId().toString()));
reportContent.append(
super.rowFormat(sampleLimitsBlock, sampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
for (int i = 0; i < roi.size(); i++) {
String beta = b_chan_start.get(i) + to_flag + b_chan_stop.get(i);
@ -616,12 +708,17 @@ public class Sample_B_Analysis implements BlockConstant {
String rowTitle = " Beta %-45s Gamma";
String rowValue = " %-50s %s";
String beta_ch = CH_Contant + super.calibration(analyseResult.d_b_fitting_type, analyseResult.d_b_fitting_e_c);
String gamma_ch = CH_Contant + super.calibration(analyseResult.d_g_fitting_type, analyseResult.d_g_fitting_e_c);
String beta_e = E_Contant + this.calibration(analyseResult.d_b_fitting_type, analyseResult.d_b_fitting_c_e);
String gamma_e = E_Contant + this.calibration(analyseResult.d_g_fitting_type, analyseResult.d_g_fitting_c_e);
String beta_ch = CH_Contant + super.calibration(analyseResult.d_b_fitting_type,
analyseResult.d_b_fitting_e_c);
String gamma_ch = CH_Contant + super.calibration(analyseResult.d_g_fitting_type,
analyseResult.d_g_fitting_e_c);
String beta_e = E_Contant +
this.calibration(analyseResult.d_b_fitting_type, analyseResult.d_b_fitting_c_e);
String gamma_e = E_Contant +
this.calibration(analyseResult.d_g_fitting_type, analyseResult.d_g_fitting_c_e);
reportContent.append(super.rowFormat(detCalibrationBlock, detSampleData.getSampleId().toString()));
reportContent.append(
super.rowFormat(detCalibrationBlock, detSampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
@ -644,9 +741,11 @@ public class Sample_B_Analysis implements BlockConstant {
List<Integer> g_chan_start = analyseResult.D_ROI_G_Boundary_start;
List<Integer> g_chan_stop = analyseResult.D_ROI_G_Boundary_stop;
reportContent.append(super.rowFormat(detLimitsBlock, detSampleData.getSampleId().toString()));
reportContent.append(
super.rowFormat(detLimitsBlock, detSampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
for (int i = 0; i < roi.size(); i++) {
String beta = b_chan_start.get(i) + to_flag + b_chan_stop.get(i);
@ -668,12 +767,17 @@ public class Sample_B_Analysis implements BlockConstant {
String rowTitle = " Beta %-45s Gamma";
String rowValue = " %-50s %s";
String beta_ch = CH_Contant + this.calibration(analyseResult.g_b_fitting_type, analyseResult.g_b_fitting_e_c);
String gamma_ch = CH_Contant + this.calibration(analyseResult.g_g_fitting_type, analyseResult.g_g_fitting_e_c);
String beta_e = E_Contant + super.calibration(analyseResult.g_b_fitting_type, analyseResult.g_b_fitting_c_e);
String gamma_e = E_Contant + super.calibration(analyseResult.g_g_fitting_type, analyseResult.g_g_fitting_c_e);
String beta_ch = CH_Contant +
this.calibration(analyseResult.g_b_fitting_type, analyseResult.g_b_fitting_e_c);
String gamma_ch = CH_Contant +
this.calibration(analyseResult.g_g_fitting_type, analyseResult.g_g_fitting_e_c);
String beta_e = E_Contant + super.calibration(analyseResult.g_b_fitting_type,
analyseResult.g_b_fitting_c_e);
String gamma_e = E_Contant + super.calibration(analyseResult.g_g_fitting_type,
analyseResult.g_g_fitting_c_e);
reportContent.append(super.rowFormat(gasSampleCalibrationBlock, gasSampleData.getSampleId().toString()));
reportContent.append(super.rowFormat(gasSampleCalibrationBlock,
gasSampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
@ -696,9 +800,11 @@ public class Sample_B_Analysis implements BlockConstant {
List<Integer> g_chan_start = analyseResult.G_ROI_G_Boundary_start;
List<Integer> g_chan_stop = analyseResult.G_ROI_G_Boundary_stop;
reportContent.append(super.rowFormat(gasLimitsBlock, gasSampleData.getSampleId().toString()));
reportContent.append(
super.rowFormat(gasLimitsBlock, gasSampleData.getSampleId().toString()));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
for (int i = 0; i < roi.size(); i++) {
String beta = b_chan_start.get(i) + to_flag + b_chan_stop.get(i);
@ -720,17 +826,28 @@ public class Sample_B_Analysis implements BlockConstant {
String rowTitle = " Roi %-46s Sample %-44s GasBkgnd %-12s DetBkgnd";
String rowValue = " %-50s %-51s %-21s %s";
List<String> roi = analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList());
List<String> s_roi_cts = analyseResult.s_roi_cts.stream().map(v -> NumberFormatUtil.numberFormat(String.valueOf(v))).collect(Collectors.toList());
List<String> g_roi_cts = analyseResult.g_roi_cts.stream().map(v -> NumberFormatUtil.numberFormat(String.valueOf(v))).collect(Collectors.toList());
List<String> d_roi_cts = analyseResult.d_roi_cts.stream().map(v -> NumberFormatUtil.numberFormat(String.valueOf(v))).collect(Collectors.toList());
List<String> roi =
analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList());
List<String> s_roi_cts = analyseResult.s_roi_cts.stream()
.map(v -> NumberFormatUtil.numberFormat(String.valueOf(v)))
.collect(Collectors.toList());
List<String> g_roi_cts = analyseResult.g_roi_cts.stream()
.map(v -> NumberFormatUtil.numberFormat(String.valueOf(v)))
.collect(Collectors.toList());
List<String> d_roi_cts = analyseResult.d_roi_cts.stream()
.map(v -> NumberFormatUtil.numberFormat(String.valueOf(v)))
.collect(Collectors.toList());
reportContent.append(grossCountsBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE,
StringConstant.SPACE));
reportContent.append(System.lineSeparator());
for (int i = 0; i < roi.size(); i++) {
reportContent.append(super.rowFormat(rowValue, roi.get(i), s_roi_cts.get(i), g_roi_cts.get(i), d_roi_cts.get(i)));
reportContent.append(
super.rowFormat(rowValue, roi.get(i), s_roi_cts.get(i), g_roi_cts.get(i),
d_roi_cts.get(i)));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
} else {
@ -752,15 +869,22 @@ public class Sample_B_Analysis implements BlockConstant {
List<Double> roi_net_count_err = analyseResult.ROI_net_coutns_err;
//此参数需第一位补0
analyseResult.LC_CTS.add(0, 0D);
List<String> lc = analyseResult.LC_CTS.stream().map(v -> NumberFormatUtil.numberFormat(String.valueOf(v))).collect(Collectors.toList());
List<String> lc = analyseResult.LC_CTS.stream()
.map(v -> NumberFormatUtil.numberFormat(String.valueOf(v)))
.collect(Collectors.toList());
reportContent.append(netCountsBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
for (int i = 0; i < roi.size(); i++) {
String netCount = NumberFormatUtil.numberFormat(String.valueOf(roi_net_count.get(i))) + arithmetic_flag + NumberFormatUtil.numberFormat(String.valueOf(roi_net_count_err.get(i)));
reportContent.append(super.rowFormat(rowValue, String.valueOf(roi.get(i)), netCount, lc.get(i)));
String netCount =
NumberFormatUtil.numberFormat(String.valueOf(roi_net_count.get(i))) +
arithmetic_flag + NumberFormatUtil.numberFormat(
String.valueOf(roi_net_count_err.get(i)));
reportContent.append(
super.rowFormat(rowValue, String.valueOf(roi.get(i)), netCount, lc.get(i)));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
} else {
@ -777,21 +901,31 @@ public class Sample_B_Analysis implements BlockConstant {
String rowTitle = " Roi %-46s Conc(mBq/m3) %-38s LC(mBq/m3) %-10s MDC(mBq/m3)";
String rowValue = " %-50s %-51s %-21s %s";
List<String> roi = analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList());
List<String> roi =
analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList());
List<Double> con = analyseResult.ROI_con_uncer;
List<Double> conErr = analyseResult.ROI_con_uncer_err;
analyseResult.LC.add(0, 0.0D);
analyseResult.MDC.add(0, 0.0D);
List<String> lc = analyseResult.LC.stream().map(v -> NumberFormatUtil.numberFormat(String.valueOf(v))).collect(Collectors.toList());
List<String> mdc = analyseResult.MDC.stream().map(v -> NumberFormatUtil.numberFormat(String.valueOf(v))).collect(Collectors.toList());
List<String> lc = analyseResult.LC.stream()
.map(v -> NumberFormatUtil.numberFormat(String.valueOf(v)))
.collect(Collectors.toList());
List<String> mdc = analyseResult.MDC.stream()
.map(v -> NumberFormatUtil.numberFormat(String.valueOf(v)))
.collect(Collectors.toList());
reportContent.append(grossCountsBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE,
StringConstant.SPACE));
reportContent.append(System.lineSeparator());
for (int i = 0; i < roi.size(); i++) {
String conc = NumberFormatUtil.numberFormat(String.valueOf(con.get(i))) + arithmetic_flag + NumberFormatUtil.numberFormat(String.valueOf(conErr.get(i)));
reportContent.append(super.rowFormat(rowValue, roi.get(i), conc, lc.get(i), mdc.get(i)));
String conc = NumberFormatUtil.numberFormat(String.valueOf(con.get(i))) +
arithmetic_flag +
NumberFormatUtil.numberFormat(String.valueOf(conErr.get(i)));
reportContent.append(
super.rowFormat(rowValue, roi.get(i), conc, lc.get(i), mdc.get(i)));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
} else {
@ -805,42 +939,75 @@ public class Sample_B_Analysis implements BlockConstant {
*/
private void handleResultSummary() throws IOException {
String resultSummaryBlock = "#RESULT SUMMARY";
String rowTitle = " Nuclide Name %-37s Conc(mBq/m3) %-38s Uncertainty(mBq/m3) %s MDC(mBq/m3) %-2s NID Flag";
String rowTitle =
" Nuclide Name %-37s Conc(mBq/m3) %-38s Uncertainty(mBq/m3) %s MDC(mBq/m3) %-2s NID Flag";
String rowValue = " %-50s %-51s %-21s %-14s %s";
String[] nuclideName = {XE_135, XE_131m, XE_133m, XE_133};
String xe_135_conc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe135_con)) + arithmetic_flag + NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe135_uncer));
String xe_131m_conc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe131m_con)) + arithmetic_flag + NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe131m_uncer));
String xe_133m_conc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe133m_con)) + arithmetic_flag + NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe133m_uncer));
String xe_133_conc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe133_con)) + arithmetic_flag + NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe133_uncer));
String xe_135_conc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe135_con)) +
arithmetic_flag + NumberFormatUtil.numberFormat(
String.valueOf(analyseResult.Xe135_uncer));
String xe_131m_conc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe131m_con)) +
arithmetic_flag + NumberFormatUtil.numberFormat(
String.valueOf(analyseResult.Xe131m_uncer));
String xe_133m_conc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe133m_con)) +
arithmetic_flag + NumberFormatUtil.numberFormat(
String.valueOf(analyseResult.Xe133m_uncer));
String xe_133_conc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.Xe133_con)) +
arithmetic_flag + NumberFormatUtil.numberFormat(
String.valueOf(analyseResult.Xe133_uncer));
String xe_135_uncertainty = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe135));
String xe_131m_uncertainty = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe131m));
String xe_133m_uncertainty = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe133m));
String xe_133_uncertainty = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe133));
String xe_135_uncertainty =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe135));
String xe_131m_uncertainty =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe131m));
String xe_133m_uncertainty =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe133m));
String xe_133_uncertainty =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.LC_Xe133));
String xe_135_mdc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe135));
String xe_131m_mdc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe131m));
String xe_133m_mdc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe133m));
String xe_133_mdc = NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe133));
String xe_135_mdc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe135));
String xe_131m_mdc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe131m));
String xe_133m_mdc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe133m));
String xe_133_mdc =
NumberFormatUtil.numberFormat(String.valueOf(analyseResult.MDC_Xe133));
String xe_135_nid_flag = analyseResult.Xe135_con > analyseResult.MDC_Xe135 ? "1" : "0";
String xe_131m_nid_flag = analyseResult.Xe131m_con > analyseResult.MDC_Xe131m ? "1" : "0";
String xe_133m_nid_flag = analyseResult.Xe133m_con > analyseResult.MDC_Xe133m ? "1" : "0";
String xe_131m_nid_flag =
analyseResult.Xe131m_con > analyseResult.MDC_Xe131m ? "1" : "0";
String xe_133m_nid_flag =
analyseResult.Xe133m_con > analyseResult.MDC_Xe133m ? "1" : "0";
String xe_133_nid_flag = analyseResult.Xe133_con > analyseResult.MDC_Xe133 ? "1" : "0";
reportContent.append(resultSummaryBlock);
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE, StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(
super.rowFormat(rowTitle, StringConstant.SPACE, StringConstant.SPACE,
StringConstant.SPACE, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue, XE_135, xe_135_conc, xe_135_uncertainty, xe_135_mdc, xe_135_nid_flag));
reportContent.append(
super.rowFormat(rowValue, XE_135, xe_135_conc, xe_135_uncertainty, xe_135_mdc,
xe_135_nid_flag));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue, XE_131m, xe_131m_conc, xe_131m_uncertainty, xe_131m_mdc, xe_131m_nid_flag));
reportContent.append(
super.rowFormat(rowValue, XE_131m, xe_131m_conc, xe_131m_uncertainty,
xe_131m_mdc, xe_131m_nid_flag));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue, XE_133m, xe_133m_conc, xe_133m_uncertainty, xe_133m_mdc, xe_133m_nid_flag));
reportContent.append(
super.rowFormat(rowValue, XE_133m, xe_133m_conc, xe_133m_uncertainty,
xe_133m_mdc, xe_133m_nid_flag));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue, XE_133, xe_133_conc, xe_133_uncertainty, xe_133_mdc, xe_133_nid_flag));
reportContent.append(
super.rowFormat(rowValue, XE_133, xe_133_conc, xe_133_uncertainty, xe_133_mdc,
xe_133_nid_flag));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -851,12 +1018,14 @@ public class Sample_B_Analysis implements BlockConstant {
StringBuilder finalReportPath = new StringBuilder();
finalReportPath.append(spectrumServiceQuotes.getSpectrumPathProperties().getRootPath());
// finalReportPath.append(File.separator);
finalReportPath.append(spectrumServiceQuotes.getSpectrumPathProperties().getSaveFilePath());
finalReportPath.append(
spectrumServiceQuotes.getSpectrumPathProperties().getSaveFilePath());
finalReportPath.append(File.separator);
finalReportPath.append(arrFilePath);
finalReportPath.append(File.separator);
finalReportPath.append(arrFileName);
FileOperation.saveOrAppendFile(finalReportPath.toString(), reportContent.toString(), false);
FileOperation.saveOrAppendFile(finalReportPath.toString(), reportContent.toString(),
false);
}
}
}

View File

@ -372,6 +372,12 @@ public class Sample_G_Analysis {
saveQcCheck(middleData, sampleId, IdAnalysis, qcItems);
/* GARDS_MDC 数据表保存 */
saveMDC(sampleId, IdAnalysis, phdFile.getMdcInfoMap());
//判断 样品普全谱
if (this.sampleData.getDataType().equals("S")&& this.sampleData.getSpectralQualifie().equals("FULL")) {
//关联波形事件数据表
serviceQuotes.getGardsWaveformEventService().create(sampleData.getSampleId());
}
//提交事务
serviceQuotes.getTransactionManager().commit(transactionStatus);
} catch (Exception e) {