修改自动分析和交互分析样品等级,计算阈值相关服务

This commit is contained in:
duwenyuan 2025-09-28 11:26:34 +08:00
parent 3a59339773
commit d8c981c2f4
8 changed files with 1424 additions and 1307 deletions

View File

@ -35,10 +35,11 @@ public class GardsAnalysesServiceImpl extends ServiceImpl<GardsAnalysesMapper, G
* @param endDate 分析结束时间
* @param logPath
* @param reportPath
* @param category 分级结果
* @return
*/
@Override
public GardsAnalyses create(Integer sampleId, GardsSampleData detSampleData, GardsSampleData gasSampleData, Date beginDate, Date endDate, String logPath, String reportPath) {
public GardsAnalyses create(Integer sampleId, GardsSampleData detSampleData, GardsSampleData gasSampleData, Date beginDate, Date endDate, String logPath, String reportPath,Integer category) {
GardsAnalyses analyses = new GardsAnalyses();
analyses.setSampleId(sampleId);
analyses.setAnalysisBegin(beginDate);
@ -47,7 +48,7 @@ public class GardsAnalysesServiceImpl extends ServiceImpl<GardsAnalysesMapper, G
analyses.setSoftware(properties.getSwName());
analyses.setSwVersion(properties.getSwVersion());
analyses.setAnalyst(properties.getAnalyst());
analyses.setCategory(1);//按C++代码写死的1该字段是分级结果张博士还没有想好数据要不要分级1,2,3,4
analyses.setCategory(category);//按C++代码写死的1该字段是分级结果张博士还没有想好数据要不要分级1,2,3,4
analyses.setComments("test");//按C++代码写死的test
analyses.setUsedgasphd(gasSampleData.getInputFileName());
analyses.setUseddetphd(detSampleData.getInputFileName());

View File

@ -4,6 +4,7 @@ import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils;
@ -12,6 +13,7 @@ import org.jeecg.modules.ErrorLogManager;
import org.jeecg.modules.base.dto.Info;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
import org.jeecg.modules.base.entity.rnauto.GardsThresholdResult;
import org.jeecg.modules.base.enums.*;
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
@ -23,8 +25,10 @@ import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.BlockConstant;
import org.jetbrains.annotations.NotNull;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.transaction.TransactionStatus;
import java.io.*;
import java.time.Instant;
import java.time.LocalDateTime;
@ -43,6 +47,8 @@ public class Sample_B_Analysis implements BlockConstant {
*/
private static final String ARR_FILE_SUFFIX = ".txt";
private static final String ARR_FILE_NAME_TAIL = "_rpt";
//样品级别消费组
private final String autoKey = RedisConstant.AUTO_CAT;
/**
* Sample谱结构体数据
*/
@ -133,7 +139,7 @@ public class Sample_B_Analysis implements BlockConstant {
public Sample_B_Analysis() {
}
public Sample_B_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler){
public Sample_B_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler) {
this.sampleData = spectrumHandler.sampleData;
this.sampleFileFinalPath = spectrumHandler.spectrumFile.getAbsolutePath();
this.spectrumServiceQuotes = spectrumHandler.spectrumServiceQuotes;
@ -150,7 +156,7 @@ public class Sample_B_Analysis implements BlockConstant {
public void analysis() throws BAnalyseException {
//标记整个分析过程是否分析失败
boolean analyseFail = false;
try{
try {
this.startAnalysisTime = new Date();
//声明分析日志对象
parsingProcessLog.setSample_B_Analysis(this);
@ -169,24 +175,25 @@ public class Sample_B_Analysis implements BlockConstant {
report.start();
//发送数据到redis
pushToRedis();
}catch (Exception e){
} catch (Exception e) {
analyseFail = true;
if (e instanceof DuplicateKeyException) {
throw new BAnalyseException(e.getMessage(), true);
} else {
throw new BAnalyseException(e.getMessage());
}
}finally {
} finally {
this.endAnalysisTime = new Date();
//如果分析成功并且analyses对象不为空
if(!analyseFail && Objects.nonNull(this.analyses)){
spectrumServiceQuotes.getAnalysesService().updateAnalysesEndTime(this.analyses.getIdAnalysis(),this.endAnalysisTime);
if (!analyseFail && Objects.nonNull(this.analyses)) {
spectrumServiceQuotes.getAnalysesService().updateAnalysesEndTime(this.analyses.getIdAnalysis(), this.endAnalysisTime);
}
}
}
/**
* 查询detgas数据sample在构造函数已经传过来
*
* @throws FileNotExistException
*/
private void queryPHDFile() throws FileNotExistException {
@ -195,11 +202,11 @@ public class Sample_B_Analysis implements BlockConstant {
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..");
}
}
@ -207,7 +214,7 @@ public class Sample_B_Analysis implements BlockConstant {
/**
* 创建报告文件路径
*/
private void structureLogAndArrFilePath(){
private void structureLogAndArrFilePath() {
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
//构造报告文件路径
StringBuilder relativePath = new StringBuilder();
@ -217,27 +224,29 @@ public class Sample_B_Analysis implements BlockConstant {
relativePath.append(File.separator);
relativePath.append(this.spectrumFileRelativePath);
this.arrFilePath = relativePath.toString();
String arrFileTail = ARR_FILE_NAME_TAIL+ARR_FILE_SUFFIX;
this.arrFileName = this.phdFileName.replace(DataType.SAMPLEPHD.getSuffix(),arrFileTail);
String arrFileTail = ARR_FILE_NAME_TAIL + ARR_FILE_SUFFIX;
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){
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);
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);
}
}
/**
* 获取det和gas谱PHD文件sample谱PHD文件位置在构造函数已经传过来
*
* @throws IOException
*/
private void getPHDFile() throws IOException, FileNotExistException {
@ -251,7 +260,7 @@ public class Sample_B_Analysis implements BlockConstant {
gasFileFinalPath.append(gasSampleData.getInputFileName());
this.gasFileFinalPath = gasFileFinalPath.toString();
File gasFile = new File(this.gasFileFinalPath);
if(!gasFile.exists()){
if (!gasFile.exists()) {
flag = true;
}
@ -264,13 +273,13 @@ public class Sample_B_Analysis implements BlockConstant {
detFileFinalPath.append(detSampleData.getInputFileName());
this.detFileFinalPath = detFileFinalPath.toString();
File detFile = new File(this.detFileFinalPath);
if(!detFile.exists()){
if (!detFile.exists()) {
flag = true;
}
if(flag){
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);
@ -280,50 +289,62 @@ public class Sample_B_Analysis implements BlockConstant {
/**
* 数据入库
*/
private void storageDataToDatabase(){
String logFileRelativePath = this.logFilePath+StringConstant.SLASH+this.logFileName;
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());
if(Objects.nonNull(idAnalysis)){
log.warn("{} file analysis data has been stored",new File(this.sampleFileFinalPath).getName());
if (Objects.nonNull(idAnalysis)) {
log.warn("{} file analysis data has been stored", new File(this.sampleFileFinalPath).getName());
return;
}
DataSourceSwitcher.switchToOracle();
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
try{
try {
Integer category = 1;
try {
//TODO 获取样品级别
//获取阈值结果
List<GardsThresholdResult> thresholds = spectrumServiceQuotes.getGardsThresholdService().findThresholdResults(this.sampleData.getStationId().toString());
//样品分级
category = spectrumServiceQuotes.getSampleGradingService().processAutoTypeB(getSampleInfo(), thresholds);
} catch (Exception e) {
}
//存储基础数据
this.analyses = spectrumServiceQuotes.getAnalysesService().create(this.sampleData.getSampleId(),this.detSampleData,
this.gasSampleData,this.startAnalysisTime,this.endAnalysisTime,logFileRelativePath,arrFileRelativePath);
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());
//提交事务
spectrumServiceQuotes.getTransactionManager().commit(transactionStatus);
}catch (Exception e){
} catch (Exception e) {
//设置分析数据存储失败标记
this.parsingProcessLog.setAnalysisDataStoreFlag(false);
//回滚事务
spectrumServiceQuotes.getTransactionManager().rollback(transactionStatus);
throw e;
}finally {
} finally {
DataSourceSwitcher.clearDataSource();
}
}
@ -331,10 +352,20 @@ public class Sample_B_Analysis implements BlockConstant {
/**
* 分析成功数据发送到Redis
*/
private void pushToRedis(){
private void pushToRedis() {
Info info = getSampleInfo();
spectrumServiceQuotes.getRedisStreamUtil().pushAnalysis(info);
//把分析结果信息存储到redis
spectrumServiceQuotes.getRedisStreamUtil().addMessage(autoKey, info);
}
@NotNull
private Info getSampleInfo() {
Info info = new Info();
info.setStationId(this.sampleData.getStationId().toString());
info.setSampleId(this.sampleData.getSampleId().toString());
info.setIdAnalysis(this.analyses.getIdAnalysis().toString());
info.setSampleType(this.sampleData.getSampleType());
info.setSampleName(this.phdFileName);
final Instant instant = this.sampleData.getCollectStart().toInstant();
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
@ -342,17 +373,17 @@ public class Sample_B_Analysis implements BlockConstant {
info.setDatasource(DSType.ARMDARR.getType());
info.setFullOrPrel(this.sampleData.getSpectralQualifie());
info.setBetaOrGamma(SpectrumType.BETA.getType());
Map<String,String> nuclides = Maps.newHashMap();
nuclides.put(XE_131m,String.valueOf(analyseResult.Xe131m_con));
nuclides.put(XE_133,String.valueOf(analyseResult.Xe133_con));
nuclides.put(XE_133m,String.valueOf(analyseResult.Xe133m_con));
nuclides.put(XE_135,String.valueOf(analyseResult.Xe135_con));
Map<String, String> nuclides = Maps.newHashMap();
nuclides.put(XE_131m, String.valueOf(analyseResult.Xe131m_con));
nuclides.put(XE_133, String.valueOf(analyseResult.Xe133_con));
nuclides.put(XE_133m, String.valueOf(analyseResult.Xe133m_con));
nuclides.put(XE_135, String.valueOf(analyseResult.Xe135_con));
info.setNuclides(nuclides);
info.setAnalyst(CommonConstant.REPORT_PREFIX_AUTO);
spectrumServiceQuotes.getRedisStreamUtil().pushAnalysis(info);
return info;
}
public Sample_B_Analysis.B_AnalysisReport getReport(){
public Sample_B_Analysis.B_AnalysisReport getReport() {
return new Sample_B_Analysis.B_AnalysisReport();
}
@ -360,7 +391,7 @@ public class Sample_B_Analysis implements BlockConstant {
/**
* B谱分析报告
*/
private class B_AnalysisReport extends AbstractAutoLogOrReport{
private class B_AnalysisReport extends AbstractAutoLogOrReport {
/**
* 模版内容
*/
@ -407,26 +438,26 @@ public class Sample_B_Analysis implements BlockConstant {
/**
* 处理报告头
*/
private void handleReportHeader(){
private void handleReportHeader() {
String header_1 = "%-64s CNL06 GENERATED REPORT";
String header_2 = "%-63s AUTO RADIONUCLIDE REPORT";
String header_3 = "%-65s (Noble Gas Version) ";
String createDateLine = "%-58s Creation Date %s";
final String createDate = DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss");
reportContent.append(super.rowFormat(header_1,StringConstant.SPACE));
reportContent.append(super.rowFormat(header_1, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(header_2,StringConstant.SPACE));
reportContent.append(super.rowFormat(header_2, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(header_3,StringConstant.SPACE));
reportContent.append(super.rowFormat(header_3, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(createDateLine,StringConstant.SPACE,createDate));
reportContent.append(super.rowFormat(createDateLine, StringConstant.SPACE, createDate));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
/**
* 处理#FILE INFORMATION 模块
*/
private void handleFileInfoMation(){
private void handleFileInfoMation() {
String fileBlock = "#FILE INFORMATION";
String sampleMeasId = " SampleMeasID:%-36s %s";
String gasMeasId = " GASBKMeasID:%-37s %s";
@ -435,22 +466,22 @@ 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(super.rowFormat(detectorType, StringConstant.SPACE, "3D b-g"));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
/**
* 处理#COLLECTION INFORMATION 模块
*/
private void handleCollectionInfoMation(){
private void handleCollectionInfoMation() {
String collectionInfoBlock = "#COLLECTION INFORMATION";
String stationId = " Station ID:%-38s %s";
String detectorId = " Detector ID:%-37s %s";
@ -462,51 +493,51 @@ 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());
}
/**
* 处理#ACQUISITION INFORMATION 模块
*/
private void handleAcquistionInfoMation(){
private void handleAcquistionInfoMation() {
String acqInfoBlock = "#ACQUISITION INFORMATION";
String acquisitionStart = " Acquisition Start:%-31s %s";
String acqRealTime = " Acq Real Time(s):%-32s %s";
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());
}
/**
* 处理#SOFTWARE 模块
*/
private void handleSoftware(){
private void handleSoftware() {
String softwareBlock = "#SOFTWARE";
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());
}
@ -518,18 +549,18 @@ 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(super.rowFormat(rowTitle, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue,beta_ch,gamma_ch));
reportContent.append(super.rowFormat(rowValue, beta_ch, gamma_ch));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue,beta_e,gamma_e));
reportContent.append(super.rowFormat(rowValue, beta_e, gamma_e));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -546,17 +577,17 @@ 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);
String gamma = g_chan_start.get(i)+to_flag+g_chan_stop.get(i);
reportContent.append(super.rowFormat(rowValue,String.valueOf(i+1),beta,gamma));
if(i==roi.size()-1){
for (int i = 0; i < roi.size(); i++) {
String beta = b_chan_start.get(i) + to_flag + b_chan_stop.get(i);
String gamma = g_chan_start.get(i) + to_flag + g_chan_stop.get(i);
reportContent.append(super.rowFormat(rowValue, String.valueOf(i + 1), beta, gamma));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}else{
} else {
reportContent.append(System.lineSeparator());
}
}
@ -570,18 +601,18 @@ 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(super.rowFormat(rowTitle, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue,beta_ch,gamma_ch));
reportContent.append(super.rowFormat(rowValue, beta_ch, gamma_ch));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue,beta_e,gamma_e));
reportContent.append(super.rowFormat(rowValue, beta_e, gamma_e));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -598,17 +629,17 @@ 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);
String gamma = g_chan_start.get(i)+to_flag+g_chan_stop.get(i);
reportContent.append(super.rowFormat(rowValue,String.valueOf(i+1),beta,gamma));
if(i==roi.size()-1){
for (int i = 0; i < roi.size(); i++) {
String beta = b_chan_start.get(i) + to_flag + b_chan_stop.get(i);
String gamma = g_chan_start.get(i) + to_flag + g_chan_stop.get(i);
reportContent.append(super.rowFormat(rowValue, String.valueOf(i + 1), beta, gamma));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}else{
} else {
reportContent.append(System.lineSeparator());
}
}
@ -622,18 +653,18 @@ 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(super.rowFormat(rowTitle, StringConstant.SPACE));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue,beta_ch,gamma_ch));
reportContent.append(super.rowFormat(rowValue, beta_ch, gamma_ch));
reportContent.append(System.lineSeparator());
reportContent.append(super.rowFormat(rowValue,beta_e,gamma_e));
reportContent.append(super.rowFormat(rowValue, beta_e, gamma_e));
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}
@ -650,17 +681,17 @@ 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);
String gamma = g_chan_start.get(i)+to_flag+g_chan_stop.get(i);
reportContent.append(super.rowFormat(rowValue,String.valueOf(i+1),beta,gamma));
if(i==roi.size()-1){
for (int i = 0; i < roi.size(); i++) {
String beta = b_chan_start.get(i) + to_flag + b_chan_stop.get(i);
String gamma = g_chan_start.get(i) + to_flag + g_chan_stop.get(i);
reportContent.append(super.rowFormat(rowValue, String.valueOf(i + 1), beta, gamma));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}else{
} else {
reportContent.append(System.lineSeparator());
}
}
@ -675,19 +706,19 @@ public class Sample_B_Analysis implements BlockConstant {
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> 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)));
if(i==roi.size()-1){
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)));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}else{
} else {
reportContent.append(System.lineSeparator());
}
}
@ -701,23 +732,23 @@ public class Sample_B_Analysis implements BlockConstant {
String rowTitle = " Roi %-46s Net count %-41s LC";
String rowValue = " %-50s %-51s %s";
List<Integer> roi = analyseResult.ROI;
List<Integer> roi = analyseResult.ROI;
List<Double> roi_net_count = analyseResult.ROI_net_coutns;
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());
analyseResult.LC_CTS.add(0, 0D);
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)));
if(i==roi.size()-1){
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)));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}else{
} else {
reportContent.append(System.lineSeparator());
}
}
@ -734,21 +765,21 @@ public class Sample_B_Analysis implements BlockConstant {
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());
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());
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)));
if(i==roi.size()-1){
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)));
if (i == roi.size() - 1) {
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
}else{
} else {
reportContent.append(System.lineSeparator());
}
}
@ -762,7 +793,7 @@ public class Sample_B_Analysis implements BlockConstant {
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[] 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));
@ -779,22 +810,22 @@ public class Sample_B_Analysis implements BlockConstant {
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_133_nid_flag = analyseResult.Xe133_con>analyseResult.MDC_Xe133?"1":"0";
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_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());
}
@ -810,7 +841,7 @@ public class Sample_B_Analysis implements BlockConstant {
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

@ -534,7 +534,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
Map<String, QcCheckItem> qcItems = new TreeMap<>();
//调用方法 读取文件信息 判断QC数据
//if (!ReadQCLimit(qcItems, vMdcInfoMap, Be7Value, phd.getHeader().getSystem_type().toUpperCase())) {
// String WARNING = "Read QC Flags from SystemManager.xml Failed!";
// String WARNING = "Read QC Flags from SystemManager.xml Failed!";
//}
String stationCode = phd.getHeader().getSite_code();
GardsStations stationInfo = getStationInfo(stationCode);
@ -542,7 +542,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
if (!ReadQCLimitByStationType(qcItems, vMdcInfoMap, Be7Value, stationType, stationCode)) {
String WARNING = "Read QC Flags from SystemManager.xml Failed!";
}
if (qcItems.isEmpty()) {
if (!ReadQCLimit(qcItems, vMdcInfoMap, Be7Value, phd.getHeader().getSystem_type().toUpperCase())) {
String WARNING = "Read QC Flags from SystemManager.xml Failed!";
}
}
//判断map是否为空
if (CollectionUtils.isNotEmpty(vMdcInfoMap)) {
//根据键值按顺序向数组中插入数据
@ -768,7 +772,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
public boolean ReadQCLimit(Map<String, QcCheckItem> qcItems, Map<String, Double> vMdcInfoMap, List<Double> Be7Value, String systemType) {
try {
String filePath = parameterProperties.getFilePath() + File.separator + "SystemManager.xml";
String filePath = parameterProperties.getFilePath() + File.separator + "parameter.xml";
//创建一个文档解析器工厂
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//创建文档解析器

View File

@ -519,6 +519,7 @@
NUMBEROFPEAKS numberOfPeaks,
BASELINE_PATH baselinePath,
LC_PATH lcPath,
CATEGORY category,
SCAC_PATH scacPath
FROM
${dbName}

View File

@ -27,6 +27,7 @@ import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.system.util.JwtUtil;
@ -39,8 +40,10 @@ import org.jeecg.modules.base.dto.NuclideActMdaDto;
import org.jeecg.modules.base.dto.PeakInfoDto;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.entity.rnman.GardsThresholdResult;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.base.enums.*;
import org.jeecg.modules.base.service.ISampleGradingService;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
@ -86,7 +89,7 @@ import static org.jeecg.modules.base.enums.ExportTemplate.*;
@Service(value = "gammaService")
@DS("ora")
public class GammaServiceImpl extends AbstractLogOrReport implements IGammaService {
private final String manKey = RedisConstant.CATEGORY;
@Autowired
private LocalCache localCache;
@Autowired
@ -156,6 +159,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Autowired
private IDataService dataService;
/// 样品等级服务
@Autowired
private ISampleGradingService sampleGradingService;
// 获取阈值信息
@Autowired
private IRnManGardsThresholdService gardsThresholdService;
@Override
public void initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
@ -203,7 +213,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
// 从数据库中读取phd其他相关信息
boolean bRet = getResultFromDB(dbName, analyst, sampleId, phd, result);
if (!redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list")) {
if (!redisUtil.hasKey(userName + StringPool.DASH + phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list")) {
//读取缓存的全部核素信息
Map<String, NuclideLines> allNuclideMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
// 查询当前用户关联的核素信息
@ -215,13 +225,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
userLib = userLib.stream().sorted().collect(Collectors.toList());
Map<String, NuclideLines> nuclideMap = new HashMap<>();
for (Map.Entry<String, NuclideLines> entry:allNuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : allNuclideMap.entrySet()) {
if (userLib.contains(entry.getKey())) {
nuclideMap.put(entry.getKey(), entry.getValue());
}
}
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap);
redisUtil.set(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list", userLib);
redisUtil.set(userName + StringPool.DASH + phd.getHeader().getSystem_type(), nuclideMap);
}
//缓存phd谱的核素信息
Map<String, NuclideLines> phdNuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
@ -231,7 +241,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result;
}
//读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-" + phd.getHeader().getSystem_type());
//如果是数据库加载 判断如果mdc计算结果是空的 就加入新的 否则使用数据库加载的mdc数据
if (CollectionUtils.isEmpty(phd.getMdcInfoMap())) {
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
@ -240,7 +250,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} else {
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
Map<String, CalMDCInfo> infoMap = phd.getMdcInfoMap();
for (Map.Entry<String, CalMDCInfo> entry:infoMap.entrySet()) {
for (Map.Entry<String, CalMDCInfo> entry : infoMap.entrySet()) {
String nuclName = entry.getKey();
CalMDCInfo info = mdcInfoMap.get(nuclName);
if (Objects.nonNull(info)) {
@ -332,6 +342,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
phd.setBaseline_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getBaselinePath());
phd.setLc_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getLcPath());
phd.setScac_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getScacPath());
if (analysis.getCategory()!=null){
phd.setCategory(analysis.getCategory().toString());
}
peakNum = analysis.getNumberOfPeaks();
phd.setTotalCmt(analysis.getComments());
phd.getBaseCtrls().setRg_low(analysis.getSearchStartChannel());
@ -538,7 +551,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
for (GardsQcCheckSpectrum qcCheckSpectrum : qcChecks) {
String str_key = qcCheckSpectrum.getQcName();
QcCheckItem qcCheckItem = new QcCheckItem();
qcCheckItem.setValue(qcCheckSpectrum.getQcValue() == null?0.0:qcCheckSpectrum.getQcValue());
qcCheckItem.setValue(qcCheckSpectrum.getQcValue() == null ? 0.0 : qcCheckSpectrum.getQcValue());
qcCheckItem.setBPass(qcCheckSpectrum.getQcResult() == 1);
qcCheckItem.setStandard(qcCheckSpectrum.getQcStandard());
phd.getQcItems().put(str_key, qcCheckItem);
@ -555,7 +568,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
GardsAnalySetting analySetting = spectrumAnalysisMapper.getAnalySetting(analysis.getIdAnalysis());
if (Objects.nonNull(analySetting)) {
phd.getUsedSetting().setECutAnalysis_Low(analySetting.getEcutanalysisLow());
phd.getUsedSetting().setECutAnalysis_High((Objects.nonNull(analySetting.getEcutanalysisHigh())?(analySetting.getEcutanalysisHigh() <= phd.getUsedSetting().getECutAnalysis_Low()?-9999:analySetting.getEcutanalysisHigh()):-9999));
phd.getUsedSetting().setECutAnalysis_High((Objects.nonNull(analySetting.getEcutanalysisHigh()) ? (analySetting.getEcutanalysisHigh() <= phd.getUsedSetting().getECutAnalysis_Low() ? -9999 : analySetting.getEcutanalysisHigh()) : -9999));
phd.getUsedSetting().setEnergyTolerance(analySetting.getEnergytolerance());
phd.getUsedSetting().setCalibrationPSS_high(analySetting.getCalibrationpssHigh());
phd.getUsedSetting().setCalibrationPSS_low(analySetting.getCalibrationpssLow());
@ -610,7 +623,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!bRet) {
return result;
}
if (!redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list")) {
if (!redisUtil.hasKey(userName + StringPool.DASH + phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list")) {
//读取缓存的全部核素信息
Map<String, NuclideLines> allNuclideMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
// 查询当前用户关联的核素信息
@ -622,19 +635,19 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
userLib = userLib.stream().sorted().collect(Collectors.toList());
Map<String, NuclideLines> nuclideMap = new HashMap<>();
for (Map.Entry<String, NuclideLines> entry:allNuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : allNuclideMap.entrySet()) {
if (userLib.contains(entry.getKey())) {
nuclideMap.put(entry.getKey(), entry.getValue());
}
}
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap);
redisUtil.set(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list", userLib);
redisUtil.set(userName + StringPool.DASH + phd.getHeader().getSystem_type(), nuclideMap);
}
//缓存phd谱的核素信息
Map<String, NuclideLines> phdNuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
phd.setPhdNuclideMap(phdNuclideMap);
//读取redis缓存的计算mdc信息
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-"+phd.getHeader().getSystem_type());
Map<String, CalMDCInfo> mdcInfoMap = (Map<String, CalMDCInfo>) redisUtil.get("mdcInfoMap-" + phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(mdcInfoMap)) {
phd.setMdcInfoMap(mdcInfoMap);
}
@ -679,7 +692,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
@Override
public Result loadSampleData(QueryRequest queryRequest, GardsSampleDataSpectrum gardsSampleData, String[] menuTypes, boolean AllUsers, boolean CollectStopB, boolean AcqStartB, Date startDate, Date endDate, HttpServletRequest request) {
Result result = new Result();
if (Objects.isNull(startDate)){
if (Objects.isNull(startDate)) {
result.error500("The start time cannot be empty");
return result;
}
@ -690,7 +703,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59";
List<String> menuTypeList = Arrays.asList(menuTypes);
if (CollectionUtils.isEmpty(menuTypeList)){
if (CollectionUtils.isEmpty(menuTypeList)) {
result.error500("The spectrum type cannot be empty");
return result;
}
@ -700,9 +713,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result;
}
List<String> userStations = new LinkedList<>();
if (Objects.nonNull(AllUsers) && !AllUsers){
if (Objects.nonNull(AllUsers) && !AllUsers) {
String userName = JwtUtil.getUserNameByToken(request);
if (StringUtils.isBlank(userName)){
if (StringUtils.isBlank(userName)) {
result.error500("Description Failed to obtain the current login user information");
return result;
}
@ -933,7 +946,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String fileName = configureData.getFileName();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
if (configureData.isApplyAll()) {
for (String key: phdCache.asMap().keySet()) {
for (String key : phdCache.asMap().keySet()) {
PHDFile phd = phdCache.getIfPresent(key);
if (Objects.isNull(phd)) {
result.error500("Please select the parse file first");
@ -1006,7 +1019,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
"2. You didn't change any setting or calibration.";
result.error500(warning);
} else if (flag == -1) {
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//分析时将phd的核素map重置
phd.setPhdNuclideMap(nuclideLinesMap);
//重新计算核素的活度浓度
@ -1024,7 +1037,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
"\t3.Test QC again.";
result.error500(warning);
} else {
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//分析时将phd的核素map重置
phd.setPhdNuclideMap(nuclideLinesMap);
//调用分析算法
@ -1218,8 +1231,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
peak.upperTailAlpha = structInsertOutput.upperTailAlpha.get(j);
peak.efficiency = structInsertOutput.efficiency.get(j);
peak.BWWidthChan = 0;
peak.recoilBetaChan = Objects.isNull(structInsertOutput.recoilBetaChan.get(j))?"nan":String.valueOf(structInsertOutput.recoilBetaChan.get(j));
peak.recoilDeltaChan = Objects.isNull(structInsertOutput.recoilDeltaChan.get(j))?"nan":String.valueOf(structInsertOutput.recoilDeltaChan.get(j));
peak.recoilBetaChan = Objects.isNull(structInsertOutput.recoilBetaChan.get(j)) ? "nan" : String.valueOf(structInsertOutput.recoilBetaChan.get(j));
peak.recoilDeltaChan = Objects.isNull(structInsertOutput.recoilDeltaChan.get(j)) ? "nan" : String.valueOf(structInsertOutput.recoilDeltaChan.get(j));
newPeaks.add(a, peak);
}
}
@ -1306,7 +1319,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Map<String, NuclideLines> nuclideLinesMap = phd.getPhdNuclideMap();//(Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
if (flag.equalsIgnoreCase("insert")) {// 如果传递的flag标识 Insert则进行峰值的插入
//重新赋值index
for (int k=0; k<newPeak.size(); k++) {
for (int k = 0; k < newPeak.size(); k++) {
newPeak.get(k).index = k;
}
phd.setVPeak(newPeak);
@ -1347,13 +1360,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
if (!tablePeaksList.get(j).isNetAreaB()) {
Af.add(Integer.valueOf(tablePeaksList.get(j).getLab())-1);
Af.add(Integer.valueOf(tablePeaksList.get(j).getLab()) - 1);
}
if (!tablePeaksList.get(j).isCentroid()) {
Cf.add(Integer.valueOf(tablePeaksList.get(j).getLab())-1);
Cf.add(Integer.valueOf(tablePeaksList.get(j).getLab()) - 1);
}
if (!tablePeaksList.get(j).isFwhmB()) {
Ff.add(Integer.valueOf(tablePeaksList.get(j).getLab())-1);
Ff.add(Integer.valueOf(tablePeaksList.get(j).getLab()) - 1);
}
}
ObjectMapper mapper = new ObjectMapper();
@ -1363,7 +1376,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
for (Map.Entry<String, Object> entry : parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("vPeak")) {
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
for (PeakInfo info:value) {
for (PeakInfo info : value) {
if (info.significance == -9999) {
info.significance = Double.POSITIVE_INFINITY;
}
@ -1439,7 +1452,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
double energy = info.energy;
if (CollectionUtils.isNotEmpty(info.nuclides)) {
//遍历核素信息
for (int i=0; i<info.nuclides.size(); i++) {
for (int i = 0; i < info.nuclides.size(); i++) {
String nuclideName = info.nuclides.get(i);
//从缓存信息中获取核素名称
NuclideLines nuclideLines = nuclideMap.get(nuclideName);
@ -1448,9 +1461,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//获取最大活度对应的核素能量值
Double maxEnergy = nuclideLines.getVenergy().get(maxYeildIdx);
//判断当前选中的峰值信息的能量值 是否在 最大活度对应的核素能量值公差范围内
if (energy >= maxEnergy-0.5 && energy <= maxEnergy+0.5) {
if (energy >= maxEnergy - 0.5 && energy <= maxEnergy + 0.5) {
//则需要删除所有关联的核素信息并 从MapNucAct中移除相关核素内容
for (PeakInfo peakInfo: phd.getVPeak()) {
for (PeakInfo peakInfo : phd.getVPeak()) {
//如果峰的核素名称中包含当前删除的核素
if (peakInfo.nuclides.contains(nuclideName)) {
peakInfo.nuclides.remove(nuclideName);
@ -1555,7 +1568,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
int index = gammaFileUtil.FindNearPeak(phd.getVPeak(), channel, false);
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
//计算核素范围的最小能量值
double min = energy - phd.getSetting().getEnergyTolerance();
@ -1566,14 +1579,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
List<String> fullNames = nuclideLines.getFullNames();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (Objects.nonNull(venergy.get(i)) && venergy.get(i) > min && venergy.get(i) < max) {
list_possible.add(fullNames.get(i));
@ -1583,14 +1596,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
if (phd.getHeader().getSystem_type().equals("P")) {
if (CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclCoincidenceSumMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
List<String> fullNames = nuclideLines.getFullNames();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (Objects.nonNull(venergy.get(i)) && venergy.get(i) > min && venergy.get(i) < max) {
list_possible.add(fullNames.get(i));
@ -1627,7 +1640,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
int index = gammaFileUtil.FindNearPeak(phd.getVPeak(), channel, false);
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//计算核素范围的最小能量值
double min = phd.getVPeak().get(index).energy - phd.getSetting().getEnergyTolerance();
//计算核素范围的最大能量值
@ -1637,13 +1650,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (Objects.nonNull(venergy.get(i)) && venergy.get(i) > min && venergy.get(i) < max) {
list_possible.add(entry.getKey());
@ -1689,7 +1702,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// 根据要进行修改的列的数据下标 操作Vpeak数据
PeakInfo peakInfo = phd.getVPeak().get(curRow);
List<String> peakNuclides = peakInfo.nuclides;
if (peakNuclides.indexOf(nuclideName) < 0 ) {
if (peakNuclides.indexOf(nuclideName) < 0) {
peakNuclides.add(nuclideName);
}
// todo 添加核素需要把deletedNuclideMap中对应的核素删除
@ -1698,7 +1711,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
deletedNuclide.remove(nuclideName);
}
// 查询当前用户所关心的核素名称
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> mapNucLines = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//用户当前缓存的核素信息
Map<String, NuclideLines> phdNuclideMap = phd.getPhdNuclideMap();
// 查询出核素信息
@ -1762,9 +1775,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//获取当前选中的峰值信息的能量值
double energy = phd.getVPeak().get(curRow).energy;
//判断当前选中的峰值信息的能量值 是否在 最大活度对应的核素能量值公差范围内
if (energy >= maxEnergy-0.5 && energy <= maxEnergy+0.5) {
if (energy >= maxEnergy - 0.5 && energy <= maxEnergy + 0.5) {
//则需要删除所有关联的核素信息并 从MapNucAct中移除相关核素内容
for (PeakInfo peakInfo: phd.getVPeak()) {
for (PeakInfo peakInfo : phd.getVPeak()) {
//如果峰的核素名称中包含当前删除的核素
if (peakInfo.nuclides.contains(nuclideName)) {
peakInfo.nuclides.remove(nuclideName);
@ -1908,7 +1921,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
return result;
}
Map<String, String> colorMap = sysUserColorService.initColor(userName);
double value = gammaFileUtil.GetEnergyByFloatChan(phd, channel.intValue()-1);
double value = gammaFileUtil.GetEnergyByFloatChan(phd, channel.intValue() - 1);
BigDecimal bigDecimal = BigDecimal.valueOf(value);
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
map.put("energy", bigDecimal);
@ -1917,18 +1930,18 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
double min = bigDecimal.doubleValue() - 0.5;
double max = bigDecimal.doubleValue() + 0.5;
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclideList.add(entry.getKey());
@ -1940,13 +1953,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (phd.getHeader().getSystem_type().equals("P")) {
if (CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclCoincidenceSumMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclideList.add(entry.getKey());
@ -1999,17 +2012,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
double min = bigDecimal.doubleValue() - 0.5;
double max = bigDecimal.doubleValue() + 0.5;
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclideList.add(entry.getKey());
@ -2045,16 +2058,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//获取当前核素名称的核素集合
NuclideLines lines = nuclideMap.get(name);
List<GardsNuclLinesLib> nuclideTableList = new LinkedList<>();//spectrumAnalysisMapper.getNuclideTable(name, span);
for (int i=0; i<lines.fullNames.size(); i++) {
for (int i = 0; i < lines.fullNames.size(); i++) {
Double energy = lines.venergy.get(i);
if (Objects.nonNull(energy)) {
if (lines.venergy.get(i) >= 30 && lines.venergy.get(i) <= span) {
GardsNuclLinesLib nuclLinesLib = new GardsNuclLinesLib();
nuclLinesLib.setFullName(lines.fullNames.get(i));
nuclLinesLib.setEnergy(Double.valueOf(String.format("%.3f", lines.venergy.get(i))));
nuclLinesLib.setEnergyUncert(Objects.nonNull(lines.vuncertE.get(i))?Double.valueOf(String.format("%.3f", lines.vuncertE.get(i))):0.0);
nuclLinesLib.setYield(Objects.nonNull(lines.vyield.get(i))?Double.valueOf(String.format("%.3f", lines.vyield.get(i)*100)):0.0);
nuclLinesLib.setYieldUncert(Objects.nonNull(lines.vuncertY.get(i))?Double.valueOf(String.format("%.3f", lines.vuncertY.get(i))):0.0);
nuclLinesLib.setEnergyUncert(Objects.nonNull(lines.vuncertE.get(i)) ? Double.valueOf(String.format("%.3f", lines.vuncertE.get(i))) : 0.0);
nuclLinesLib.setYield(Objects.nonNull(lines.vyield.get(i)) ? Double.valueOf(String.format("%.3f", lines.vyield.get(i) * 100)) : 0.0);
nuclLinesLib.setYieldUncert(Objects.nonNull(lines.vuncertY.get(i)) ? Double.valueOf(String.format("%.3f", lines.vuncertY.get(i))) : 0.0);
nuclideTableList.add(nuclLinesLib);
}
}
@ -2116,7 +2129,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Map<String, String> colorMap = sysUserColorService.initColor(userName);
//获取缓存的核素信息
Map<String, NuclideLines> nuclideLinesMap = new HashMap<>();
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
if (phd.getHeader().getSystem_type().equals("P")) {
NuclideLines newNuclideLines = new NuclideLines();
@ -2126,7 +2139,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
List<Double> vYield = new LinkedList<>();
List<Double> vYieldUncert = new LinkedList<>();
if (CollectionUtils.isNotEmpty(nuclideMap)) {
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
NuclideLines nuclideLines = entry.getValue();
if (nuclideLines.fullNames.contains(nuclideName)) {
nuclideName = entry.getKey();
@ -2134,7 +2147,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
}
if (CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclCoincidenceSumMap.entrySet()) {
NuclideLines nuclideLines = entry.getValue();
if (nuclideLines.fullNames.contains(nuclideName)) {
nuclideName = entry.getKey();
@ -2185,9 +2198,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
Map<String, String> colorMap = sysUserColorService.initColor(userName);
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
if (CollectionUtils.isNotEmpty(nuclideMap)) {
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
NuclideLines nuclideLines = entry.getValue();
if (nuclideLines.fullNames.contains(nuclideName)) {
nuclideName = entry.getKey();
@ -2196,7 +2209,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
Map<String, NuclideLines> nuclCoincidenceSumMap = (Map<String, NuclideLines>) redisUtil.get("nuclCoincidenceSumMap");
if (phd.getHeader().getSystem_type().equals("P") && CollectionUtils.isNotEmpty(nuclCoincidenceSumMap)) {
for (Map.Entry<String, NuclideLines> entry:nuclCoincidenceSumMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclCoincidenceSumMap.entrySet()) {
NuclideLines nuclideLines = entry.getValue();
if (nuclideLines.fullNames.contains(nuclideName)) {
nuclideName = entry.getKey();
@ -2229,17 +2242,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
double min = bigDecimal.doubleValue() - tolerance;
double max = bigDecimal.doubleValue() + tolerance;
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclideList.add(entry.getKey());
@ -2601,8 +2614,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
data.setPeakEffi(null);
}
} else {
effi = Math.exp( coeffData.Effciency1 * ener + coeffData.Effciency2 + coeffData.Effciency3 / ener + coeffData.Effciency4 / Math.pow(ener, 2) + coeffData.Effciency5 / Math.pow(ener, 3) + coeffData.Effciency6 / Math.pow(ener, 4) );
totE = Math.exp( coeffData.totalEf1 * ener + coeffData.totalEf2 + coeffData.totalEf3 / ener + coeffData.totalEf4 / Math.pow(ener, 2) + coeffData.totalEf5 / Math.pow(ener, 3) + coeffData.totalEf6 / Math.pow(ener, 4) );
effi = Math.exp(coeffData.Effciency1 * ener + coeffData.Effciency2 + coeffData.Effciency3 / ener + coeffData.Effciency4 / Math.pow(ener, 2) + coeffData.Effciency5 / Math.pow(ener, 3) + coeffData.Effciency6 / Math.pow(ener, 4));
totE = Math.exp(coeffData.totalEf1 * ener + coeffData.totalEf2 + coeffData.totalEf3 / ener + coeffData.totalEf4 / Math.pow(ener, 2) + coeffData.totalEf5 / Math.pow(ener, 3) + coeffData.totalEf6 / Math.pow(ener, 4));
data.setTotalEffi(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(totE))));
data.setPeakEffi(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(effi))));
}
@ -3648,17 +3661,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
double max = editEnergyDou + err;
if (libraryName.equals("UserLibrary")) {
//获取缓存的核素信息
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type());
Map<String, NuclideLines> nuclideMap = (Map<String, NuclideLines>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type());
//判断缓存的核素信息是否为空
if (CollectionUtils.isNotEmpty(nuclideMap)) {
//遍历核素信息
for (Map.Entry<String, NuclideLines> entry:nuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : nuclideMap.entrySet()) {
//获取核素的关联信息
NuclideLines nuclideLines = entry.getValue();
//获取核素关联的全部能量信息
List<Double> venergy = nuclideLines.getVenergy();
//遍历能量
for (int i=0; i<venergy.size(); i++) {
for (int i = 0; i < venergy.size(); i++) {
//如果有一个能量在范围内 则将核素名称存入返回结果数组并结束当前核素名称的循环
if (venergy.get(i) > min && venergy.get(i) < max) {
nuclides.add(entry.getKey());
@ -3675,7 +3688,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
} else {
if (libraryName.equals("UserLibrary")) {
//redis中获取缓存的用户关注核素信息
nuclides = (List<String>)redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list");
nuclides = (List<String>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list");
} else if (libraryName.equals("FULLLibrary")) {
nuclides = spectrumAnalysisMapper.getNuclideNames("CONFIGURATION.GARDS_NUCL_LIB");
} else if (libraryName.equals("RelevantLibrary")) {
@ -3815,7 +3828,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
List<String> nuclides = spectrumAnalysisMapper.getNuclideNames("CONFIGURATION.GARDS_NUCL_LIB");
//redis中获取缓存的用户关注核素信息
List<String> userNuclides = (List<String>)redisUtil.get(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list");
List<String> userNuclides = (List<String>) redisUtil.get(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list");
map.put("AllNuclides", nuclides);
map.put("UserNuclides", userNuclides);
result.setSuccess(true);
@ -3851,13 +3864,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase());
}
Map<String, NuclideLines> nuclideMap = new HashMap<>();
for (Map.Entry<String, NuclideLines> entry:allNuclideMap.entrySet()) {
for (Map.Entry<String, NuclideLines> entry : allNuclideMap.entrySet()) {
if (userLib.contains(entry.getKey())) {
nuclideMap.put(entry.getKey(), entry.getValue());
}
}
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type()+"-list", userLib);
redisUtil.set(userName+StringPool.DASH+phd.getHeader().getSystem_type(), nuclideMap);
redisUtil.set(userName + StringPool.DASH + phd.getHeader().getSystem_type() + "-list", userLib);
redisUtil.set(userName + StringPool.DASH + phd.getHeader().getSystem_type(), nuclideMap);
phd.setPhdNuclideMap(nuclideMap);
} else {
result.success("Modification failure");
@ -4133,7 +4146,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
String spectrum = gammaFileUtil.makeUpSpectrum(phd);
map.put("Spectrum", spectrum);
if(StringUtils.isNotBlank(phd.getTmpFilePath())) {
if (StringUtils.isNotBlank(phd.getTmpFilePath())) {
List<String> lines = gammaFileUtil.readLine(phd.getTmpFilePath());
map.put("phdSpectrum", lines);
}
@ -4384,7 +4397,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
tablePeak.setNetCountRate(rate);
tablePeak.setNcRateErr(area_err);
tablePeak.setLc(NumberFormatUtil.numberFormat(String.valueOf(peak.lc)));
tablePeak.setSignificance(Double.isFinite(peak.significance)?NumberFormatUtil.numberFormat(String.valueOf(peak.significance)):(Double.isInfinite(peak.significance)?"inf":"nan"));
tablePeak.setSignificance(Double.isFinite(peak.significance) ? NumberFormatUtil.numberFormat(String.valueOf(peak.significance)) : (Double.isInfinite(peak.significance) ? "inf" : "nan"));
peakFitList.add(tablePeak);
}
map.put("peakFit", peakFitList);
@ -4442,7 +4455,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
tableResult.setActErr(act_err);
tableResult.setFactor1(NumberFormatUtil.numberFormat(coverage_factor));
tableResult.setConfidence1(NumberFormatUtil.numberFormat(level_confidence));
tableResult.setConc(Objects.isNull(nuc.getConcentration())?null:NumberFormatUtil.numberFormat(String.valueOf(nuc.getConcentration() / 1000)));
tableResult.setConc(Objects.isNull(nuc.getConcentration()) ? null : NumberFormatUtil.numberFormat(String.valueOf(nuc.getConcentration() / 1000)));
tableResult.setConcErr(act_err);
tableResult.setFactor2(NumberFormatUtil.numberFormat(coverage_factor));
tableResult.setConfidence2(NumberFormatUtil.numberFormat(level_confidence));
@ -4564,24 +4577,24 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
List<CalMDCInfo> mdcInfoList = new LinkedList<>();
Map<String, CalMDCInfo> mdcInfoMap = phd.getMdcInfoMap();
if (CollectionUtils.isNotEmpty(mdcInfoMap) && phd.isBAnalyed()) {
for (String key:mdcInfoMap.keySet()) {
for (String key : mdcInfoMap.keySet()) {
CalMDCInfo mdcInfo = mdcInfoMap.get(key);
CalMDCInfo calMDCInfo = new CalMDCInfo();
calMDCInfo.setNuclideName(mdcInfo.getNuclideName());
if (Objects.nonNull(mdcInfo.getMdc()) && Double.isFinite(mdcInfo.getMdc())) {
calMDCInfo.setMdc( Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getMdc()))) );
calMDCInfo.setMdc(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getMdc()))));
}
if (Objects.nonNull(mdcInfo.getEnergy()) && Double.isFinite(mdcInfo.getEnergy())) {
calMDCInfo.setEnergy( Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getEnergy()))) );
calMDCInfo.setEnergy(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getEnergy()))));
}
if (Objects.nonNull(mdcInfo.getEfficiency()) && Double.isFinite(mdcInfo.getEfficiency())) {
calMDCInfo.setEfficiency( Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getEfficiency()))) );
calMDCInfo.setEfficiency(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getEfficiency()))));
}
if (Objects.nonNull(mdcInfo.getYield()) && Double.isFinite(mdcInfo.getYield())) {
calMDCInfo.setYield( Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getYield()))) );
calMDCInfo.setYield(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(mdcInfo.getYield()))));
}
if (Objects.nonNull(mdcInfo.getHalflife()) && Double.isFinite(mdcInfo.getHalflife())) {
calMDCInfo.setHalflifeView(mdcInfo.getHalflife()+"D");
calMDCInfo.setHalflifeView(mdcInfo.getHalflife() + "D");
}
mdcInfoList.add(calMDCInfo);
}
@ -4721,17 +4734,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String mSaveFileName = nameMap.get("saveFile");
String dateTimeSubdir = "";
int pos = mSaveFileName.indexOf('-');
if(-1 == pos) {
if (-1 == pos) {
} else if(fileName.length() >= pos+7) {
dateTimeSubdir+=StringPool.SLASH+fileName.substring(pos+1,pos+5);
dateTimeSubdir+=StringPool.SLASH+fileName.substring(pos+5,pos+7);
} else if (fileName.length() >= pos + 7) {
dateTimeSubdir += StringPool.SLASH + fileName.substring(pos + 1, pos + 5);
dateTimeSubdir += StringPool.SLASH + fileName.substring(pos + 5, pos + 7);
}
//判断当前分析员是否有过历史分析当前文件
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir+ dateTypeSubdir + dateTimeSubdir + StringPool.SLASH + mSaveFileName, userName);
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir + dateTypeSubdir + dateTimeSubdir + StringPool.SLASH + mSaveFileName, userName);
// 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员
if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) {
result.error500("You have no permission to save "+phd.getHeader().getSite_code()+" results to DB!");
result.error500("You have no permission to save " + phd.getHeader().getSite_code() + " results to DB!");
return result;
}
// 如果有权限则开始保存数据库操作
@ -4765,6 +4778,22 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (comments.length() > 1024) {
comments = comments.substring(0, 1024);
}
middleData.setSample_stationID(String.valueOf(stationId));
middleData.setSample_id(String.valueOf(phd.getId_sample()));
Info info = getSampleInfo(middleData, phd);
//TODO 获取样品级别
try {
//获取阈值结果
List<GardsThresholdResult> thresholds = gardsThresholdService.findThresholdResults(stationId.toString());
//样品分级
Integer category = sampleGradingService.processTypeP(info, thresholds);
middleData.setAnalyses_category(category);
} catch (Exception e) {
}
// 判断idAnalysis是否为空
if (StringUtils.isBlank(idAnalysis)) {
// RNMAN.GARDS_ANALYSES 表插入数据
@ -4840,12 +4869,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// }
// }
{
String logFileName = middleData.analyses_absolute_LogPath.substring(middleData.analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH)+1);
String logFileName = middleData.analyses_absolute_LogPath.substring(middleData.analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH) + 1);
File logFile = new File(logFileName);
try {
FileUtil.writeString(gammaFileUtil.GetLogContent(middleData), logFile, "UTF-8");
FileInputStream in = new FileInputStream(logFile);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_LogPath, in);
ftpUtil.saveFile(spectrumPathProperties.getRootPath() + middleData.analyses_absolute_LogPath, in);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
@ -4853,12 +4882,12 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
}
{
String rptFileName = middleData.analyses_absolute_ReportPath.substring(middleData.analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt";
String rptFileName = middleData.analyses_absolute_ReportPath.substring(middleData.analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH) + 1) + ".txt";
File rptFile = new File(rptFileName);
try {
FileUtil.writeString(gammaFileUtil.GetReportContent(middleData), rptFile, "UTF-8");
FileInputStream in = new FileInputStream(rptFile);
ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_ReportPath+".txt", in);
ftpUtil.saveFile(spectrumPathProperties.getRootPath() + middleData.analyses_absolute_ReportPath + ".txt", in);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
@ -4881,9 +4910,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
map.put("DetailedInformation", detailedInfo);
//发送数据到redis
middleData.setSample_stationID(String.valueOf(stationId));
middleData.setSample_id(String.valueOf(phd.getId_sample()));
pushToRedis(middleData, phd);
pushToRedis(info);
result.setSuccess(true);
result.setResult(map);
return result;
@ -4892,25 +4919,33 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
/**
* 分析成功数据发送到Redis
*/
private void pushToRedis(GStoreMiddleProcessData middleData, PHDFile phd){
private void pushToRedis(Info info) {
redisStreamUtil.pushAnalysis(info);
redisStreamUtil.addMessage(manKey, info);
}
private Info getSampleInfo(GStoreMiddleProcessData middleData, PHDFile phd) {
try {
Info info = new Info();
info.setStationId(middleData.sample_stationID);
info.setSampleId(middleData.sample_id);
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)+1));
info.setIdAnalysis(middleData.IdAnalysis);
info.setSampleType(middleData.sample_Type);
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH) + 1));
final Instant instant = DateUtils.parseDate(middleData.sample_collection_start).toInstant();
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
info.setCollectionDate(collectTime);
info.setDatasource(DSType.ARMDRRR.getType());
info.setFullOrPrel(phd.getHeader().getSpectrum_quantity());
info.setBetaOrGamma(SpectrumType.GAMMA.getType());
Map<String,String> nuclides = Maps.newHashMap();
for (int i=0; i<middleData.nucl_ided_Nuclidename.size(); i++) {
Map<String, String> nuclides = Maps.newHashMap();
for (int i = 0; i < middleData.nucl_ided_Nuclidename.size(); i++) {
nuclides.put(middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Concentration.get(i));
}
info.setNuclides(nuclides);
info.setAnalyst(middleData.analyses_analyst);
redisStreamUtil.pushAnalysis(info);
return info;
} catch (ParseException e) {
throw new RuntimeException(e);
}
@ -5002,7 +5037,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String fwhm = NumberFormatUtil.numberFormat(String.valueOf(peakInfo.fwhm));
String area = NumberFormatUtil.numberFormat(String.valueOf(peakInfo.area));
String areaErr = NumberFormatUtil.numberFormat(String.valueOf(peakInfo.areaErr));
String signif = Double.isFinite(peakInfo.significance)?NumberFormatUtil.numberFormat(String.valueOf(peakInfo.significance)):(Double.isInfinite(peakInfo.significance)?"inf":"nan");
String signif = Double.isFinite(peakInfo.significance) ? NumberFormatUtil.numberFormat(String.valueOf(peakInfo.significance)) : (Double.isInfinite(peakInfo.significance) ? "inf" : "nan");
String sensit = NumberFormatUtil.numberFormat(String.valueOf(peakInfo.sensitivity));
String nuclide = StringUtils.join(peakInfo.nuclides, StringPool.SEMICOLON);
strBuild.append(rowFormat(title2, peakId, energy, peakCentroid, multiIndex, fwhm, area, areaErr, signif, sensit, nuclide));
@ -5113,7 +5148,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String dataType = phd.getMsgInfo().getData_type().substring(0, 1);
String format = ".txt";
String txtFileName = String.format("%s-%s_%s_%s_RESULT%s", detectorCode, date, time, dataType, format);
if (StrUtil.isNotBlank(fileName)){
if (StrUtil.isNotBlank(fileName)) {
if (StrUtil.contains(fileName, ".PHD"))
txtFileName = StrUtil.replace(fileName, ".PHD", ".txt");
}
@ -5255,7 +5290,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String dataType = phd.getMsgInfo().getData_type().substring(0, 1);
String format = ".xls";
String xlsFileName = String.format("%s-%s_%s_%s_RESULT%s", detectorCode, date, time, dataType, format);
if (StrUtil.isNotBlank(fileName)){
if (StrUtil.isNotBlank(fileName)) {
if (StrUtil.contains(fileName, ".PHD"))
xlsFileName = StrUtil.replace(fileName, ".PHD", ".xls");
}
@ -5338,7 +5373,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
stopWatch.start();
String iecValue = fileFtransitUtil.WriteIEC(datas);
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",ImsName,stopWatch.getTime(TimeUnit.MILLISECONDS));
log.info("{}处理耗时为:{}毫秒", ImsName, stopWatch.getTime(TimeUnit.MILLISECONDS));
// 设置响应类型
response.setContentType("application/octet-stream");
// 解决中文不能生成文件
@ -5388,7 +5423,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
stopWatch.start();
String imsValue = fileFtransitUtil.WriteIMS(datas);
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",IecName,stopWatch.getTime(TimeUnit.MILLISECONDS));
log.info("{}处理耗时为:{}毫秒", IecName, stopWatch.getTime(TimeUnit.MILLISECONDS));
// 设置响应类型
response.setContentType("application/octet-stream");
// 解决中文不能生成文件
@ -5432,11 +5467,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
stopWatch.start();
String imsValue = fileFtransitUtil.WriteIMS(datas);
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",SpcName,stopWatch.getTime(TimeUnit.MILLISECONDS));
log.info("{}处理耗时为:{}毫秒", SpcName, stopWatch.getTime(TimeUnit.MILLISECONDS));
String suffix = nameStandUtil.GetSuffix(datas.getData_type(), datas.getQuantity(), String.valueOf(datas.getAcq_live()));
String ImsName = datas.getDetector()+StringPool.DASH+datas.getAcq_date().replace(StringPool.SLASH, StringPool.EMPTY)+StringPool.UNDERSCORE+
datas.getAcq_time().substring(0, 5).replace(StringPool.COLON, StringPool.EMPTY)+ suffix;
String ImsName = datas.getDetector() + StringPool.DASH + datas.getAcq_date().replace(StringPool.SLASH, StringPool.EMPTY) + StringPool.UNDERSCORE +
datas.getAcq_time().substring(0, 5).replace(StringPool.COLON, StringPool.EMPTY) + suffix;
// 设置响应类型
response.setContentType("application/octet-stream");
// 解决中文不能生成文件
@ -5484,7 +5519,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
stopWatch.start();
fileFtransitUtil.WriteSPC(spcFile, datas);
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",ImsName,stopWatch.getTime(TimeUnit.MILLISECONDS));
log.info("{}处理耗时为:{}毫秒", ImsName, stopWatch.getTime(TimeUnit.MILLISECONDS));
// 获取文件输入流
spcInputStream = new FileInputStream(spcFile);
@ -5533,7 +5568,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
stopWatch.start();
String iecValue = fileFtransitUtil.WriteIEC(datas);
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",SpcName,stopWatch.getTime(TimeUnit.MILLISECONDS));
log.info("{}处理耗时为:{}毫秒", SpcName, stopWatch.getTime(TimeUnit.MILLISECONDS));
// 设置响应类型
response.setContentType("application/octet-stream");
@ -5582,7 +5617,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
stopWatch.start();
fileFtransitUtil.WriteSPC(spcFile, datas);
stopWatch.stop();
log.info("{}处理耗时为:{}毫秒",IecName,stopWatch.getTime(TimeUnit.MILLISECONDS));
log.info("{}处理耗时为:{}毫秒", IecName, stopWatch.getTime(TimeUnit.MILLISECONDS));
// 获取文件输入流
spcInputStream = new FileInputStream(spcFile);
@ -5613,11 +5648,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
/**
* 读取计算MDC参数文件方法
* 读取计算MDC参数文件方法
*/
public void readMDCParameter() {
//配置文件路径
String filePath = parameterProperties.getFilePath()+ File.separator + "MDCParameter.xml";
String filePath = parameterProperties.getFilePath() + File.separator + "MDCParameter.xml";
try {
//创建一个文档解析器工厂
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@ -5625,7 +5660,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
//读取xml文件生成一个文档
Document document = documentBuilder.parse(filePath);
if (Objects.nonNull(document)){
if (Objects.nonNull(document)) {
//获取文档的根元素
Element element = document.getDocumentElement();
//获取根元素的子节点
@ -5633,7 +5668,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//判断文件内的节点是否大于0
if (Objects.nonNull(docChildNodes) && docChildNodes.getLength() > 0) {
//遍历文件节点读取内容
for (int i=0; i<docChildNodes.getLength(); i++) {
for (int i = 0; i < docChildNodes.getLength(); i++) {
//获取节点信息
Node node = docChildNodes.item(i);
//判断节点名称是否是 P
@ -5645,7 +5680,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//如果子节点不为空
if (Objects.nonNull(childNodes) && childNodes.getLength() > 0) {
//遍历子节点信息 将核素信息封存到缓存中
for (int j=0; j<childNodes.getLength(); j++) {
for (int j = 0; j < childNodes.getLength(); j++) {
Node childNode = childNodes.item(j);
//判断节点名称是否是item
if (childNode.getNodeName().equalsIgnoreCase("item")) {
@ -5655,7 +5690,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (Objects.nonNull(attributes)) {
CalMDCInfo info = new CalMDCInfo();
//遍历属性信息
for (int k=0; k<attributes.getLength(); k++) {
for (int k = 0; k < attributes.getLength(); k++) {
//根据顺序读取属性
Node attribute = attributes.item(k);
if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) {
@ -5682,7 +5717,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//判断子节点是否为空
if (Objects.nonNull(childNodes) && childNodes.getLength() > 0) {
//遍历子节点信息
for (int j=0; j<childNodes.getLength(); j++) {
for (int j = 0; j < childNodes.getLength(); j++) {
Node childNode = childNodes.item(j);
//判断节点名称是否是item
if (childNode.getNodeName().equalsIgnoreCase("item")) {
@ -5692,7 +5727,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (Objects.nonNull(attributes)) {
CalMDCInfo info = new CalMDCInfo();
//遍历属性信息
for (int k=0; k<attributes.getLength(); k++) {
for (int k = 0; k < attributes.getLength(); k++) {
//根据顺序读取属性
Node attribute = attributes.item(k);
if (attribute.getNodeName().equalsIgnoreCase("nuclide_name")) {

View File

@ -28,6 +28,7 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesM
analyses.setAnalysisBegin(DateUtils.parseDate(phd.getAnaly_start_time()));
analyses.setAnalysisEnd(new Date());
analyses.setType(middleData.analyses_type);
analyses.setCategory((int) middleData.analyses_category);
analyses.setSoftware("");
analyses.setSwVersion("1.0.1");
analyses.setAnalyst(userName);
@ -57,6 +58,7 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesM
analyses.setAnalysisBeginStr(phd.getAnaly_start_time());
analyses.setAnalysisEndStr(DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss"));
analyses.setSoftware("");
analyses.setCategory((int) middleData.analyses_category);
analyses.setSwVersion("1.0.1");
analyses.setComments(comments);
analyses.setSearchStartChannel((int) middleData.analyses_searchStartChannel);

View File

@ -22,6 +22,7 @@ import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.BetaCache;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
@ -37,6 +38,7 @@ import org.jeecg.modules.base.entity.original.GardsSampleAux;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnman.*;
import org.jeecg.modules.base.enums.*;
import org.jeecg.modules.base.service.ISampleGradingService;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.entity.vo.QCFlagParmData.Rule;
@ -75,7 +77,7 @@ import static org.jeecg.modules.base.enums.ExportTemplate.*;
@Service("spectrumAnalysisService")
@DS("ora")
public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements ISpectrumAnalysisService {
private final String manKey = RedisConstant.CATEGORY;
@Autowired
private SpectrumAnalysisMapper spectrumAnalysisMapper;
@Autowired
@ -135,6 +137,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
@Autowired
private IGardsROIResultsSpectrumService gardsROIResultsSpectrumService;
/// 样品等级服务
@Autowired
private ISampleGradingService sampleGradingService;
// 获取阈值信息
@Autowired
private IRnManGardsThresholdService gardsThresholdService;
@Override
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
@ -714,7 +722,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
// 查询Gas谱
GardsSampleData gasSampleData = sampleDataSpectrumService.getSampleByMId(aux.getGasBkgdMeasurementId(),
DataTypeAbbr.DETBKPHD.getType(), sampleData.getSampleType());
DataTypeAbbr.GASBKPHD.getType(), sampleData.getSampleType());
if (StringUtils.isEmpty(sampleFilePath)
&& (Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName()))
@ -1734,7 +1742,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
QCResult qcResult = new QCResult();
switch (station.getEfficCalculType()) {
case "SAUNA":
qcResult = ProcessQCResultBranch(StationDetailType.SAUNA,betaDataFile);
qcResult = ProcessQCResultBranch(StationDetailType.SAUNA, betaDataFile);
break;
case "SAUNA2":
qcResult = ProcessQCResultBranch(StationDetailType.SAUNA2, betaDataFile);
@ -1898,7 +1906,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
double acquisition_live_time = sampleSourceData.acquisition_live_time / 3600.0;
String acquisition_live_sec = String.format("%.2f", sampleSourceData.acquisition_live_time / 3600.0);
qcResult.setAcquisitionTimeValue(acquisition_live_sec);
if (acquisitionTimeRules.get(1).getMin() < acquisition_live_time && acquisition_live_time < acquisitionTimeRules.get(acquisitionTimeRules.size()-1).getMin()) {
if (acquisitionTimeRules.get(1).getMin() < acquisition_live_time && acquisition_live_time < acquisitionTimeRules.get(acquisitionTimeRules.size() - 1).getMin()) {
qcResult.setAcquisitionTimeStatus("Pass");
} else {
qcResult.setAcquisitionTimeStatus("Failed");
@ -4498,6 +4506,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName);
gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName);
detId = spectrumAnalysisMapper.getSampleId(detFilePathName);
betaDataFile.setSampleId(String.valueOf(sampleId));
Info info = getSampleInfo(betaDataFile, userName);
// 获取级别信息
//获取阈值结果
List<GardsThresholdResult> thresholds = gardsThresholdService.findThresholdResults(stationId.toString());
Integer category = sampleGradingService.processTypeB(info, thresholds);
//如果分析过就修改原记录--GARDS_ANALYSES
GardsAnalysesSpectrum gardsAnalyses = new GardsAnalysesSpectrum();
gardsAnalyses.setSampleId(sampleId);
@ -4506,7 +4524,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
gardsAnalyses.setType(AnalysesType.REVIEWED.value);
gardsAnalyses.setSoftware("BetaGammaAnalyser");
gardsAnalyses.setSwVersion("1.0.1");
gardsAnalyses.setCategory(1);
gardsAnalyses.setCategory(category);
gardsAnalyses.setComments(anlyseResultIn.getComment());
gardsAnalyses.setUsedgasphd(gasFilePathName);
gardsAnalyses.setUseddetphd(detFilePathName);
@ -4520,7 +4538,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
} else {//如果没有分析过就新增--GARDS_ANALYSES
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
}
betaDataFile.setSampleId(String.valueOf(sampleId));
//查询analysisId根据sampleId 分析员名称--GARDS_ANALYSES
GardsAnalysesSpectrum analysis = spectrumAnalysisMapper.getAnalysis("RNMAN.GARDS_ANALYSES", sampleId, userName);
Integer idAnalysis = analysis.getIdAnalysis();
@ -4672,7 +4689,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
map.put("qc", qcData);
}
//发送数据到redis
pushToRedis(betaDataFile, userName);
pushToRedis(info);
result.setSuccess(true);
result.setResult(map);
return result;
@ -4866,11 +4883,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
/**
* 分析成功数据发送到Redis
*/
private void pushToRedis(BetaDataFile betaDataFile, String userName) {
private void pushToRedis(Info info) {
redisStreamUtil.pushAnalysis(info);
redisStreamUtil.addMessage(manKey, info);
}
private Info getSampleInfo(BetaDataFile betaDataFile, String userName) {
try {
Info info = new Info();
info.setStationId(betaDataFile.getStationId());
info.setSampleId(betaDataFile.getSampleId());
info.setSampleType(betaDataFile.getSampleStruct().system_type);
info.setSampleName(betaDataFile.getSampleFileName());
final Instant instant = DateUtils.parseDate(betaDataFile.getSampleStruct().collection_start_date + StringPool.SPACE + betaDataFile.getSampleStruct().collection_start_time).toInstant();
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
@ -4893,7 +4916,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
info.setNuclides(nuclides);
info.setAnalyst(userName);
redisStreamUtil.pushAnalysis(info);
return info;
} catch (ParseException e) {
throw new RuntimeException(e);
}