Merge remote-tracking branch 'origin/SelfStation' into SelfStation

This commit is contained in:
xiaoguangbin 2024-07-24 15:42:21 +08:00
commit f4aef9bdee
9 changed files with 1812 additions and 11 deletions

View File

@ -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="";

View File

@ -181,6 +181,8 @@ public class PHDFile implements Serializable {
private Map<String, NuclideLines> phdNuclideMap;
private String roiSuffix;
public PHDFile() {
userId = "";
xmlFilePath = "";

View File

@ -0,0 +1,24 @@
package org.jeecg.modules.exception;
/**
* C谱分析异常
*/
public class CAnalyseException extends AnalyseException{
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public CAnalyseException(String message) {
super(message);
}
public CAnalyseException(String message, boolean isDuplicateKeyException) {
super(message,isDuplicateKeyException);
}
}

View File

@ -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();
}
}
}

View File

@ -6,6 +6,7 @@ import org.jeecg.common.properties.*;
import org.jeecg.common.util.NameStandUtil;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.SelfUtil;
import org.jeecg.modules.datasource.OraDataSourceProperties;
import org.jeecg.modules.service.*;
import org.springframework.context.ApplicationContext;
@ -88,11 +89,12 @@ public class SpectrumServiceQuotes {
private final IGardsGPSDataService gardsGPSDataService;
private final SelfUtil selfStationUtil;
/**
* 原始库插入数据锁
*/
private final Object originalLibraryLock = new Object();
private final BatchesCounter batchesCounter;
}

View File

