Gamma分析算法修改传递参数内容

Gamma分析算法新增参数接收当前进度执行结果
自动处理程序,人工交互分析启动类增加dll调用
This commit is contained in:
qiaoqinzheng 2023-10-10 10:12:46 +08:00
parent bd1bb8cf46
commit 67c2a6b355
9 changed files with 97 additions and 117 deletions

View File

@ -18,9 +18,9 @@ public class AnalyseData implements Serializable {
private boolean qcData;
private boolean bGammaEnergyValid;
private boolean gammaEnergyValid;
private boolean bBetaEnergyValid;
private boolean betaEnergyValid;
private List<String> dbNames;
@ -39,8 +39,8 @@ public class AnalyseData implements Serializable {
gasBgData = false;
detBgData = false;
qcData = false;
bGammaEnergyValid = false;
bBetaEnergyValid = false;
gammaEnergyValid = false;
betaEnergyValid = false;
}
}

View File

@ -20,6 +20,7 @@ import org.jeecg.modules.base.enums.CalName;
import org.jeecg.modules.base.enums.CalType;
import org.jeecg.modules.base.enums.MiddleDataType;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.native_jni.AnalysisProcess;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
@ -66,7 +67,7 @@ public class GammaFileUtil {
InputStream inputStream = null;
File file = null;
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
@ -78,7 +79,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
@ -292,7 +293,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(lcFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//调用FileUtils的readLines方法获取文件的所有行数据
@ -340,7 +341,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(scacFileName);
if (Objects.nonNull(inputStream)){
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//调用FileUtils的readLines方法获取文件的所有行数据
@ -603,7 +604,7 @@ public class GammaFileUtil {
public void RunQC(PHDFile phd) {
//调用dll库
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
try {
//获取phdFile的 采集开始时间
Date start = DateUtils.parseDate(phd.getCollect().getCollection_start_date() + StringPool.SPACE + phd.getCollect().getCollection_start_time());
@ -748,8 +749,8 @@ public class GammaFileUtil {
}
public Double CalculateMDC(PHDFile phd, List<Double> vMdcInfo, Double CCF) {
//System.loadLibrary("GammaAnaly");
try {
System.loadLibrary("GammaAnaly");
//判断用于计算的数据大小是否小于3 判断集合中最后一个数值是否等于0
if(vMdcInfo.size() < 3 || vMdcInfo.get(2) == 0) {
return 0.0;
@ -1233,7 +1234,7 @@ public class GammaFileUtil {
}
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, String color, long m_nCount, List<Double> p, boolean bEnergy) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<ChartData> datalist = new LinkedList<>();
int peakNum = vPeak.size();
if(peakNum < 1 || vBase.size() != m_nCount){
@ -1311,7 +1312,7 @@ public class GammaFileUtil {
}
public List<ShapeData> Energy_BaseCP(PHDFile phd) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<ShapeData> shapes = new LinkedList<>();
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(phd.getBaseCtrls().getXCtrl(), phd.getUsedEnerPara().getP());
List<Double> vEner = calValuesOut.counts;
@ -1374,14 +1375,14 @@ public class GammaFileUtil {
}
public boolean AnalyseSpectrum(PHDFile phd, Map<String, NuclideLines> mapLines){
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
//解析获取临时文件信息
File tmpFile = analyzeFile(phd.getFilepath(), phd.getFilename());
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(phd);
String nuclideLinesMap = mapper.writeValueAsString(mapLines);
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, tmpFile.getAbsolutePath());
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, tmpFile.getAbsolutePath(), new AnalysisProcess());
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
@ -1452,6 +1453,10 @@ public class GammaFileUtil {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewEner(value);
}
if (entry.getKey().equalsIgnoreCase("newReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewReso(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GEnergyBlock> value = new HashMap<>();
@ -1625,7 +1630,7 @@ public class GammaFileUtil {
for (int i=0; i<peakNum; i++) {
vEner.add(phd.getVPeak().get(i).energy);
}
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vEner, phd.getUsedEffiPara().getP());
List<Double> vEffi = calValuesOut.counts;
for (int i=0; i<peakNum; i++) {
@ -1917,7 +1922,7 @@ public class GammaFileUtil {
}
public List<SeriseData> Differance(PHDFile phd, List<PeakInfo> vecPeak, List<Long> m_vCount, long m_nCount) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<SeriseData> pointlist = new LinkedList<>();
int start =0;
long end = -1;
@ -2055,7 +2060,7 @@ public class GammaFileUtil {
}
public void UpdateChartEnergy(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurCentroid, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
int num = m_vCurEnergy.size();
if(num < 1){
return;
@ -2120,7 +2125,7 @@ public class GammaFileUtil {
}
public void UpdateChartResolution(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurReso, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
int num = m_vCurEnergy.size();
if(num < 1) return;
@ -2255,7 +2260,7 @@ public class GammaFileUtil {
}
public void UpdateChartEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurEffi, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
int num = m_vCurEnergy.size();
if(num < 1) return;
@ -3685,7 +3690,7 @@ public class GammaFileUtil {
}
public void PeaksChanged(PHDFile phd) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
List<Double> vCentroid = new LinkedList<>();
List<Double> vFwhmCh = new LinkedList<>();
List<Double> vTail = new LinkedList<>();
@ -3881,7 +3886,7 @@ public class GammaFileUtil {
InputStream inputStream = null;
File file = null;
//加载dll工具库
System.loadLibrary("ReadPHDFile");
//System.loadLibrary("ReadPHDFile");
try {
//切换被动模式
ftpClient.enterLocalPassiveMode();
@ -3893,7 +3898,7 @@ public class GammaFileUtil {
inputStream = ftpClient.retrieveFileStream(compareFileName);
if (Objects.nonNull(inputStream)) {
//声明一个临时文件
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
@ -4014,7 +4019,7 @@ public class GammaFileUtil {
ftpClient.changeWorkingDirectory(path);
inputStream = ftpClient.retrieveFileStream(fileName);
if (Objects.nonNull(inputStream)){
file = File.createTempFile("tmp", null);
file = File.createTempFile("betaGamma", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
}

View File

@ -15,6 +15,6 @@ public class AnalysisProcess {
// JSON.parseObject(str, PHDFile.class);
// // 通过 redis 订阅发送 websocket 消息
// redisTemplate.convertAndSend(GlobalConstants.REDIS_TOPIC_NAME, params);;
System.out.println(userId);
System.out.println(userId+"-----"+process);
}
}

View File

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

View File

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

View File

@ -37,6 +37,7 @@ import org.jeecg.modules.base.enums.RoleType;
import org.jeecg.modules.entity.vo.*;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.AnalysisProcess;
import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
import org.jeecg.modules.service.*;
@ -177,7 +178,6 @@ public class GammaServiceImpl implements IGammaService {
Result result = new Result();
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
phd.getSetting().setBUpdateCal(false);
phd.setUserId("1");
phd.setXmlFilePath(parameterProperties.getFilePath());
String systemType = fileName.substring(2, 3);
@ -200,7 +200,7 @@ public class GammaServiceImpl implements IGammaService {
try {
String phdStr = mapper.writeValueAsString(phd);
String mapLines = mapper.writeValueAsString(nuclideLinesMap);
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, tmpFile.getAbsolutePath());
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, tmpFile.getAbsolutePath(), new AnalysisProcess());
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
@ -271,6 +271,10 @@ public class GammaServiceImpl implements IGammaService {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewEner(value);
}
if (entry.getKey().equalsIgnoreCase("newReso")) {
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
phd.setNewReso(value);
}
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
Map<String, GEnergyBlock> value = new HashMap<>();
@ -388,22 +392,6 @@ public class GammaServiceImpl implements IGammaService {
return result;
}
public static void main(String[] args) {
System.loadLibrary("GammaAnaly");
String path = "D:\\ARMD\\PHD\\Samplephd\\PHP52_001-20230908_0543_S_PREL_43188.PHD";
ObjectMapper mapper = new ObjectMapper();
try {
String phdStr = mapper.writeValueAsString(new PHDFile());
String mapLines = mapper.writeValueAsString(new HashMap<String, NuclideLines>());
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, path);
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
System.out.println("parseMap:" + parseMap);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
@Override
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
Result result = new Result();
@ -751,7 +739,7 @@ public class GammaServiceImpl implements IGammaService {
vChan.add(c);
c += 1;
}
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
CalValuesOut calValuesOut = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP());
phd.setVEnergy(calValuesOut.counts);
phd.setBAnalyed(true);
@ -1057,7 +1045,7 @@ public class GammaServiceImpl implements IGammaService {
public Result insertPeak(Integer sampleId, String fileName, Integer curChan) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -1923,7 +1911,7 @@ public class GammaServiceImpl implements IGammaService {
public Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -1954,8 +1942,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
EnergyData energyData = new EnergyData();
double delta = (m_vCurEnergy.get(i) - vFit.get(i)) / m_vCurEnergy.get(i) * 100;
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(i)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(i)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
energyData.setFit(String.format("%.3f", vFit.get(i)));
energyData.setDelta(String.format("%.3f", delta));
energyDataList.add(energyData);
@ -1989,7 +1977,7 @@ public class GammaServiceImpl implements IGammaService {
}
private void DataChangeEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
if(m_vCurEnergy.size() < 1) {
return;
} else if(m_vCurEnergy.size() == 1) {
@ -2011,8 +1999,8 @@ public class GammaServiceImpl implements IGammaService {
for(int j=0; j<m_vCurEnergy.size(); j++) {
EnergyData energyData = new EnergyData();
double delta = (m_vCurEnergy.get(j) - vFit.get(j)) / m_vCurEnergy.get(j) * 100;
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(j)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(j)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(j)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(j)));
energyData.setFit(String.format("%.3f", vFit.get(j)));
energyData.setDelta(String.format("%.3f", delta));
energyDataList.add(energyData);
@ -2020,8 +2008,8 @@ public class GammaServiceImpl implements IGammaService {
} else {
for(int j=0; j<m_vCurEnergy.size(); j++) {
EnergyData energyData = new EnergyData();
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(j)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(j)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(j)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(j)));
energyData.setFit("");
energyData.setDelta("");
energyDataList.add(energyData);
@ -2106,7 +2094,7 @@ public class GammaServiceImpl implements IGammaService {
InputStream inputStream = null;
try {
//创建临时文件
tmpFile = File.createTempFile("tmp", null);
tmpFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
//复制上传文件的输入流到临时文件
FileUtils.copyInputStreamToFile(inputStream ,tmpFile);
@ -2144,8 +2132,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
EnergyData energyData = new EnergyData();
double delta = (m_vCurEnergy.get(i) - vFit.get(i)) / m_vCurEnergy.get(i) * 100;
energyData.setChannel(String.format("%.3f", m_vCurCentroid.get(i)));
energyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
energyData.setChannel(String.valueOf(m_vCurCentroid.get(i)));
energyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
energyData.setFit(String.format("%.3f", vFit.get(i)));
energyData.setDelta(String.format("%.3f", delta));
energyDataList.add(energyData);
@ -2199,7 +2187,7 @@ public class GammaServiceImpl implements IGammaService {
public Result resolutionCalibration(Integer sampleId, String fileName, String currentText, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2230,8 +2218,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
ResolutionData resolutionData = new ResolutionData();
double delta = (m_vCurReso.get(i) - vFit.get(i)) / m_vCurReso.get(i) * 100;
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit(String.format("%.3f", vFit.get(i)));
resolutionData.setDelta(String.format("%.3f", delta));
resolutionDataList.add(resolutionData);
@ -2252,7 +2240,7 @@ public class GammaServiceImpl implements IGammaService {
public Result changeDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2266,7 +2254,7 @@ public class GammaServiceImpl implements IGammaService {
}
public void DataChangeResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
m_curParam.setP(CalValuesHandler.calFitPara("Cal_Resolution", 4, m_vCurEnergy, m_vCurReso, m_vCurUncert));
map.put("uncert", m_vCurUncert);
map.put("param", m_curParam);
@ -2277,8 +2265,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
ResolutionData resolutionData = new ResolutionData();
double delta = (m_vCurReso.get(i) - vFit.get(i)) / m_vCurReso.get(i) * 100;
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit(String.format("%.3f", vFit.get(i)));
resolutionData.setDelta(String.format("%.3f", delta));
resolutionDataList.add(resolutionData);
@ -2286,8 +2274,8 @@ public class GammaServiceImpl implements IGammaService {
} else {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
ResolutionData resolutionData = new ResolutionData();
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit("");
resolutionData.setDelta("");
resolutionDataList.add(resolutionData);
@ -2372,7 +2360,7 @@ public class GammaServiceImpl implements IGammaService {
File tmpFile = null;
try {
//创建临时文件
tmpFile = File.createTempFile("tmp", null);
tmpFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
//复制上传文件的输入流到临时文件
FileUtils.copyInputStreamToFile(inputStream ,tmpFile);
@ -2410,8 +2398,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
ResolutionData resolutionData = new ResolutionData();
double delta = (m_vCurReso.get(i) - vFit.get(i)) / m_vCurReso.get(i) * 100;
resolutionData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.format("%.3f", m_vCurReso.get(i)));
resolutionData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
resolutionData.setFwhm(String.valueOf(m_vCurReso.get(i)));
resolutionData.setFit(String.format("%.3f", vFit.get(i)));
resolutionData.setDelta(String.format("%.3f", delta));
resolutionDataList.add(resolutionData);
@ -2474,7 +2462,7 @@ public class GammaServiceImpl implements IGammaService {
m_vFuncName.add("HAE Efficiency(1-2)"); // 94
m_vFuncName.add("HAE Efficiency(1-2-3)"); // 95
map.put("function", m_vFuncName);
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2505,8 +2493,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
double delta = (m_vCurEffi.get(i) - vFit.get(i)) / m_vCurEffi.get(i) * 100;
EfficiencyData efficiencyData = new EfficiencyData();
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit(String.format("%.3f", vFit.get(i)));
efficiencyData.setDelta(String.format("%.3f", delta));
efficiencyDataList.add(efficiencyData);
@ -2527,7 +2515,7 @@ public class GammaServiceImpl implements IGammaService {
public Result changeDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, Integer sampleId, String fileName, Double width) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
PHDFile phd = phdCache.getIfPresent(fileName);
if (Objects.isNull(phd)){
@ -2541,7 +2529,7 @@ public class GammaServiceImpl implements IGammaService {
}
public void DataChangeEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, PHDFile phd, Double width, Map<String, Object> map) {
System.loadLibrary("GammaAnaly");
//System.loadLibrary("GammaAnaly");
m_curParam.setP(CalValuesHandler.calFitPara("Cal_Efficiency", funcId, m_vCurEnergy, m_vCurEffi, m_vCurUncert));
map.put("uncert", m_vCurUncert);
map.put("param", m_curParam);
@ -2552,8 +2540,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
EfficiencyData efficiencyData = new EfficiencyData();
double delta = (m_vCurEffi.get(i) - vFit.get(i)) / m_vCurEffi.get(i) * 100;
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit(String.format("%.3f", vFit.get(i)));
efficiencyData.setDelta(String.format("%.3f", delta));
efficiencyDataList.add(efficiencyData);
@ -2561,8 +2549,8 @@ public class GammaServiceImpl implements IGammaService {
} else {
for(int i=0; i<m_vCurEnergy.size(); ++i) {
EfficiencyData efficiencyData = new EfficiencyData();
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit("");
efficiencyData.setDelta("");
efficiencyDataList.add(efficiencyData);
@ -2649,7 +2637,7 @@ public class GammaServiceImpl implements IGammaService {
InputStream inputStream = null;
try {
//创建临时文件
tmpFile = File.createTempFile("tmp", null);
tmpFile = File.createTempFile("betaGamma", null);
inputStream = file.getInputStream();
//复制上传文件的输入流到临时文件
FileUtils.copyInputStreamToFile(inputStream ,tmpFile);
@ -2698,8 +2686,8 @@ public class GammaServiceImpl implements IGammaService {
for(int i=0; i<num; ++i) {
double delta = (m_vCurEffi.get(i) - vFit.get(i)) / m_vCurEffi.get(i) * 100;
EfficiencyData efficiencyData = new EfficiencyData();
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.format("%.3f", m_vCurEffi.get(i)));
efficiencyData.setEnergy(String.valueOf(m_vCurEnergy.get(i)));
efficiencyData.setEfficiency(String.valueOf(m_vCurEffi.get(i)));
efficiencyData.setFit(String.format("%.3f", vFit.get(i)));
efficiencyData.setDelta(String.format("%.3f", delta));
efficiencyDataList.add(efficiencyData);

View File

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

View File

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

View File

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