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

This commit is contained in:
nieziyan 2023-10-10 21:12:57 +08:00
commit 9e89b4aea9
46 changed files with 814 additions and 1323 deletions

View File

@ -0,0 +1,24 @@
package org.jeecg.common.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.io.Serializable;
@Data
@Component
@ConfigurationProperties(prefix = "parameter")
public class ParameterProperties implements Serializable {
/**
* 算法计算需要用到的文件存储路径
*/
private String filePath;
/**
* db文件存储路径
*/
private String dbPath;
}

View File

@ -0,0 +1,57 @@
package org.jeecg.common.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.MathContext;
@Component
public class NumberFormatUtil {
public static void main(String[] args) {
double value = 8823 * 12 * 30 + 79.2 * 10000;
value = value - 2640000;
System.out.println(value);
}
//接收参数判断是否是科学计数法
public static String numberFormat(String number) {
String value = "";
//判断传入的字符串是否包含e
if (StringUtils.isNotBlank(number)) {
if (number.contains("e") || number.contains("E")) {
value = scienceCal(number);
} else {
value = numberCal(number);
}
}
return value;
}
public static String scienceCal(String number) {
String value = "";
if (number.indexOf("e")>0) {
String calNumber = number.substring(0, number.indexOf("e"));
String numberCal = numberCal(calNumber);
value = numberCal + number.substring(number.indexOf("e"));
} else if (number.indexOf("E")>0) {
String calNumber = number.substring(0, number.indexOf("E"));
String numberCal = numberCal(calNumber);
value = numberCal + number.substring(number.indexOf("E"));
}
return value;
}
//正常小数进行固定长度的保留小数
public static String numberCal(String number) {
//将当前字符串的数字
BigDecimal b = new BigDecimal(number);
BigDecimal divisor = BigDecimal.ONE;
//需要保留的长度
MathContext mc = new MathContext(6);
return String.valueOf(b.divide(divisor, mc));
}
}

View File