@ -2,6 +2,7 @@ package org.jeecg.common.util;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
@ -3178,8 +3179,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
boolean bRet=true;
//标准名称规范化
String dataType = fileAnlyse.getMsgInfo().getData_type();
String systemType = fileAnlyse.getHeader().getSystem_type();
String subDirSavePath = "";
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
subDirSavePath+=nameStandUtil.GetSysTemSubdir(systemType);
subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType);
Map<String, String> fileNames = nameStandUtil.NameStandard(fileAnlyse);
String lcName = fileNames.get("lc");
@ -3212,7 +3214,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
anylseBegin = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
bRet = AnalyseSpectrum(fileAnlyse,nucline);
if (bRet) {
RunQC(fileAnlyse);
if (!StrUtil.equals(systemType, SystemType.SELFSTATION.getType()))
RunQC(fileAnlyse);
fileAnlyse.setEfficiencyParam(fileAnlyse.getUsedEffiPara().getP());
fileAnlyse.setEfficiencyEnergy(fileAnlyse.getUsedEffiKD().getG_energy());
fileAnlyse.setEfficiencyCurRow(0);
@ -3316,7 +3319,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
//gards_ calibration_pairs Efficiency
middleData.calibration_pairs_sample_type = fileAnlyse.getHeader().getSystem_type();
middleData.calibration_pairs_sample_type = systemType;
if(fileAnlyse.getUsedEffiKD() != null && fileAnlyse.getUsedEffiKD().getG_energy().size() != 0) {
middleData.calibration_pairs_EF_Caltype = CalType.EFFICIENCY_CAL.getType();
middleData.calibration_pairs_EF_Input = fileAnlyse.getUsedEffi();
@ -3390,7 +3393,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
// gards_ calibration 数据表
//拼写刻度字符串
//获取刻度描述字符串
middleData.calibration_sample_type = fileAnlyse.getHeader().getSystem_type();
middleData.calibration_sample_type = systemType;
String coeffEnergy = "";
String uncerEnergy = "";
String funcDefEnergy = "";
@ -3805,7 +3808,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
middleData.sample_stationID = fileAnlyse.getHeader().getSite_code();
middleData.sample_detectID = fileAnlyse.getHeader().getDetector_code();
middleData.sample_Geometry = fileAnlyse.getHeader().getSample_geometry();
middleData.sample_Type = fileAnlyse.getHeader().getSystem_type();
middleData.sample_Type = systemType;
middleData.setting_specSetup = fileAnlyse.getUsedSetting();
middleData.Collection_Station_Comments = StringUtils.isNotBlank(fileAnlyse.getOriTotalCmt())?fileAnlyse.getOriTotalCmt():"";
middleData.NDC_Analysis_General_Comments = StringUtils.isNotBlank(fileAnlyse.getTotalCmt())?fileAnlyse.getTotalCmt():"";

View File

@ -0,0 +1,348 @@
package org.jeecg.common.util;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import org.jeecg.modules.base.enums.CalName;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
@Component
public class SelfUtil {
public List<Long> roiList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
// g_counts
List<Long> counts = new LinkedList<>();
//存储同一列不同行加和后的数量
List<Integer> sumList = new LinkedList<>();
//遍历所有列
for (int i=0; i<gammaChannels; i++) {
long sum = 0;
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
for (int j=startChannel; j <= endChannel; j++) {
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
int index = (int) (i * betaChannels + j);
long count = 0;
//判断下标是否在h_counts范围内
if (index > 0 && index < h_counts.size()) {
count = h_counts.get(index);
}
sum+=count;
}
counts.add(sum);
}
return counts;
}
/**
* 根据ROI卡出来的Gamma数据生成新的GammaPHD文件
* @param pathName 文件存储路径
* @param fileName GammaPHD名称
* @param struct BetaPHD内容
* @param g_counts ROI卡出来的Gamma数据
*/
public void createGammaFile(String pathName,String fileName, EnergySpectrumStruct struct, List<Long> g_counts) {
File file = new File(pathName + "\\" + fileName);
// 创建PrintWriter对象
PrintWriter out = null;
DecimalFormat decimalFormat = new DecimalFormat("0.000000");
try {
out = new PrintWriter(file);
out.println("BEGIN IMS2.0");
out.println("MSG_TYPE DATA");
// todo msg_type用的不对dll没解析出这个字段
out.println("MSG_ID " + struct.msg_id + " " + struct.msg_type + "\n" + "DATA_TYPE " + struct.data_type);
out.println("#Header 3");
// 解析出的Gamma谱 系统类型暂时使用G
out.println(struct.site_code + " " + struct.detector_code + " C " +
struct.sample_geometry + " " + struct.spectrum_quantity);
out.println(struct.sample_ref_id);
out.println(struct.measurement_id + " " + struct.detector_bk_measurement_id + " 0");
out.println(struct.transmit_date + " " + struct.transmit_time);
out.println("#Collection");
out.println(struct.collection_start_date + " " + struct.collection_start_time + " " +
struct.collection_stop_date + " " + struct.collection_stop_time + " "
+ decimalFormat.format(struct.air_volume));
out.println("#Acquisition");
out.println(struct.acquisition_start_date + " " + struct.acquisition_start_time + " " +
decimalFormat.format(struct.acquisition_real_time) + " " +
decimalFormat.format(struct.acquisition_live_time));
out.println("#g_Energy");
format(struct.g_energy, struct.g_centroid_channel, struct.g_uncertainty, out);
out.println("#g_Resolution");
format(struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty, out);
out.println("#g_Efficiency");
format(struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty, out);
out.println("#g_Spectrum");
// num_g_channel 根据g_counts数量得来和PHD写的数字没有关系g_energy_span是PHD写的值
out.println(struct.num_g_channel + " " + struct.g_energy_span);
// 存储前一个数字
String beforeStr = "";
for (int i = 0; i < g_counts.size(); i++) {
String str = g_counts.get(i).toString();
if(i % 5 == 0) {
if (i == 0) {
out.printf((i+1)+"");
} else {
out.printf("\n" + (i+1) );
}
beforeStr = i+"";
}
if(StrUtil.isEmpty(beforeStr)){
beforeStr = str;
}
// 根据前一个字符长度计算需要的空格
out.printf("%" + (str.length() + (6 - beforeStr.length()))+ "s" , g_counts.get(i));
if(i == g_counts.size() - 1) {
out.println();
}
beforeStr = str;
}
out.print("STOP");
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
if (null != out) {
out.close();
}
}
}
/**
* 数据格式化
* @param aList 第一列数据
* @param bList 第二列数据
* @param cList 第三列数据
* @param out
*/
private static void format(List<Double> aList, List<Double> bList,List<Double> cList,PrintWriter out) {
for (int i = 0; i < aList.size(); i++) {
DecimalFormat decimalFormat = new DecimalFormat("0.000000");
String a = decimalFormat.format(aList.get(i));
String b = decimalFormat.format(bList.get(i));
String c = decimalFormat.format(cList.get(i));
out.print(a);
out.printf("%" + ( b.length() + (17 - a.length())) + "s", b);
out.printf("%" + ( c.length() + (17 - b.length())) + "s", c+"\n");
}
}
/**
* 根据DLL解析GammaPHD内容 得到PHDFile实体
* @param fileName
* @param pathName
* @return
*/
public PHDFile getGammaPHD(String fileName, String pathName) {
PHDFile phd = new PHDFile();
phd.setFilepath(pathName);
phd.setFilename(fileName);
File file = new File(pathName + StringPool.SLASH + fileName);
phd.setTmpFilePath(file.getAbsolutePath());
try {
//读取文件信息
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//MsgInfo
phd.getMsgInfo().setMsg_id(struct.msg_id);
phd.getMsgInfo().setMsg_type(struct.msg_type);
phd.getMsgInfo().setData_type(struct.data_type);
//Header
phd.getHeader().setDesignator(struct.designator);
phd.getHeader().setSite_code(struct.site_code);
phd.getHeader().setDetector_code(struct.detector_code);
phd.getHeader().setSystem_type(struct.system_type);
phd.getHeader().setSample_geometry(struct.sample_geometry);
phd.getHeader().setSpectrum_quantity(struct.spectrum_quantity);
phd.getHeader().setSample_ref_id(struct.sample_ref_id);
phd.getHeader().setMeasurement_id(struct.measurement_id);
phd.getHeader().setDetector_bk_measurement_id(struct.detector_bk_measurement_id);
phd.getHeader().setGas_bk_measurement_id(struct.gas_bk_measurement_id);
phd.getHeader().setTransmit_date(struct.transmit_date);
phd.getHeader().setTransmit_time(struct.transmit_time);
//Comment
phd.setOriTotalCmt(struct.comment);
//Collection
if (StrUtil.isNotBlank(struct.collection_start_date) && StrUtil.isNotBlank(struct.collection_start_time)
&& StrUtil.isNotBlank(struct.collection_stop_date) && StrUtil.isNotBlank(struct.collection_stop_time)
&& Objects.nonNull(struct.air_volume)) {
phd.getCollect().setCollection_start_date(struct.collection_start_date);
phd.getCollect().setCollection_start_time(struct.collection_start_time);
phd.getCollect().setCollection_stop_date(struct.collection_stop_date);
phd.getCollect().setCollection_stop_time(struct.collection_stop_time);
phd.getCollect().setAir_volume(struct.air_volume);
if (phd.getCollect().getCollection_start_time().indexOf('.') < 0) {
phd.getCollect().setCollection_start_time(phd.getCollect().getCollection_start_time() + ".0");
}
if (phd.getCollect().getCollection_stop_time().indexOf('.') < 0) {
phd.getCollect().setCollection_stop_time(phd.getCollect().getCollection_stop_time() + ".0");
}
} else {
phd.getCollect().setAir_volume(0.0);
}
//Acquisition
if (StrUtil.isNotBlank(struct.acquisition_start_date) && StrUtil.isNotBlank(struct.acquisition_start_time)
&& Objects.nonNull(struct.acquisition_real_time) && Objects.nonNull(struct.acquisition_live_time)) {
phd.getAcq().setAcquisition_start_date(struct.acquisition_start_date);
phd.getAcq().setAcquisition_start_time(struct.acquisition_start_time);
phd.getAcq().setAcquisition_real_time(struct.acquisition_real_time);
phd.getAcq().setAcquisition_live_time(struct.acquisition_live_time);
if (phd.getAcq().getAcquisition_start_time().indexOf('.') < 0) {
phd.getAcq().setAcquisition_start_time(phd.getAcq().getAcquisition_start_time() + ".0");
}
} else {
phd.getAcq().setAcquisition_live_time(0.0);
phd.getAcq().setAcquisition_real_time(0.0);
}
//Processing
if (Objects.nonNull(struct.sample_volume_of_Xe) && Objects.nonNull(struct.uncertainty_1)
&& Objects.nonNull(struct.Xe_collection_yield) && Objects.nonNull(struct.uncertainty_2)
&& StrUtil.isNotBlank(struct.archive_bottle_id)) {
phd.getProcess().setSample_volume_of_Xe(struct.sample_volume_of_Xe);
phd.getProcess().setUncertainty_1(struct.uncertainty_1);
phd.getProcess().setXe_collection_yield(struct.Xe_collection_yield);
phd.getProcess().setUncertainty_2(struct.uncertainty_2);
phd.getProcess().setArchive_bottle_id(struct.archive_bottle_id);
} else {
phd.getProcess().setSample_volume_of_Xe(0.0);
phd.getProcess().setXe_collection_yield(0.0);
phd.getProcess().setUncertainty_1(0.0);
phd.getProcess().setUncertainty_2(0.0);
}
//Sample
if (Objects.nonNull(struct.dimension_1) && Objects.nonNull(struct.dimension_2)) {
phd.getSampleBlock().setDimension_1(struct.dimension_1);
phd.getSampleBlock().setDimension_2(struct.dimension_2);
} else {
phd.getSampleBlock().setDimension_1(0.0);
phd.getSampleBlock().setDimension_2(0.0);
}
//Calibration
if (StrUtil.isNotBlank(struct.date_calibration) && StrUtil.isNotBlank(struct.time_calibration)) {
phd.getCalibration().setDate_calibration(struct.date_calibration);
phd.getCalibration().setTime_calibration(struct.time_calibration);
}
//Certificate
if (Objects.nonNull(struct.total_source_activity) && StrUtil.isNotBlank(struct.assay_date)
&& StrUtil.isNotBlank(struct.assay_time) && StrUtil.isNotBlank(struct.units_activity)
&& CollectionUtils.isNotEmpty(struct.nuclide_name)
&& CollectionUtils.isNotEmpty(struct.half_life_time) && CollectionUtils.isNotEmpty(struct.time_unit)
&& CollectionUtils.isNotEmpty(struct.activity_nuclide_time_assay) && CollectionUtils.isNotEmpty(struct.uncertainty)
&& CollectionUtils.isNotEmpty(struct.cer_g_energy) && CollectionUtils.isNotEmpty(struct.g_intensity)
&& CollectionUtils.isNotEmpty(struct.electron_decay_mode) && CollectionUtils.isNotEmpty(struct.maximum_energy)
&& CollectionUtils.isNotEmpty(struct.intensity_b_particle) && Objects.nonNull(struct.record_count)) {
phd.getCertificate().setTotal_source_activity(struct.total_source_activity);
phd.getCertificate().setAssay_date(struct.assay_date);
phd.getCertificate().setAssay_time(struct.assay_time);
phd.getCertificate().setUnits_activity(struct.units_activity);
phd.getCertificate().setNuclide_name(struct.nuclide_name);
phd.getCertificate().setHalf_life_time(struct.half_life_time);
phd.getCertificate().setTime_unit(struct.time_unit);
phd.getCertificate().setActivity_nuclide_time_assay(struct.activity_nuclide_time_assay);
phd.getCertificate().setUncertainty(struct.uncertainty);
phd.getCertificate().setG_energy(struct.cer_g_energy);
phd.getCertificate().setG_intensity(struct.g_intensity);
phd.getCertificate().setElectron_decay_mode(struct.electron_decay_mode);
phd.getCertificate().setMaximum_energy(struct.maximum_energy);
phd.getCertificate().setIntensity_b_particle(struct.intensity_b_particle);
phd.getCertificate().setRecord_count(struct.record_count);
}
//g_Spectrum
if (Objects.nonNull(struct.num_g_channel) && Objects.nonNull(struct.g_energy_span)
&& Objects.nonNull(struct.g_begin_channel) && CollectionUtils.isNotEmpty(struct.g_counts)) {
phd.getSpec().setNum_g_channel(struct.g_counts.size()); // todo 原Num_g_channel有误
phd.getSpec().setG_energy_span(struct.g_energy_span);
phd.getSpec().setBegin_channel(struct.g_begin_channel);
phd.getSpec().setCounts(struct.g_counts);
int i = 0;
for (; i < phd.getSpec().getNum_g_channel(); i++) {
if (phd.getSpec().getCounts().get(i) > 0) {
break;
}
}
if (i == phd.getSpec().getNum_g_channel()) {
phd.setValid(false);
}
}
//g_Energy
if (CollectionUtils.isNotEmpty(struct.g_energy) && CollectionUtils.isNotEmpty(struct.g_centroid_channel) &&
CollectionUtils.isNotEmpty(struct.g_uncertainty) && Objects.nonNull(struct.g_record_count)) {
GEnergyBlock gEnergyBlock = new GEnergyBlock();
gEnergyBlock.setG_energy(struct.g_energy);
gEnergyBlock.setCentroid_channel(struct.g_centroid_channel);
gEnergyBlock.setUncertainty(struct.g_uncertainty);
gEnergyBlock.setRecord_count(struct.g_record_count);
phd.getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock);
}
//g_Resolution
if (CollectionUtils.isNotEmpty(struct.g_r_energy) && CollectionUtils.isNotEmpty(struct.g_r_FWHM) &&
CollectionUtils.isNotEmpty(struct.g_r_uncertainty) && Objects.nonNull(struct.g_r_record_count)) {
GResolutionBlock gResolutionBlock = new GResolutionBlock();
gResolutionBlock.setG_energy(struct.g_r_energy);
gResolutionBlock.setFWHM(struct.g_r_FWHM);
gResolutionBlock.setUncertainty(struct.g_r_uncertainty);
gResolutionBlock.setRecord_count(struct.g_r_record_count);
phd.getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock);
}
//g_Efficiency
if (CollectionUtils.isNotEmpty(struct.g_e_energy) && CollectionUtils.isNotEmpty(struct.g_e_efficiency) &&
CollectionUtils.isNotEmpty(struct.g_e_uncertainty) && Objects.nonNull(struct.g_e_record_count)) {
GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock();
gEfficiencyBlock.setG_energy(struct.g_e_energy);
gEfficiencyBlock.setEfficiency(struct.g_e_efficiency);
gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty);
gEfficiencyBlock.setRecord_count(struct.g_e_record_count);
phd.getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock);
}
//TotalEff
if (CollectionUtils.isNotEmpty(struct.t_g_energy) && CollectionUtils.isNotEmpty(struct.total_efficiency) &&
CollectionUtils.isNotEmpty(struct.t_uncertainty) && Objects.nonNull(struct.t_record_count)) {
TotaleffBlock totaleffBlock = new TotaleffBlock();
totaleffBlock.setG_energy(struct.t_g_energy);
totaleffBlock.setTotal_efficiency(struct.total_efficiency);
totaleffBlock.setUncertainty(struct.t_uncertainty);
totaleffBlock.setRecord_count(struct.t_record_count);
phd.getMapTotEKD().put(CalName.CalPHD.getType(), totaleffBlock);
}
// 初始化默认分析设置
if(phd.getHeader().getSystem_type().equalsIgnoreCase("P")) {
phd.getSetting().setECutAnalysis_Low(35.0);
phd.getSetting().setBUpdateCal(true);
}
if (StrUtil.isNotBlank(phd.getCollect().getCollection_start_date())
&& StrUtil.isNotBlank(phd.getCollect().getCollection_start_time())) {
phd.getSetting().setRefTime_conc(DateUtils.parseDate(phd.getCollect().getCollection_start_date()
+ StringPool.SPACE + phd.getCollect().getCollection_start_time()));
}
if (StrUtil.isNotBlank(phd.getAcq().getAcquisition_start_date()) && StrUtil.isNotBlank(phd.getAcq().getAcquisition_start_time())) {
phd.getSetting().setRefTime_act(DateUtils.parseDate(phd.getAcq().getAcquisition_start_date()
+ StringPool.SPACE + phd.getAcq().getAcquisition_start_time()));
}
SpecSetup usedSetting = new SpecSetup();
BeanUtils.copyProperties(phd.getSetting(), usedSetting);
phd.setUsedSetting(usedSetting);
phd.setBAnalyed(false);
phd.setAnaly_start_time(DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss"));
} catch (Exception e) {
throw new RuntimeException(e);
}
return phd;
}
}

View File

@ -401,6 +401,30 @@ public class SelfStationUtil extends AbstractLogOrReport {
return map;
}
public List<Long> roiList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
// g_counts
List<Long> counts = new LinkedList<>();
//存储同一列不同行加和后的数量
List<Integer> sumList = new LinkedList<>();
//遍历所有列
for (int i=0; i<gammaChannels; i++) {
long sum = 0;
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
for (int j=startChannel; j <= endChannel; j++) {
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
int index = (int) (i * betaChannels + j);
long count = 0;
//判断下标是否在h_counts范围内
if (index > 0 && index < h_counts.size()) {
count = h_counts.get(index);
}
sum+=count;
}
counts.add(sum);
}
return counts;
}
public String UpdateEquationEnergy(ParameterInfo m_curParam) {
String equation ="";
int p_size = m_curParam.getP().size()-1;