Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
51373c79d2
|
@ -0,0 +1,11 @@
|
||||||
|
package org.jeecg.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Websocket Redis Monitor Handler
|
||||||
|
*/
|
||||||
|
public class WebSocketHandlerConst {
|
||||||
|
/**
|
||||||
|
* Gamma 分析
|
||||||
|
*/
|
||||||
|
public static final String GAMMA_ANALYSIS_HANDLER = "gammaAnalysisHandler";
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||||
import org.jeecg.common.util.DateUtils;
|
import org.jeecg.common.util.DateUtils;
|
||||||
import org.jeecg.common.util.FTPUtil;
|
import org.jeecg.common.util.FTPUtil;
|
||||||
|
import org.jeecg.common.util.NameStandUtil;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||||
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
||||||
|
@ -2788,7 +2789,7 @@ public class GammaFileUtil {
|
||||||
String subDirSavePath = "";
|
String subDirSavePath = "";
|
||||||
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
||||||
subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType);
|
subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType);
|
||||||
Map<String, String> fileNames = nameStandUtil.NameStandard(subDirSavePath, fileAnlyse);
|
Map<String, String> fileNames = nameStandUtil.NameStandard(fileAnlyse);
|
||||||
String lcName = fileNames.get("lc");
|
String lcName = fileNames.get("lc");
|
||||||
String scacName = fileNames.get("scac");
|
String scacName = fileNames.get("scac");
|
||||||
String baselineName = fileNames.get("baseline");
|
String baselineName = fileNames.get("baseline");
|
||||||
|
|
|
@ -1,196 +0,0 @@
|
||||||
package org.jeecg.common;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
||||||
import org.jeecg.common.util.DateUtils;
|
|
||||||
import org.jeecg.modules.base.enums.DataType;
|
|
||||||
import org.jeecg.modules.base.enums.SystemType;
|
|
||||||
import org.jeecg.modules.entity.vo.PHDFile;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class NameStandUtil {
|
|
||||||
|
|
||||||
public String GetSysTemSubdir(String systemType) {
|
|
||||||
StringBuffer path = new StringBuffer();
|
|
||||||
if(systemType.contains(SystemType.BETA.getType())) {
|
|
||||||
path.append(StringPool.SLASH+"Spectrum");
|
|
||||||
path.append(StringPool.SLASH+"Xenon");
|
|
||||||
path.append(StringPool.SLASH+"Sauna");
|
|
||||||
} else if(systemType.contains(SystemType.GAMMA.getType())) {
|
|
||||||
path.append(StringPool.SLASH+"Spectrum");
|
|
||||||
path.append(StringPool.SLASH+"Xenon");
|
|
||||||
path.append(StringPool.SLASH+"Spalax");
|
|
||||||
} else if(systemType.contains(SystemType.PARTICULATE.getType())) {
|
|
||||||
path.append(StringPool.SLASH+"Spectrum");
|
|
||||||
path.append(StringPool.SLASH+"Particulates");
|
|
||||||
}
|
|
||||||
return path.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String GetDateTypeSubdir(String dataType){
|
|
||||||
StringBuffer path = new StringBuffer();
|
|
||||||
if(dataType.contains(DataType.SAMPLEPHD.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Samplephd");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.QCPHD.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Qcphd");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.DETBKPHD.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Detbkphd");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.GASBKPHD.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Gasbkphd");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.SOH.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Soh");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.MET.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Met");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.ALERT_FLOW.getType())||
|
|
||||||
dataType.contains(DataType.ALERT_SYSTEM.getType())||
|
|
||||||
dataType.contains(DataType.ALERT_TEMP.getType())||
|
|
||||||
dataType.contains(DataType.ALERT_UPS.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Alert");
|
|
||||||
}
|
|
||||||
else if(dataType.contains(DataType.ERROR.getType()))
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Error");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
path.append(StringPool.SLASH+"Other");
|
|
||||||
}
|
|
||||||
return path.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> NameStandard(String path, PHDFile fileAnlyse) {
|
|
||||||
String suffix = GetSuffix(fileAnlyse.getMsgInfo().getData_type(),fileAnlyse.getHeader().getSystem_type(),fileAnlyse.getHeader().getSpectrum_quantity(),String.valueOf(fileAnlyse.getAcq().getAcquisition_live_time()));
|
|
||||||
Map<String, String> fileNames = NameStandardByName(path, fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix);
|
|
||||||
return fileNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String GetSuffix(String dataType,String sysType,String Fulltype,String LT) {
|
|
||||||
String rData = "";
|
|
||||||
BigDecimal bd = new BigDecimal(LT);
|
|
||||||
if(dataType.contains(DataType.SAMPLEPHD.getType())) {
|
|
||||||
bd = bd.setScale(1, RoundingMode.HALF_UP);
|
|
||||||
rData = "_S_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
} else if(dataType.contains(DataType.GASBKPHD.getType())){
|
|
||||||
bd = bd.setScale(1, RoundingMode.HALF_UP);
|
|
||||||
rData = "_G_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
}else if(dataType.contains(DataType.DETBKPHD.getType())){
|
|
||||||
bd = bd.setScale(0, RoundingMode.HALF_UP);
|
|
||||||
rData = "_D_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
}else if(dataType.contains(DataType.QCPHD.getType())){
|
|
||||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
|
||||||
rData = "_Q_"+Fulltype+"_"+bd+".PHD";
|
|
||||||
}
|
|
||||||
return rData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> NameStandardByName(String path, String fileName, String dateTimeFormat, String suffix) {
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
String StandardFileName="";
|
|
||||||
String measurementName = GetFileNameFromDateTime(dateTimeFormat, suffix);
|
|
||||||
String fileDir = path + StringPool.SLASH;
|
|
||||||
if(measurementName != fileName) {
|
|
||||||
StandardFileName = fileDir+measurementName;
|
|
||||||
}
|
|
||||||
String fileSuffix = "PHD";
|
|
||||||
|
|
||||||
String m_lcFileName = StandardFileName;
|
|
||||||
String m_baseLineFileName = StandardFileName;
|
|
||||||
String m_scacFileName = StandardFileName;
|
|
||||||
String m_logfileName = StandardFileName;
|
|
||||||
String m_reportFileName = StandardFileName;
|
|
||||||
|
|
||||||
m_lcFileName.replace(fileSuffix,"lc");
|
|
||||||
m_baseLineFileName.replace(fileSuffix,"baseline");
|
|
||||||
m_scacFileName.replace(fileSuffix,"scac");
|
|
||||||
m_logfileName.replace(fileSuffix,"log");
|
|
||||||
m_reportFileName.replace("."+fileSuffix,"_rpt");
|
|
||||||
|
|
||||||
String m_saveFileName = StandardFileName;
|
|
||||||
|
|
||||||
map.put("lc", m_lcFileName);
|
|
||||||
map.put("baseline", m_baseLineFileName);
|
|
||||||
map.put("scac", m_scacFileName);
|
|
||||||
map.put("log", m_logfileName);
|
|
||||||
map.put("rpt", m_reportFileName);
|
|
||||||
map.put("saveFile", m_saveFileName);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String GetFileNameFromDateTime(String dateTimeFormat, String suffix){
|
|
||||||
String rData = "";
|
|
||||||
int pos = dateTimeFormat.indexOf("-");
|
|
||||||
if(-1 != pos) {
|
|
||||||
String dateTime = dateTimeFormat;
|
|
||||||
if (pos+17>dateTime.length()){
|
|
||||||
dateTime = dateTime.substring(pos+1);
|
|
||||||
}else {
|
|
||||||
dateTime = dateTime.substring(pos+1, pos+17);
|
|
||||||
}
|
|
||||||
dateTime = dateTime.replace(" ","-");
|
|
||||||
String fileHeader = dateTimeFormat.substring(0, pos+1);
|
|
||||||
String temp = DateTimeStandardToFileFormat(dateTime);
|
|
||||||
rData = fileHeader+ temp + suffix;
|
|
||||||
}
|
|
||||||
return rData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String DateTimeStandardToFileFormat(String data) {
|
|
||||||
String dateTime = "";
|
|
||||||
try {
|
|
||||||
if ( data.indexOf("-") > 0 ){
|
|
||||||
dateTime = DateUtils.formatDate(DateUtils.parseDate(data,"yyyy/MM/dd-HH:mm"), "yyyyMMdd_HHmm");
|
|
||||||
} else if( data.indexOf(" ") > 0 ) {
|
|
||||||
dateTime = DateUtils.formatDate(DateUtils.parseDate(data,"yyyy/MM/dd HH:mm"), "yyyyMMdd_HHmm");
|
|
||||||
} else if( data.indexOf("-")<0 && data.indexOf(" ") < 0) {
|
|
||||||
dateTime = DateUtils.formatDate(DateUtils.parseDate(data,"yyyy/MM/dd"), "yyyyMMdd");
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return dateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String SetFileDir(String path, String saveFileName) {
|
|
||||||
String input_file_name = path;
|
|
||||||
//添加文件名日期
|
|
||||||
List<String> dateSub = GetSubDirByFileName(saveFileName);
|
|
||||||
for(int pos=0;pos<dateSub.size();pos++) {
|
|
||||||
input_file_name=input_file_name+dateSub.get(pos)+StringPool.SLASH;
|
|
||||||
}
|
|
||||||
return input_file_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> GetSubDirByFileName(String fileName) {
|
|
||||||
List<String> rData = new LinkedList<>();
|
|
||||||
int pos = fileName.indexOf('-');
|
|
||||||
if(-1 == pos) {
|
|
||||||
//
|
|
||||||
} else if(fileName.length()>=pos+7) {
|
|
||||||
rData.add(fileName.substring(pos+1, pos+5));
|
|
||||||
rData.add(fileName.substring(pos+5, pos+7));
|
|
||||||
}
|
|
||||||
return rData;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -23,7 +23,6 @@ import org.jeecg.modules.base.entity.rnauto.*;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -104,10 +103,11 @@ public class Sample_G_Analysis {
|
||||||
GammaFileUtil gammaFileUtil = new GammaFileUtil();
|
GammaFileUtil gammaFileUtil = new GammaFileUtil();
|
||||||
PHDFile phdFile = new PHDFile();
|
PHDFile phdFile = new PHDFile();
|
||||||
|
|
||||||
// todo 获取数据库 Gamma 默认参数
|
// 获取数据库 Gamma 默认参数
|
||||||
// todo 文件路径
|
getSettingFromDB(phdFile);
|
||||||
|
// 文件路径
|
||||||
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
|
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||||
// todo 读取文件内容并附值
|
// 读取文件内容并附值
|
||||||
this.setPHDFile(phdFile, this.energySpectrumStruct);
|
this.setPHDFile(phdFile, this.energySpectrumStruct);
|
||||||
// todo 根据系统类型传入不同的核素参数
|
// todo 根据系统类型传入不同的核素参数
|
||||||
Map<String, NuclideLines> nuclideLibs = new HashMap<>();
|
Map<String, NuclideLines> nuclideLibs = new HashMap<>();
|
||||||
|
@ -124,22 +124,22 @@ public class Sample_G_Analysis {
|
||||||
// 获取分析结果ID ==> SELECT IDANALYSIS
|
// 获取分析结果ID ==> SELECT IDANALYSIS
|
||||||
Integer IdAnalysis = getIdAnalysis(sampleId);
|
Integer IdAnalysis = getIdAnalysis(sampleId);
|
||||||
// 修改保存结果状态 ==> UPDATE ORIGINAL.GARDS_SAMPLE_DATA
|
// 修改保存结果状态 ==> UPDATE ORIGINAL.GARDS_SAMPLE_DATA
|
||||||
// serviceQuotes.getSampleDataService().updateStatus(null,null);
|
serviceQuotes.getSampleDataService().updateStatus(null,null);
|
||||||
/* GARDS_CALIBRATION_PAIRS 数据表保存 */
|
/* GARDS_CALIBRATION_PAIRS 数据表保存 */
|
||||||
// saveCalibrationPairs(middleData,sampleId,IdAnalysis);
|
saveCalibrationPairs(middleData, sampleId, IdAnalysis);
|
||||||
/* GARDS_CALIBRATION 数据表保存 */
|
/* GARDS_CALIBRATION 数据表保存 */
|
||||||
// saveCalibration(middleData,sampleId,IdAnalysis);
|
saveCalibration(middleData, sampleId, IdAnalysis);
|
||||||
/* Gards_Peaks 数据表保存 */
|
/* Gards_Peaks 数据表保存 */
|
||||||
// savePeaks(middleData);
|
savePeaks(middleData);
|
||||||
/* Gards_Nucl_Lines_Ided 数据表保存 */
|
/* Gards_Nucl_Lines_Ided 数据表保存 */
|
||||||
// saveNuclLinesIded(middleData,sampleId,IdAnalysis);
|
saveNuclLinesIded(middleData, sampleId, IdAnalysis);
|
||||||
/* Gards_Nucl_Ided 数据表保存 */
|
/* Gards_Nucl_Ided 数据表保存 */
|
||||||
// saveNuclIded(middleData,sampleId,IdAnalysis);
|
saveNuclIded(middleData, sampleId, IdAnalysis);
|
||||||
/* Gards_Qc_Check 数据表保存 */
|
/* Gards_Qc_Check 数据表保存 */
|
||||||
// saveQcCheck(middleData,sampleId,IdAnalysis);
|
saveQcCheck(middleData, sampleId, IdAnalysis, phdFile.getQcItems());
|
||||||
/* */
|
// 生成日志文件
|
||||||
/** 收尾处理 ==> 写日志文件和报告文件 **/
|
|
||||||
writeLog(middleData.getAnalyses_LogPath(), middleData);
|
writeLog(middleData.getAnalyses_LogPath(), middleData);
|
||||||
|
// todo 报告文件
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
|
@ -148,6 +148,11 @@ public class Sample_G_Analysis {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成日志文件
|
||||||
|
* @param logFilePath
|
||||||
|
* @param middleData
|
||||||
|
*/
|
||||||
private void writeLog(String logFilePath, GStoreMiddleProcessData middleData) {
|
private void writeLog(String logFilePath, GStoreMiddleProcessData middleData) {
|
||||||
String sampleId = middleData.getSample_id();
|
String sampleId = middleData.getSample_id();
|
||||||
MyLogFormatUtil myLogFormatUtil = new MyLogFormatUtil();
|
MyLogFormatUtil myLogFormatUtil = new MyLogFormatUtil();
|
||||||
|
@ -411,51 +416,6 @@ public class Sample_G_Analysis {
|
||||||
FileUtil.writeLines(writes, logFilePath, "utf8");
|
FileUtil.writeLines(writes, logFilePath, "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getAttribute(List<String> channel, String channelUnit, List<String> energys, String energyUnit,
|
|
||||||
List<String> errors, String errorUnit){
|
|
||||||
|
|
||||||
List<List<String>> data = new ArrayList<>();
|
|
||||||
List<String> result = new ArrayList<>();
|
|
||||||
|
|
||||||
// 初始化数据
|
|
||||||
for (int i = 0; i < channel.size(); i++) {
|
|
||||||
data.add(Arrays.asList(
|
|
||||||
"Channel : " + channel.get(i) + " " + channelUnit,
|
|
||||||
"Energy : " + energys.get(i) + " " + energyUnit,
|
|
||||||
"Error : " + errors.get(i) + " " + errorUnit)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// 计算每列数据中最长的字符串长度
|
|
||||||
int[] columnWidths = new int[data.get(0).size()];
|
|
||||||
for (List<String> row : data) {
|
|
||||||
for (int i = 0; i < row.size(); i++) {
|
|
||||||
columnWidths[i] = Math.max(columnWidths[i], row.get(i).length());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构造格式化字符串
|
|
||||||
StringBuilder formatBuilder = new StringBuilder();
|
|
||||||
for (int i = 0; i < columnWidths.length; i++) {
|
|
||||||
formatBuilder.append("%-" + (columnWidths[i] + 4) + "s");
|
|
||||||
}
|
|
||||||
formatBuilder.append("\n");
|
|
||||||
String format = formatBuilder.toString();
|
|
||||||
// 格式化输出日志
|
|
||||||
for (List<String> row : data) {
|
|
||||||
String log = String.format(format, row.toArray());
|
|
||||||
result.add(log);
|
|
||||||
System.out.print(log);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
List<String> channels = Arrays.asList("59.541", "88.034", "122.061", "165.857", "391.698", "661.657", "834.838", "898.036", "1115.540", "1173.230", "1332.490", "1836.050");
|
|
||||||
List<String> energies = Arrays.asList("0.168", "0.176", "0.174", "0.155", "0.092", "0.059", "0.051", "0.040", "0.040", "0.031", "0.028", "0.022");
|
|
||||||
List<String> errors = Arrays.asList("0.003", "0.004", "0.003", "0.003", "0.002", "0.001", "0.001", "0.001", "0.001", "0.001", "0.001", "0.000");
|
|
||||||
getAttribute(channels,"",energies,"",errors,"");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAnalysis(GStoreMiddleProcessData middleData,Integer sampleId){
|
public void saveAnalysis(GStoreMiddleProcessData middleData,Integer sampleId){
|
||||||
GardsAnalyses analysis = toAnalysis(middleData);
|
GardsAnalyses analysis = toAnalysis(middleData);
|
||||||
analysis.setSampleId(sampleId);
|
analysis.setSampleId(sampleId);
|
||||||
|
@ -669,10 +629,8 @@ public class Sample_G_Analysis {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveQcCheck(GStoreMiddleProcessData middleData,
|
public void saveQcCheck(GStoreMiddleProcessData middleData,
|
||||||
Integer sampleId, Integer IdAnalysis){
|
Integer sampleId, Integer IdAnalysis,Map<String, QcCheckItem> qcItems){
|
||||||
// Gards_Qc_Check数据表 ==> INSERT INTO RNAUTO.GARDS_QC_CHECK
|
// Gards_Qc_Check数据表 ==> INSERT INTO RNAUTO.GARDS_QC_CHECK
|
||||||
PHDFile phdFile = getSettingFromDB();
|
|
||||||
Map<String, QcCheckItem> qcItems = phdFile.getQcItems();
|
|
||||||
if (MapUtil.isNotEmpty(qcItems)){
|
if (MapUtil.isNotEmpty(qcItems)){
|
||||||
String base_QC = String.valueOf(qcItems.size());
|
String base_QC = String.valueOf(qcItems.size());
|
||||||
QcCheckDto qcCheckDto = new QcCheckDto();
|
QcCheckDto qcCheckDto = new QcCheckDto();
|
||||||
|
@ -772,10 +730,9 @@ public class Sample_G_Analysis {
|
||||||
return fieldMap;
|
return fieldMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PHDFile getSettingFromDB(){
|
public PHDFile getSettingFromDB(PHDFile phdFile){
|
||||||
Map<String, String> mapSetting = serviceQuotes.getGammaDefaultParamsService()
|
Map<String, String> mapSetting = serviceQuotes.getGammaDefaultParamsService()
|
||||||
.mapSetting();
|
.mapSetting();
|
||||||
PHDFile phdFile = new PHDFile();
|
|
||||||
SpecSetup setting = phdFile.getSetting();
|
SpecSetup setting = phdFile.getSetting();
|
||||||
String BaseImprovePSS = mapSetting.get(Setting.BASEIMPROVEPSS);
|
String BaseImprovePSS = mapSetting.get(Setting.BASEIMPROVEPSS);
|
||||||
if (StrUtil.isNotBlank(BaseImprovePSS))
|
if (StrUtil.isNotBlank(BaseImprovePSS))
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPFile;
|
|
||||||
import org.ejml.simple.SimpleMatrix;
|
import org.ejml.simple.SimpleMatrix;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||||
|
@ -366,12 +365,10 @@ public class GammaFileUtil {
|
||||||
String baselineFileName = "RNAUTO_"+subFileName + ".baseline";
|
String baselineFileName = "RNAUTO_"+subFileName + ".baseline";
|
||||||
inputStream = ftpClient.retrieveFileStream(baselineFileName);
|
inputStream = ftpClient.retrieveFileStream(baselineFileName);
|
||||||
if (Objects.nonNull(inputStream)){
|
if (Objects.nonNull(inputStream)){
|
||||||
//声明一个临时文件
|
long start = System.currentTimeMillis();
|
||||||
File file = File.createTempFile("tmp", null);
|
ReadBaseCtrlInfo(phd, inputStream);
|
||||||
//将ftp文件的输入流复制给临时文件
|
long end = System.currentTimeMillis();
|
||||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
System.out.println(end-start);
|
||||||
List<String> readLines = FileUtils.readLines(file, "UTF-8");
|
|
||||||
ReadBaseCtrlInfo(phd,readLines);
|
|
||||||
phd.setVBase(phd.getBaseCtrls().getBaseline());
|
phd.setVBase(phd.getBaseCtrls().getBaseline());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -426,61 +423,7 @@ public class GammaFileUtil {
|
||||||
return vData;
|
return vData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadBaseCtrlInfo(PHDFile phd, List<String> readLines) {
|
public void ReadBaseCtrlInfo(PHDFile phd, InputStream in) {
|
||||||
for (int i=0; i< readLines.size(); i++){
|
|
||||||
String line = readLines.get(i);
|
|
||||||
if (line.contains("#")){
|
|
||||||
String block_name = line.trim();
|
|
||||||
int j=i+1;
|
|
||||||
line = readLines.get(j);
|
|
||||||
String block_data = line;
|
|
||||||
while(j!= readLines.size()-1 && StringUtils.isNotBlank(line)) {
|
|
||||||
j++;
|
|
||||||
line = readLines.get(j);
|
|
||||||
if (!line.contains("#")){
|
|
||||||
block_data += StringPool.SPACE + line;
|
|
||||||
}else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i=j-1;
|
|
||||||
block_data = block_data.trim();
|
|
||||||
List<String> str_list = Arrays.asList(block_data.split("\\s+"));
|
|
||||||
if(str_list.size() < 1){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<Double> vTemp = new LinkedList<>();
|
|
||||||
for(String str:str_list) {
|
|
||||||
if (StringUtils.isNotBlank(str) && !str.equalsIgnoreCase("nan")){
|
|
||||||
double d = Double.valueOf(str);
|
|
||||||
vTemp.add(d);
|
|
||||||
} else if (StringUtils.isNotBlank(str) && str.equalsIgnoreCase("nan")) {
|
|
||||||
vTemp.add(0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(block_name.contains("#AnalyseRange")) {
|
|
||||||
if(vTemp.size() == 2) {
|
|
||||||
phd.getBaseCtrls().setRg_low(vTemp.get(0).intValue());
|
|
||||||
phd.getBaseCtrls().setRg_high(vTemp.get(1).intValue());
|
|
||||||
}
|
|
||||||
} else if(block_name.contains("#XCtrl")) {
|
|
||||||
phd.getBaseCtrls().setXCtrl(vTemp);
|
|
||||||
} else if(block_name.contains("#YCtrl")) {
|
|
||||||
phd.getBaseCtrls().setYCtrl(vTemp);
|
|
||||||
} else if(block_name.contains("#YSlope")) {
|
|
||||||
phd.getBaseCtrls().setYSlope(vTemp);
|
|
||||||
} else if(block_name.contains("#Baseline")) {
|
|
||||||
List<Double> list = vTemp.subList(1, vTemp.size());
|
|
||||||
phd.getBaseCtrls().setBaseline(list);
|
|
||||||
} else if(block_name.contains("#StepCounts")) {
|
|
||||||
List<Double> list = vTemp.subList(1, vTemp.size());
|
|
||||||
phd.getBaseCtrls().setStepCounts(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ReadBaseCtrlInfo(PHDFile phd, InputStream in){
|
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||||
String line ;
|
String line ;
|
||||||
|
@ -509,20 +452,25 @@ public class GammaFileUtil {
|
||||||
phd.getBaseCtrls().setRg_low(vTemp.get(0).intValue());
|
phd.getBaseCtrls().setRg_low(vTemp.get(0).intValue());
|
||||||
phd.getBaseCtrls().setRg_high(vTemp.get(1).intValue());
|
phd.getBaseCtrls().setRg_high(vTemp.get(1).intValue());
|
||||||
}
|
}
|
||||||
} else if(map.containsKey("#XCtrl")) {
|
}
|
||||||
|
if(map.containsKey("#XCtrl")) {
|
||||||
List<Double> vTemp = map.get("#XCtrl");
|
List<Double> vTemp = map.get("#XCtrl");
|
||||||
phd.getBaseCtrls().setXCtrl(vTemp);
|
phd.getBaseCtrls().setXCtrl(vTemp);
|
||||||
} else if(map.containsKey("#YCtrl")) {
|
}
|
||||||
|
if(map.containsKey("#YCtrl")) {
|
||||||
List<Double> vTemp = map.get("#YCtrl");
|
List<Double> vTemp = map.get("#YCtrl");
|
||||||
phd.getBaseCtrls().setYCtrl(vTemp);
|
phd.getBaseCtrls().setYCtrl(vTemp);
|
||||||
} else if(map.containsKey("#YSlope")) {
|
}
|
||||||
|
if(map.containsKey("#YSlope")) {
|
||||||
List<Double> vTemp = map.get("#YSlope");
|
List<Double> vTemp = map.get("#YSlope");
|
||||||
phd.getBaseCtrls().setYSlope(vTemp);
|
phd.getBaseCtrls().setYSlope(vTemp);
|
||||||
} else if(map.containsKey("#Baseline")) {
|
}
|
||||||
|
if(map.containsKey("#Baseline")) {
|
||||||
List<Double> vTemp = map.get("#Baseline");
|
List<Double> vTemp = map.get("#Baseline");
|
||||||
List<Double> list = vTemp.subList(1, vTemp.size());
|
List<Double> list = vTemp.subList(1, vTemp.size());
|
||||||
phd.getBaseCtrls().setBaseline(list);
|
phd.getBaseCtrls().setBaseline(list);
|
||||||
} else if(map.containsKey("#StepCounts")) {
|
}
|
||||||
|
if(map.containsKey("#StepCounts")) {
|
||||||
List<Double> vTemp = map.get("#StepCounts");
|
List<Double> vTemp = map.get("#StepCounts");
|
||||||
List<Double> list = vTemp.subList(1, vTemp.size());
|
List<Double> list = vTemp.subList(1, vTemp.size());
|
||||||
phd.getBaseCtrls().setStepCounts(list);
|
phd.getBaseCtrls().setStepCounts(list);
|
||||||
|
@ -2761,6 +2709,14 @@ public class GammaFileUtil {
|
||||||
return strBuffer.toString();
|
return strBuffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Double> DoubleLimit_L(List<Long> data) {
|
||||||
|
List<Double> rData = new LinkedList<>();
|
||||||
|
for(int pos=0;pos<data.size();pos++) {
|
||||||
|
rData.add(Double.valueOf(String.valueOf(data.get(pos))));
|
||||||
|
}
|
||||||
|
return rData;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> DoubleLimit(List data) {
|
public List<String> DoubleLimit(List data) {
|
||||||
List<String> rData = new LinkedList<>();
|
List<String> rData = new LinkedList<>();
|
||||||
for(int pos=0;pos<data.size();pos++) {
|
for(int pos=0;pos<data.size();pos++) {
|
||||||
|
|
|
@ -3,10 +3,16 @@ package org.jeecg.modules.controller;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.base.BaseMap;
|
||||||
|
import org.jeecg.common.constant.GlobalConstants;
|
||||||
|
import org.jeecg.common.constant.WebSocketHandlerConst;
|
||||||
import org.jeecg.modules.base.bizVo.GammaRLR;
|
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysUser;
|
||||||
import org.jeecg.modules.entity.vo.*;
|
import org.jeecg.modules.entity.vo.*;
|
||||||
|
import org.jeecg.modules.feignclient.SystemClient;
|
||||||
import org.jeecg.modules.service.IGammaService;
|
import org.jeecg.modules.service.IGammaService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@ -22,12 +28,35 @@ public class GammaController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGammaService gammaService;
|
private IGammaService gammaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SystemClient systemClient;
|
||||||
|
|
||||||
@GetMapping("initValue")
|
@GetMapping("initValue")
|
||||||
@ApiOperation(value = "初始化gamma数据", notes = "初始化gamma数据")
|
@ApiOperation(value = "初始化gamma数据", notes = "初始化gamma数据")
|
||||||
public Result initValue(Integer sampleId, String dbName, HttpServletRequest request) {
|
public Result initValue(Integer sampleId, String dbName, HttpServletRequest request) {
|
||||||
return gammaService.initValue(sampleId, dbName, request);
|
return gammaService.initValue(sampleId, dbName, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("analysisProcess")
|
||||||
|
@ApiOperation(value = "分析进度", notes = "分析进度")
|
||||||
|
public void message(String message) {
|
||||||
|
Result<SysUser> user = systemClient.getUserData();
|
||||||
|
BaseMap params = new BaseMap();
|
||||||
|
params.put(GlobalConstants.HANDLER_NAME, WebSocketHandlerConst.GAMMA_ANALYSIS_HANDLER);
|
||||||
|
params.put("userId", user.getResult().getId());
|
||||||
|
params.put("message", message);
|
||||||
|
// 通过 redis 订阅发送 websocket 消息
|
||||||
|
redisTemplate.convertAndSend(GlobalConstants.REDIS_TOPIC_NAME, params);;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("testFun")
|
||||||
|
public Result testFun(String fileName){
|
||||||
|
return gammaService.testFun(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("gammaByDB")
|
@GetMapping("gammaByDB")
|
||||||
public Result gammaByDB(Integer sampleId, String dbName, HttpServletRequest request){
|
public Result gammaByDB(Integer sampleId, String dbName, HttpServletRequest request){
|
||||||
return gammaService.gammaByDB(dbName, sampleId, request);
|
return gammaService.gammaByDB(dbName, sampleId, request);
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.jeecg.modules.feignclient;
|
||||||
|
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysUser;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@FeignClient("jeecg-system")
|
||||||
|
public interface SystemClient {
|
||||||
|
|
||||||
|
/* 获取当前用户信息 */
|
||||||
|
@GetMapping("/sys/user/login/setting/getUserData")
|
||||||
|
Result<SysUser> getUserData();
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.native_jni;
|
package org.jeecg.modules.native_jni;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.jeecg.modules.entity.vo.PeakInfo;
|
import org.jeecg.modules.entity.vo.PeakInfo;
|
||||||
import org.jeecg.modules.entity.vo.StructInsertInput;
|
import org.jeecg.modules.entity.vo.StructInsertInput;
|
||||||
import org.jeecg.modules.entity.vo.StructInsertOutput;
|
import org.jeecg.modules.entity.vo.StructInsertOutput;
|
||||||
|
@ -38,9 +39,9 @@ public class CalValuesHandler {
|
||||||
|
|
||||||
public static native String calUpdate(String dataType, List<Double> certEne, boolean E1, boolean R, boolean E2, boolean KeepCalPeakSearchPeaks, double k_back, double k_alpha, double k_beta);
|
public static native String calUpdate(String dataType, List<Double> certEne, boolean E1, boolean R, boolean E2, boolean KeepCalPeakSearchPeaks, double k_back, double k_alpha, double k_beta);
|
||||||
|
|
||||||
public static native String peakSearch(double ECutLow, double ECutHigh, double deltaE, double pssLow, double k_back, double k_alpha, double k_beta);
|
public static native String peakSearch(double ECutLow, double ECutHigh, double deltaE, double pssLow, double k_back, double k_alpha, double k_beta, List<PeakInfo> Peaks);
|
||||||
|
|
||||||
public static native String baseImprove(double BaseImprovePSS, double k_back, double k_alpha, double k_beta);
|
public static native String baseImprove(double BaseImprovePSS, double k_back, double k_alpha, double k_beta, double ECutLow, double ECutHigh, double deltaE, double pssLow);
|
||||||
|
|
||||||
public static native String fitPeakFull();
|
public static native String fitPeakFull();
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ public interface IGammaService{
|
||||||
|
|
||||||
Result initValue(Integer sampleId, String dbName, HttpServletRequest request);
|
Result initValue(Integer sampleId, String dbName, HttpServletRequest request);
|
||||||
|
|
||||||
|
Result testFun(String fileName);
|
||||||
|
|
||||||
Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request);
|
Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request);
|
||||||
|
|
||||||
Result gammaByFile(String fileName, HttpServletRequest request);
|
Result gammaByFile(String fileName, HttpServletRequest request);
|
||||||
|
|
|
@ -143,6 +143,35 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result testFun(String fileName) {
|
||||||
|
Result result = new Result();
|
||||||
|
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||||
|
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
System.loadLibrary("GammaAnaly");
|
||||||
|
// List<Double> baseInfo_s_Energy = CalValuesHandler.calValues(0, phd.getSpec().getCounts().size());
|
||||||
|
// map.put("baseInfo_s_Energy", baseInfo_s_Energy);
|
||||||
|
// List<Double> baseInfo_s_fwhmcAll = CalValuesHandler.GetFwhmcAll(phd.getSpec().getCounts().size());
|
||||||
|
// map.put("baseInfo_s_fwhmcAll", baseInfo_s_fwhmcAll);
|
||||||
|
// List<Double> baseInfo_s_Lc = CalValuesHandler.calculateLC(phd.getBaseCtrls().getBaseline(), baseInfo_s_fwhmcAll, phd.getSetting().getRiskLevelK());
|
||||||
|
// map.put("baseInfo_s_Lc", baseInfo_s_Lc);
|
||||||
|
// List<Double> values = gammaFileUtil.DoubleLimit_L(phd.getSpec().getCounts());
|
||||||
|
// List<Double> baseInfo_s_Scac = CalValuesHandler.calculateSCAC(values, phd.getBaseCtrls().getBaseline(), baseInfo_s_fwhmcAll);
|
||||||
|
// map.put("baseInfo_s_Scac", baseInfo_s_Scac);
|
||||||
|
// boolean armaAny = CalValuesHandler.armaAny(values);
|
||||||
|
// map.put("armaAny", armaAny);
|
||||||
|
String dataType = phd.getMsgInfo().getData_type().substring(0, 1);
|
||||||
|
List<Double> gEnergy = phd.getCertificate().getG_energy();
|
||||||
|
String calUpdateStr = CalValuesHandler.calUpdate(dataType, gEnergy, true, true, true, phd.getSetting().isKeepCalPeakSearchPeaks(), phd.getSetting().getK_back(), phd.getSetting().getK_alpha(), phd.getSetting().getK_beta());
|
||||||
|
map.put("calUpdateStr", calUpdateStr);
|
||||||
|
// CalValuesHandler.peakSearch(phd.getSetting().getECutAnalysis_Low(), phd.getSetting().getECutAnalysis_High(),
|
||||||
|
// phd.getSetting().getEnergyTolerance(), phd.getSetting().getPSS_low(), phd.getSetting().getK_back(), phd.getSetting().getK_alpha(), phd.getSetting().getK_beta(), phd.getVPeak());
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
|
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
@ -1851,7 +1880,7 @@ public class GammaServiceImpl implements IGammaService {
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
//从最后一个。切割文件名称 获取文件名称后缀
|
//从最后一个。切割文件名称 获取文件名称后缀
|
||||||
String fileSuffix = fileName.substring(fileName.lastIndexOf(StringPool.DOT));
|
String fileSuffix = fileName.substring(fileName.lastIndexOf(StringPool.DOT));
|
||||||
if (fileSuffix.equalsIgnoreCase(".eft")) {
|
if (fileSuffix.equalsIgnoreCase(".eft") || fileSuffix.equalsIgnoreCase(".ent")) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
List<Double> m_vCurEffi = new LinkedList<>();
|
List<Double> m_vCurEffi = new LinkedList<>();
|
||||||
List<Double> m_vCurEnergy = new LinkedList<>();
|
List<Double> m_vCurEnergy = new LinkedList<>();
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.jeecg.modules.message.handle;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.base.BaseMap;
|
||||||
|
import org.jeecg.common.constant.WebSocketHandlerConst;
|
||||||
|
import org.jeecg.common.modules.redis.listener.JeecgRedisListener;
|
||||||
|
import org.jeecg.modules.message.websocket.WebSocket;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析进度
|
||||||
|
* @author xiao
|
||||||
|
* @date: 9 月 22 日
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component(WebSocketHandlerConst.GAMMA_ANALYSIS_HANDLER)
|
||||||
|
public class AnalysisHandler implements JeecgRedisListener {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WebSocket webSocket;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(BaseMap message) {
|
||||||
|
webSocket.sendMessage(message.get("userId").toString(), message.get("message"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user