feat:自建台站谱解析类
This commit is contained in:
parent
7cd16a77c2
commit
95116338ad
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
|
@ -34,6 +35,8 @@ public class NameStandUtil {
|
|||
path = pathMap.getOrDefault(SystemType.PARTICULATE.getType(), "Spectrum/Particulates");
|
||||
} else if(systemType.contains(SystemType.WATER.getType())) {
|
||||
path = pathMap.getOrDefault(SystemType.WATER.getType(), "Spectrum/Water");
|
||||
} else if (systemType.contains(SystemType.SELFSTATION.getType())) {
|
||||
path = pathMap.getOrDefault(SystemType.SELFSTATION.getType(), "Spectrum/Xenon/Self");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
@ -84,14 +87,15 @@ public class NameStandUtil {
|
|||
|
||||
public Map<String, String> NameStandard(String dataType, String spectrumQuantity, Double acqusitionLiveTime, String sampleFileName, String measurementId) {
|
||||
String suffix = GetSuffix(dataType, spectrumQuantity,String.valueOf(acqusitionLiveTime));
|
||||
Map<String, String> fileNames = NameStandardByName(sampleFileName, measurementId,suffix);
|
||||
return fileNames;
|
||||
return NameStandardByName(sampleFileName, measurementId,suffix);
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandard(PHDFile fileAnlyse) {
|
||||
String suffix = GetSuffix(fileAnlyse.getMsgInfo().getData_type(), fileAnlyse.getHeader().getSpectrum_quantity(),String.valueOf(fileAnlyse.getAcq().getAcquisition_live_time()));
|
||||
Map<String, String> fileNames = NameStandardByName(fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix);
|
||||
return fileNames;
|
||||
String suffix = GetSuffix(fileAnlyse.getMsgInfo().getData_type(),
|
||||
fileAnlyse.getHeader().getSpectrum_quantity(),
|
||||
String.valueOf(fileAnlyse.getAcq().getAcquisition_live_time()),
|
||||
fileAnlyse.getRoiSuffix());
|
||||
return NameStandardByName(fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix);
|
||||
}
|
||||
|
||||
public String GetSuffix(String dataType, String Fulltype, String LT) {
|
||||
|
@ -117,6 +121,33 @@ public class NameStandUtil {
|
|||
return rData;
|
||||
}
|
||||
|
||||
public String GetSuffix(String dataType, String Fulltype, String LT, String roiSuffix) {
|
||||
String rData = "";
|
||||
DecimalFormat df = new DecimalFormat("#.##########");
|
||||
//AUX09_003-20151226_1855 _S_FULL_40184.8.PHD
|
||||
//将acquisition_live_time保留六位有效数字 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位
|
||||
String numberCal = NumberFormatUtil.numberCal(LT);
|
||||
numberCal = df.format(Double.valueOf(numberCal));
|
||||
// 谱类型增加 SPHDF 和 SPHDP
|
||||
if(dataType.contains(DataType.SAMPLEPHD.getType()) ||
|
||||
dataType.contains(DataType.SPHDF.getType()) ||
|
||||
dataType.contains(DataType.SPHDP.getType())) {
|
||||
|
||||
rData = StrUtil.isBlank(roiSuffix) ? "_S_"+Fulltype+"_"+numberCal+".PHD"
|
||||
: "_S_"+Fulltype+"_"+numberCal+roiSuffix+".PHD";
|
||||
} else if(dataType.contains(DataType.GASBKPHD.getType())) {
|
||||
rData = StrUtil.isBlank(roiSuffix) ? "_G_"+Fulltype+"_"+numberCal+".PHD"
|
||||
: "_G_"+Fulltype+"_"+numberCal+roiSuffix+".PHD";
|
||||
} else if(dataType.contains(DataType.DETBKPHD.getType())) {
|
||||
rData = StrUtil.isBlank(roiSuffix) ? "_D_"+Fulltype+"_"+numberCal+".PHD"
|
||||
: "_D_"+Fulltype+"_"+numberCal+roiSuffix+".PHD";
|
||||
} else if(dataType.contains(DataType.QCPHD.getType())) {
|
||||
rData = StrUtil.isBlank(roiSuffix) ? "_Q_"+Fulltype+"_"+numberCal+".PHD"
|
||||
: "_Q_"+Fulltype+"_"+numberCal+roiSuffix+".PHD";
|
||||
}
|
||||
return rData;
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandardByName(String fileName, String dateTimeFormat, String suffix) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String StandardFileName="";
|
||||
|
|
|
@ -181,6 +181,8 @@ public class PHDFile implements Serializable {
|
|||
|
||||
private Map<String, NuclideLines> phdNuclideMap;
|
||||
|
||||
private String roiSuffix;
|
||||
|
||||
public PHDFile() {
|
||||
userId = "";
|
||||
xmlFilePath = "";
|
||||
|
|
|
@ -13,13 +13,11 @@ import com.google.common.collect.Maps;
|
|||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.*;
|
||||
import org.jeecg.common.constant.enums.SpectrumSystemType;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.ErrorLogManager;
|
||||
import org.jeecg.modules.base.bizVo.AttributeItemVo;
|
||||
import org.jeecg.modules.base.dto.*;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
|
@ -28,7 +26,6 @@ import org.jeecg.modules.base.enums.DSType;
|
|||
import org.jeecg.modules.base.enums.MiddleDataType;
|
||||
import org.jeecg.modules.base.enums.SpectrumType;
|
||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.exception.AnalySpectrumException;
|
||||
import org.jeecg.modules.exception.GAnalyseException;
|
||||
|
@ -166,28 +163,42 @@ public class Sample_C_Analysis {
|
|||
getSettingFromDB(phdFile1, phdFile2, phdFile3, phdFile4);
|
||||
|
||||
// 文件路径
|
||||
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
||||
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
GStoreMiddleProcessData middleData1 = new GStoreMiddleProcessData();
|
||||
GStoreMiddleProcessData middleData2 = new GStoreMiddleProcessData();
|
||||
GStoreMiddleProcessData middleData3 = new GStoreMiddleProcessData();
|
||||
GStoreMiddleProcessData middleData4 = new GStoreMiddleProcessData();
|
||||
middleData1.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
middleData2.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
middleData3.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
middleData4.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
|
||||
// 读取文件内容并附值
|
||||
PHDFile phdFile = new PHDFile();
|
||||
this.setPHDFile(phdFile, this.sampleStruct);
|
||||
phdFile.getSetting().setRefTime_act(DateUtils.parseDate(phdFile.getAcq().getAcquisition_start_date()+" "+phdFile.getAcq().getAcquisition_start_time()));
|
||||
phdFile.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile.getCollect().getCollection_start_date()+" "+phdFile.getCollect().getCollection_start_time()));
|
||||
// 根据能谱的系统类型传入不同的核素参数
|
||||
Map<String, NuclideLines> nuclideLibs = new HashMap<>();
|
||||
if (this.systemType.equals(SpectrumSystemType.P.name())) {
|
||||
nuclideLibs = this.getNuclideLinesP();
|
||||
}
|
||||
if (this.systemType.equals(SpectrumSystemType.G.name())) {
|
||||
nuclideLibs = this.getNuclideLinesG();
|
||||
}
|
||||
//读取参数内容
|
||||
readMDCParameter(phdFile);
|
||||
// 执行分析业务代码
|
||||
boolean analyFlag = gammaFileUtil.GetMiddleData(phdFile, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData, MiddleDataType.Auto.getType(), "");
|
||||
this.setPHDFile(phdFile1, phdFile2, phdFile3, phdFile4);
|
||||
|
||||
if (analyFlag) {
|
||||
phdFile1.getSetting().setRefTime_act(DateUtils.parseDate(phdFile1.getAcq().getAcquisition_start_date()+" "+phdFile1.getAcq().getAcquisition_start_time()));
|
||||
phdFile2.getSetting().setRefTime_act(DateUtils.parseDate(phdFile2.getAcq().getAcquisition_start_date()+" "+phdFile2.getAcq().getAcquisition_start_time()));
|
||||
phdFile3.getSetting().setRefTime_act(DateUtils.parseDate(phdFile3.getAcq().getAcquisition_start_date()+" "+phdFile3.getAcq().getAcquisition_start_time()));
|
||||
phdFile4.getSetting().setRefTime_act(DateUtils.parseDate(phdFile4.getAcq().getAcquisition_start_date()+" "+phdFile4.getAcq().getAcquisition_start_time()));
|
||||
phdFile1.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile1.getCollect().getCollection_start_date()+" "+phdFile1.getCollect().getCollection_start_time()));
|
||||
phdFile2.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile2.getCollect().getCollection_start_date()+" "+phdFile2.getCollect().getCollection_start_time()));
|
||||
phdFile3.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile3.getCollect().getCollection_start_date()+" "+phdFile3.getCollect().getCollection_start_time()));
|
||||
phdFile4.getSetting().setRefTime_conc(DateUtils.parseDate(phdFile4.getCollect().getCollection_start_date()+" "+phdFile4.getCollect().getCollection_start_time()));
|
||||
|
||||
// 根据能谱的系统类型传入不同的核素参数
|
||||
Map<String, NuclideLines> nuclideLibs = this.getNuclideLinesG();
|
||||
|
||||
//读取参数内容
|
||||
readMDCParameter(phdFile1);
|
||||
readMDCParameter(phdFile2);
|
||||
readMDCParameter(phdFile3);
|
||||
readMDCParameter(phdFile4);
|
||||
|
||||
// 执行分析业务代码
|
||||
boolean analyFlag1 = gammaFileUtil.GetMiddleData(phdFile1, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData1, MiddleDataType.Auto.getType(), "");
|
||||
boolean analyFlag2 = gammaFileUtil.GetMiddleData(phdFile2, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData2, MiddleDataType.Auto.getType(), "");
|
||||
boolean analyFlag3 = gammaFileUtil.GetMiddleData(phdFile3, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData3, MiddleDataType.Auto.getType(), "");
|
||||
boolean analyFlag4 = gammaFileUtil.GetMiddleData(phdFile4, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData4, MiddleDataType.Auto.getType(), "");
|
||||
/*if (analyFlag) {
|
||||
// 数据插入数据库
|
||||
this.storageDataToDatabase(phdFile, middleData, phdFile.getQcItems());
|
||||
|
||||
|
@ -209,7 +220,7 @@ public class Sample_C_Analysis {
|
|||
} else {
|
||||
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), phdFile.getAnalyMessage(), this.sampleFilename));
|
||||
throw new AnalySpectrumException(phdFile.getAnalyMessage());
|
||||
}
|
||||
}*/
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("Sample_C_Analysis", e);
|
||||
|
@ -281,9 +292,13 @@ public class Sample_C_Analysis {
|
|||
selfStationUtil.createGammaFile(sampleFilePath, gammaFourName, this.sampleStruct, roiFourCounts);
|
||||
// 将生成的GammaPHD文件转换为PHDFile对象
|
||||
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, sampleFilePath);
|
||||
this.phdFile1.setRoiSuffix("_ROI_1");
|
||||
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, sampleFilePath);
|
||||
this.phdFile2.setRoiSuffix("_ROI_2");
|
||||
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, sampleFilePath);
|
||||
this.phdFile3.setRoiSuffix("_ROI_3");
|
||||
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, sampleFilePath);
|
||||
this.phdFile4.setRoiSuffix("_ROI_4");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1291,7 +1306,10 @@ public class Sample_C_Analysis {
|
|||
}
|
||||
}
|
||||
|
||||
private void setPHDFile(PHDFile phdFile, EnergySpectrumStruct spectrumStruct) {
|
||||
private void setPHDFile(PHDFile... phdFiles) {
|
||||
for (PHDFile phdFile : phdFiles) {
|
||||
String filePath = phdFile.getTmpFilePath();
|
||||
EnergySpectrumStruct spectrumStruct = EnergySpectrumHandler.getSourceData(filePath);
|
||||
HeaderBlock headerBlock = new HeaderBlock();
|
||||
BeanUtil.copyProperties(spectrumStruct, headerBlock);
|
||||
phdFile.setHeader(headerBlock);
|
||||
|
@ -1329,4 +1347,5 @@ public class Sample_C_Analysis {
|
|||
BeanUtil.copyProperties(spectrumStruct, certificateBlock);
|
||||
phdFile.setCertificate(certificateBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,5 +116,9 @@ public class SamplephdSpectrum extends AbstractS_D_Q_G_SpectrumHandler {
|
|||
Sample_G_Analysis sample_g_analysis = new Sample_G_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData);
|
||||
sample_g_analysis.analysis();
|
||||
}
|
||||
if (this.sourceData.system_type.equals(SystemType.SELFSTATION.getType())) {
|
||||
Sample_C_Analysis sample_c_analysis = new Sample_C_Analysis(this, super.sourceData, super.spectrumServiceQuotes, super.sampleData);
|
||||
sample_c_analysis.analysis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user