@ -48,7 +48,9 @@ public enum DataType {
/**
* 气体谱
*/
GASBKPHD("GASBKPHD",".PHD");
GASBKPHD("GASBKPHD",".PHD"),
SPHDP("SPHDP", ".PHD"),
SPHDF("SPHDF", ".PHD");
private String type;

View File

@ -12,25 +12,15 @@ public class AnalyseData implements Serializable {
private boolean sampleData;
private boolean GasBgData;
private boolean gasBgData;
private boolean DetBgData;
private boolean detBgData;
private boolean QCData;
private boolean qcData;
private boolean gFitting;
private boolean gammaEnergyValid;
private boolean bFitting;
private boolean bGammaEnergyValid;
private boolean bBetaEnergyValid;
private List<TableWidget> fittingChannelEnergy;
private CalibrationParam g_calibration_param;
private CalibrationParam b_calibration_param;
private boolean betaEnergyValid;
private List<String> dbNames;
@ -42,15 +32,15 @@ public class AnalyseData implements Serializable {
private List<String> detFileNames;
private List<String> qcFileNames;
public AnalyseData(){
sampleData = false;
GasBgData = false;
DetBgData = false;
QCData = false;
bGammaEnergyValid = false;
bBetaEnergyValid = false;
g_calibration_param = new CalibrationParam();
b_calibration_param = new CalibrationParam();
gasBgData = false;
detBgData = false;
qcData = false;
gammaEnergyValid = false;
betaEnergyValid = false;
}
}

View File

@ -18,7 +18,7 @@
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
</dependency>
<!-- 引入jeecg-boot-starter-cloud依赖 -->
<dependency>

View File

@ -38,7 +38,8 @@ public class FTPUtils {
this.client.setFileType(FTPClient.BINARY_FILE_TYPE);
this.client.setControlEncoding(this.encoding);
this.client.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
// this.client.setDataTimeout(60000);
// this.client.setConnectTimeout();
//判断是否连接成功
int reply = client.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {

View File

@ -1,30 +0,0 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.eneity.vo.StructInsertInput;
import org.jeecg.modules.eneity.vo.StructInsertOutput;
import org.jeecg.modules.entity.vo.PeakInfo;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
import java.util.List;
public class CalValuesHandler {
public static native CalValuesOut calFcnEval(List<Double> x, List<Double> para);
public static native CalValuesOut energyToChannel(List<Double> energy, List<Double> para);
public static native CalValuesOut calDerivEval(List<Double> channel, List<Double> para);
public static native double calDerivaOut(double Chan, List<Double> p);
public static native List<Double> interp1(PeakInfo peak, List<Double> t_base, List<Double> regChan);
public static native StructInsertOutput insertPeaks(StructInsertInput structInsertInput);
public static native List<Double> calFitPara(String type, int funcId, List<Double> x, List<Double> y, List<Double> err);
public static native StructInsertOutput ComputePeakRange(int peakSize, int m_nCount, List<Double> vCentroid, List<Double> vFwhmCh, List<Double> vTail, List<Double> vUpperTail);
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath);
}

View File

@ -1,48 +0,0 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.native_jni.struct.*;
import java.util.List;
/**
* 能谱处理本地类
*/
public class EnergySpectrumHandler {
/**
* 获取能谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native EnergySpectrumStruct getSourceData(String path);
/**
* 获取健康状态谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native SOHSpectrumStruct getSOHSourceData(String path);
/**
* 获取警告谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native AlertSpectrumStruct getAlertSourceData(String path);
/**
* 获取气象谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native MetSpectrumStruct getMetSourceData(String path);
/**
* BetaGamma 分析算法
* @param sampleFile 样品谱文件
* @param gasFile 气体谱文件
* @param detFile 探测器本地谱文件
* @return
*/
public static native BgAnalyseResult bgAnalyse(String sampleFile, String gasFile, String detFile);
}

View File

@ -1,18 +0,0 @@
package org.jeecg.modules.native_jni;
import com.alibaba.fastjson.JSON;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
public class TestDll {
public static void main(String[] args) throws InterruptedException {
String dllPath = "D:\\Work\\核素\\C++\\c++lib\\ReadPHDFile.dll";
String sourcePath = "D:\\Work\\核素\\C++\\谱文件样例\\Gamma\\CNP21_001-20170116_0245_S.PHD";
while (true){
System.load(dllPath);
final EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sourcePath);
System.out.println(sourceData);
Thread.sleep(10000L);
}
}
}

View File

@ -1,191 +0,0 @@
package org.jeecg.modules.native_jni.struct;
import java.util.List;
public class BgAnalyseResult {
/************************** GARDS_XE_RESULTS START**************************/
/************************** XE_131m **************************/
public double Xe131m_con;
public double Xe131m_uncer;
public double MDC_Xe131m;
public double LC_Xe131m;
public int XE_131m_NID_FLAG;
/************************** XE_133 **************************/
public double Xe133_con;
public double Xe133_uncer;
public double MDC_Xe133;
public double LC_Xe133;
public int XE_133_NID_FLAG;
/************************** XE_133m **************************/
public double Xe133m_con;
public double Xe133m_uncer;
public double MDC_Xe133m;
public double LC_Xe133m;
public int XE_133m_NID_FLAG;
/************************** XE_135 **************************/
public double Xe135_con;
public double Xe135_uncer;
public double MDC_Xe135;
public double LC_Xe135;
public int XE_135_NID_FLAG;
/************************** GARDS_XE_RESULTS end **************************/
/************************** GARDS_ROI_RESULTS START**************************/
public List<Integer> ROI;
public List<Double> LC;
public List<Double> s_roi_cts;
public List<Double> g_roi_cts;
public List<Double> d_roi_cts;
public List<Double> s_deduct_d_cts;
public List<Double> g_deduct_d_cts;
public List<Double> ROI_net_coutns;
public List<Double> ROI_net_coutns_err;
public List<Double> ROI_con_uncer;
public List<Double> ROI_con_uncer_err;
public List<Double> MDC;
public List<Integer> dNidFlag;
public List<Double> LC_CTS;
/************************** GARDS_ROI_RESULTS end **************************/
/************************** GARDS_CALIBRATION START**************************/
public List<Double> s_b_fitting_e_c;
public int s_b_fitting_type;
public String s_b_fitting_type_def;
public List<Double> s_g_fitting_e_c;
public int s_g_fitting_type;
public String s_g_fitting_type_def;
public List<Double> s_b_fitting_c_e;
public List<Double> s_g_fitting_c_e;
public List<Double> g_b_fitting_e_c;
public int g_b_fitting_type;
public String g_b_fitting_type_def;
public List<Double> g_g_fitting_e_c;
public int g_g_fitting_type;
public String g_g_fitting_type_def;
public List<Double> g_b_fitting_c_e;
public List<Double> g_g_fitting_c_e;
public List<Double> d_b_fitting_e_c;
public int d_b_fitting_type;
public String d_b_fitting_type_def;
public List<Double> d_g_fitting_e_c;
public int d_g_fitting_type;
public String d_g_fitting_type_def;
public List<Double> d_b_fitting_c_e;
public List<Double> d_g_fitting_c_e;
/************************** GARDS_CALIBRATION end **************************/
/************************** GARDS_ROI_CHANNELS START**************************/
public List<Integer> S_ROI;
public List<Integer> S_ROI_B_Boundary_start;
public List<Integer> S_ROI_B_Boundary_stop;
public List<Integer> S_ROI_G_Boundary_start;
public List<Integer> S_ROI_G_Boundary_stop;
public List<Integer> G_ROI;
public List<Integer> G_ROI_B_Boundary_start;
public List<Integer> G_ROI_B_Boundary_stop;
public List<Integer> G_ROI_G_Boundary_start;
public List<Integer> G_ROI_G_Boundary_stop;
public List<Integer> D_ROI;
public List<Integer> D_ROI_B_Boundary_start;
public List<Integer> D_ROI_B_Boundary_stop;
public List<Integer> D_ROI_G_Boundary_start;
public List<Integer> D_ROI_G_Boundary_stop;
/************************** GARDS_ROI_CHANNELS end **************************/
/**
* 分析结果标记true成功false失败
*/
public boolean analyse_flag;
/**
* 失败原因
*/
public String error_log;
@Override
public String toString() {
return "BgAnalyseResult{" +
"Xe131m_con=" + Xe131m_con +
", Xe131m_uncer=" + Xe131m_uncer +
", MDC_Xe131m=" + MDC_Xe131m +
", LC_Xe131m=" + LC_Xe131m +
", XE_131m_NID_FLAG=" + XE_131m_NID_FLAG +
", Xe133_con=" + Xe133_con +
", Xe133_uncer=" + Xe133_uncer +
", MDC_Xe133=" + MDC_Xe133 +
", LC_Xe133=" + LC_Xe133 +
", XE_133_NID_FLAG=" + XE_133_NID_FLAG +
", Xe133m_con=" + Xe133m_con +
", Xe133m_uncer=" + Xe133m_uncer +
", MDC_Xe133m=" + MDC_Xe133m +
", LC_Xe133m=" + LC_Xe133m +
", XE_133m_NID_FLAG=" + XE_133m_NID_FLAG +
", Xe135_con=" + Xe135_con +
", Xe135_uncer=" + Xe135_uncer +
", MDC_Xe135=" + MDC_Xe135 +
", LC_Xe135=" + LC_Xe135 +
", XE_135_NID_FLAG=" + XE_135_NID_FLAG +
", ROI=" + ROI +
", LC=" + LC +
", s_roi_cts=" + s_roi_cts +
", g_roi_cts=" + g_roi_cts +
", d_roi_cts=" + d_roi_cts +
", s_deduct_d_cts=" + s_deduct_d_cts +
", g_deduct_d_cts=" + g_deduct_d_cts +
", ROI_net_coutns=" + ROI_net_coutns +
", ROI_net_coutns_err=" + ROI_net_coutns_err +
", ROI_con_uncer=" + ROI_con_uncer +
", ROI_con_uncer_err=" + ROI_con_uncer_err +
", MDC=" + MDC +
", dNidFlag=" + dNidFlag +
", LC_CTS=" + LC_CTS +
", s_b_fitting_e_c=" + s_b_fitting_e_c +
", s_b_fitting_type=" + s_b_fitting_type +
", s_b_fitting_type_def='" + s_b_fitting_type_def + '\'' +
", s_g_fitting_e_c=" + s_g_fitting_e_c +
", s_g_fitting_type=" + s_g_fitting_type +
", s_g_fitting_type_def='" + s_g_fitting_type_def + '\'' +
", s_b_fitting_c_e=" + s_b_fitting_c_e +
", s_g_fitting_c_e=" + s_g_fitting_c_e +
", g_b_fitting_e_c=" + g_b_fitting_e_c +
", g_b_fitting_type=" + g_b_fitting_type +
", g_b_fitting_type_def='" + g_b_fitting_type_def + '\'' +
", g_g_fitting_e_c=" + g_g_fitting_e_c +
", g_g_fitting_type=" + g_g_fitting_type +
", g_g_fitting_type_def='" + g_g_fitting_type_def + '\'' +
", g_b_fitting_c_e=" + g_b_fitting_c_e +
", g_g_fitting_c_e=" + g_g_fitting_c_e +
", d_b_fitting_e_c=" + d_b_fitting_e_c +
", d_b_fitting_type=" + d_b_fitting_type +
", d_b_fitting_type_def='" + d_b_fitting_type_def + '\'' +
", d_g_fitting_e_c=" + d_g_fitting_e_c +
", d_g_fitting_type=" + d_g_fitting_type +
", d_g_fitting_type_def='" + d_g_fitting_type_def + '\'' +
", d_b_fitting_c_e=" + d_b_fitting_c_e +
", d_g_fitting_c_e=" + d_g_fitting_c_e +
", S_ROI=" + S_ROI +
", S_ROI_B_Boundary_start=" + S_ROI_B_Boundary_start +
", S_ROI_B_Boundary_stop=" + S_ROI_B_Boundary_stop +
", S_ROI_G_Boundary_start=" + S_ROI_G_Boundary_start +
", S_ROI_G_Boundary_stop=" + S_ROI_G_Boundary_stop +
", G_ROI=" + G_ROI +
", G_ROI_B_Boundary_start=" + G_ROI_B_Boundary_start +
", G_ROI_B_Boundary_stop=" + G_ROI_B_Boundary_stop +
", G_ROI_G_Boundary_start=" + G_ROI_G_Boundary_start +
", G_ROI_G_Boundary_stop=" + G_ROI_G_Boundary_stop +
", D_ROI=" + D_ROI +
", D_ROI_B_Boundary_start=" + D_ROI_B_Boundary_start +
", D_ROI_B_Boundary_stop=" + D_ROI_B_Boundary_stop +
", D_ROI_G_Boundary_start=" + D_ROI_G_Boundary_start +
", D_ROI_G_Boundary_stop=" + D_ROI_G_Boundary_stop +
", analyse_flag=" + analyse_flag +
", error_log='" + error_log + '\'' +
'}';
}
}

View File

@ -1,13 +0,0 @@
package org.jeecg.modules.native_jni.struct;
import java.util.List;
public class CalValuesOut {
public int rowNum;
public int colNum;
public List<Double> counts;
}

View File

@ -1,557 +0,0 @@
package org.jeecg.modules.native_jni.struct;
import lombok.Data;
import java.util.List;
import java.util.Objects;
/**
* 能谱结构体字段信息
*/
@Data
public class EnergySpectrumStruct {
/************************* Infomations ******************/
/**
* 消息类型
*/
public String msg_type;
/**
* 消息id
*/
public String msg_id;
/**
* 数据类型
*/
public String data_type;
/************************* Header Black ******************/
/**
* designator
*/
public String designator;
/**
* site code
*/
public String site_code;
/**
* detector code
*/
public String detector_code;
/**
* system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and
*/
public String system_type;
/**
* sample geometry
*/
public String sample_geometry;
/**
* spectrum qualifier: preliminary ( PREL )or full ( FULL)
*/
public String spectrum_quantity;
/**
* sample reference identification
*/
public String sample_ref_id;
/**
* measurement identification
*/
public String measurement_id;
/**
* detector background measurement identification
*/
public String detector_bk_measurement_id;
/**
* gas background measurement identification (memory effect)
*/
public String gas_bk_measurement_id;
/**
* transmit date (yyyy / mm / dd)
*/
public String transmit_date;
/**
* transmit time (hh : mm : ss . s)
*/
public String transmit_time;
/************************* Sample ******************/
public double dimension_1;
public double dimension_2;
/************************* Comment ******************/
public String comment;
/************************* Acquisition Block ******************/
/**
* acquisition start date (yyyy / mm / dd)
*/
public String acquisition_start_date;
/**
* acquisition start time (hh : mm : ss . s)
*/
public String acquisition_start_time;
/**
* acquisition real time (s)
*/
public double acquisition_real_time;
/**
* acquisition live time (s)
*/
public double acquisition_live_time;
/************************* Collection Block ******************/
/**
* collection start date (yyyy / mm / dd)
*/
public String collection_start_date;
/**
* collection start time (hh : mm : ss . s)
*/
public String collection_start_time;
/**
* collection stop date (yyyy / mm / dd)
*/
public String collection_stop_date;
/**
* collection stop time (hh : mm : ss . s)
*/
public String collection_stop_time;
/**
* total air volume sampled (standard cubic meters [scm])
*/
public double air_volume;
/************************* Processing Block ******************/
/**
* sample volume of Xe (cm 3 )
*/
public double sample_volume_of_Xe;
/**
* uncertainty (cm 3 )
*/
public double uncertainty_1;
/**
* Xe collection yield (Xe gas in sample/total Xe gas sampled)
*/
public double Xe_collection_yield;
/**
* uncertainty (Xe gas in sample/total Xe gas sampled)
*/
public double uncertainty_2;
/**
* archive bottle identification
*/
public String archive_bottle_id;
/************************* Calibration Block ******************/
/**
* date of last calibration (yyyy / mm / dd)
*/
public String date_calibration;
/**
* time of last calibration (hh : mm : ss)
*/
public String time_calibration;
/************************* g_Energy Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_energy;
/**
* centroid channel
*/
public List<Double> g_centroid_channel;
/**
* uncertainty (channels)
*/
public List<Double> g_uncertainty;
public int g_record_count;
/************************* b_Energy Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_electron_energy;
/**
* decay mode descriptor: B for β-particle, C for conversion electron (CE)
*/
public List<String> b_decay_mode;
/**
* maximum channel of β-particle distribution or centroid channel of CE (channels)
*/
public List<Double> b_channel;
/**
* uncertainty (channels)
*/
public List<Double> b_uncertainty;
public int b_record_count;
/************************* g_Resolution Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_r_energy;
/**
* FWHM (keV)
*/
public List<Double> g_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> g_r_uncertainty;
public int g_r_record_count;
/************************* b_Resolution Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_r_electron_energy;
/**
* FWHM (keV)
*/
public List<Double> b_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> b_r_uncertainty;
public int b_r_record_count;
/************************* g_Efficiency Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_e_energy;
/**
* efficiency (counts in peak/photon emitted)
*/
public List<Double> g_e_efficiency;
/**
* uncertainty (counts in peak/photon emitted)
*/
public List<Double> g_e_uncertainty;
public int g_e_record_count;
/************************* ROI_Limits Block ******************/
/**
* ROI number
*/
public List<String> ROI_number;
/**
* 2-D ROI β-range start, x 1 (keV)
*/
public List<Double> POI_B_x1;
/**
* 2-D ROI β-range stop, x 2 (keV)
*/
public List<Double> POI_B_x2;
/**
* 2-D ROI γ-range start, y 1 (keV)
*/
public List<Double> POI_G_y1;
/**
* 2-D ROI γ-range stop, y 2 (keV)
*/
public List<Double> POI_G_y2;
public int roi_record_count;
/************************* b-gEfficiency Block ******************/
/**
* nuclide name
*/
public List<String> bg_nuclide_name;
/**
* ROI number
*/
public List<Double> bg_ROI_number;
/**
* β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_efficiency;
/**
* uncertainty (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_uncertainty;
public int bg_record_count;
/************************* Ratios Block ******************/
/**
* ratio identifier
*/
public List<String> ratio_id;
/**
* ROI number for the higher γ -energy ROI
*/
public List<String> ROI_num_highter_G_energy_ROI;
/**
* ROI number for the lower γ -energy ROI
*/
public List<String> ROI_num_lower_G_energy_ROI;
/**
* Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI)
*/
public List<Double> count_ratio;
/**
* count ratio uncertainty (percent)
*/
public List<Double> count_ratio_uncertainty;
public int ratio_record_count;
/************************* g_Spectrum Block ******************/
/**
* number of γ channels
*/
public long num_g_channel;
/**
* γ-energy span (keV)
*/
public long g_energy_span;
/**
* begin of channels
*/
public long g_begin_channel;
/**
* count at channel
*/
public List<Long> g_counts;
/************************* b_Spectrum Block ******************/
/**
* number of β -channels
*/
public long num_b_channel;
/**
* β -energy span (keV)
*/
public long b_energy_span;
/**
* begin of channels
*/
public long b_begin_channel;
/**
* counts at channels
*/
public List<Long> b_counts;
/************************* Histogram Block ******************/
/**
* β-channels
*/
public long b_channels;
/**
* γ-channels
*/
public long g_channels;
/**
* β-energy span
*/
public long b_h_energy_span;
/**
* γ-energy span
*/
public long g_h_energy_span;
/**
* counts at channels
*/
public List<Long> h_counts;
/************************* Certificate_Block ******************/
/**
* total source activity (Bq)
*/
public double total_source_activity;
/**
* assay date (yyyy / mm / dd)
*/
public String assay_date;
/**
* assay time (hh : mm : ss)
*/
public String assay_time;
/**
* units of activity: B, b for Bq or [blank]; if nothing, then B is assigned
*/
public String units_activity;
/**
* nuclide name
*/
public List<String> nuclide_name;
/**
* half-life in seconds, hours, days, or years
*/
public List<String> half_life_time;
/**
* time unit(Y, D, H, S)
*/
public List<String> time_unit;
/**
* activity of nuclide at time of assay
*/
public List<Double> activity_nuclide_time_assay;
/**
* uncertainty (%)
*/
public List<Double> uncertainty;
/**
* γ-energy (keV)
*/
public List<Double> cer_g_energy;
/**
* γ-intensity (percent)
*/
public List<Double> g_intensity;
/**
* electron decay mode descriptor: B for β particle or C for conversion electron (CE), 0 for none (that is, γ-only source)
*/
public List<String> electron_decay_mode;
/**
* maximum β-particle energy or CE energy (keV)
*/
public List<Double> maximum_energy;
/**
* intensity of β-particle (percent)
*/
public List<Double> intensity_b_particle;
public int record_count;
/************************* Totaleff Block ******************/
/**
* γ-energy (keV)
*/
public List<Double> t_g_energy;
/**
* total efficiency (counts/photon emitted)
*/
public List<Double> total_efficiency;
/**
* uncertainty (counts/photon emitted)
*/
public List<Double> t_uncertainty;
public int t_record_count;
public EnergySpectrumStruct() {
super();
}
@Override
public String toString() {
return "EnergySpectrumStruct{" +
"msg_type='" + msg_type + '\'' +
", msg_id='" + msg_id + '\'' +
", data_type='" + data_type + '\'' +
", designator='" + designator + '\'' +
", site_code='" + site_code + '\'' +
", detector_code='" + detector_code + '\'' +
", system_type='" + system_type + '\'' +
", sample_geometry='" + sample_geometry + '\'' +
", spectrum_quantity='" + spectrum_quantity + '\'' +
", sample_ref_id='" + sample_ref_id + '\'' +
", measurement_id='" + measurement_id + '\'' +
", detector_bk_measurement_id='" + detector_bk_measurement_id + '\'' +
", gas_bk_measurement_id='" + gas_bk_measurement_id + '\'' +
", transmit_date='" + transmit_date + '\'' +
", transmit_time='" + transmit_time + '\'' +
", dimension_1=" + dimension_1 +
", dimension_2=" + dimension_2 +
", comment='" + comment + '\'' +
", acquisition_start_date='" + acquisition_start_date + '\'' +
", acquisition_start_time='" + acquisition_start_time + '\'' +
", acquisition_real_time=" + acquisition_real_time +
", acquisition_live_time=" + acquisition_live_time +
", collection_start_date='" + collection_start_date + '\'' +
", collection_start_time='" + collection_start_time + '\'' +
", collection_stop_date='" + collection_stop_date + '\'' +
", collection_stop_time='" + collection_stop_time + '\'' +
", air_volume=" + air_volume +
", sample_volume_of_Xe=" + sample_volume_of_Xe +
", uncertainty_1=" + uncertainty_1 +
", Xe_collection_yield=" + Xe_collection_yield +
", uncertainty_2=" + uncertainty_2 +
", archive_bottle_id='" + archive_bottle_id + '\'' +
", date_calibration='" + date_calibration + '\'' +
", time_calibration='" + time_calibration + '\'' +
", g_energy=" + g_energy +
", g_centroid_channel=" + g_centroid_channel +
", g_uncertainty=" + g_uncertainty +
", g_record_count=" + g_record_count +
", b_electron_energy=" + b_electron_energy +
", b_decay_mode=" + b_decay_mode +
", b_channel=" + b_channel +
", b_uncertainty=" + b_uncertainty +
", b_record_count=" + b_record_count +
", g_r_energy=" + g_r_energy +
", g_r_FWHM=" + g_r_FWHM +
", g_r_uncertainty=" + g_r_uncertainty +
", g_r_record_count=" + g_r_record_count +
", b_r_electron_energy=" + b_r_electron_energy +
", b_r_FWHM=" + b_r_FWHM +
", b_r_uncertainty=" + b_r_uncertainty +
", b_r_record_count=" + b_r_record_count +
", g_e_energy=" + g_e_energy +
", g_e_efficiency=" + g_e_efficiency +
", g_e_uncertainty=" + g_e_uncertainty +
", g_e_record_count=" + g_e_record_count +
", ROI_number=" + ROI_number +
", POI_B_x1=" + POI_B_x1 +
", POI_B_x2=" + POI_B_x2 +
", POI_G_y1=" + POI_G_y1 +
", POI_G_y2=" + POI_G_y2 +
", roi_record_count=" + roi_record_count +
", bg_nuclide_name=" + bg_nuclide_name +
", bg_ROI_number=" + bg_ROI_number +
", bg_efficiency=" + bg_efficiency +
", bg_uncertainty=" + bg_uncertainty +
", bg_record_count=" + bg_record_count +
", ratio_id=" + ratio_id +
", ROI_num_highter_G_energy_ROI=" + ROI_num_highter_G_energy_ROI +
", ROI_num_lower_G_energy_ROI=" + ROI_num_lower_G_energy_ROI +
", count_ratio=" + count_ratio +
", count_ratio_uncertainty=" + count_ratio_uncertainty +
", ratio_record_count=" + ratio_record_count +
", num_g_channel=" + num_g_channel +
", g_energy_span=" + g_energy_span +
", g_begin_channel=" + g_begin_channel +
", g_counts=" + g_counts +
", num_b_channel=" + num_b_channel +
", b_energy_span=" + b_energy_span +
", b_begin_channel=" + b_begin_channel +
", b_counts=" + b_counts +
", b_channels=" + b_channels +
", g_channels=" + g_channels +
", b_h_energy_span=" + b_h_energy_span +
", g_h_energy_span=" + g_h_energy_span +
", h_counts=" + h_counts +
", total_source_activity=" + total_source_activity +
", assay_date='" + assay_date + '\'' +
", assay_time='" + assay_time + '\'' +
", units_activity='" + units_activity + '\'' +
", nuclide_name=" + nuclide_name +
", half_life_time=" + half_life_time +
", time_unit=" + time_unit +
", activity_nuclide_time_assay=" + activity_nuclide_time_assay +
", uncertainty=" + uncertainty +
", cer_g_energy=" + cer_g_energy +
", g_intensity=" + g_intensity +
", electron_decay_mode=" + electron_decay_mode +
", maximum_energy=" + maximum_energy +
", intensity_b_particle=" + intensity_b_particle +
", record_count=" + record_count +
", t_g_energy=" + t_g_energy +
", total_efficiency=" + total_efficiency +
", t_uncertainty=" + t_uncertainty +
", t_record_count=" + t_record_count +
'}';
}
}

View File

@ -16,6 +16,7 @@ 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.GammaFileUtil;
import org.jeecg.common.util.RedisUtil;
@ -30,6 +31,7 @@ import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.ftp.FTPUtils;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.TransactionStatus;
import java.io.File;
@ -56,6 +58,8 @@ public class Sample_G_Analysis {
// 能谱文件存储路径属性
private SpectrumPathProperties spectrumPathProperties;
private ParameterProperties parameterProperties;
private RedisUtil redisUtil;
/**
@ -117,8 +121,9 @@ public class Sample_G_Analysis {
Integer sampleId = sampleData.getSampleId();
GammaFileUtil gammaFileUtil = ApplicationContextUtil.getContext().getBean(GammaFileUtil.class);
parameterProperties = ApplicationContextUtil.getContext().getBean(ParameterProperties.class);
PHDFile phdFile = new PHDFile();
phdFile.setXmlFilePath(parameterProperties.getFilePath());
// 解析PHD文件
spectrumPathProperties = ApplicationContextUtil.getContext().getBean(SpectrumPathProperties.class);
String sampleFilePath = sampleData.getInputFileName();
@ -126,7 +131,7 @@ public class Sample_G_Analysis {
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phdFile, new Result());
// todo 测试阶段暂时注释掉获取数据库 Gamma 默认参数
// getSettingFromDB(phdFile);
getSettingFromDB(phdFile);
// 文件路径
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
// 读取文件内容并附值

View File

@ -118,14 +118,20 @@ public abstract class SpectrumHandler extends Chain{
boolean flag = false;
final DataType[] values = DataType.values();
for(DataType value : values){
if(this.mailContent.indexOf(DATA_TYPE_PREFIX+value.getType()) != -1){
// 判断能谱数据类型是否正确
if(this.mailContent.contains(DATA_TYPE_PREFIX + value.getType())){
StringBuilder localPath = new StringBuilder();
localPath.append(this.spectrumServiceQuotes.getTaskProperties().getTemporaryStoragePath());
localPath.append(File.separator);
localPath.append(System.currentTimeMillis());
localPath.append(value.getSuffix());
this.mailFile = FileUtil.writeString(this.mailContent, localPath.toString(), "UTF-8");
this.currDataType = value;
// 能谱数据类型如果是 SPHDP 或者 SPHDF 统一改为 SAMPLEPHD
if (value.equals(DataType.SPHDP) || value.equals(DataType.SPHDF)) {
this.currDataType = DataType.SAMPLEPHD;
} else {
this.currDataType = value;
}
flag = true;
break;
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SoftwareProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.properties.TaskProperties;
@ -36,6 +37,8 @@ public class SpectrumServiceQuotes {
private final SpectrumPathProperties spectrumPathProperties;
private final ParameterProperties parameterProperties;
private final ISOHSpectrumService sohSpectrumService;
private final IAlertSpectrumService alertSpectrumService;

View File

@ -9,7 +9,7 @@
<version>3.5.1</version>
</parent>
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>

View File

@ -11,6 +11,7 @@ import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.ejml.simple.SimpleMatrix;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
@ -19,6 +20,7 @@ import org.jeecg.modules.base.enums.CalName;
import org.jeecg.modules.base.enums.CalType;
import org.jeecg.modules.base.enums.MiddleDataType;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.native_jni.AnalysisProcess;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
@ -44,8 +46,8 @@ import java.util.*;
@Component
public class GammaFileUtil {
@Value("${parameter.filePath}")
private String parameterFilePath;
@Autowired
private ParameterProperties parameterProperties;
@Autowired
private FTPUtil ftpUtil;
@Autowired
@ -65,7 +67,7 @@ public class GammaFileUtil {
InputStream inputStream = null;
File file = null;
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
@ -77,7 +79,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
@ -291,7 +293,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(lcFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//调用FileUtils的readLines方法获取文件的所有行数据
@ -339,7 +341,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(scacFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//调用FileUtils的readLines方法获取文件的所有行数据
@ -602,7 +604,7 @@ public class GammaFileUtil {
public void RunQC(PHDFile phd) {
//调用dll库
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
try {
//获取phdFile的 采集开始时间
Date start = DateUtils.parseDate(phd.getCollect().getCollection_start_date() + StringPool.SPACE + phd.getCollect().getCollection_start_time());
@ -747,8 +749,8 @@ public class GammaFileUtil {
}
public Double CalculateMDC(PHDFile phd, List<Double> vMdcInfo, Double CCF) {
//System.loadLibrary("GammaAnaly");
try {
System.loadLibrary("GammaAnaly");
//判断用于计算的数据大小是否小于3 判断集合中最后一个数值是否等于0
if(vMdcInfo.size() < 3 || vMdcInfo.get(2) == 0) {
return 0.0;
@ -845,7 +847,7 @@ public class GammaFileUtil {
public boolean ReadQCLimit(Map<String, QcCheckItem> qcItems, Map<String, Double> vMdcInfoMap, Double ener_Be7, String systemType) {
try {
String filePath = parameterFilePath+ File.separator +"SystemManager.xml";
String filePath = parameterProperties.getFilePath()+ File.separator +"SystemManager.xml";
//创建一个文档解析器工厂
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//创建文档解析器
@ -1232,7 +1234,7 @@ public class GammaFileUtil {
}
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, String color, long m_nCount, List<Double> p, boolean bEnergy) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<ChartData> datalist = new LinkedList<>();
int peakNum = vPeak.size();
if(peakNum < 1 || vBase.size() != m_nCount){
@ -1310,7 +1312,7 @@ public class GammaFileUtil {
}
public List<ShapeData> Energy_BaseCP(PHDFile phd) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<ShapeData> shapes = new LinkedList<>();
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(phd.getBaseCtrls().getXCtrl(), phd.getUsedEnerPara().getP());
List<Double> vEner = calValuesOut.counts;
@ -1373,17 +1375,16 @@ public class GammaFileUtil {
}
public boolean AnalyseSpectrum(PHDFile phd, Map<String, NuclideLines> mapLines){
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
//解析获取临时文件信息
File tmpFile = analyzeFile(phd.getFilepath(), phd.getFilename());
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(phd);
String nuclideLinesMap = mapper.writeValueAsString(mapLines);
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, tmpFile.getAbsolutePath());
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, tmpFile.getAbsolutePath(), new AnalysisProcess());
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
System.out.println(entry.getKey());
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
phd.setBAnalyed(value);
@ -1452,6 +1453,10 @@ public class GammaFileUtil {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewEner(value);
}
if (entry.getKey().equalsIgnoreCase("newReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewReso(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GEnergyBlock> value = new HashMap<>();
@ -1546,58 +1551,6 @@ public class GammaFileUtil {
}
}
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
if(CollectionUtils.isNotEmpty(phd.getMapEnerKD())) {
String key = "";
key = phd.getNewEner();
phd.setUsedEner(key);
GEnergyBlock source = new GEnergyBlock();
GEnergyBlock gEnergyBlock = phd.getMapEnerKD().get(phd.getNewEner());
BeanUtils.copyProperties(gEnergyBlock, source);
phd.setUsedEnerKD(source);
ParameterInfo info = new ParameterInfo();
ParameterInfo parameterInfo = phd.getMapEnerPara().get(phd.getNewEner());
BeanUtils.copyProperties(parameterInfo, info);
phd.setUsedEnerPara(info);
}
if(CollectionUtils.isNotEmpty(phd.getMapResoKD())) {
String key = "";
key = phd.getNewReso();
phd.setUsedReso(key);
GResolutionBlock source = new GResolutionBlock();
GResolutionBlock gResolutionBlock = phd.getMapResoKD().get(phd.getNewReso());
BeanUtils.copyProperties(gResolutionBlock, source);
phd.setUsedResoKD(source);
ParameterInfo info = new ParameterInfo();
ParameterInfo parameterInfo = phd.getMapResoPara().get(phd.getNewReso());
BeanUtils.copyProperties(parameterInfo, info);
phd.setUsedResoPara(info);
}
if(CollectionUtils.isNotEmpty(phd.getMapEffiKD())) {
String key = "";
key = phd.getNewEffi();
phd.setUsedEffi(key);
GEfficiencyBlock source = new GEfficiencyBlock();
GEfficiencyBlock gEfficiencyBlock = phd.getMapEffiKD().get(phd.getNewEffi());
BeanUtils.copyProperties(gEfficiencyBlock, source);
phd.setUsedEffiKD(source);
ParameterInfo info = new ParameterInfo();
ParameterInfo parameterInfo = Objects.nonNull(phd.getMapEffiPara().get(phd.getNewEffi()))?phd.getMapEffiPara().get(phd.getNewEffi()):new ParameterInfo();
BeanUtils.copyProperties(parameterInfo, info);
phd.setUsedEffiPara(info);
}
if(CollectionUtils.isNotEmpty(phd.getMapTotEKD())) {
String key = "";
key = phd.getNewTotE();
phd.setUsedTotE(key);
TotaleffBlock source = new TotaleffBlock();
TotaleffBlock totaleffBlock = phd.getMapTotEKD().get(phd.getNewTotE());
BeanUtils.copyProperties(totaleffBlock, source);
phd.setUsedTotEKD(source);
ParameterInfo info = new ParameterInfo();
ParameterInfo parameterInfo = Objects.nonNull(phd.getMapTotEPara().get(phd.getNewTotE()))?phd.getMapTotEPara().get(phd.getNewTotE()):new ParameterInfo();
BeanUtils.copyProperties(parameterInfo, info);
phd.setUsedTotEPara(info);
}
for (PeakInfo peak:phd.getVPeak()) {
if (StringUtils.isBlank(peak.recoilBetaChan)) {
@ -1677,7 +1630,7 @@ public class GammaFileUtil {
for (int i=0; i<peakNum; i++) {
vEner.add(phd.getVPeak().get(i).energy);
}
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vEner, phd.getUsedEffiPara().getP());
List<Double> vEffi = calValuesOut.counts;
for (int i=0; i<peakNum; i++) {
@ -1810,7 +1763,7 @@ public class GammaFileUtil {
private void ReadSpecialNuclides(Map<String, Double> mapHalflife, List<String> vNuclides) {
try {
String fileName = parameterFilePath+"/setup/nuclide_ActMdc.txt";
String fileName = parameterProperties.getFilePath() + StringPool.SLASH +"nuclide_ActMdc.txt";
File t_file = new File(fileName);
List<String> readLines = FileUtils.readLines(t_file, "UTF-8");
for (int i=0;i< readLines.size();i++){
@ -1969,7 +1922,7 @@ public class GammaFileUtil {
}
public List<SeriseData> Differance(PHDFile phd, List<PeakInfo> vecPeak, List<Long> m_vCount, long m_nCount) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<SeriseData> pointlist = new LinkedList<>();
int start =0;
long end = -1;
@ -2061,7 +2014,7 @@ public class GammaFileUtil {
public void ReadData(List<Double> m_vEnergy, List<String> m_vNuclide) {
try {
String filePath = parameterFilePath+File.separator+"Energy_Nuclide.txt";
String filePath = parameterProperties.getFilePath() +File.separator+"Energy_Nuclide.txt";
File file = new File(filePath);
List<String> readLines = FileUtils.readLines(file, "UTF-8");
for (int i=0; i<readLines.size(); i++){
@ -2107,7 +2060,7 @@ public class GammaFileUtil {
}
public void UpdateChartEnergy(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurCentroid, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
int num = m_vCurEnergy.size();
if(num < 1){
return;
@ -2172,7 +2125,7 @@ public class GammaFileUtil {
}
public void UpdateChartResolution(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurReso, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
int num = m_vCurEnergy.size();
if(num < 1) return;
@ -2226,12 +2179,14 @@ public class GammaFileUtil {
map.put("AllData", datalist);
}
public String UpdateEquationEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam) {
public String UpdateEquationEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, Integer funId) {
String equation = "";
if(m_curParam.getP().size() > 2) {
int p_size = m_curParam.getP().size()-1;
int e_size = m_vCurEnergy.size();
int funId = m_curParam.getP().get(0).intValue();
if (Objects.isNull(funId)) {
funId = m_curParam.getP().get(0).intValue();
}
switch(funId) {
case 1: // Interpolation: y=yi+(y(i+1)-yi)*(x-xi)/(x(i+1)-xi) for xi<=x<x(i+1)
if(p_size == 2 * e_size && p_size >= 4) {
@ -2305,7 +2260,7 @@ public class GammaFileUtil {
}
public void UpdateChartEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurEffi, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
int num = m_vCurEnergy.size();
if(num < 1) return;
@ -2698,7 +2653,11 @@ public class GammaFileUtil {
public List<String> DoubleLimit(List data) {
List<String> rData = new LinkedList<>();
for(int pos=0;pos<data.size();pos++) {
rData.add(String.format("%.3f", Double.valueOf(String.valueOf(data.get(pos)))));
if (null != data.get(pos)) {
rData.add(String.valueOf(data.get(pos)));
} else {
rData.add(null);
}
}
return rData;
}
@ -2708,7 +2667,7 @@ public class GammaFileUtil {
for(int pos=0;pos<_data.size();pos++) {
Double value = _data.get(pos);
if(Objects.isNull(value)) {
rdata.add("NULL");
rdata.add(null);
} else {
rdata.add(String.format("%.10g", value));
}
@ -3005,7 +2964,7 @@ public class GammaFileUtil {
}
funcDefEffi = EquationDescription(funcType);
funcTypeDefEffi = EquationName(funcType);
middleData.calibration_EF_Caltype = "efficiency";
middleData.calibration_EF_Caltype = CalType.EFFICIENCY_CAL.getType();
middleData.calibration_EF_function = funcType;
middleData.calibration_EF_functionDef = funcDefEffi;
middleData.calibration_EF_functionTypeDef = funcTypeDefEffi;
@ -3037,7 +2996,7 @@ public class GammaFileUtil {
}
funcDefReso = EquationDescription(funcType);
funcTypeDefReso = EquationName(funcType);
middleData.calibration_R_Caltype = "Resolution";
middleData.calibration_R_Caltype = CalType.RESOLUTION_CAL.getType();
middleData.calibration_R_function = funcType;
middleData.calibration_R_functionDef = funcDefReso;
middleData.calibration_R_functionTypeDef = funcTypeDefReso;
@ -3731,7 +3690,7 @@ public class GammaFileUtil {
}
public void PeaksChanged(PHDFile phd) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<Double> vCentroid = new LinkedList<>();
List<Double> vFwhmCh = new LinkedList<>();
List<Double> vTail = new LinkedList<>();
@ -3927,7 +3886,7 @@ public class GammaFileUtil {
InputStream inputStream = null;
File file = null;
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
@ -3939,7 +3898,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(compareFileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
@ -4060,7 +4019,7 @@ public class GammaFileUtil {
ftpClient.changeWorkingDirectory(path);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}

View File

@ -0,0 +1,20 @@
package org.jeecg.modules.native_jni;
public class AnalysisProcess {
// @Autowired
// private RedisTemplate<String, Object> redisTemplate;
public void gammaProcess(String userId, String process){
// BaseMap params = new BaseMap();
// params.put(GlobalConstants.HANDLER_NAME, WebSocketHandlerConst.GAMMA_ANALYSIS_HANDLER);
// params.put("userId", userId);
// // userId, fileName, process
// params.put("message", process);
// String str = "";
// JSON.parseObject(str, PHDFile.class);
// // 通过 redis 订阅发送 websocket 消息
// redisTemplate.convertAndSend(GlobalConstants.REDIS_TOPIC_NAME, params);;
System.out.println(userId+"-----"+process);
}
}

View File

@ -25,6 +25,6 @@ public class CalValuesHandler {
public static native StructInsertOutput ComputePeakRange(int peakSize, int m_nCount, List<Double> vCentroid, List<Double> vFwhmCh, List<Double> vTail, List<Double> vUpperTail);
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath);
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath, AnalysisProcess process);
}

View File

@ -1,9 +1,6 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.BgBoundary;
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.native_jni.struct.*;
import java.util.List;
@ -51,4 +48,25 @@ public class EnergySpectrumHandler {
*/
public static native BgAnalyseResult bgAnalyse(String sampleFile, String gasFile, String detFile);
/**
* 获取健康状态谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native SOHSpectrumStruct getSOHSourceData(String path);
/**
* 获取警告谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native AlertSpectrumStruct getAlertSourceData(String path);
/**
* 获取气象谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native MetSpectrumStruct getMetSourceData(String path);
}

View File

@ -1,10 +1,13 @@
package org.jeecg.modules.native_jni.struct;
import lombok.Data;
import java.util.List;
/**
* 能谱结构体字段信息
*/
@Data
public class EnergySpectrumStruct {
/************************* Infomations ******************/
/**
@ -440,113 +443,4 @@ public class EnergySpectrumStruct {
super();
}
@Override
public String toString() {
return "EnergySpectrumStruct{" +
"msg_type='" + msg_type + '\'' +
", msg_id='" + msg_id + '\'' +
", data_type='" + data_type + '\'' +
", designator='" + designator + '\'' +
", site_code='" + site_code + '\'' +
", detector_code='" + detector_code + '\'' +
", system_type='" + system_type + '\'' +
", sample_geometry='" + sample_geometry + '\'' +
", spectrum_quantity='" + spectrum_quantity + '\'' +
", sample_ref_id='" + sample_ref_id + '\'' +
", measurement_id='" + measurement_id + '\'' +
", detector_bk_measurement_id='" + detector_bk_measurement_id + '\'' +
", gas_bk_measurement_id='" + gas_bk_measurement_id + '\'' +
", transmit_date='" + transmit_date + '\'' +
", transmit_time='" + transmit_time + '\'' +
", comment='" + comment + '\'' +
", acquisition_start_date='" + acquisition_start_date + '\'' +
", acquisition_start_time='" + acquisition_start_time + '\'' +
", acquisition_real_time=" + acquisition_real_time +
", acquisition_live_time=" + acquisition_live_time +
", collection_start_date='" + collection_start_date + '\'' +
", collection_start_time='" + collection_start_time + '\'' +
", collection_stop_date='" + collection_stop_date + '\'' +
", collection_stop_time='" + collection_stop_time + '\'' +
", air_volume=" + air_volume +
", sample_volume_of_Xe=" + sample_volume_of_Xe +
", uncertainty_1=" + uncertainty_1 +
", Xe_collection_yield=" + Xe_collection_yield +
", uncertainty_2=" + uncertainty_2 +
", archive_bottle_id='" + archive_bottle_id + '\'' +
", date_calibration='" + date_calibration + '\'' +
", time_calibration='" + time_calibration + '\'' +
", g_energy=" + g_energy +
", g_centroid_channel=" + g_centroid_channel +
", g_uncertainty=" + g_uncertainty +
", g_record_count=" + g_record_count +
", b_electron_energy=" + b_electron_energy +
", b_decay_mode=" + b_decay_mode +
", b_channel=" + b_channel +
", b_uncertainty=" + b_uncertainty +
", b_record_count=" + b_record_count +
", g_r_energy=" + g_r_energy +
", g_r_FWHM=" + g_r_FWHM +
", g_r_uncertainty=" + g_r_uncertainty +
", g_r_record_count=" + g_r_record_count +
", b_r_electron_energy=" + b_r_electron_energy +
", b_r_FWHM=" + b_r_FWHM +
", b_r_uncertainty=" + b_r_uncertainty +
", b_r_record_count=" + b_r_record_count +
", g_e_energy=" + g_e_energy +
", g_e_efficiency=" + g_e_efficiency +
", g_e_uncertainty=" + g_e_uncertainty +
", g_e_record_count=" + g_e_record_count +
", ROI_number=" + ROI_number +
", POI_B_x1=" + POI_B_x1 +
", POI_B_x2=" + POI_B_x2 +
", POI_G_y1=" + POI_G_y1 +
", POI_G_y2=" + POI_G_y2 +
", roi_record_count=" + roi_record_count +
", bg_nuclide_name=" + bg_nuclide_name +
", bg_ROI_number=" + bg_ROI_number +
", bg_efficiency=" + bg_efficiency +
", bg_uncertainty=" + bg_uncertainty +
", bg_record_count=" + bg_record_count +
", ratio_id=" + ratio_id +
", ROI_num_highter_G_energy_ROI=" + ROI_num_highter_G_energy_ROI +
", ROI_num_lower_G_energy_ROI=" + ROI_num_lower_G_energy_ROI +
", count_ratio=" + count_ratio +
", count_ratio_uncertainty=" + count_ratio_uncertainty +
", ratio_record_count=" + ratio_record_count +
", num_g_channel=" + num_g_channel +
", g_energy_span=" + g_energy_span +
", g_begin_channel=" + g_begin_channel +
", g_counts=" + g_counts +
", num_b_channel=" + num_b_channel +
", b_energy_span=" + b_energy_span +
", b_begin_channel=" + b_begin_channel +
", b_counts=" + b_counts +
", b_channels=" + b_channels +
", g_channels=" + g_channels +
", b_h_energy_span=" + b_h_energy_span +
", g_h_energy_span=" + g_h_energy_span +
", h_counts=" + h_counts +
", total_source_activity=" + total_source_activity +
", assay_date='" + assay_date + '\'' +
", assay_time='" + assay_time + '\'' +
", units_activity='" + units_activity + '\'' +
", nuclide_name=" + nuclide_name +
", half_life_time=" + half_life_time +
", time_unit=" + time_unit +
", activity_nuclide_time_assay=" + activity_nuclide_time_assay +
", uncertainty=" + uncertainty +
", cer_g_energy=" + cer_g_energy +
", g_intensity=" + g_intensity +
", electron_decay_mode=" + electron_decay_mode +
", maximum_energy=" + maximum_energy +
", intensity_b_particle=" + intensity_b_particle +
", record_count=" + record_count +
'}';
}
public static void main(String[] args) {
EnergySpectrumStruct s = new EnergySpectrumStruct();
System.out.println(s);
System.out.println(s.gas_bk_measurement_id);
}
}

View File

@ -25,7 +25,7 @@
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.ejml/ejml-simple -->

View File

@ -41,9 +41,9 @@ public class PHDFileUtil {
@Autowired
private SpectrumPathProperties spectrumPathProperties;
public Map<String, Object> getSourceData(String filePath, List<GardsXeResultsSpectrum> xeDataList, Integer sampleId, String status){
public Map<String, Object> getSourceData(String filePath, Integer sampleId, String status){
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(filePath);
Map<String, Object> map = new HashMap<>();
try {
@ -225,24 +225,6 @@ public class PHDFileUtil {
betaEnergyList.add(betaEnergy);
}
map.put("betaEnergyData", betaEnergyList);
//Xe
if (CollectionUtils.isNotEmpty(xeDataList)){
for (GardsXeResultsSpectrum xeData:xeDataList) {
Double conc = xeData.getConc();
Double mdc = xeData.getMdc();
if (conc < 0){
xeData.setColor("red");
xeData.setNidFlag(0);
} else if (0<conc && conc < mdc) {
xeData.setColor("#ffcc30");
xeData.setNidFlag(0);
} else if (conc > mdc) {
xeData.setColor("green");
xeData.setNidFlag(1);
}
}
map.put("XeData", xeDataList);
}
//计算边界值
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
@ -301,7 +283,7 @@ public class PHDFileUtil {
iStream=ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(iStream)) {
//声明一个临时文件
File file = File.createTempFile("tmp", null);
File file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(iStream, file);
List<String> allLines = FileUtils.readLines(file, ftpUtil.getEncoding());
@ -466,7 +448,7 @@ public class PHDFileUtil {
public Map<String, String> getFileData(String filePath, String sampleFileName){
Map<String, String> map = new HashMap<>();
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//连接ftp 获取ftp文件数据
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -486,7 +468,7 @@ public class PHDFileUtil {
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
File file = File.createTempFile("tmp", null);
File file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载sampleFile内容
@ -544,7 +526,7 @@ public class PHDFileUtil {
ftpClient.changeWorkingDirectory(filePath);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}
@ -563,7 +545,7 @@ public class PHDFileUtil {
}
}
//加载动态库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
String systemType = sourceData.system_type;
String dataType = sourceData.data_type;
@ -614,7 +596,7 @@ public class PHDFileUtil {
ftpClient.changeWorkingDirectory(filePath);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}
@ -633,7 +615,7 @@ public class PHDFileUtil {
}
}
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//计算边界值
List<Double> gCentroidChannel = struct.g_centroid_channel;
@ -698,7 +680,7 @@ public class PHDFileUtil {
String fileCompare = tmpFileName.substring(0,23);
for (String fileName:fileNames) {
String compare = fileName.substring(0, 23);
if (compare.equals(fileCompare)) {
if (compare.equals(fileCompare) && fileName.contains("FULL")) {
matchFileName = fileName;
}
}
@ -716,7 +698,9 @@ public class PHDFileUtil {
if(qcphdDateTime>dateTime) {
break;
} else {
rData = fileNames.get(pos);
if (fileNames.get(pos).contains("FULL")) {
rData = fileNames.get(pos);
}
}
}
return rData;
@ -739,7 +723,7 @@ public class PHDFileUtil {
ftpClient.changeWorkingDirectory(path);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}
@ -762,7 +746,7 @@ public class PHDFileUtil {
public BgDataAnlyseResultIn analyzeSpectrum(File sampleTmp, File gasTmp, File detTmp, Map<String, Object> map) {
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
BgAnalyseResult bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
BgDataAnlyseResultIn resultIn = new BgDataAnlyseResultIn();
@ -792,7 +776,7 @@ public class PHDFileUtil {
public EnergySpectrumStruct analyzeFileSourceData(String filePath, String fileName) {
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = new EnergySpectrumStruct();
FTPClient ftpClient = ftpUtil.LoginFTP();
InputStream inputStream = null;
@ -807,7 +791,7 @@ public class PHDFileUtil {
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
File file = File.createTempFile("tmp", null);
File file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
@ -831,7 +815,7 @@ public class PHDFileUtil {
public List<GardsXeResultsSpectrum> analyzeQCResultXe(File sampleTmp, File gasTmp, File detTmp){
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
BgAnalyseResult bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
@ -869,7 +853,7 @@ public class PHDFileUtil {
public Map<String, Object> analyze(File sampleTmp, File gasTmp, File detTmp){
Map<String, Object> result = new HashMap<>();
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
BgAnalyseResult bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
/* GardsROIChannelsSpectrum集合 */

View File

@ -13,8 +13,6 @@ public class SpectrumGroup implements Serializable {
public List<Double> b_c2e;
public List<Double> g_c2e;
public Integer sampleId;
public SpectrumGroup(){
BgCalPara = new BgCalibratePara();
b_c2e = new LinkedList<>();

View File

@ -25,6 +25,6 @@ public class CalValuesHandler {
public static native StructInsertOutput ComputePeakRange(int peakSize, int m_nCount, List<Double> vCentroid, List<Double> vFwhmCh, List<Double> vTail, List<Double> vUpperTail);
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath);
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath, AnalysisProcess process);
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.entity.vo.BgCalibratePara;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.BgBoundary;
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
@ -51,4 +52,14 @@ public class EnergySpectrumHandler {
*/
public static native BgAnalyseResult bgAnalyse(String sampleFile, String gasFile, String detFile);
/**
* BetaGamma 重新分析算法
* @param sampleFile
* @param gasFile
* @param detFile
* @param BgCalPara
* @return
*/
public static native BgAnalyseResult bgReAnalyse(String sampleFile, String gasFile, String detFile, BgCalibratePara BgCalPara);
}

View File

@ -21,6 +21,7 @@ import org.apache.commons.net.ftp.FTPClient;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.*;
@ -36,9 +37,11 @@ import org.jeecg.modules.base.enums.RoleType;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.AnalysisProcess;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
import org.jeecg.modules.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -89,8 +92,8 @@ public class GammaServiceImpl implements IGammaService {
private FTPUtil ftpUtil;
@Value("${ZeroTime}")
private String ZeroTimeStr;
@Value("${parameter.filePath}")
private String parameterFilePath;
@Autowired
private ParameterProperties parameterProperties;
@Autowired
private IGardsAnalysesSpectrumService analysesSpectrumService;
@Autowired
@ -173,7 +176,15 @@ public class GammaServiceImpl implements IGammaService {
@Override
public Result testFun(String fileName, HttpServletRequest request) {
Result result = new Result();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
phd.setUserId("1");
phd.setXmlFilePath(parameterProperties.getFilePath());
String systemType = fileName.substring(2, 3);
if (Objects.isNull(phd)){
result.error500("请先选择解析文件!");
return result;
}
String userName = JwtUtil.getUserNameByToken(request);
//查询当前用户关联的核素信息
List<String> nuclides = new LinkedList<>();
@ -183,25 +194,202 @@ public class GammaServiceImpl implements IGammaService {
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", systemType);
}
Map<String, NuclideLines> nuclideLinesMap = GetNuclideLines(nuclides);
result.setSuccess(true);
result.setResult(nuclideLinesMap);
return result;
}
public static void main(String[] args) {
System.loadLibrary("GammaAnaly");
String path = "D:\\ARMD\\PHD\\Samplephd\\PHP52_001-20230908_0543_S_PREL_43188.PHD";
//解析获取临时文件信息
File tmpFile = gammaFileUtil.analyzeFile(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(new PHDFile());
String mapLines = mapper.writeValueAsString(new HashMap<String, NuclideLines>());
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, path);
String phdStr = mapper.writeValueAsString(phd);
String mapLines = mapper.writeValueAsString(nuclideLinesMap);
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, tmpFile.getAbsolutePath(), new AnalysisProcess());
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
System.out.println("parseMap:" + parseMap);
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
phd.setBAnalyed(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapEnerPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapResoPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapResoPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapEffiPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapEffiPara(value);
}
if (entry.getKey().equalsIgnoreCase("mapTotEPara")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, ParameterInfo> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
String key = objectEntry.getKey();
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
value.put(key, entryValue);
}
phd.setMapTotEPara(value);
}
if (entry.getKey().equalsIgnoreCase("para_stepRatio")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_stepRatio(value);
}
if (entry.getKey().equalsIgnoreCase("para_tail")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tail(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailAlpha")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailAlpha(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailRight")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailRight(value);
}
if (entry.getKey().equalsIgnoreCase("para_tailRightAlpha")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setPara_tailRightAlpha(value);
}
if (entry.getKey().equalsIgnoreCase("newEner")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewEner(value);
}
if (entry.getKey().equalsIgnoreCase("newReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewReso(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GEnergyBlock> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
String key = objectEntry.getKey();
GEnergyBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GEnergyBlock.class);
value.put(key, entryValue);
}
phd.setMapEnerKD(value);
}
if (entry.getKey().equalsIgnoreCase("mapResoKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GResolutionBlock> value = new HashMap<>();
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
String key = objectEntry.getKey();
GResolutionBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GResolutionBlock.class);
value.put(key, entryValue);
}
phd.setMapResoKD(value);
}
if (entry.getKey().equalsIgnoreCase("vEnergy")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVEnergy(value);
}
if (entry.getKey().equalsIgnoreCase("vBase")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVBase(value);
}
if (entry.getKey().equalsIgnoreCase("vLc")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVLc(value);
}
if (entry.getKey().equalsIgnoreCase("vScac")) {
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
phd.setVScac(value);
}
if (entry.getKey().equalsIgnoreCase("vPeak")) {
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
phd.setVPeak(value);
}
if (entry.getKey().equalsIgnoreCase("baseCtrls")) {
BaseControls value = JSON.parseObject(JSON.toJSONString(entry.getValue()), BaseControls.class);
phd.setBaseCtrls(value);
}
if (entry.getKey().equalsIgnoreCase("usedEner")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedEner(value);
}
if (entry.getKey().equalsIgnoreCase("usedEnerKD")) {
GEnergyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEnergyBlock.class);
phd.setUsedEnerKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedEnerPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedEnerPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedReso(value);
}
if (entry.getKey().equalsIgnoreCase("usedResoKD")) {
GResolutionBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GResolutionBlock.class);
phd.setUsedResoKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedResoPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedResoPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffi")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedEffi(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffiKD")) {
GEfficiencyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEfficiencyBlock.class);
phd.setUsedEffiKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedEffiPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedEffiPara(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotE")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setUsedTotE(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotEKD")) {
TotaleffBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), TotaleffBlock.class);
phd.setUsedTotEKD(value);
}
if (entry.getKey().equalsIgnoreCase("usedTotEPara")) {
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
phd.setUsedTotEPara(value);
}
}
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
for (PeakInfo peak:phd.getVPeak()) {
if (StringUtils.isBlank(peak.recoilBetaChan)) {
peak.recoilBetaChan = "1";
}
if (StringUtils.isBlank(peak.recoilDeltaChan)) {
peak.recoilDeltaChan = "1";
}
}
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
gammaFileUtil.RunQC(phd);
result.setResult(phd);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} finally {
if (Objects.nonNull(tmpFile)) {
tmpFile.delete();
}
}
result.setSuccess(true);
return result;
}
@Override
@ -461,8 +649,8 @@ public class GammaServiceImpl implements IGammaService {
phd.getMapNucActMda().get(str_key).setEfficiency(nuclLinesIdedSpectrum.getEffic());
phd.getMapNucActMda().get(str_key).setEffi_err(nuclLinesIdedSpectrum.getUnEffic());
phd.getMapNucActMda().get(str_key).setMda(nuclLinesIdedSpectrum.getMda());
phd.getMapNucActMda().get(str_key).setMdc(Double.valueOf(nuclLinesIdedSpectrum.getMdc()));
phd.getMapNucActMda().get(str_key).setConcentration(Double.valueOf(nuclLinesIdedSpectrum.getConcentration()));
phd.getMapNucActMda().get(str_key).setMdc(nuclLinesIdedSpectrum.getMdc().equalsIgnoreCase("inf")?0.0:Double.valueOf(nuclLinesIdedSpectrum.getMdc()));
phd.getMapNucActMda().get(str_key).setConcentration(nuclLinesIdedSpectrum.getConcentration().equalsIgnoreCase("inf")?0.0:Double.valueOf(nuclLinesIdedSpectrum.getConcentration()));
if(phd.getMapNucActMda().get(str_key).getActivity() > 0){
phd.getMapNucActMda().get(str_key).setBCalculateMDA(true);
}
@ -551,7 +739,7 @@ public class GammaServiceImpl implements IGammaService {
vChan.add(c);
c += 1;
}
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP());
phd.setVEnergy(calValuesOut.counts);
phd.setBAnalyed(true);
@ -729,7 +917,7 @@ public class GammaServiceImpl implements IGammaService {
phd.setUserId(user.getId());
}
//赋值xml文件存放路径
phd.setXmlFilePath(parameterFilePath);
phd.setXmlFilePath(parameterProperties.getFilePath());
//获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
//查询当前用户关联的核素信息
@ -857,7 +1045,7 @@ public class GammaServiceImpl implements IGammaService {
public Result insertPeak(Integer sampleId, String fileName, Integer curChan) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -1723,7 +1911,7 @@ public class GammaServiceImpl implements IGammaService {
public Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -1754,8 +1942,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
EnergyData energyData = new EnergyData();
double delta = (m_vCurEnergy.get(i) - vFit.get(i)) / m_vCurEnergy.get(i) * 100;
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(i)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(i)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
energyData.setFit(String.format("%.3f", vFit.get(i)));
energyData.setDelta(String.format("%.3f", delta));
energyDataList.add(energyData);
@ -1789,7 +1977,7 @@ public class GammaServiceImpl implements IGammaService {
}
private void DataChangeEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
if(m_vCurEnergy.size() < 1) {
return;
} else if(m_vCurEnergy.size() == 1) {
@ -1811,8 +1999,8 @@ public class GammaServiceImpl implements IGammaService {
for(int j=0; j<m_vCurEnergy.size(); j++) {
EnergyData energyData = new EnergyData();
double delta = (m_vCurEnergy.get(j) - vFit.get(j)) / m_vCurEnergy.get(j) * 100;
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(j)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(j)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(j)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(j)));
energyData.setFit(String.format("%.3f", vFit.get(j)));
energyData.setDelta(String.format("%.3f", delta));
energyDataList.add(energyData);
@ -1820,8 +2008,8 @@ public class GammaServiceImpl implements IGammaService {
} else {
for(int j=0; j<m_vCurEnergy.size(); j++) {
EnergyData energyData = new EnergyData();
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(j)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(j)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(j)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(j)));
energyData.setFit("");
energyData.setDelta("");
energyDataList.add(energyData);
@ -1906,7 +2094,7 @@ public class GammaServiceImpl implements IGammaService {
InputStream inputStream = null;
try {
//创建临时文件
tmpFile = File.createTempFile("tmp", null);
tmpFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
//复制上传文件的输入流到临时文件
FileUtils.copyInputStreamToFile(inputStream ,tmpFile);
@ -1944,8 +2132,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
EnergyData energyData = new EnergyData();
double delta = (m_vCurEnergy.get(i) - vFit.get(i)) / m_vCurEnergy.get(i) * 100;
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(i)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(i)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
energyData.setFit(String.format("%.3f", vFit.get(i)));
energyData.setDelta(String.format("%.3f", delta));
energyDataList.add(energyData);
@ -1999,7 +2187,7 @@ public class GammaServiceImpl implements IGammaService {
public Result resolutionCalibration(Integer sampleId, String fileName, String currentText, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2030,8 +2218,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
ResolutionData resolutionData = new ResolutionData();
double delta = (m_vCurReso.get(i) - vFit.get(i)) / m_vCurReso.get(i) * 100;
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit(String.format("%.3f", vFit.get(i)));
resolutionData.setDelta(String.format("%.3f", delta));
resolutionDataList.add(resolutionData);
@ -2052,7 +2240,7 @@ public class GammaServiceImpl implements IGammaService {
public Result changeDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2066,7 +2254,7 @@ public class GammaServiceImpl implements IGammaService {
}
public void DataChangeResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
m_curParam.setP(CalValuesHandler.calFitPara("Cal_Resolution", 4, m_vCurEnergy, m_vCurReso, m_vCurUncert));
map.put("uncert", m_vCurUncert);
map.put("param", m_curParam);
@ -2077,8 +2265,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
ResolutionData resolutionData = new ResolutionData();
double delta = (m_vCurReso.get(i) - vFit.get(i)) / m_vCurReso.get(i) * 100;
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit(String.format("%.3f", vFit.get(i)));
resolutionData.setDelta(String.format("%.3f", delta));
resolutionDataList.add(resolutionData);
@ -2086,8 +2274,8 @@ public class GammaServiceImpl implements IGammaService {
} else {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
ResolutionData resolutionData = new ResolutionData();
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit("");
resolutionData.setDelta("");
resolutionDataList.add(resolutionData);
@ -2172,7 +2360,7 @@ public class GammaServiceImpl implements IGammaService {
File tmpFile = null;
try {
//创建临时文件
tmpFile = File.createTempFile("tmp", null);
tmpFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
//复制上传文件的输入流到临时文件
FileUtils.copyInputStreamToFile(inputStream ,tmpFile);
@ -2210,8 +2398,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
ResolutionData resolutionData = new ResolutionData();
double delta = (m_vCurReso.get(i) - vFit.get(i)) / m_vCurReso.get(i) * 100;
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit(String.format("%.3f", vFit.get(i)));
resolutionData.setDelta(String.format("%.3f", delta));
resolutionDataList.add(resolutionData);
@ -2274,7 +2462,7 @@ public class GammaServiceImpl implements IGammaService {
m_vFuncName.add("HAE Efficiency(1-2)"); // 94
m_vFuncName.add("HAE Efficiency(1-2-3)"); // 95
map.put("function", m_vFuncName);
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2305,14 +2493,14 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
double delta = (m_vCurEffi.get(i) - vFit.get(i)) / m_vCurEffi.get(i) * 100;
EfficiencyData efficiencyData = new EfficiencyData();
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit(String.format("%.3f", vFit.get(i)));
efficiencyData.setDelta(String.format("%.3f", delta));
efficiencyDataList.add(efficiencyData);
}
map.put("table", efficiencyDataList);
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam, null);
map.put("equation", equation);
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
@ -2327,7 +2515,7 @@ public class GammaServiceImpl implements IGammaService {
public Result changeDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, Integer sampleId, String fileName, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2341,7 +2529,7 @@ public class GammaServiceImpl implements IGammaService {
}
public void DataChangeEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
m_curParam.setP(CalValuesHandler.calFitPara("Cal_Efficiency", funcId, m_vCurEnergy, m_vCurEffi, m_vCurUncert));
map.put("uncert", m_vCurUncert);
map.put("param", m_curParam);
@ -2352,8 +2540,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
EfficiencyData efficiencyData = new EfficiencyData();
double delta = (m_vCurEffi.get(i) - vFit.get(i)) / m_vCurEffi.get(i) * 100;
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit(String.format("%.3f", vFit.get(i)));
efficiencyData.setDelta(String.format("%.3f", delta));
efficiencyDataList.add(efficiencyData);
@ -2361,8 +2549,8 @@ public class GammaServiceImpl implements IGammaService {
} else {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
EfficiencyData efficiencyData = new EfficiencyData();
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit("");
efficiencyData.setDelta("");
efficiencyDataList.add(efficiencyData);
@ -2370,7 +2558,7 @@ public class GammaServiceImpl implements IGammaService {
String Warning = "Fit failed. Maybe:\n1. data's number are too little;\n2. %1 isn't suitable for the data.";
}
map.put("table", efficiencyDataList);
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam, funcId);
map.put("equation", equation);
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
}
@ -2449,7 +2637,7 @@ public class GammaServiceImpl implements IGammaService {
InputStream inputStream = null;
try {
//创建临时文件
tmpFile = File.createTempFile("tmp", null);
tmpFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
//复制上传文件的输入流到临时文件
FileUtils.copyInputStreamToFile(inputStream ,tmpFile);
@ -2498,14 +2686,14 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
double delta = (m_vCurEffi.get(i) - vFit.get(i)) / m_vCurEffi.get(i) * 100;
EfficiencyData efficiencyData = new EfficiencyData();
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit(String.format("%.3f", vFit.get(i)));
efficiencyData.setDelta(String.format("%.3f", delta));
efficiencyDataList.add(efficiencyData);
}
map.put("table", efficiencyDataList);
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam, null);
map.put("equation", equation);
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
@ -3141,7 +3329,7 @@ public class GammaServiceImpl implements IGammaService {
}
item.setName(name);
item.setFlag(iter.getValue().isBPass() ? "PASS" : "FAIL");
item.setValue(NumUtil.fixedMax(6 ,iter.getValue().getValue()));
item.setValue( Double.parseDouble(NumberFormatUtil.numberCal(String.valueOf(iter.getValue().getValue()))) );
String standard="";
List<String> strList = Arrays.asList(iter.getValue().getStandard().split(StringPool.COMMA));
for (String str : strList) {
@ -3258,16 +3446,16 @@ public class GammaServiceImpl implements IGammaService {
TablePeakFit tablePeak = new TablePeakFit();
tablePeak.setIndex(i + 1);
PeakInfo peak = phd.getVPeak().get(i);
tablePeak.setEnergy(NumUtil.keep3Str(peak.energy));
tablePeak.setEnergy( NumberFormatUtil.numberCal(String.valueOf(peak.energy)) );
tablePeak.setEnergyErr(energy_uncert);
tablePeak.setNetArea(NumUtil.keep4ScienceStr(peak.area));
String area_err = peak.area > 0 ? NumUtil.keep2Str(peak.areaErr/peak.area*100) : "0";
tablePeak.setNetArea( NumberFormatUtil.numberCal(String.valueOf(peak.area)) );
String area_err = peak.area > 0 ? NumberFormatUtil.numberCal(String.valueOf(peak.areaErr/peak.area*100)) : "0";
tablePeak.setAreaErr(area_err);
String rate = live_time > 0 ? NumUtil.keep4ScienceStr(peak.area/live_time) : "0";
String rate = live_time > 0 ? NumberFormatUtil.numberCal(String.valueOf(peak.area/live_time)) : "0";
tablePeak.setNetCountRate(rate);
tablePeak.setNcRateErr(area_err);
tablePeak.setLc(NumUtil.keep4ScienceStr(peak.lc));
tablePeak.setSignificance(NumUtil.keep2Str(peak.significance));
tablePeak.setLc( NumberFormatUtil.numberCal(String.valueOf(peak.lc)) );
tablePeak.setSignificance( NumberFormatUtil.numberCal(String.valueOf(peak.significance)) );
peakFitList.add(tablePeak);
}
map.put("peakFit", peakFitList);

View File

@ -218,7 +218,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Result result = new Result();
List<Map<String, Object>> resultList = new LinkedList<>();
String userName = JwtUtil.getUserNameByToken(request);
String filePath = "/test";//StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String filePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH +userName;
String sampleRx = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.PHD";
Pattern regexPattern = Pattern.compile(sampleRx);
String sampleRx1 = "[a-zA-Z]{3}[0-9]{2}_[0-9]{3}-[0-9]{8}_[0-9]{4}_S_(FULL_|PREL_)\\d+\\.\\d+\\.PHD";
@ -300,7 +300,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
public Result getDBSpectrumChart(String dbName, Integer sampleId, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
Map<String, Object> resultMap = new HashMap<>();
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList= new LinkedList<>();
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
List<GardsCalibrationPairsSpectrum> gammaCalibrationPairsList = new LinkedList<>();
List<GardsCalibrationPairsSpectrum> betaCalibrationPairsList = new LinkedList<>();
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
if (Objects.isNull(sampleId)){
result.error500("请选择一条数据");
@ -310,15 +318,50 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (dbName.equalsIgnoreCase("auto")){
dbName = "RNAUTO";
analysisID = spectrumAnalysisMapper.getAnalysisID("RNAUTO", sampleId, "RNAUTO");
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam("RNAUTO", analysisID, sampleId);
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam("RNAUTO", analysisID, sampleId);
roiChannelsSpectrumList = spectrumAnalysisMapper.ReadROIChannels("RNAUTO", analysisID, sampleId);
roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults("RNAUTO", analysisID, sampleId);
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults("RNAUTO", analysisID, sampleId);
}else if (dbName.equalsIgnoreCase("man")){
} else if (dbName.equalsIgnoreCase("man")){
dbName = "RNMAN";
analysisID = spectrumAnalysisMapper.getAnalysisID("RNMAN", sampleId, userName);
gammaCalibrationPairsList = spectrumAnalysisMapper.ReadGammaFitChannelEnergy(analysisID, sampleId);
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam("RNMAN", analysisID, sampleId);
betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID, sampleId);
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam("RNMAN", analysisID, sampleId);
roiChannelsSpectrumList = spectrumAnalysisMapper.ReadROIChannels("RNMAN", analysisID, sampleId);
roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults("RNMAN", analysisID, sampleId);
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults("RNMAN", analysisID, sampleId);
cacheMap.put("gammaCalibrationPairsList", gammaCalibrationPairsList);
cacheMap.put("betaCalibrationPairsList", betaCalibrationPairsList);
}else {
result.error500("数据库类型不存在");
return result;
}
cacheMap.put("gammaCalibrationSpectrumList", gammaCalibrationSpectrumList);
cacheMap.put("betaCalibrationSpectrumList", betaCalibrationSpectrumList);
cacheMap.put("roiChannelsSpectrumList", roiChannelsSpectrumList);
cacheMap.put("roiResultsSpectrumList", roiResultsSpectrumList);
cacheMap.put("xeResultsSpectrumList", xeResultsSpectrumList);
//Xe
if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){
for (GardsXeResultsSpectrum xeData:xeResultsSpectrumList) {
Double conc = xeData.getConc();
Double mdc = xeData.getMdc();
if (conc < 0){
xeData.setColor("red");
xeData.setNidFlag(0);
} else if (0<conc && conc < mdc) {
xeData.setColor("#ffcc30");
xeData.setNidFlag(0);
} else if (conc > mdc) {
xeData.setColor("green");
xeData.setNidFlag(1);
}
}
resultMap.put("XeData", xeResultsSpectrumList);
}
//查询数据库文件信息
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
List<String> filePath = new LinkedList<>();
@ -333,8 +376,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
GardsSampleData sample = spectrumAnalysisMapper.findSampleByFilePath(sampleFilePath);
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
sampleMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, sample.getSampleId(), sample.getStatus());
sampleMap = this.fenxi(pathName, fileName, sample.getSampleId(), sample.getStatus());
resultMap.put("sample",sampleMap);
cache.put(fileName+"-"+userName, cacheMap);
betaCache.setBetaCache(cache);
}
if(StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())){
String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath();
@ -343,7 +388,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(gasBg)) {
gasBgMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, gasBg.getSampleId(), gasBg.getStatus());
gasBgMap = this.fenxi(pathName, fileName, gasBg.getSampleId(), gasBg.getStatus());
resultMap.put("gasBg",gasBgMap);
}
}
@ -354,7 +399,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(detBg)) {
detBgMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, detBg.getSampleId(), detBg.getStatus());
detBgMap = this.fenxi(pathName, fileName, detBg.getSampleId(), detBg.getStatus());
resultMap.put("detBg",detBgMap);
}
}
@ -367,7 +412,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String pathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
String fileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
if (Objects.nonNull(qc)) {
qcMap = this.fenxi(pathName, fileName, xeResultsSpectrumList, qc.getSampleId(), qc.getStatus());
qcMap = this.fenxi(pathName, fileName, qc.getSampleId(), qc.getStatus());
resultMap.put("qc",qcMap);
}
}
@ -376,6 +421,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
resultMap.put("savedAnalysisResult", true);
} else {
resultMap.clear();
cacheMap.clear();
}
result.setSuccess(true);
result.setResult(resultMap);
@ -385,7 +431,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
@Override
public Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
Result result = new Result();
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + JwtUtil.getUserNameByToken(request);
String userName = JwtUtil.getUserNameByToken(request);
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
Map<String, Object> resultMap = new HashMap<>();
List<String> filePath = new LinkedList<>();
Map<String, Object> sampleMap = new HashMap<>();
@ -395,28 +442,29 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if(StringUtils.isNotBlank(sampleFileName)){
String sampleFilePath = path + sampleFileName;
filePath.add(sampleFilePath);
sampleMap = this.fenxi(path, sampleFileName, null, null, null);
resultMap.put("sample",sampleMap);
sampleMap = this.fenxi(path, sampleFileName, null, null);
resultMap.put("sample", sampleMap);
}
if(StringUtils.isNotBlank(gasFileName)){
String gasBgFilePath = path + gasFileName;
filePath.add(gasBgFilePath);
gasBgMap = this.fenxi(path, gasFileName, null, null, null);
resultMap.put("gasBg",gasBgMap);
gasBgMap = this.fenxi(path, gasFileName, null, null);
resultMap.put("gasBg", gasBgMap);
}
if(StringUtils.isNotBlank(detFileName)){
String detBgFilePath = path + detFileName;
filePath.add(detBgFilePath);
detBgMap = this.fenxi(path, detFileName, null, null, null);
resultMap.put("detBg",detBgMap);
detBgMap = this.fenxi(path, detFileName, null, null);
resultMap.put("detBg", detBgMap);
}
if(StringUtils.isNotBlank(qcFileName)){
String dbQcFilePath = path + qcFileName;
filePath.add(dbQcFilePath);
qcMap = this.fenxi(path, qcFileName, null, null, null);
resultMap.put("qc",qcMap);
qcMap = this.fenxi(path, qcFileName, null, null);
resultMap.put("qc", qcMap);
}
phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap);
resultMap.put("XeData", new LinkedList<>());
resultMap.put("bProcessed", false);
resultMap.put("savedAnalysisResult", false);
result.setSuccess(true);
@ -424,7 +472,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
return result;
}
private Map<String, Object> fenxi(String pathName, String fileName, List<GardsXeResultsSpectrum> xeDataList, Integer sampleId, String status) {
private Map<String, Object> fenxi(String pathName, String fileName, Integer sampleId, String status) {
Map<String, Object> map = new HashMap<>();
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -443,10 +491,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
map = phdFileUtil.getSourceData(file.getAbsolutePath(), xeDataList, sampleId, status);
map = phdFileUtil.getSourceData(file.getAbsolutePath(), sampleId, status);
map.put("fileName", fileName);
map.put("filePath", pathName);
}
@ -525,11 +573,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
commentInfo.setSpectrumCommentInfo(struct.comment);
}
@ -924,11 +972,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
String measurementID = struct.measurement_id;
String bkgdMeasurementID = struct.detector_bk_measurement_id;
@ -1225,11 +1273,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
rlrDataValues.setSrid(struct.sample_ref_id);
rlrDataValues.setColloct_start_date(struct.collection_start_date);
@ -1348,11 +1396,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(qcFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//读取Gamma Detector Calibration所需要的参数
long numGChannel = struct.num_g_channel;
@ -1496,11 +1544,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(qcFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//Figure of Beta Detector Calibration
long numBChannel = struct.num_b_channel;
@ -1623,7 +1671,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
samplePathName = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp连接失败");
@ -1644,7 +1692,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//ftp文件输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
@ -1774,7 +1822,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
filePath = StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp连接失败");
@ -1795,7 +1843,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(sampleFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//ftp文件输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
@ -2164,7 +2212,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Map<String, Object> cacheMap = new HashMap<>();
Map<String, Object> map = new HashMap<>();
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
if ((CollectionUtils.isNotEmpty(tempPoints) && Objects.nonNull(count) && tempPoints.size() != count) || (Objects.isNull(paramA) || StringUtils.isBlank(String.valueOf(paramA)))
|| (Objects.isNull(paramB) || StringUtils.isBlank(String.valueOf(paramB))) || (Objects.isNull(paramC) || StringUtils.isBlank(String.valueOf(paramC))) ){
List<Double> xs = new LinkedList<>();
@ -2314,11 +2362,11 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
inputStream = ftpClient.retrieveFileStream(qcFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//Beta-Gamma Spectrum: QC
long bChannels = struct.b_channels;
@ -2362,30 +2410,79 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
@Override
public Result ReAnalyse(AnalyseData analyseData, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
if ("CurrentSpectrum".equals(analyseData.getApplyType())) {
List<Integer> sampleIds = analyseData.getSampleIds();
if (CollectionUtils.isNotEmpty(sampleIds)){
String dbName = analyseData.getDbNames().get(0);
Integer sampleId = sampleIds.get(0);
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
String dbName = analyseData.getDbNames().get(0);
Integer sampleId = analyseData.getSampleIds().get(0);
if (Objects.nonNull(sampleId)){
Integer analysisID = null;
if (dbName.equalsIgnoreCase("auto")){
dbName = "RNAUTO";
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
}else if (dbName.equalsIgnoreCase("man")){
dbName = "RNMAN";
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
}
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
if (Objects.nonNull(dbSpectrumFilePath)) {
BetaGammaAnalyzeCurrentProcess(analyseData, dbSpectrumFilePath, userName);
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
BgAnalyseResult analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, sampleFilePath, gasFilePath, detFilePath, userName);
result.setSuccess(true);
result.setResult(analyseResult);
}
} else {
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
BgAnalyseResult analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, path, path, path, userName);
result.setSuccess(true);
result.setResult(analyseResult);
}
} else if ("AllSpectrum".equals(analyseData.getApplyType())) {
Map<String, SpectrumFileRecord> m_loadData = new HashMap<>();
List<Map<String, String>> loadDataList = new LinkedList<>();
for (int i=0; i<analyseData.getSampleIds().size(); i++) {
Map<String, String> m_loadData = new HashMap<>();
Integer sampleId = analyseData.getSampleIds().get(i);
String dbName = analyseData.getDbNames().get(i);
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
m_loadData.put(String.valueOf(sampleId), dbSpectrumFilePath);
String sampleFileName = analyseData.getSampleFileNames().get(i);
String gasFileName = analyseData.getGasFileNames().get(i);
String detFileName = analyseData.getDetFileNames().get(i);
String qcFileName = analyseData.getQcFileNames().get(i);
if (Objects.nonNull(sampleId)){
Integer analysisID = null;
if (dbName.equalsIgnoreCase("auto")){
dbName = "RNAUTO";
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
}else if (dbName.equalsIgnoreCase("man")){
dbName = "RNMAN";
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
}
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
if (Objects.nonNull(dbSpectrumFilePath)) {
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
m_loadData.put("sampleFilePath", sampleFilePath);
m_loadData.put("gasFilePath", gasFilePath);
m_loadData.put("detFilePath", detFilePath);
}
} else {
String sampleFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String gasFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
String detFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
m_loadData.put("sampleFilePath", sampleFilePath);
m_loadData.put("gasFilePath", gasFilePath);
m_loadData.put("detFilePath", detFilePath);
}
m_loadData.put("sampleFileName", sampleFileName);
m_loadData.put("gasFileName", gasFileName);
m_loadData.put("detFileName", detFileName);
m_loadData.put("qcFileName", qcFileName);
loadDataList.add(m_loadData);
}
BetaGammaAnalyzeAllProcess(m_loadData, analyseData);
BetaGammaAnalyzeAllProcess(loadDataList, analyseData, userName);
}
// if (analyseData.isBBetaEnergyValid()) {
// ui->BetaOriginalChartView->SetFittingParam(fit_analy_param.b_calibration_param.param_a_c2e_new,
// fit_analy_param.b_calibration_param.param_b_c2e_new,
@ -2402,95 +2499,183 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
// fit_analy_param.g_calibration_param.param_b_c2e_new,
// fit_analy_param.g_calibration_param.param_c_c2e_new);
// }
return null;
return result;
}
private void BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, SpectrumFileRecord dbSpectrumFilePath, String userName){
SpectrumGroup spectrum_group = new SpectrumGroup();
spectrum_group.sampleId = dbSpectrumFilePath.getSampleId();
spectrum_group.SampleSpectrumFile = dbSpectrumFilePath.getSampleFilePath();
spectrum_group.GasBgSpectrumFile = dbSpectrumFilePath.getGasBgFilePath();
spectrum_group.DetBgSpectrumFile = dbSpectrumFilePath.getDetBgFilePath();
if (analyseData.isBBetaEnergyValid()) {
List<Double> beCal = new LinkedList<>();
beCal.add(analyseData.getB_calibration_param().param_c_e2c_new);
beCal.add(analyseData.getB_calibration_param().param_b_e2c_new);
beCal.add(analyseData.getB_calibration_param().param_a_e2c_new);
spectrum_group.BgCalPara.b_e_cal = beCal;
List<Double> bc2e = new LinkedList<>();
bc2e.add(analyseData.getB_calibration_param().param_c_c2e_new);
bc2e.add(analyseData.getB_calibration_param().param_b_c2e_new);
bc2e.add(analyseData.getB_calibration_param().param_a_c2e_new);
spectrum_group.b_c2e = bc2e;
}
if (analyseData.isBGammaEnergyValid()) {
List<Double> geCal = new LinkedList<>();
geCal.add(analyseData.getG_calibration_param().param_c_e2c_new);
geCal.add(analyseData.getG_calibration_param().param_b_e2c_new);
geCal.add(analyseData.getG_calibration_param().param_a_e2c_new);
spectrum_group.BgCalPara.g_e_cal = geCal;
List<Double> gc2e = new LinkedList<>();
gc2e.add(analyseData.getG_calibration_param().param_c_c2e_new);
gc2e.add(analyseData.getG_calibration_param().param_b_c2e_new);
gc2e.add(analyseData.getG_calibration_param().param_a_c2e_new);
spectrum_group.g_c2e = gc2e;
}
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData();
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQCData();
}
private void BetaGammaAnalyzeAllProcess(Map<String, SpectrumFileRecord> m_loadData, AnalyseData analyseData){
List<SpectrumGroup> spectrum_group_list = new LinkedList<>();
for (Map.Entry<String, SpectrumFileRecord> entry: m_loadData.entrySet()){
private BgAnalyseResult BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, String sampleFilePath, String gasFilePath, String detFilePath, String userName) {
//System.loadLibrary("ReadPHDFile");
//根据文件路径 文件名称获取对应的临时文件
File sampleTmp = null;
File gasTmp = null;
File detTmp = null;
BgAnalyseResult analyseResult = null;
try {
List<String> sampleFileNames = analyseData.getSampleFileNames();
String sampleFileName = sampleFileNames.get(0);
List<String> gasFileNames = analyseData.getGasFileNames();
String gasFileName = gasFileNames.get(0);
List<String> detFileNames = analyseData.getDetFileNames();
String detFileName = detFileNames.get(0);
List<String> qcFileNames = analyseData.getQcFileNames();
String qcFileName = qcFileNames.get(0);
SpectrumGroup spectrum_group = new SpectrumGroup();
SpectrumFileRecord spectrumFileRecord = entry.getValue();
spectrum_group.SampleSpectrumFile = spectrumFileRecord.getSampleFilePath();
spectrum_group.GasBgSpectrumFile = spectrumFileRecord.getGasBgFilePath();
spectrum_group.DetBgSpectrumFile = spectrumFileRecord.getDetBgFilePath();
if (analyseData.isBBetaEnergyValid()) {
//从本地缓存获取beta gamma的数组
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingPara = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingPara = (List<String>) betaMap.get("fittingPara");
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
}
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingPara = new LinkedList<>();
List<String> gammaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
}
if (analyseData.isBetaEnergyValid()) {
List<Double> beCal = new LinkedList<>();
beCal.add(analyseData.getB_calibration_param().param_c_e2c_new);
beCal.add(analyseData.getB_calibration_param().param_b_e2c_new);
beCal.add(analyseData.getB_calibration_param().param_a_e2c_new);
beCal.add(Double.valueOf(betaFittingParaToUi.get(0)));
beCal.add(Double.valueOf(betaFittingParaToUi.get(1)));
beCal.add(Double.valueOf(betaFittingParaToUi.get(2)));
spectrum_group.BgCalPara.b_e_cal = beCal;
List<Double> bc2e = new LinkedList<>();
bc2e.add(analyseData.getB_calibration_param().param_c_c2e_new);
bc2e.add(analyseData.getB_calibration_param().param_b_c2e_new);
bc2e.add(analyseData.getB_calibration_param().param_a_c2e_new);
bc2e.add(Double.valueOf(betaFittingPara.get(0)));
bc2e.add(Double.valueOf(betaFittingPara.get(1)));
bc2e.add(Double.valueOf(betaFittingPara.get(2)));
spectrum_group.b_c2e = bc2e;
}
if (analyseData.isBGammaEnergyValid()) {
if (analyseData.isGammaEnergyValid()) {
List<Double> geCal = new LinkedList<>();
geCal.add(analyseData.getG_calibration_param().param_c_e2c_new);
geCal.add(analyseData.getG_calibration_param().param_b_e2c_new);
geCal.add(analyseData.getG_calibration_param().param_a_e2c_new);
geCal.add(Double.valueOf(gammaFittingParaToUi.get(0)));
geCal.add(Double.valueOf(gammaFittingParaToUi.get(1)));
geCal.add(Double.valueOf(gammaFittingParaToUi.get(2)));
spectrum_group.BgCalPara.g_e_cal = geCal;
List<Double> gc2e = new LinkedList<>();
gc2e.add(analyseData.getG_calibration_param().param_c_c2e_new);
gc2e.add(analyseData.getG_calibration_param().param_b_c2e_new);
gc2e.add(analyseData.getG_calibration_param().param_a_c2e_new);
gc2e.add(Double.valueOf(gammaFittingPara.get(0)));
gc2e.add(Double.valueOf(gammaFittingPara.get(1)));
gc2e.add(Double.valueOf(gammaFittingPara.get(2)));
spectrum_group.g_c2e = gc2e;
}
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData();
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQCData();
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
sampleTmp = phdFileUtil.analyzeFile(sampleFilePath, sampleFileName);
gasTmp = phdFileUtil.analyzeFile(gasFilePath, gasFileName);
detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (Objects.nonNull(sampleTmp)) {
sampleTmp.delete();
}
if (Objects.nonNull(gasTmp)) {
gasTmp.delete();
}
if (Objects.nonNull(detTmp)) {
detTmp.delete();
}
}
return analyseResult;
}
spectrum_group_list.add(spectrum_group);
private void BetaGammaAnalyzeAllProcess(List<Map<String, String>> loadDataList, AnalyseData analyseData, String userName){
List<BgAnalyseResult> analyseResultList = new LinkedList<>();
File sampleTmp = null;
File gasTmp = null;
File detTmp = null;
try {
for (Map<String, String> m_loadData: loadDataList){
String sampleFileName = m_loadData.get("sampleFileName");
String gasFileName = m_loadData.get("gasFileName");
String detFileName = m_loadData.get("detFileName");
String qcFileName = m_loadData.get("qcFileName");
String sampleFilePath = m_loadData.get("sampleFilePath");
String gasFilePath = m_loadData.get("gasFilePath");
String detFilePath = m_loadData.get("detFilePath");
SpectrumGroup spectrum_group = new SpectrumGroup();
//从本地缓存获取beta gamma的数组
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
//根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
List<SeriseData> betaList = new LinkedList<>();
List<String> betaFittingPara = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(betaMap)) {
betaList = (List<SeriseData>)betaMap.get("Series");
betaFittingPara = (List<String>) betaMap.get("fittingPara");
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
}
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
List<SeriseData> gammaList = new LinkedList<>();
List<String> gammaFittingPara = new LinkedList<>();
List<String> gammaFittingParaToUi = new LinkedList<>();
if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaList = (List<SeriseData>)gammaMap.get("Series");
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
}
if (analyseData.isBetaEnergyValid()) {
List<Double> beCal = new LinkedList<>();
beCal.add(Double.valueOf(betaFittingParaToUi.get(0)));
beCal.add(Double.valueOf(betaFittingParaToUi.get(1)));
beCal.add(Double.valueOf(betaFittingParaToUi.get(2)));
spectrum_group.BgCalPara.b_e_cal = beCal;
List<Double> bc2e = new LinkedList<>();
bc2e.add(Double.valueOf(betaFittingPara.get(0)));
bc2e.add(Double.valueOf(betaFittingPara.get(1)));
bc2e.add(Double.valueOf(betaFittingPara.get(2)));
spectrum_group.b_c2e = bc2e;
}
if (analyseData.isGammaEnergyValid()) {
List<Double> geCal = new LinkedList<>();
geCal.add(Double.valueOf(gammaFittingParaToUi.get(0)));
geCal.add(Double.valueOf(gammaFittingParaToUi.get(1)));
geCal.add(Double.valueOf(gammaFittingParaToUi.get(2)));
spectrum_group.BgCalPara.g_e_cal = geCal;
List<Double> gc2e = new LinkedList<>();
gc2e.add(Double.valueOf(gammaFittingPara.get(0)));
gc2e.add(Double.valueOf(gammaFittingPara.get(1)));
gc2e.add(Double.valueOf(gammaFittingPara.get(2)));
spectrum_group.g_c2e = gc2e;
}
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData();
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
sampleTmp = phdFileUtil.analyzeFile(sampleFilePath, sampleFileName);
gasTmp = phdFileUtil.analyzeFile(gasFilePath, gasFileName);
detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
analyseResultList.add(analyseResult);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (Objects.nonNull(sampleTmp)) {
sampleTmp.delete();
}
if (Objects.nonNull(gasTmp)) {
gasTmp.delete();
}
if (Objects.nonNull(detTmp)) {
detTmp.delete();
}
}
if (CollectionUtils.isNotEmpty(spectrum_group_list)) {
// beta_gamma_analy.SetSpectrumGroupList(spectrum_group_list);
// AnalyProcessDlg analy_dlg(beta_gamma_analy);
// analy_dlg.SetProgressRange(0, spectrum_group_list.count());
// analy_dlg.exec();
}
}
@Override
@ -3307,7 +3492,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//如果勾选了Energy Calibration页面下sample Data
if (Objects.nonNull(sampleTmp)) {
if(anlyseResultIn.isCheckSample()) {
@ -3423,7 +3608,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
@ -3686,8 +3871,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
@ -3984,7 +4167,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
try {
//获取ftp文件路径下临时文件
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
if (Objects.nonNull(sampleTmp)){
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
List<Double> poiBX1 = sourceData.POI_B_x1;
@ -4254,12 +4437,12 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
ftpClient.changeWorkingDirectory(filePath);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}
//加载动态库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
//读取文件内容
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//获取文件中块名信息

View File

@ -1,7 +1,9 @@
package org.jeecg.common;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.modules.entity.data.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.w3c.dom.*;
@ -22,8 +24,8 @@ import java.util.concurrent.TimeUnit;
@Component
public class CalculateStationData {
@Value("${parameter.filePath}")
private String parameterFilePath;
@Autowired
private ParameterProperties parameterProperties;
/**
* 初始化配置信息
@ -31,7 +33,7 @@ public class CalculateStationData {
public RateParam initParameter() {
try {
//文件路径
String filePath = parameterFilePath+ File.separator +"parameter.xml";
String filePath = parameterProperties.getFilePath()+ File.separator +"parameter.xml";
//声明一个实体类存储参数信息
RateParam mRateParam = new RateParam();
//创建一个文档解析器工厂

View File

@ -63,7 +63,7 @@ public class ReadLineUtil {
//读取ftp文件的输入流
iStream=ftpClient.retrieveFileStream(ftpFile.getName());
//声明一个临时文件
File file = File.createTempFile("tmp", null);
File file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(iStream, file);
List<String> allLines = FileUtils.readLines(file, encoding);

View File

@ -60,13 +60,14 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
public void run(String... args) throws Exception {
//调用dll
System.loadLibrary("ReadPHDFile");
System.loadLibrary("GammaAnaly");
//根据配置文件配置邮件获取策略定义时间条件默认EmailReceivePolicy.HISTORY_ORDER_RECEIVE.getPolicy()
Date systemStartupTime = DateUtils.parseDate("1970-01-01 00:00:00","yyyy-MM-dd HH:mm:ss");
if(EmailReceivePolicy.CURR_DATE_ORDER_RECEIVE.getPolicy().equals(taskProperties.getReceivePolicy())){
systemStartupTime = new Date();
}
autoProcessManager.start(systemStartupTime);
undealHandleManager.start();
// autoProcessManager.start(systemStartupTime);
// undealHandleManager.start();
fileSourceHandleManager.start();
}
}

View File

@ -15,5 +15,5 @@ spring:
config:
import:
- optional:nacos:jeecg.yaml
- optional:nacos:jeecg-@profile.name@.yaml
- optional:nacos:jeecg-@profile.name@-pbl.yaml

View File

@ -41,6 +41,8 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Override
public void run(String... args) throws Exception {
//加载dll工具库
System.loadLibrary("ReadPHDFile");
System.loadLibrary("GammaAnaly");
}
}

View File

@ -84,7 +84,7 @@
<module>jeecg-module-abnormal-alarm</module>
<module>jeecg-module-auto-process</module>
<module>jeecg-module-spectrum-analysis</module>
<module>jeecg-module-BetaGammaAnalyser</module>
<module>jeecg-module-beta-gamma-analyser</module>
</modules>
<repositories>
@ -202,10 +202,10 @@
<artifactId>jeecg-module-spectrum-analysis</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!--jeecg-module-BetaGammaAnalyser-->
<!--jeecg-module-beta-gamma-analyser-->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!-- jeecg tools -->