Beta功能生成RRR报告问题修改

移除没用的dll调用
Beta新增Extrapolation页面分析接口
Gamma功能新增Ims转Iec,Iec转Ims接口
新增FtransitEnum枚举
新增FileFtransitUtil工具类
新增FileData,FileDataInfo,AnalyseExtInfo实体类
EnergySpectrumStruct多余注解问题修改
EnergySpectrumHandler新增方法GetFittingPara,GetFittingData
This commit is contained in:
qiaoqinzheng 2023-10-18 11:31:13 +08:00
parent 2628be8cb0
commit b954d0a238
18 changed files with 1753 additions and 200 deletions

View File

@ -9,12 +9,6 @@ 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 = "";

View File

@ -0,0 +1,17 @@
package org.jeecg.common.enums;
public enum FtransitEnum {
IecLineNo("A004"), IecFirstLine("A004 1 1 0");
private String code;
FtransitEnum(String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}

View File

@ -1,8 +1,684 @@
package org.jeecg.common.util;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.enums.FtransitEnum;
import org.jeecg.modules.entity.vo.FileData;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.springframework.stereotype.Component;
import java.io.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
@Component
public class FileFtransitUtil {
public static boolean ReadIEC(File iecFile, FileData datas) {
//判断文件是否是只读类型
if(!iecFile.setReadOnly()) {
String waring = "Open "+iecFile.getName()+" failed when reading!";
return false;
}
FileInputStream inputStream = null;
InputStreamReader streamReader = null;
BufferedReader in = null;
try {
//通过读取文件内容所有行数据
inputStream = new FileInputStream(iecFile);
streamReader = new InputStreamReader(inputStream);
in = new BufferedReader(streamReader);
// 用于存储临时数据 用于存储单行数据
String temp, line;
// 读第一行判断是否是IEC格式文件
line = in.readLine();
if(line.compareTo(FtransitEnum.IecFirstLine.getCode()) != 0) {
String Warning = "The format of "+iecFile.getName()+" is invalid.";
return false;
}
//读取第二行数据
line = in.readLine();
//第二行数据根据任意长度空格等字符切割
List<String> line2Str = Arrays.asList(line.split("\\s+"));
//读取出行标 存活时间 实时时间 总道数
temp = line2Str.get(0);
datas.setAcq_live(Double.valueOf(line2Str.get(1)));
datas.setAcq_real(Double.valueOf(line2Str.get(2)));
datas.setNum_count(Integer.valueOf(line2Str.get(3)));
//读取第三行
line = in.readLine();
//第三行数据根据任意长度空格等字符切割
List<String> line3Str = Arrays.asList(line.split("\\s+"));
//获取第三行第一个数据
temp = line3Str.get(0);
// 取acquisition的日期与时间
// 行标与日期连在一起
if(temp.length() == 12) {
temp = temp.replace(FtransitEnum.IecLineNo.getCode(), "");
String temp_date = "19";
if(Integer.valueOf(temp.substring(6, 7)) >= 0 && Integer.valueOf(temp.substring(6, 7)) <= 5) {
temp_date = "20";
}
temp_date+=temp.substring(temp.length()-2);
temp_date+=temp.substring(2, 6);
temp_date+=temp.substring(0, 2);
datas.setAcq_date(temp_date);
temp = line3Str.get(1); // 读第三行第二个数据
datas.setAcq_time(temp+".0"); // 时间后加上毫秒
} else { // 行标与日期之间有空格
if(line3Str.size() == 2) {
datas.setAcq_date(line3Str.get(0));
datas.setAcq_time(line3Str.get(1)+".0");
}
}
//读取第四行
line = in.readLine();
//第四行数据根据任意长度空格等字符切割
List<String> line4Str = Arrays.asList(line.split("\\s+"));
//获取行标 能量刻度截距 能量刻度斜率 0 0
temp = line4Str.get(0);
datas.setEner_intercept(Double.valueOf(line4Str.get(1)));
datas.setEner_slope(Double.valueOf(line4Str.get(2)));
temp = line4Str.get(3);
temp = line4Str.get(4);
//读取第五行
line = in.readLine();
//当前行不为空时进入
while(null != line) {
//读取到的当前行数据如果只有头部数据的空行
while(line.trim().equals(FtransitEnum.IecLineNo.getCode())) {
//读取下一行
line = in.readLine();
}
// Calibration
//当前行去掉多余空格后 内容匹配 A004SPARE
if(line.trim().equals("A004SPARE")) {
//读取下一行数据
line = in.readLine();
//声明初始数据
double ener1 = 0.0;
double second1 = 0.0;
double ener2 = 0.0;
double second2 = 0.0;
// Read Energy Calibration
//对行数据进行切割
List<String> lineStr = Arrays.asList(line.split("\\s+"));
temp = lineStr.get(0);
ener1 = Double.parseDouble(lineStr.get(1));
second1= Double.parseDouble(lineStr.get(2));
ener2 = Double.parseDouble(lineStr.get(3));
second2= Double.parseDouble(lineStr.get(4));
//当ener1的数据大于0.001 数组第一个数据的大小小于24
while(ener1 >= 0.001 && datas.getVvEner().get(0).size() < 24) {
//将本行数据加入到存储数据数组中
datas.getVvEner().get(0).add(ener1);
datas.getVvEner().get(1).add(second1);
datas.getVvEner().get(2).add(0.5);
//ener2数值大于0.001 将数据加入到存储数据的数组中
if(ener2 >= 0.001) {
datas.getVvEner().get(0).add(ener2);
datas.getVvEner().get(1).add(second2);
datas.getVvEner().get(2).add(0.5);
}
//读取下一行数据
line = in.readLine();
//切割数据
lineStr = Arrays.asList(line.split("\\s+"));
//各数据对应赋值
temp = lineStr.get(0);
ener1 = Double.parseDouble(lineStr.get(1));
second1= Double.parseDouble(lineStr.get(2));
ener2 = Double.parseDouble(lineStr.get(3));
second2= Double.parseDouble(lineStr.get(4));
}
//如果读取到的行数据ener1的数值小于0.001
while(ener1 < 0.001) {
//读取下一行数据
line = in.readLine();
//切割数据
lineStr = Arrays.asList(line.split("\\s+"));
temp = lineStr.get(0);
ener1 = Double.parseDouble(lineStr.get(1));
second1= Double.parseDouble(lineStr.get(2));
ener2 = Double.parseDouble(lineStr.get(3));
second2= Double.parseDouble(lineStr.get(4));
}
// the slope of Energy calibration
int num = datas.getVvEner().get(0).size();
if(num > 1) {
int i1 = 1;
int i2 = num - 2;
if(num < 4) {
i1 = 0;
i2 = num - 1;
}
datas.setEner_slope((datas.getVvEner().get(0).get(i2) - datas.getVvEner().get(0).get(i1)) / (datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(1).get(i1)));
}
// Read Resolution Calibration
while(ener1 >= 0.001 && datas.getVvReso().get(0).size() < 24) {
datas.getVvReso().get(0).add(ener1);
datas.getVvReso().get(1).add(second1);
datas.getVvReso().get(2).add(0.5);
if(ener2 >= 0.001) {
datas.getVvReso().get(0).add(ener2);
datas.getVvReso().get(1).add(second2);
datas.getVvReso().get(2).add(0.5);
}
//读取下一行数据
line = in.readLine();
//切割数据
lineStr = Arrays.asList(line.split("\\s+"));
//各数据对应赋值
temp = lineStr.get(0);
ener1 = Double.parseDouble(lineStr.get(1));
second1= Double.parseDouble(lineStr.get(2));
ener2 = Double.parseDouble(lineStr.get(3));
second2= Double.parseDouble(lineStr.get(4));
}
while(ener1 < 0.001) {
//读取下一行数据
line = in.readLine();
//切割数据
lineStr = Arrays.asList(line.split("\\s+"));
//各数据对应赋值
temp = lineStr.get(0);
ener1 = Double.parseDouble(lineStr.get(1));
second1= Double.parseDouble(lineStr.get(2));
ener2 = Double.parseDouble(lineStr.get(3));
second2= Double.parseDouble(lineStr.get(4));
}
// Read Efficiency Calibration
int lineNum = 0;
while(lineNum < 11) {
if(ener1 >= 0.001) {
datas.getVvEffi().get(0).add(ener1);
datas.getVvEffi().get(1).add(second1);
datas.getVvEffi().get(2).add(0.5);
}
if(ener2 >= 0.001) {
datas.getVvEffi().get(0).add(ener2);
datas.getVvEffi().get(1).add(second2);
datas.getVvEffi().get(2).add(0.5);
}
//读取下一行数据
line = in.readLine();
//切割数据
lineStr = Arrays.asList(line.split("\\s+"));
//各数据对应赋值
temp = lineStr.get(0);
ener1 = Double.parseDouble(lineStr.get(1));
second1= Double.parseDouble(lineStr.get(2));
ener2 = Double.parseDouble(lineStr.get(3));
second2= Double.parseDouble(lineStr.get(4));
lineNum++;
}
line = in.readLine();
} else if (line.trim().equals("A004USERDEFINED")) { // Spectrum
datas.setMax_energy((int) (datas.getNum_count() * datas.getEner_slope()));
List<Long> L = new LinkedList<>();
//读取下一行数据
line = in.readLine();
//分割数据
List<String> lineStr = Arrays.asList(line.split("\\s+"));
//各数据对应赋值
temp = lineStr.get(0);
L.add(Long.valueOf(lineStr.get(1)));
L.add(Long.valueOf(lineStr.get(2)));
L.add(Long.valueOf(lineStr.get(3)));
L.add(Long.valueOf(lineStr.get(4)));
L.add(Long.valueOf(lineStr.get(5)));
L.add(Long.valueOf(lineStr.get(6)));
datas.setStart_chan(L.get(0).intValue());
while(datas.getVCounts().size() <= datas.getNum_count() - 5) {
datas.getVCounts().add(L.get(1));
datas.getVCounts().add(L.get(2));
datas.getVCounts().add(L.get(3));
datas.getVCounts().add(L.get(4));
datas.getVCounts().add(L.get(5));
//读取下一行数据
line = in.readLine();
//分割数据
lineStr = Arrays.asList(line.split("\\s+"));
L.clear();
//各数据对应赋值
temp = lineStr.get(0);
L.add(Long.valueOf(lineStr.get(1)));
L.add(Long.valueOf(lineStr.get(2)));
L.add(Long.valueOf(lineStr.get(3)));
L.add(Long.valueOf(lineStr.get(4)));
L.add(Long.valueOf(lineStr.get(5)));
L.add(Long.valueOf(lineStr.get(6)));
}
for(int i=0; i<datas.getNum_count()%5; i++) {
datas.getVCounts().add(L.get(i+1));
}
line = in.readLine();
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(in)) {
in.close();
}
if (Objects.nonNull(streamReader)) {
streamReader.close();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return true;
}
public static String WriteIEC(FileData datas) {
StringBuffer out = new StringBuffer();
// first line
out.append(FtransitEnum.IecFirstLine.getCode());
//换行
out.append(System.lineSeparator());
// live_time real_time channel_num
out.append(String.format("%-6s %-13s %-13s %-5s", FtransitEnum.IecLineNo.getCode(), String.format("%.6f", datas.getAcq_live()), String.format("%.6f", datas.getAcq_real()), datas.getNum_count()));
//换行
out.append(System.lineSeparator());
// acq_datetime
String right = datas.getAcq_date().substring(datas.getAcq_date().length() - 2);
String mid1 = datas.getAcq_date().substring(5, 7);
String mid2 = datas.getAcq_date().substring(2, 4);
String time = datas.getAcq_time().substring(0, 8);
out.append(String.format("%s%s/%s/%s %s", FtransitEnum.IecLineNo.getCode(), right, mid1, mid2, time));
//换行
out.append(System.lineSeparator());
// the slope and intercept of Energy calibration
int num = datas.getVvEner().get(0).size();
if(num > 1) {
int i1 = 1;
int i2 = num - 2;
if(num < 4) {
i1 = 0;
i2 = num - 1;
}
datas.setEner_slope((datas.getVvEner().get(0).get(i2) - datas.getVvEner().get(0).get(i1)) / (datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(1).get(i1)));
datas.setEner_intercept((datas.getVvEner().get(0).get(i1) * datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(0).get(i2) * datas.getVvEner().get(1).get(i1)) / (datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(1).get(i1)));
}
out.append(String.format("%-10s %-13s %-13s %-13s %-13s", FtransitEnum.IecLineNo.getCode(), String.format("%.6f", datas.getEner_intercept()), String.format("%.6f", datas.getEner_slope()), "0", "0"));
//换行
out.append(System.lineSeparator());
// 5 empty line
for(int i=0; i<5; i++) {
out.append(String.format("%s", FtransitEnum.IecLineNo.getCode()));
//换行
out.append(System.lineSeparator());
}
// Calibration
out.append(String.format("%sSPARE", FtransitEnum.IecLineNo.getCode()));
//换行
out.append(System.lineSeparator());
// Energy calibration
num = datas.getVvEner().get(0).size() / 2 * 2;
int i = 0;
int width = 0;
for(i=0; i<num; i+=2) {
String data1 = String.format("%.3f", datas.getVvEner().get(0).get(i));
String data2 = String.format("%.2f", datas.getVvEner().get(1).get(i));
String data3 = String.format("%.3f", datas.getVvEner().get(0).get(i + 1));
String data4 = String.format("%.2f", datas.getVvEner().get(1).get(i + 1));
width = 20-data1.length();
out.append(String.format("%-"+width+"s %-15s %-15s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), data1, data2, data3, data4));
//换行
out.append(System.lineSeparator());
}
if(i < datas.getVvEner().get(0).size()) {
String data1 = String.format("%.3f", datas.getVvEner().get(0).get(i));
String data2 = String.format("%.2f", datas.getVvEner().get(1).get(i));
width = 20-data1.length();
out.append(String.format("%-"+width+"s %-15s %-22s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), data1, data2, "0", "0"));
//换行
out.append(System.lineSeparator());
num += 2;
}
for (i=num/2; i<12; i++) {
out.append(String.format("%-19s %-15s %-15s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), "0", "0", "0", "0"));
//换行
out.append(System.lineSeparator());
}
// Resolution calibration
num = datas.getVvReso().get(0).size() / 2 * 2;
for(i=0; i<num; i+=2) {
String data1 = String.format("%.3f", datas.getVvReso().get(0).get(i));
String data2 = String.format("%.4f", datas.getVvReso().get(1).get(i));
String data3 = String.format("%.3f", datas.getVvReso().get(0).get(i + 1));
String data4 = String.format("%.4f", datas.getVvReso().get(1).get(i + 1));
width = 20-data1.length();
out.append(String.format("%-"+width+"s %-15s %-15s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), data1, data2, data3, data4));
//换行
out.append(System.lineSeparator());
}
if(i < datas.getVvReso().get(0).size()) {
String data1 = String.format("%.3f", datas.getVvReso().get(0).get(i));
String data2 = String.format("%.4f", datas.getVvReso().get(1).get(i));
width = 20-data1.length();
out.append(String.format("%-"+width+"s %-15s %-22s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), data1, data2, "0", "0"));
//换行
out.append(System.lineSeparator());
num += 2;
}
for (i=num/2; i<12; i++) {
out.append(String.format("%-19s %-15s %-15s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), "0", "0", "0", "0"));
//换行
out.append(System.lineSeparator());
}
// Efficiency calibration
num = datas.getVvEffi().get(0).size() / 2 * 2;
for(i=0; i<num; i+=2) {
String data1 = String.format("%.3f", datas.getVvEffi().get(0).get(i));
String data2 = String.format("%.8f", datas.getVvEffi().get(1).get(i));
String data3 = String.format("%.3f", datas.getVvEffi().get(0).get(i + 1));
String data4 = String.format("%.8f", datas.getVvEffi().get(1).get(i + 1));
width = 20-data1.length();
out.append(String.format("%-"+width+"s %-15s %-15s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), data1, data2, data3, data4));
//换行
out.append(System.lineSeparator());
}
if(i < datas.getVvEffi().get(0).size()) {
String data1 = String.format("%.3f", datas.getVvEffi().get(0).get(i));
String data2 = String.format("%.8f", datas.getVvEffi().get(1).get(i));
width = 20-data1.length();
out.append(String.format("%-"+width+"s %-15s %-22s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), data1, data2, "0", "0"));
//换行
out.append(System.lineSeparator());
num += 2;
}
for (i=num/2; i<12; i++) {
out.append(String.format("%-19s %-15s %-15s %-15s %-15s", FtransitEnum.IecLineNo.getCode(), "0", "0", "0", "0"));
//换行
out.append(System.lineSeparator());
}
for(i=0; i<=10; i++) {
out.append(String.format("%s", FtransitEnum.IecLineNo.getCode()));
//换行
out.append(System.lineSeparator());
}
out.append(String.format("%sUSERDEFINED", FtransitEnum.IecLineNo.getCode()));
//换行
out.append(System.lineSeparator());
// #g_Spectrum
int chan = 0; //datas.Start_chan;
int size = datas.getVCounts().size();
num = size / 5 * 5;
for(i=0; i<num; i+=5,chan+=5) {
String data1 = datas.getVCounts().get(i).toString();
String data2 = datas.getVCounts().get(i + 1).toString();
String data3 = datas.getVCounts().get(i + 2).toString();
String data4 = datas.getVCounts().get(i + 3).toString();
String data5 = datas.getVCounts().get(i + 4).toString();
width = 10-data1.length();
out.append(String.format("%-"+width+"s %-5s %-9s %-9s %-9s %-9s %-9s", FtransitEnum.IecLineNo.getCode(), String.valueOf(chan), data1, data2, data3, data4, data5));
//换行
out.append(System.lineSeparator());
}
if(i < size) {
List<String> strValues = new LinkedList<>();
String formatStr = "%-"+width+"s %-5s";
strValues.add(FtransitEnum.IecLineNo.getCode());
strValues.add(String.valueOf(chan));
int j;
for(j=0; j<size%5; j++) {
formatStr+=" %-9s";
strValues.add(String.valueOf(datas.getVCounts().get(i+j)));
}
for(; j<5; j++) {
formatStr+=" %-9s";
strValues.add("0");
}
out.append(String.format(formatStr, strValues.toArray()));
}
return out.toString();
}
public static boolean ReadIMS(File imsFile, FileData datas) {
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(imsFile.getAbsolutePath());
if (StringUtils.isNotBlank(struct.designator)) {
datas.setDesignator(struct.designator);
}
if (StringUtils.isNotBlank(struct.site_code)) {
datas.setStation(struct.site_code);
}
if (StringUtils.isNotBlank(struct.detector_code)) {
datas.setDetector(struct.detector_code);
}
if (StringUtils.isNotBlank(struct.system_type)) {
datas.setSys_type(struct.system_type);
}
if (StringUtils.isNotBlank(struct.sample_geometry)) {
datas.setSam_geom(struct.sample_geometry);
}
if (StringUtils.isNotBlank(struct.spectrum_quantity)) {
datas.setQuantity(struct.spectrum_quantity);
}
if (StringUtils.isNotBlank(struct.sample_ref_id)) {
datas.setSrId(struct.sample_ref_id);
}
if (StringUtils.isNotBlank(struct.detector_bk_measurement_id)) {
datas.setBgMeasureId(struct.detector_bk_measurement_id);
}
if (StringUtils.isNotBlank(struct.gas_bk_measurement_id)) {
datas.setGasMeasureId(struct.gas_bk_measurement_id);
}
if (StringUtils.isNotBlank(struct.transmit_date) && StringUtils.isNotBlank(struct.transmit_time)) {
datas.setTransmit(struct.transmit_date + " " + struct.transmit_time);
}
if(StringUtils.isNotBlank(struct.comment)) {
datas.setComment(struct.comment);
}
if (StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time)) {
datas.setCollect_start(struct.collection_start_date + " " + struct.collection_start_time);
}
if (StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time)) {
datas.setCollect_stop(struct.collection_stop_date + " " + struct.collection_stop_time);
}
datas.setAir_volume(struct.air_volume);
if (StringUtils.isNotBlank(struct.acquisition_start_date)) {
datas.setAcq_date(struct.acquisition_start_date);
}
if (StringUtils.isNotBlank(struct.acquisition_start_time)) {
datas.setAcq_time(struct.acquisition_start_time);
}
datas.setAcq_live(struct.acquisition_live_time);
datas.setAcq_real(struct.acquisition_real_time);
if (StringUtils.isNotBlank(struct.date_calibration) && StringUtils.isNotBlank(struct.time_calibration)) {
datas.setCalibra_time(struct.date_calibration + " " + struct.time_calibration);
}
datas.setStart_chan((int) struct.g_begin_channel);
datas.setNum_count((int) struct.num_g_channel);
datas.getVCounts().clear();
for(int i=0; i<struct.num_g_channel; i++) {
datas.getVCounts().add(struct.g_counts.get(i));
}
for(int i=0; i<3; i++) {
datas.getVvEner().get(i).clear();
datas.getVvReso().get(i).clear();
datas.getVvEffi().get(i).clear();
}
if (CollectionUtils.isNotEmpty(struct.g_energy)) {
datas.getVvEner().get(0).addAll(struct.g_energy);
}
if (CollectionUtils.isNotEmpty(struct.g_centroid_channel)) {
datas.getVvEner().get(1).addAll(struct.g_centroid_channel);
}
if (CollectionUtils.isNotEmpty(struct.g_uncertainty)) {
datas.getVvEner().get(2).addAll(struct.g_uncertainty);
}
int num = datas.getVvEner().get(0).size();
if(num > 1) {
int i1 = 1;
int i2 = num - 2;
if(num < 4) {
i1 = 0;
i2 = num - 1;
}
datas.setEner_slope((datas.getVvEner().get(0).get(i2) - datas.getVvEner().get(0).get(i1)) / (datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(1).get(i1)));
datas.setEner_intercept((datas.getVvEner().get(0).get(i1) * datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(0).get(i2) * datas.getVvEner().get(1).get(i1)) / (datas.getVvEner().get(1).get(i2) - datas.getVvEner().get(1).get(i1)));
}
if (CollectionUtils.isNotEmpty(struct.g_r_energy)) {
datas.getVvReso().get(0).addAll(struct.g_r_energy);
}
if (CollectionUtils.isNotEmpty(struct.g_r_FWHM)) {
datas.getVvReso().get(1).addAll(struct.g_r_FWHM);
}
if (CollectionUtils.isNotEmpty(struct.g_r_uncertainty)) {
datas.getVvReso().get(2).addAll(struct.g_r_uncertainty);
}
if (CollectionUtils.isNotEmpty(struct.g_e_energy)) {
datas.getVvEffi().get(0).addAll(struct.g_e_energy);
}
if (CollectionUtils.isNotEmpty(struct.g_e_efficiency)) {
datas.getVvEffi().get(1).addAll(struct.g_e_efficiency);
}
if (CollectionUtils.isNotEmpty(struct.g_e_uncertainty)) {
datas.getVvEffi().get(2).addAll(struct.g_e_uncertainty);
}
return true;
}
public static String WriteIMS(FileData datas) {
StringBuffer out = new StringBuffer();
//第一行
out.append("BEGIN IMS2.0");
//换行
out.append(System.lineSeparator());
//第二行
out.append("MSG_TYPE DATA");
//换行
out.append(System.lineSeparator());
//第三行
out.append("MSG_ID "+datas.getMsg_id() );
//换行
out.append(System.lineSeparator());
//第四行
out.append("DATA_TYPE "+datas.getData_type());
//换行
out.append(System.lineSeparator());
// #Header
out.append(String.format("#Header %s", datas.getDesignator()));
//换行
out.append(System.lineSeparator());
out.append(String.format("%-6s%-10s%-2s%-18s%-5s", datas.getStation(), datas.getDetector(), datas.getSys_type(), datas.getSam_geom(), datas.getQuantity()));
//换行
out.append(System.lineSeparator());
out.append(String.format("%s", datas.getSrId()));
//换行
out.append(System.lineSeparator());
out.append(String.format("%s-%s-%s %-32s%s", datas.getDetector(), datas.getAcq_date(), datas.getAcq_time(), datas.getBgMeasureId(), datas.getGasMeasureId()));
//换行
out.append(System.lineSeparator());
out.append(datas.getTransmit());
//换行
out.append(System.lineSeparator());
// #Comment
if(!"".equals(datas.getComment().trim())) {
datas.getComment().replace("\n", System.lineSeparator());
out.append("#Comment");
//换行
out.append(System.lineSeparator());
out.append(datas.getComment());
//换行
out.append(System.lineSeparator());
}
// #Collection
out.append("#Collection");
//换行
out.append(System.lineSeparator());
out.append(String.format("%s %s %s", datas.getCollect_start(), datas.getCollect_stop(), String.valueOf(datas.getAir_volume())));
//换行
out.append(System.lineSeparator());
// #Acquisition
out.append("#Acquisition");
//换行
out.append(System.lineSeparator());
out.append(String.format("%-10s %-10s %-14s %-14s", datas.getAcq_date(), datas.getAcq_time(), String.format("%.2f", datas.getAcq_real()), String.format("%.2f", datas.getAcq_live()) ));
//换行
out.append(System.lineSeparator());
// #Calibration
if(StringUtils.isNotBlank(datas.getCalibra_time())) {
out.append("#Calibration");
out.append(System.lineSeparator());
out.append(datas.getCalibra_time());
out.append(System.lineSeparator());
}
// #g_Energy
out.append("#g_Energy");
out.append(System.lineSeparator());
for(int i=0; i<datas.getVvEner().get(0).size(); i++) {
out.append(String.format("%-16s %-16s %-16s", String.format("%.9f", datas.getVvEner().get(0).get(i)), String.format("%.9f", datas.getVvEner().get(1).get(i)), String.format("%.9f", datas.getVvEner().get(2).get(i))));
out.append(System.lineSeparator());
}
// #g_Resolution
out.append("#g_Resolution");
out.append(System.lineSeparator());
for(int i=0; i<datas.getVvReso().get(0).size(); i++) {
out.append(String.format("%-16s %-16s %-16s", String.format("%.9f", datas.getVvReso().get(0).get(i)), String.format("%.9f", datas.getVvReso().get(1).get(i)), String.format("%.9f", datas.getVvReso().get(2).get(i))));
out.append(System.lineSeparator());
}
// #g_Efficiency
out.append("#g_Efficiency");
out.append(System.lineSeparator());
for(int i=0; i<datas.getVvEffi().get(0).size(); i++) {
out.append(String.format("%-16s %-16s %-16s", String.format("%.9f", datas.getVvEffi().get(0).get(i)), String.format("%.9f", datas.getVvEffi().get(1).get(i)), String.format("%.9f", datas.getVvEffi().get(2).get(i))));
out.append(System.lineSeparator());
}
// #g_Spectrum
out.append("#g_Spectrum");
out.append(System.lineSeparator());
out.append(String.format("%-5s %-4s", String.valueOf(datas.getNum_count()), String.valueOf(datas.getMax_energy())));
out.append(System.lineSeparator());
int i=0, j=datas.getStart_chan();
for(; i<datas.getNum_count()-4; i+=5,j+=5) {
out.append(String.format("%-5s %-10s %-10s %-10s %-10s %-10s", String.valueOf(j), String.valueOf(datas.getVCounts().get(i)), String.valueOf(datas.getVCounts().get(i+1)), String.valueOf(datas.getVCounts().get(i+2)), String.valueOf(datas.getVCounts().get(i+3)), String.valueOf(datas.getVCounts().get(i+4))));
out.append(System.lineSeparator());
}
if(i < datas.getNum_count()) {
String formatStr = "%-5s %-10s";
List<String> strValues = new LinkedList<>();
strValues.add(String.valueOf(j));
strValues.add(String.valueOf(datas.getVCounts().get(i)));
for(i = i+1; i < datas.getNum_count(); i++) {
formatStr+=" %-10s";
strValues.add(String.valueOf(datas.getVCounts().get(i)));
}
out.append(String.format(formatStr, strValues.toArray()));
out.append(System.lineSeparator());
}
// STOP
out.append("STOP");
out.append(System.lineSeparator());
return out.toString();
}
}

View File

@ -9,6 +9,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.checkerframework.checker.units.qual.N;
import org.ejml.simple.SimpleMatrix;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.properties.ParameterProperties;
@ -1220,7 +1221,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, String color, long m_nCount, List<Double> p, boolean bEnergy) {
//System.loadLibrary("GammaAnaly");
List<ChartData> datalist = new LinkedList<>();
int peakNum = vPeak.size();
if(peakNum < 1 || vBase.size() != m_nCount){
@ -1298,7 +1298,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
public List<ShapeData> Energy_BaseCP(PHDFile phd) {
//System.loadLibrary("GammaAnaly");
List<ShapeData> shapes = new LinkedList<>();
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(phd.getBaseCtrls().getXCtrl(), phd.getUsedEnerPara().getP());
List<Double> vEner = calValuesOut.counts;
@ -1615,7 +1614,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
for (int i=0; i<peakNum; i++) {
vEner.add(phd.getVPeak().get(i).energy);
}
//System.loadLibrary("GammaAnaly");
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vEner, phd.getUsedEffiPara().getP());
List<Double> vEffi = calValuesOut.counts;
for (int i=0; i<peakNum; i++) {
@ -1907,7 +1905,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
public List<SeriseData> Differance(PHDFile phd, List<PeakInfo> vecPeak, List<Long> m_vCount, long m_nCount) {
//System.loadLibrary("GammaAnaly");
List<SeriseData> pointlist = new LinkedList<>();
int start =0;
long end = -1;
@ -2034,18 +2031,17 @@ public class GammaFileUtil extends AbstractLogOrReport {
int p_size = m_curParam.getP().size()-1;
if(p_size >= 2 && m_curParam.getP().get(2) > 0) {
// Polynomial: y=a0+a1*x+a2*x^2+a3*x^3
equation +="Energy = "+m_curParam.getP().get(1)+" + C * "+m_curParam.getP().get(2);
equation +="Energy = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + C * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
for(int i=3; i<=p_size; i++) {
equation += " + C<sup style=\"vertical-align:super;\">" + (i-1) +"</sup> * "+m_curParam.getP().get(i)+"";
equation += " + C<sup style=\"vertical-align:super;\">" + (i-1) +"</sup> * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+"";
}
} else if(p_size == 1) {
equation = "Energy = "+m_curParam.getP().get(1)+" * C";
equation = "Energy = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * C";
}
return equation;
}
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");
int num = m_vCurEnergy.size();
if(num < 1){
return;
@ -2100,9 +2096,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
int p_size = m_curParam.getP().size()-1;
if(p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
// Square root of polynomial: y = sqrt(a0+a1*x+a2*x^2+a3*x^3 )
equation += "FWHM = ("+m_curParam.getP().get(1)+" + E * "+m_curParam.getP().get(2);
equation += "FWHM = ("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + E * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
for(int i=3; i<=p_size; i++) {
equation += " + E<sup style=\"vertical-align:super;\">"+(i-1)+"</sup> * "+m_curParam.getP().get(i);
equation += " + E<sup style=\"vertical-align:super;\">"+(i-1)+"</sup> * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)));
}
equation += ")<sup style=\"vertical-align:super;\">"+1+"/"+2+"</sup>";
}
@ -2110,7 +2106,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
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");
int num = m_vCurEnergy.size();
if(num < 1) return;
@ -2181,16 +2176,16 @@ public class GammaFileUtil extends AbstractLogOrReport {
double y1, y0, x1, x0;
if(i < e_size - 1)
{
y1 = m_curParam.getP().get(i*2+3);
y0 = m_curParam.getP().get(i*2+1);
x1 = m_curParam.getP().get(i*2+2);
x0 = m_curParam.getP().get(i*2);
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+3))));
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+1))));
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+2))));
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2))));
}
else {
y1 = m_curParam.getP().get(i*2+1);
y0 = m_curParam.getP().get(i*2-1);
x1 = m_curParam.getP().get(i*2);
x0 = m_curParam.getP().get(i*2-2);
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+1))));
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2-1))));
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2))));
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2-2))));
}
equation += "Efficiency = "+y0+" + ("+y1+"-"+y0+") * (E - "+x0+") / ("+x1+" - "+x0+")";
}
@ -2200,43 +2195,43 @@ public class GammaFileUtil extends AbstractLogOrReport {
for(int i=1; i<=p_size; i++) {
if(m_curParam.getP().get(i) <= 0) break;
}
equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(3)+"</sup>) * "+
"(1-exp(-("+m_curParam.getP().get(4)+" / E)<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(5)+"</sup>))";
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1-exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"</sup>))";
}
break;
case 6: // Polynomial in log(y) against log(x): log(y) = a0 + a1*log(x) +a2*log(x)^2+ a3*log(x)^3
if(p_size >= 2) {
equation += "log(Efficiency) = "+m_curParam.getP().get(1)+" + "+m_curParam.getP().get(2)+" * log(E)";
equation += "log(Efficiency) = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" * log(E)";
for(int i=3; i<=p_size; i++) {
equation += " + "+m_curParam.getP().get(i)+" * log(E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
equation += " + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+" * log(E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
}
}
break;
case 8: // Polynomial in log(y) against log(1/x): log(y) = a0 + a1*log(c/x) + a2*log(c/x)^2 + a3*log(c/x)^3 + a4*log(c/x)^4
if(p_size >= 3) {
equation += "log(Efficiency) = "+m_curParam.getP().get(1)+" + "+m_curParam.getP().get(2)+" * log(C/E)";
equation += "log(Efficiency) = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" * log(C/E)";
for(int i=3; i<=p_size; i++) {
equation += " + "+m_curParam.getP().get(i)+" * log(C/E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
equation += " + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+" * log(C/E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
}
}
break;
case 93: // HAE Efficiency (1-3): y=S*exp(-(E1/x)^k)*(1- exp(-(2*E3/(x-E3))^n))
if(p_size == 5) {
equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(3)+"</sup>) * "+
"(1 - exp(-(2 * "+m_curParam.getP().get(4)+" / (E - "+m_curParam.getP().get(4)+"))<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(5)+"</sup>))";
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1 - exp(-(2 * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"</sup>))";
}
break;
case 94: // HAE Efficiency (1-2): y=S*exp(-(E1/x)^k)*(1- exp(-b*(1/(x-E2))^m))
if(p_size == 6) {
equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(3)+"</sup>) * "+
"(1 - exp(-"+m_curParam.getP().get(4)+" * (1 / (E - "+m_curParam.getP().get(5)+"))<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(6)+"</sup>))";
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1 - exp(-"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" * (1 / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6)))+"</sup>))";
}
break;
case 95: // HAE Efficiency (1-2-3): y = S * exp(-(E1/x)^k) * (1- exp(-b*(1/(x-E2))^m)) *(1 - exp(-(2*E3/(E-E3))^n))
if(p_size == 8) {
equation += "Efficiency = "+m_curParam.getP().get(1)+" * exp(-("+m_curParam.getP().get(2)+" / E)<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(3)+"</sup>) * "+
"(1 - exp(-"+m_curParam.getP().get(4)+" * (1 / (E - "+m_curParam.getP().get(5)+"))<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(6)+"</sup>)) * "+
"(1 - exp(-(2 * "+m_curParam.getP().get(7)+" / (E - "+m_curParam.getP().get(7)+"))<sup style=\"vertical-align:super;\">"+m_curParam.getP().get(8)+"</sup>))";
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
"(1 - exp(-"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" * (1 / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6)))+"</sup>)) * "+
"(1 - exp(-(2 * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7)))+" / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(8)))+"</sup>))";
}
break;
}
@ -2245,7 +2240,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
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");
int num = m_vCurEnergy.size();
if(num < 1) return;
@ -3858,7 +3852,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
public void PeaksChanged(PHDFile phd) {
//System.loadLibrary("GammaAnaly");
List<Double> vCentroid = new LinkedList<>();
List<Double> vFwhmCh = new LinkedList<>();
List<Double> vTail = new LinkedList<>();
@ -4063,8 +4056,6 @@ public class GammaFileUtil extends AbstractLogOrReport {
}
InputStream inputStream = null;
File file = null;
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class AnalyseExtInfo implements Serializable {
private Integer sampleId;
private String dbName;
private String sampleFileName;
private String detFileName;
private Integer gammaBegin;
private Integer gammaEnd;
private Double minEnergy;
private Double halfLife;
private String fitType;
}

View File

@ -1,15 +1,13 @@
package org.jeecg.modules.entity.vo;
import com.google.common.collect.Lists;
import lombok.Data;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
@Data
public class FileData implements Serializable {
private String comment; // spectrum comments
private String msg_id;
private String data_type;
@ -43,24 +41,45 @@ public class FileData implements Serializable {
private List<List<Double> > vvEffi; // Efficiency Calibration
public FileData() {
comment = "";
msg_id = "";
data_type = "";
designator = "";
station = "";
detector = "";
sys_type = "";
sam_geom = "";
quantity = "";
srId = "";
bgMeasureId = "";
gasMeasureId = "0";
num_count = 0;
max_energy = 0;
transmit = "";
collect_start = "";
collect_stop = "";
air_volume = 0.0;
acq_date = "";
acq_time = "";
acq_real = 0.0;
acq_live = 0.0;
calibra_time = "";
ener_slope = 1.0;
ener_intercept = 0.0;
List<Double> vEmpty = new LinkedList<>();
vvEner.add(vEmpty);
vvEner.add(vEmpty);
vvEner.add(vEmpty);
vvReso.add(vEmpty);
vvReso.add(vEmpty);
vvReso.add(vEmpty);
vvEffi.add(vEmpty);
vvEffi.add(vEmpty);
vvEffi.add(vEmpty);
start_chan = 0;
num_count = 0;
max_energy = 0;
vCounts = new LinkedList<>();
vvEner = new LinkedList<>();
vvReso = new LinkedList<>();
vvEffi = new LinkedList<>();
vvEner.add(new LinkedList<>());
vvEner.add(new LinkedList<>());
vvEner.add(new LinkedList<>());
vvReso.add(new LinkedList<>());
vvReso.add(new LinkedList<>());
vvReso.add(new LinkedList<>());
vvEffi.add(new LinkedList<>());
vvEffi.add(new LinkedList<>());
vvEffi.add(new LinkedList<>());
}

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.entity.vo;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
@Data
public class FileDataInfo extends FileData{
private MultipartFile file;
}

View File

@ -80,4 +80,8 @@ public class EnergySpectrumHandler {
*/
public static native MetSpectrumStruct getMetSourceData(String path);
public static native List<Double> GetFittingPara(List<Double> Nx, List<Double> Ny, String fitType);
public static native List<Double> GetFittingData(List<Double> data, String fitType, List<Double> fittingPara);
}

View File

@ -1,13 +1,10 @@
package org.jeecg.modules.native_jni.struct;
import lombok.Data;
import java.util.List;
/**
* 能谱结构体字段信息
*/
@Data
public class EnergySpectrumStruct {
/************************* Infomations ******************/
/**
@ -443,4 +440,113 @@ 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

@ -44,8 +44,6 @@ public class PHDFileUtil {
private SpectrumPathProperties spectrumPathProperties;
public Map<String, Object> getSourceData(String filePath, Integer sampleId, String status){
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(filePath);
Map<String, Object> map = new HashMap<>();
try {
@ -453,8 +451,6 @@ public class PHDFileUtil {
public Map<String, String> getFileData(String filePath, String sampleFileName){
Map<String, String> map = new HashMap<>();
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
//连接ftp 获取ftp文件数据
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -821,8 +817,6 @@ public class PHDFileUtil {
}
public List<GardsXeResultsSpectrum> analyzeQCResultXe(File sampleTmp, File gasTmp, File detTmp){
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
BgAnalyseResult bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
@ -859,8 +853,6 @@ public class PHDFileUtil {
public Map<String, Object> analyze(File sampleTmp, File gasTmp, File detTmp){
Map<String, Object> result = new HashMap<>();
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
//调用动态库解析文件
BgAnalyseResult bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
/* GardsROIChannelsSpectrum集合 */

View File

@ -0,0 +1,25 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import org.jeecg.modules.entity.vo.FileData;
import org.jeecg.modules.service.IGammaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("gamma/ftransit")
public class FtransitController {
@Autowired
private IGammaService gammaService;
@PostMapping("IecToIms")
public void IecToIms(@RequestPart("file") MultipartFile file, @RequestPart("data") FileData data, HttpServletResponse response) {
gammaService.IecToIms(data, file, response);
}
}

View File

@ -192,11 +192,7 @@ public class GammaController {
@GetMapping("exportZeroTimeAnalyse")
@ApiOperation(value = "Zero Time分析导出", notes = "Zero Time分析导出")
public void exportZeroTimeAnalyse(String nuclide1, String nuclide2,
Double product1, Double product2,
String target, String energyTFH,
String date, String time,
HttpServletResponse response) {
public void exportZeroTimeAnalyse(String nuclide1, String nuclide2, Double product1, Double product2, String target, String energyTFH, String date, String time, HttpServletResponse response) {
gammaService.exportZeroTimeAnalyse(nuclide1, nuclide2, product1, product2,
target, energyTFH, date, time, response);
}
@ -243,8 +239,8 @@ public class GammaController {
@PostMapping("callDataEnergy")
@ApiOperation(value = "导入Energy Calibration数据", notes = "导入Energy Calibration数据")
public Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText) {
return gammaService.callDataEnergy(file, sampleFileName, width, currentText);
public Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
return gammaService.callDataEnergy(file, sampleFileName, width, currentText, request);
}
@PutMapping("setCurrentEnergy")
@ -279,8 +275,8 @@ public class GammaController {
@PostMapping("callDataResolution")
@ApiOperation(value = "导入Resolution Calibration数据", notes = "导入Resolution Calibration数据")
public Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText) {
return gammaService.callDataResolution(file, sampleFileName, width, currentText);
public Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
return gammaService.callDataResolution(file, sampleFileName, width, currentText, request);
}
@PutMapping("setCurrentResolution")
@ -315,8 +311,8 @@ public class GammaController {
@PostMapping("callDataEfficiency")
@ApiOperation(value = "导入Efficiency Calibration数据", notes = "导入Efficiency Calibration数据")
public Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText) {
return gammaService.callDataEfficiency(file, sampleFileName, width, currentText);
public Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
return gammaService.callDataEfficiency(file, sampleFileName, width, currentText, request);
}
@PutMapping("setCurrentEfficiency")
@ -491,4 +487,14 @@ public class GammaController {
gammaService.saveToPHD(fileName, request, response);
}
@PostMapping("ImsToIec")
public void ImsToIec(MultipartFile file, HttpServletResponse response) {
gammaService.ImsToIec(file, response);
}
@PostMapping("IecToIms")
public void IecToIms(FileDataInfo data, HttpServletResponse response) {
gammaService.IecToIms(data, data.getFile(), response);
}
}

View File

@ -148,6 +148,12 @@ public class SpectrumAnalysesController {
return spectrumAnalysisService.viewExtrapolation(sampleId, sampleFileName, request);
}
//todo--功能不明确待完成
@PostMapping("analyseExtrapolation")
public Result analyseExtrapolation(@RequestBody AnalyseExtInfo extInfo, HttpServletRequest request) {
return null;
}
@GetMapping("viewMDC")
@ApiOperation(value = "查看MDC数据", notes = "查看MDC数据")
public Result viewMDC(Integer sampleId, String sampleFileName, HttpServletRequest request) {

View File

@ -7,6 +7,7 @@ import org.jeecg.modules.entity.GardsROIResultsSpectrum;
import org.jeecg.modules.entity.GardsXeResultsSpectrum;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
@Data
@ -24,16 +25,50 @@ public class RRRLogInfo implements Serializable {
private boolean qcData;
private boolean bGammaEnergyValid;
private boolean bBetaEnergyValid;
private String sampleFilePath;
private String sampleFileName;
private String gasFilePath;
private String gasFileName;
private String detFilePath;
private String detFileName;
private String qcFileName;
/**
* 是否点击过Energy Calibration页面下Gamma Detector Calibration的fitting按钮
*/
private boolean bGammaEnergyValidSample;
/**
* 是否点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮
*/
private boolean bBetaEnergyValidSample;
/**
* 是否点击过Energy Calibration页面下Gamma Detector Calibration的fitting按钮
*/
private boolean bGammaEnergyValidGas;
/**
* 是否点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮
*/
private boolean bBetaEnergyValidGas;
/**
* 是否点击过Energy Calibration页面下Gamma Detector Calibration的fitting按钮
*/
private boolean bGammaEnergyValidDet;
/**
* 是否点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮
*/
private boolean bBetaEnergyValidDet;
private List<GardsROIChannelsSpectrum> roiChannelsSpectrumList;
private List<GardsROIResultsSpectrum> roiResultsSpectrumList;
@ -44,4 +79,31 @@ public class RRRLogInfo implements Serializable {
private List<GardsCalibrationSpectrum> betaCalibrationParamList;
public RRRLogInfo() {
dbName = "";
sampleId = null;
sampleData = false;
gasBgData = false;
detBgData = false;
qcData = false;
sampleFilePath = "";
sampleFileName = "";
gasFilePath = "";
gasFileName = "";
detFilePath = "";
detFileName = "";
qcFileName = "";
bGammaEnergyValidSample = false;
bBetaEnergyValidSample = false;
bGammaEnergyValidGas = false;
bBetaEnergyValidGas = false;
bGammaEnergyValidDet = false;
bBetaEnergyValidDet = false;
roiChannelsSpectrumList = new LinkedList<>();
roiResultsSpectrumList = new LinkedList<>();
xeResultsSpectrumList = new LinkedList<>();
gammaCalibrationParamList = new LinkedList<>();
betaCalibrationParamList = new LinkedList<>();
}
}

View File

@ -86,7 +86,7 @@ public interface IGammaService{
void saveDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText);
Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request);
Result setCurrentEnergy(String fileName, String currentName, HttpServletRequest request);
@ -98,7 +98,7 @@ public interface IGammaService{
void saveDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText);
Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request);
Result setCurrentResolution(String fileName, String currentName, HttpServletRequest request);
@ -110,7 +110,7 @@ public interface IGammaService{
void saveDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, Integer funId, HttpServletResponse response);
Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText);
Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request);
Result setCurrentEfficiency(String fileName, String currentName, HttpServletRequest request);
@ -172,4 +172,8 @@ public interface IGammaService{
void saveToPHD(String fileName, HttpServletRequest request, HttpServletResponse response);
void ImsToIec(MultipartFile file, HttpServletResponse response);
void IecToIms(FileData data, MultipartFile file, HttpServletResponse response);
}

View File

@ -52,6 +52,8 @@ public interface ISpectrumAnalysisService {
Result viewExtrapolation(Integer sampleId, String sampleFileName, HttpServletRequest request);
Result analyseExtrapolation(AnalyseExtInfo extInfo, HttpServletRequest request);
Result viewMDC(Integer sampleId, String sampleFileName, HttpServletRequest request);
Result changeDetector(String stationName);

View File

@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.minio.credentials.Jwt;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import com.google.common.cache.Cache;
@ -70,6 +71,7 @@ import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static io.netty.util.ResourceLeakDetector.setEnabled;
import static org.jeecg.modules.base.enums.ExportTemplate.*;
@Service(value = "gammaService")
@ -414,9 +416,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Map<String, Object> map = new HashMap<>();
//加载本地缓存信息
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
//声明phd实体类
PHDFile phd = new PHDFile();
//读取文件内容
//根据sampleId获取sample文件路径
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
if (StringUtils.isBlank(sampleFilePath)){
@ -427,6 +426,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String pathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
//切割数据库存储的文件路径获取文件名称
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
//声明phd实体类
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)) {
phd = new PHDFile();
//读取文件内容
//调用加载文件的方法 传入文件路径文件名称全局变量phd响应结果result
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phd, result);
//如果文件加载失败 返回失败原因
@ -441,6 +445,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
if (!bRet){
return result;
}
}
//获取当前角色配置的颜色信息
Map<String, String> colorMap = sysUserColorService.initColor(userName);
// 更新 QC Flags 状态
@ -754,7 +759,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
vChan.add(c);
c += 1;
}
//System.loadLibrary("GammaAnaly");
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP());
phd.setVEnergy(calValuesOut.counts);
phd.setBAnalyed(true);
@ -770,14 +774,17 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
//上传文件路径
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
PHDFile phd = new PHDFile();
//获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)) {
phd = new PHDFile();
//加载文件内容
boolean bRet = gammaFileUtil.loadFile(path, fileName, phd, result);
if (!bRet) {
return result;
}
//获取当前角色的颜色配置
Map<String, String> colorMap = sysUserColorService.initColor(userName);
}
// 更新 QC Flags 状态
List<String> qcstate = gammaFileUtil.Qcstate(phd);
map.put("QCFlag", qcstate);
@ -809,6 +816,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//获取缓存的phd数据
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)) {
result.error500("请先选择解析文件");
return result;
}
long m_nCount = phd.getSpec().getNum_g_channel();
List<Double> vEnergy = phd.getVEnergy();
//获取Compare数据
@ -830,6 +841,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
//获取缓存的phd数据
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)) {
result.error500("请先选择解析文件");
return result;
}
long m_nCount = phd.getSpec().getNum_g_channel();
List<Double> vEnergy = phd.getVEnergy();
long m_nSChan = phd.getSpec().getBegin_channel();
@ -1070,7 +1085,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Map<String, Object> map = new HashMap<>();
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
@ -1326,9 +1340,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
ObjectMapper mapper = new ObjectMapper();
String phdStr = mapper.writeValueAsString(phd);
String str = CalValuesHandler.fitPeakFull(phdStr, Af, Cf, Ff);
String strValue = CalValuesHandler.fitPeakFull(phdStr, Af, Cf, Ff);
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("vPeak")) {
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
phd.setVPeak(value);
}
}
//重新计算peak的改变
gammaFileUtil.PeaksChanged(phd);
@ -1833,13 +1852,11 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
baseLineCtrls.setReplotNeeded(false);
BaseControls m_baseCtrl = new BaseLineCtrls();
BeanUtils.copyProperties(baseLineCtrls, m_baseCtrl);
phd.setBaseCtrls(m_baseCtrl);
phd.setVBase(m_baseCtrl.getBaseline());
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), baseLineCtrls.getBaseline(), colorMap.get("Color_peak"), m_nCount, null, false);
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), m_baseCtrl.getBaseline(), colorMap.get("Color_Peak"), m_nCount, null, false);
map.put("peakSet", peakSet);
ChartData chartData = gammaFileUtil.CreateTempBaseLine(colorMap.get("Color_base"), "BaseLine", m_baseCtrl);
ChartData chartData = gammaFileUtil.CreateTempBaseLine(colorMap.get("Color_Base"), "BaseLine", m_baseCtrl);
map.put("chartData", chartData);
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls());
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(m_baseCtrl);
map.put("shapeData", shapeData);
if(m_baseCtrl.getBaseStack().size() > 2) {
for (int j =1; j<m_baseCtrl.getBaseStack().size()-1; j++) {
@ -1895,7 +1912,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
map.put("barChart", differance);
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
map.put("channelBaseLineChart", channelBaseLine);
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), phd.getVBase(), colorMap.get("Color_peak"), m_nCount, null, false);
List<ChartData> peakSet = gammaFileUtil.PeakSet(phd.getVPeak(), phd.getVBase(), colorMap.get("Color_Peak"), m_nCount, null, false);
map.put("peakSet", peakSet);
List<ShapeData> shapeData = gammaFileUtil.CreateShapeCP(phd.getBaseCtrls());
map.put("shapeData", shapeData);
@ -2163,7 +2180,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Map<String, Object> map = new HashMap<>();
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
@ -2231,7 +2247,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
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");
if(m_vCurEnergy.size() < 1) {
return;
} else if(m_vCurEnergy.size() == 1) {
@ -2332,10 +2347,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
@Override
public Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText) {
public Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(sampleFileName);
PHDFile phd = phdCache.getIfPresent(sampleFileName+"-"+userName);
if (Objects.isNull(phd)) {
result.error500("请先选择解析文件");
return result;
}
if (Objects.nonNull(file)) {
String fileName = file.getOriginalFilename();
//从最后一个切割文件名称 获取文件名称后缀
@ -2444,7 +2464,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Map<String, Object> map = new HashMap<>();
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
@ -2499,7 +2518,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Map<String, Object> map = new HashMap<>();
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
@ -2513,7 +2531,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
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");
m_curParam.setP(CalValuesHandler.calFitPara("Cal_Resolution", 4, m_vCurEnergy, m_vCurReso, m_vCurUncert));
map.put("uncert", m_vCurUncert);
map.put("param", m_curParam);
@ -2603,10 +2620,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
@Override
public Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText) {
public Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(sampleFileName);
PHDFile phd = phdCache.getIfPresent(sampleFileName+"-"+userName);
if (Objects.isNull(phd)) {
result.error500("请先选择解析文件");
return result;
}
if (Objects.nonNull(file)) {
String fileName = file.getOriginalFilename();
//从最后一个切割文件名称 获取文件名称后缀
@ -2724,7 +2746,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
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");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
@ -2779,7 +2800,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Map<String, Object> map = new HashMap<>();
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)){
@ -2793,7 +2813,6 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
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");
m_curParam.setP(CalValuesHandler.calFitPara("Cal_Efficiency", funcId, m_vCurEnergy, m_vCurEffi, m_vCurUncert));
map.put("uncert", m_vCurUncert);
map.put("param", m_curParam);
@ -2884,10 +2903,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
@Override
public Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText) {
public Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText, HttpServletRequest request) {
Result result = new Result();
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(sampleFileName);
PHDFile phd = phdCache.getIfPresent(sampleFileName+"-"+userName);
if (Objects.isNull(phd)) {
result.error500("请先选择解析文件");
return result;
}
if (Objects.nonNull(file)) {
String fileName = file.getOriginalFilename();
//从最后一个切割文件名称 获取文件名称后缀
@ -4143,6 +4167,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String userName = JwtUtil.getUserNameByToken(request);
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)) {
return;
}
if (Objects.nonNull(phd)) {
StringBuilder strBuild = new StringBuilder();
//txt文本内容
@ -4302,52 +4329,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
}
}
@Override
public void saveToPHD(String fileName, HttpServletRequest request, HttpServletResponse response) {
//获取当前登陆用户名
String userName = JwtUtil.getUserNameByToken(request);
//读取本地缓存的phd文件信息
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.nonNull(phd)) {
String detectorCode = phd.getHeader().getDetector_code();
String date = phd.getAcq().getAcquisition_start_date().replace("/", "");
String time = phd.getAcq().getAcquisition_start_time().replace(":", "").substring(0, 4);
String dataType = phd.getMsgInfo().getData_type().substring(0, 1);
String phdFileName = String.format("%s-%s_%s_%s.PHD", detectorCode, date, time, dataType);
String spectrum = gammaFileUtil.makeUpSpectrum(phd);
//导出数据内容到txt文本
OutputStream fos = null;
try {
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(phdFileName,"UTF-8"));
fos = response.getOutputStream();
fos.write(spectrum.getBytes());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(fos)) {
fos.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
@Override
public void saveToExcel(String fileName, HttpServletResponse response) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String username = loginUser.getUsername();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName + StrUtil.DASHED + username);
if (ObjectUtil.isNull(phd)) return;
if (ObjectUtil.isNull(phd)) {
return;
}
Map<String, Object> data = new HashMap<>();
/* The Results of Peak Searching */
List<PeakInfo> peakInfos = phd.getVPeak();
@ -4442,4 +4432,138 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// 导出时使用默认文件名 file.xls
ExportUtil.exportXls(response, template, data);
}
@Override
public void saveToPHD(String fileName, HttpServletRequest request, HttpServletResponse response) {
//获取当前登陆用户名
String userName = JwtUtil.getUserNameByToken(request);
//读取本地缓存的phd文件信息
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName+"-"+userName);
if (Objects.isNull(phd)) {
return;
}
if (Objects.nonNull(phd)) {
String detectorCode = phd.getHeader().getDetector_code();
String date = phd.getAcq().getAcquisition_start_date().replace("/", "");
String time = phd.getAcq().getAcquisition_start_time().replace(":", "").substring(0, 4);
String dataType = phd.getMsgInfo().getData_type().substring(0, 1);
String phdFileName = String.format("%s-%s_%s_%s.PHD", detectorCode, date, time, dataType);
String spectrum = gammaFileUtil.makeUpSpectrum(phd);
//导出数据内容到txt文本
OutputStream fos = null;
try {
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(phdFileName,"UTF-8"));
fos = response.getOutputStream();
fos.write(spectrum.getBytes());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(fos)) {
fos.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
@Override
public void ImsToIec(MultipartFile file, HttpServletResponse response) {
String ImsName = file.getOriginalFilename();
String IecName = ImsName.substring(0, ImsName.length()-4)+".IEC";
FileData datas = new FileData();
File imsFile = null;
InputStream inputStream = null;
//导出数据内容到txt文本
OutputStream fos = null;
try {
imsFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
FileUtils.copyInputStreamToFile(inputStream, imsFile);
if(!FileFtransitUtil.ReadIMS(imsFile, datas)) {
String Warning = "Read "+ImsName+" failed!\n"+
"Possible Reason:\n"+
"1、The file is unreadable;\n"+
"2、The format of file is error.";
return;
}
String iecValue = FileFtransitUtil.WriteIEC(datas);
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(IecName,"UTF-8"));
fos = response.getOutputStream();
fos.write(iecValue.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(imsFile)) {
imsFile.delete();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (Objects.nonNull(fos)) {
fos.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
@Override
public void IecToIms(FileData datas, MultipartFile file, HttpServletResponse response) {
String IecName = file.getOriginalFilename();
String ImsName = IecName.substring(0, IecName.length()-4)+".Ims";
File iecFile = null;
InputStream inputStream = null;
//导出数据内容到txt文本
OutputStream fos = null;
try {
iecFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
FileUtils.copyInputStreamToFile(inputStream, iecFile);
if(!FileFtransitUtil.ReadIEC(iecFile, datas)) {
String Warning = "Read "+IecName+" failed!\n"+
"Possible Reason:\n"+
"1、The file is unreadable;\n"+
"2、The format of file is error.";
return;
}
String imsValue = FileFtransitUtil.WriteIMS(datas);
//设置响应类型
response.setContentType("application/octet-stream");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(ImsName,"UTF-8"));
fos = response.getOutputStream();
fos.write(imsValue.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (Objects.nonNull(iecFile)) {
iecFile.delete();
}
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (Objects.nonNull(fos)) {
fos.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

View File

@ -39,6 +39,7 @@ import org.jeecg.modules.base.enums.*;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.BgBoundary;
@ -631,8 +632,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
commentInfo.setSpectrumCommentInfo(struct.comment);
}
@ -722,6 +721,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
GardsCalibrationSpectrum betaCalibrationParamS = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamG = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamD = new GardsCalibrationSpectrum();
BgCalibratePara BgCalPara = null;
String sampleFilePath = "";
String gasFilePath = "";
String detFilePath = "";
@ -748,6 +748,58 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
gasFilePath = path;
detFilePath = path;
}
rrrLogInfo.setSampleFilePath(sampleFilePath);
rrrLogInfo.setGasFilePath(gasFilePath);
rrrLogInfo.setDetFilePath(detFilePath);
//从本地缓存获取beta gamma的数组
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
List<String> betaFittingPara = new LinkedList<>();
List<String> gammaFittingPara = new LinkedList<>();
if (Objects.nonNull(cache)) {
//根据qc文件名称-用户名-beta的方式获取beta的内容
Map<String, Object> betaMap = cache.getIfPresent(rrrLogInfo.getQcFileName() + "-" + userName + "-beta");
if (CollectionUtils.isNotEmpty(betaMap)) {
betaFittingPara = (List<String>) betaMap.get("fittingPara");
}
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
Map<String, Object> gammaMap = cache.getIfPresent(rrrLogInfo.getQcFileName() + "-" + userName + "-gamma");
if (CollectionUtils.isNotEmpty(gammaMap)) {
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
}
//根据key获取重新分析的参数
Map<String, Object> reAnalyseParam = cache.getIfPresent(rrrLogInfo.getSampleFileName() + "-" + userName + "-reAnalyseParam");
//判断重新分析的参数信息是否为空
if (CollectionUtils.isNotEmpty(reAnalyseParam)) {
BgCalPara = (BgCalibratePara) reAnalyseParam.get("reAnalyseParam");
Boolean bGammaEnergyValidSample = (Boolean) reAnalyseParam.get("bGammaEnergyValidSample");
if (Objects.nonNull(bGammaEnergyValidSample)) {
rrrLogInfo.setBGammaEnergyValidSample(bGammaEnergyValidSample);
}
Boolean bBetaEnergyValidSample = (Boolean) reAnalyseParam.get("bBetaEnergyValidSample");
if (Objects.nonNull(bBetaEnergyValidSample)) {
rrrLogInfo.setBBetaEnergyValidSample(bBetaEnergyValidSample);
}
Boolean bGammaEnergyValidGas = (Boolean) reAnalyseParam.get("bGammaEnergyValidGas");
if (Objects.nonNull(bGammaEnergyValidGas)) {
rrrLogInfo.setBGammaEnergyValidGas(bGammaEnergyValidGas);
}
Boolean bBetaEnergyValidGas = (Boolean) reAnalyseParam.get("bBetaEnergyValidGas");
if (Objects.nonNull(bBetaEnergyValidGas)) {
rrrLogInfo.setBBetaEnergyValidGas(bBetaEnergyValidGas);
}
Boolean bGammaEnergyValidDet = (Boolean) reAnalyseParam.get("bGammaEnergyValidDet");
if (Objects.nonNull(bGammaEnergyValidDet)) {
rrrLogInfo.setBGammaEnergyValidDet(bGammaEnergyValidDet);
}
Boolean bBetaEnergyValidDet = (Boolean) reAnalyseParam.get("bBetaEnergyValidDet");
if (Objects.nonNull(bBetaEnergyValidDet)) {
rrrLogInfo.setBBetaEnergyValidDet(bBetaEnergyValidDet);
}
}
}
//对当前文件内容进行分析
analyzeRRR(rrrLogInfo, BgCalPara, betaFittingPara, gammaFittingPara);
//对分析后的内容进行数据获取
List<GardsROIChannelsSpectrum> channelsSpectrums = rrrLogInfo.getRoiChannelsSpectrumList();
List<GardsROIResultsSpectrum> resultsSpectrums = rrrLogInfo.getRoiResultsSpectrumList();
List<GardsXeResultsSpectrum> xeResultsSpectrums = rrrLogInfo.getXeResultsSpectrumList();
@ -950,6 +1002,229 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
return result;
}
public void analyzeRRR(RRRLogInfo rrrLogInfo, BgCalibratePara BgCalPara, List<String> betaFittingPara, List<String> gammaFittingPara) {
File sampleTmp = null;
File gasTmp = null;
File detTmp = null;
try {
//根据文件路径 文件名称获取对应的临时文件
sampleTmp = phdFileUtil.analyzeFile(rrrLogInfo.getSampleFilePath(), rrrLogInfo.getSampleFileName());
gasTmp = phdFileUtil.analyzeFile(rrrLogInfo.getGasFilePath(), rrrLogInfo.getGasFileName());
detTmp = phdFileUtil.analyzeFile(rrrLogInfo.getDetFilePath(), rrrLogInfo.getDetFileName());
//调用动态库解析文件
//Gamma Energy Calibration页面 如果点击过fitting使BGammaEnergyValid并且有勾选
//如果三个sampleData,GasData,DetData数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
BgAnalyseResult bgAnalyseResult = null;
if (Objects.isNull(BgCalPara)) {
bgAnalyseResult = EnergySpectrumHandler.bgAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath());
} else {
bgAnalyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), BgCalPara);
}
//处理XeData的数据
List<GardsXeResultsSpectrum> xeResultsSpectrumList = new LinkedList<>();
GardsXeResultsSpectrum xe131m = new GardsXeResultsSpectrum();
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
xe131m.setConc(bgAnalyseResult.Xe131m_con);
xe131m.setConcErr(bgAnalyseResult.Xe131m_uncer);
xe131m.setLc(bgAnalyseResult.LC_Xe131m);
xe131m.setMdc(bgAnalyseResult.MDC_Xe131m);
xe131m.setNidFlag(bgAnalyseResult.XE_131m_NID_FLAG);
xeResultsSpectrumList.add(xe131m);
GardsXeResultsSpectrum xe133 = new GardsXeResultsSpectrum();
xe133.setNuclideName(XeNuclideName.XE_133.getType());
xe133.setConc(bgAnalyseResult.Xe133_con);
xe133.setConcErr(bgAnalyseResult.Xe133_uncer);
xe133.setLc(bgAnalyseResult.LC_Xe133);
xe133.setMdc(bgAnalyseResult.MDC_Xe133);
xe133.setNidFlag(bgAnalyseResult.XE_133_NID_FLAG);
xeResultsSpectrumList.add(xe133);
GardsXeResultsSpectrum xe133m = new GardsXeResultsSpectrum();
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
xe133m.setConc(bgAnalyseResult.Xe133m_con);
xe133m.setConcErr(bgAnalyseResult.Xe133m_uncer);
xe133m.setLc(bgAnalyseResult.LC_Xe133m);
xe133m.setMdc(bgAnalyseResult.MDC_Xe133m);
xe133m.setNidFlag(bgAnalyseResult.XE_133m_NID_FLAG);
xeResultsSpectrumList.add(xe133m);
GardsXeResultsSpectrum xe135 = new GardsXeResultsSpectrum();
xe135.setNuclideName(XeNuclideName.XE_135.getType());
xe135.setConc(bgAnalyseResult.Xe135_con);
xe135.setConcErr(bgAnalyseResult.Xe135_uncer);
xe135.setLc(bgAnalyseResult.LC_Xe135);
xe135.setMdc(bgAnalyseResult.MDC_Xe135);
xe135.setNidFlag(bgAnalyseResult.XE_135_NID_FLAG);
xeResultsSpectrumList.add(xe135);
rrrLogInfo.setXeResultsSpectrumList(xeResultsSpectrumList);
//处理GammaCalibration的数据
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList = new LinkedList<>();
if (rrrLogInfo.isBGammaEnergyValidSample()) {
GardsCalibrationSpectrum gammaCalibrationS = new GardsCalibrationSpectrum();
gammaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
gammaCalibrationS.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
gammaCalibrationS.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
gammaCalibrationS.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
gammaCalibrationSpectrumList.add(gammaCalibrationS);
} else {
GardsCalibrationSpectrum gammaCalibrationS = new GardsCalibrationSpectrum();
gammaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
gammaCalibrationS.setCoeff1(bgAnalyseResult.s_g_fitting_c_e.get(0));
gammaCalibrationS.setCoeff2(bgAnalyseResult.s_g_fitting_c_e.get(1));
gammaCalibrationS.setCoeff3(bgAnalyseResult.s_g_fitting_c_e.get(2));
gammaCalibrationSpectrumList.add(gammaCalibrationS);
}
if (rrrLogInfo.isBGammaEnergyValidGas()) {
GardsCalibrationSpectrum gammaCalibrationG = new GardsCalibrationSpectrum();
gammaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
gammaCalibrationG.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
gammaCalibrationG.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
gammaCalibrationG.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
gammaCalibrationSpectrumList.add(gammaCalibrationG);
} else {
GardsCalibrationSpectrum gammaCalibrationG = new GardsCalibrationSpectrum();
gammaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
gammaCalibrationG.setCoeff1(bgAnalyseResult.g_g_fitting_c_e.get(0));
gammaCalibrationG.setCoeff2(bgAnalyseResult.g_g_fitting_c_e.get(1));
gammaCalibrationG.setCoeff3(bgAnalyseResult.g_g_fitting_c_e.get(2));
gammaCalibrationSpectrumList.add(gammaCalibrationG);
}
if (rrrLogInfo.isBGammaEnergyValidDet()) {
GardsCalibrationSpectrum gammaCalibrationD = new GardsCalibrationSpectrum();
gammaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
gammaCalibrationD.setCoeff1(Double.valueOf(gammaFittingPara.get(0)));
gammaCalibrationD.setCoeff2(Double.valueOf(gammaFittingPara.get(1)));
gammaCalibrationD.setCoeff3(Double.valueOf(gammaFittingPara.get(2)));
gammaCalibrationSpectrumList.add(gammaCalibrationD);
} else {
GardsCalibrationSpectrum gammaCalibrationD = new GardsCalibrationSpectrum();
gammaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
gammaCalibrationD.setCoeff1(bgAnalyseResult.d_g_fitting_c_e.get(0));
gammaCalibrationD.setCoeff2(bgAnalyseResult.d_g_fitting_c_e.get(1));
gammaCalibrationD.setCoeff3(bgAnalyseResult.d_g_fitting_c_e.get(2));
gammaCalibrationSpectrumList.add(gammaCalibrationD);
}
rrrLogInfo.setGammaCalibrationParamList(gammaCalibrationSpectrumList);
//处理BetaCalibration数据
List<GardsCalibrationSpectrum> betaCalibrationSpectrumList = new LinkedList<>();
if (rrrLogInfo.isBBetaEnergyValidSample()) {
GardsCalibrationSpectrum betaCalibrationS = new GardsCalibrationSpectrum();
betaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
betaCalibrationS.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
betaCalibrationS.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
betaCalibrationS.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
betaCalibrationSpectrumList.add(betaCalibrationS);
} else {
GardsCalibrationSpectrum betaCalibrationS = new GardsCalibrationSpectrum();
betaCalibrationS.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
betaCalibrationS.setCoeff1(bgAnalyseResult.s_b_fitting_c_e.get(0));
betaCalibrationS.setCoeff2(bgAnalyseResult.s_b_fitting_c_e.get(1));
betaCalibrationS.setCoeff3(bgAnalyseResult.s_b_fitting_c_e.get(2));
betaCalibrationSpectrumList.add(betaCalibrationS);
}
if (rrrLogInfo.isBBetaEnergyValidGas()) {
GardsCalibrationSpectrum betaCalibrationG = new GardsCalibrationSpectrum();
betaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
betaCalibrationG.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
betaCalibrationG.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
betaCalibrationG.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
betaCalibrationSpectrumList.add(betaCalibrationG);
} else {
GardsCalibrationSpectrum betaCalibrationG = new GardsCalibrationSpectrum();
betaCalibrationG.setDataType(DataTypeAbbr.GASBKPHD.getType());
betaCalibrationG.setCoeff1(bgAnalyseResult.g_b_fitting_c_e.get(0));
betaCalibrationG.setCoeff2(bgAnalyseResult.g_b_fitting_c_e.get(1));
betaCalibrationG.setCoeff3(bgAnalyseResult.g_b_fitting_c_e.get(2));
betaCalibrationSpectrumList.add(betaCalibrationG);
}
if (rrrLogInfo.isBBetaEnergyValidDet()) {
GardsCalibrationSpectrum betaCalibrationD = new GardsCalibrationSpectrum();
betaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
betaCalibrationD.setCoeff1(Double.valueOf(betaFittingPara.get(0)));
betaCalibrationD.setCoeff2(Double.valueOf(betaFittingPara.get(1)));
betaCalibrationD.setCoeff3(Double.valueOf(betaFittingPara.get(2)));
betaCalibrationSpectrumList.add(betaCalibrationD);
} else {
GardsCalibrationSpectrum betaCalibrationD = new GardsCalibrationSpectrum();
betaCalibrationD.setDataType(DataTypeAbbr.DETBKPHD.getType());
betaCalibrationD.setCoeff1(bgAnalyseResult.d_b_fitting_c_e.get(0));
betaCalibrationD.setCoeff2(bgAnalyseResult.d_b_fitting_c_e.get(1));
betaCalibrationD.setCoeff3(bgAnalyseResult.d_b_fitting_c_e.get(2));
betaCalibrationSpectrumList.add(betaCalibrationD);
}
rrrLogInfo.setBetaCalibrationParamList(betaCalibrationSpectrumList);
//存储roiChannel数据
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = new LinkedList<>();
for (int i=0; i<bgAnalyseResult.S_ROI_B_Boundary_start.size(); i++) {
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
roiChannels.setDataType(DataTypeAbbr.SAMPLEPHD.getType());
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(bgAnalyseResult.S_ROI_B_Boundary_start.get(i));
roiChannels.setBChanStop(bgAnalyseResult.S_ROI_B_Boundary_stop.get(i));
roiChannels.setGChanStart(bgAnalyseResult.S_ROI_G_Boundary_start.get(i));
roiChannels.setGChanStop(bgAnalyseResult.S_ROI_G_Boundary_stop.get(i));
roiChannelsSpectrumList.add(roiChannels);
}
for (int i=0; i<bgAnalyseResult.G_ROI_B_Boundary_start.size(); i++) {
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
roiChannels.setDataType(DataTypeAbbr.GASBKPHD.getType());
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(bgAnalyseResult.G_ROI_B_Boundary_start.get(i));
roiChannels.setBChanStop(bgAnalyseResult.G_ROI_B_Boundary_stop.get(i));
roiChannels.setGChanStart(bgAnalyseResult.G_ROI_G_Boundary_start.get(i));
roiChannels.setGChanStop(bgAnalyseResult.G_ROI_G_Boundary_stop.get(i));
roiChannelsSpectrumList.add(roiChannels);
}
for (int i=0; i<bgAnalyseResult.D_ROI_B_Boundary_start.size(); i++) {
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
roiChannels.setDataType(DataTypeAbbr.DETBKPHD.getType());
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(bgAnalyseResult.D_ROI_B_Boundary_start.get(i));
roiChannels.setBChanStop(bgAnalyseResult.D_ROI_B_Boundary_stop.get(i));
roiChannels.setGChanStart(bgAnalyseResult.D_ROI_G_Boundary_start.get(i));
roiChannels.setGChanStop(bgAnalyseResult.D_ROI_G_Boundary_stop.get(i));
roiChannelsSpectrumList.add(roiChannels);
}
rrrLogInfo.setRoiChannelsSpectrumList(roiChannelsSpectrumList);
bgAnalyseResult.LC.add(0, 0.0);
bgAnalyseResult.MDC.add(0, 0.0);
//存储roiResult的数据
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
for (int i=0; i<bgAnalyseResult.s_roi_cts.size(); i++) {
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
roiResults.setRoi(i+1);
roiResults.setLc(bgAnalyseResult.LC.get(i));
roiResults.setSGross(bgAnalyseResult.s_roi_cts.get(i));
roiResults.setGGross(bgAnalyseResult.g_roi_cts.get(i));
roiResults.setBGross(bgAnalyseResult.d_roi_cts.get(i));
roiResults.setSNet(bgAnalyseResult.s_deduct_d_cts.get((i+1)*3));
roiResults.setGNet(bgAnalyseResult.g_deduct_d_cts.get((i+1)*3));
roiResults.setNet(bgAnalyseResult.ROI_net_coutns.get(i));
roiResults.setNetErr(bgAnalyseResult.ROI_net_coutns_err.get(i));
roiResults.setConc(bgAnalyseResult.ROI_con_uncer.get(i));
roiResults.setConcErr(bgAnalyseResult.ROI_con_uncer_err.get(i));
roiResults.setMdc(bgAnalyseResult.MDC.get(i));
if(bgAnalyseResult.ROI_con_uncer.get(i)>bgAnalyseResult.MDC.get(i)) {
roiResults.setNidFlag(1);
} else {
roiResults.setNidFlag(0);
}
roiResultsSpectrumList.add(roiResults);
}
rrrLogInfo.setRoiResultsSpectrumList(roiResultsSpectrumList);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (Objects.nonNull(sampleTmp)) {
sampleTmp.delete();
}
if (Objects.nonNull(gasTmp)) {
gasTmp.delete();
}
if (Objects.nonNull(detTmp)) {
detTmp.delete();
}
}
}
@Override
public Result viewSpectrum(Integer sampleId, String dbName, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
Result result = new Result();
@ -1036,8 +1311,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
String measurementID = struct.measurement_id;
String bkgdMeasurementID = struct.detector_bk_measurement_id;
@ -1460,8 +1733,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//读取Gamma Detector Calibration所需要的参数
long numGChannel = struct.num_g_channel;
@ -1608,8 +1879,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//Figure of Beta Detector Calibration
long numBChannel = struct.num_b_channel;
@ -1731,8 +2000,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
samplePathName = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp连接失败");
@ -1847,6 +2114,235 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
return result;
}
@Override
public Result analyseExtrapolation(AnalyseExtInfo extInfo, HttpServletRequest request) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
Integer sampleId = extInfo.getSampleId();
String dbName = extInfo.getDbName();
//获取数据信息
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
String sampleFilePath = "";
String detFilePath = "";
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)){
Integer analysisID = null;
if (extInfo.getDbName().equalsIgnoreCase("auto")){
dbName = "RNAUTO";
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
}else if (extInfo.getDbName().equalsIgnoreCase("man")){
dbName = "RNMAN";
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
}
dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId, analysisID);
if (Objects.nonNull(dbSpectrumFilePath)) {
sampleFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
detFilePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
}
} else {
sampleFilePath = path;
detFilePath = path;
}
//获取sample文件的文件读取信息
EnergySpectrumStruct sampleTmp = phdFileUtil.analyzeFileSourceData(sampleFilePath, extInfo.getSampleFileName());
//获取文件中的数据
double sampleRealTime = 0.0;
List<Long> sample_spectrum = new LinkedList<>();
List<Long> sample_b_spectrum = new LinkedList<>();
List<Long> sample_histogram = new LinkedList<>();
if (Objects.nonNull(sampleTmp.acquisition_real_time)) {
sampleRealTime = sampleTmp.acquisition_real_time;
}
if (CollectionUtils.isNotEmpty(sampleTmp.g_counts)) {
sample_spectrum = sampleTmp.g_counts;
}
if (CollectionUtils.isNotEmpty(sampleTmp.b_counts)) {
sample_b_spectrum = sampleTmp.b_counts;
}
if (CollectionUtils.isNotEmpty(sampleTmp.h_counts)) {
sample_histogram = sampleTmp.h_counts;
}
//获取det文件的文件读取信息
EnergySpectrumStruct detTmp = phdFileUtil.analyzeFileSourceData(detFilePath, extInfo.getDetFileName());
double detbgrRealTime = 0.0;
List<Long> detbgr_spectrum = new LinkedList<>();
List<Long> detbgr_b_spectrum = new LinkedList<>();
List<Long> detbgr_historgram = new LinkedList<>();
if (Objects.nonNull(detTmp.acquisition_real_time)) {
detbgrRealTime = detTmp.acquisition_real_time;
}
if (CollectionUtils.isNotEmpty(detTmp.g_counts)) {
detbgr_spectrum = detTmp.g_counts;
}
if (CollectionUtils.isNotEmpty(detTmp.b_counts)) {
detbgr_b_spectrum = detTmp.b_counts;
}
if (CollectionUtils.isNotEmpty(detTmp.h_counts)) {
detbgr_historgram = detTmp.h_counts;
}
//计算
//Ng
double s_Ng = 0.0;
double d_Ng = 0.0;
int begin = extInfo.getGammaBegin();
int end = extInfo.getGammaEnd();
for(int i=begin;i<sample_spectrum.size()&&i<detbgr_spectrum.size()&&i<=end;i++){
s_Ng+= sample_spectrum.get(i);
d_Ng+= detbgr_spectrum.get(i);
}
double NgR = (s_Ng/sampleRealTime)-(d_Ng/detbgrRealTime);
double EbT = 10000000;
double min_e = extInfo.getMinEnergy();
int index = 0;
List<Double> Eb = new LinkedList<>();
List<Double> Ny = new LinkedList<>();
List<Double> Nx = new LinkedList<>();
while(index<=51&&EbT>min_e) {
double s_Nb=0.0;
double d_Nb=0.0;
for(int k = index*5;k<sample_b_spectrum.size()&&k<detbgr_b_spectrum.size()&&k<255;k++) {
s_Nb += sample_b_spectrum.get(k);
d_Nb += detbgr_b_spectrum.get(k);
}
double NbR = (s_Nb/sampleRealTime)-(d_Nb/detbgrRealTime);
double s_Nc = 0.0;
double d_Nc = 0.0;
for(int l = index*5;l<=255;l++) {
for(int m=begin;m<=end&&(256*m+l)<sample_histogram.size()&&(256*m+l)<detbgr_historgram.size();m++) {
s_Nc+=sample_histogram.get(256*m+l);
d_Nc+=detbgr_historgram.get(256*m+l);
}
}
double NcR= (s_Nc/sampleRealTime)-(d_Nc/detbgrRealTime);
if(NgR==0) {
NgR=1;
}
if(NcR==0) {
NcR=1;
}
EbT= NcR/NgR;
Eb.add(EbT);
Ny.add((NbR*NgR)/NcR);
Nx.add((1-EbT)/EbT);
index++;
}
int pos=0;
String fittype = extInfo.getFitType();
if(fittype.equals("liner")) {
pos=1;
} else if(fittype.equals("poly2")) {
pos=0;
} else if(fittype.equals("poly3")) {
}
double lamadaXe = Math.log(2)/(extInfo.getHalfLife()*24*60*60);
List<Double> fittingPara = new LinkedList<>();
fittingPara = EnergySpectrumHandler.GetFittingPara(Nx,Ny,fittype);
if(CollectionUtils.isEmpty(fittingPara) && pos>fittingPara.size()-1) {
return result;
}
double acqRealTime = sampleRealTime;
double Xe_activity = fittingPara.get(pos)*(lamadaXe*acqRealTime)/(1-Math.exp(-lamadaXe*acqRealTime));
List<SeriseData> line_serise_data = new LinkedList<>();
List<SeriseData> scatter_serise_data = new LinkedList<>();
double maxLeft=0.0;
double maxBottom=0.0;
double minLeft=0.0;
for(int i=0;i<Nx.size()&&i<Ny.size();i++) {
if(maxBottom<Nx.get(i)) {
maxBottom = Nx.get(i);
}
if(minLeft>Nx.get(i)) {
minLeft = Nx.get(i);
}
if(maxLeft<Ny.get(i)) {
maxLeft = Ny.get(i);
}
if(minLeft>Ny.get(i)) {
minLeft = Ny.get(i);
}
}
for(int i=0;i<Nx.size()&&i<Ny.size();i++) {
SeriseData temp = new SeriseData();
temp.setX(Nx.get(pos));
temp.setY(Ny.get(pos));
scatter_serise_data.add(temp);
}
String fittingTitle = "";
String fittingDataFormat = "";
String tempStr = "";
if(fittype.equals("liner")) {
SeriseData left = new SeriseData();
List<Double> data = new LinkedList<>();
List<Double> rData = new LinkedList<>();
data.add(Nx.get(0));
rData = EnergySpectrumHandler.GetFittingData(data, fittype, fittingPara);
left.setX(Nx.get(0));
left.setY(rData.get(0));
data.clear();
rData.clear();
data.add(Nx.get(Nx.size()-1));
rData = EnergySpectrumHandler.GetFittingData(data,fittype,fittingPara);
SeriseData right = new SeriseData();
right.setX(Nx.get(Nx.size()-1));
right.setY(rData.get(0));
line_serise_data.add(left);
line_serise_data.add(right);
// fittingTitle = RESULT_FITTING_LINER_TITLE;
// fittingDataFormat = tempStr.sprintf(RESULT_FITTING_LINER_DATA,fittingPara.at(0),fittingPara.at(1));
} else if(fittype.equals("poly2")) {
for(int i=1;i<51;i++) {
SeriseData temp = new SeriseData();
List<Double> data = new LinkedList<>();
List<Double> rData = new LinkedList<>();
data.add(pos*maxBottom/50);
rData = EnergySpectrumHandler.GetFittingData(data,fittype,fittingPara);
temp.setX(pos*maxBottom/50);
temp.setY(rData.get(0));
line_serise_data.add(temp);
}
// fittingTitle = RESULT_FITTING_2_TITLE;
// fittingDataFormat = tempStr.sprintf(RESULT_FITTING_2_DATA,fittingPara.at(0),fittingPara.at(1),fittingPara.at(2));
} else if(fittype.equals("poly3")) {
// fittingTitle = RESULT_FITTING_3_TITLE;
// fittingDataFormat = RESULT_FITTING_3_DATA;
}
// String resultText = "";
// resultText+=RESULT_TITLE;
// resultText+=tempStr.sprintf(RESULT_DATA_TITLE);
// for(int i=0;i<Nx.size()&&i<Ny.size()&&i<Eb.size();i++) {
// resultText+=tempStr.sprintf(RESULT_DATA,i,Eb.get(i),Nx.get(i),Ny.get(i));
// }
// resultText+=fittingTitle;
// resultText+=fittingDataFormat;
// resultText+=XE_ACTIVTITY_TITLE;
// resultText+=tempStr.sprintf(XE_ACTIVTITY_DATA,ui->label_acquisition_start_show->text().toStdString().c_str(),Xe_activity);
// if(maxLeft<=0||maxBottom<=0||scatter_serise_data.size()<=1) {
// return result;
// }
// if(maxLeft<4) {
// m_extraResult.SetLeftFormat(QLatin1String("%f"));
// } else {
// m_extraResult.SetLeftFormat(QLatin1String("%i"));
// }
maxBottom+=1;
maxLeft*=1.5;
minLeft-=1.5;
// m_extraResult.SetResultText(resultText);
// m_extraResult.SetResultViewLeftRange(0,maxLeft);
// m_extraResult.SetResultVIewBottomRange(minLeft,maxBottom);
// m_extraResult.SetResultViewScatterDataValue(scatter_serise_data);
// m_extraResult.SetResultViewLineDataValue(line_serise_data);
return null;
}
private List<Long> handleHistogram(List<Long> hcounts, long bChannels, long gChannels, String type) {
List<Long> projected_data_value = new LinkedList<>();
if (type.equals("Vertical")){
@ -1882,8 +2378,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
String sampleFilePath = spectrumAnalysisMapper.getSampleFilePath(sampleId);
filePath = StringPool.SLASH + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
}
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
result.error500("ftp连接失败");
@ -2272,8 +2766,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
Map<String, Object> cacheMap = new HashMap<>();
Map<String, Object> map = new HashMap<>();
//加载dll工具库
//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<>();
@ -2426,8 +2918,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//加载dll工具库
//System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//Beta-Gamma Spectrum: QC
long bChannels = struct.b_channels;
@ -3978,7 +4468,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());
//System.loadLibrary("ReadPHDFile");
//如果勾选了Energy Calibration页面下sample Data
if (Objects.nonNull(sampleTmp)) {
if(anlyseResultIn.isCheckSample()) {
@ -4093,8 +4582,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数据都是被勾选状态 则需要传递新的参数重新分析 否则不需要改变数据分析当前文件内容
@ -4657,7 +5144,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
try {
//获取ftp文件路径下临时文件
sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
//System.loadLibrary("ReadPHDFile");
if (Objects.nonNull(sampleTmp)){
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
List<Double> poiBX1 = sourceData.POI_B_x1;