Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
5eb536c21d
|
@ -20,15 +20,15 @@ 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("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("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("Spectrum");
|
||||
path.append(StringPool.SLASH+"Particulates");
|
||||
}
|
||||
return path.toString();
|
||||
|
@ -78,9 +78,9 @@ public class NameStandUtil {
|
|||
return path.toString();
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandard(String path, PHDFile fileAnlyse) {
|
||||
public Map<String, String> NameStandard(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);
|
||||
Map<String, String> fileNames = NameStandardByName(fileAnlyse.getFilename(), fileAnlyse.getHeader().getMeasurement_id(),suffix);
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
|
@ -117,13 +117,12 @@ public class NameStandUtil {
|
|||
return rData;
|
||||
}
|
||||
|
||||
public Map<String, String> NameStandardByName(String path, String fileName, String dateTimeFormat, String suffix) {
|
||||
public Map<String, String> NameStandardByName(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;
|
||||
StandardFileName = measurementName;
|
||||
}
|
||||
String fileSuffix = "PHD";
|
||||
|
||||
|
@ -133,11 +132,11 @@ public class NameStandUtil {
|
|||
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");
|
||||
m_lcFileName = m_lcFileName.replace(fileSuffix,"lc");
|
||||
m_baseLineFileName = m_baseLineFileName.replace(fileSuffix,"baseline");
|
||||
m_scacFileName = m_scacFileName.replace(fileSuffix,"scac");
|
||||
m_logfileName = m_logfileName.replace(fileSuffix,"log");
|
||||
m_reportFileName = m_reportFileName.replace("."+fileSuffix,"_rpt");
|
||||
|
||||
String m_saveFileName = StandardFileName;
|
||||
|
||||
|
@ -189,7 +188,7 @@ public class NameStandUtil {
|
|||
//添加文件名日期
|
||||
List<String> dateSub = GetSubDirByFileName(saveFileName);
|
||||
for(int pos=0;pos<dateSub.size();pos++) {
|
||||
input_file_name=input_file_name+dateSub.get(pos)+StringPool.SLASH;
|
||||
input_file_name=input_file_name+StringPool.SLASH+dateSub.get(pos);
|
||||
}
|
||||
return input_file_name;
|
||||
}
|
|
@ -68,7 +68,6 @@ public class FileSourceHandleManager {
|
|||
@Override
|
||||
public void run() {
|
||||
for(;;){
|
||||
System.out.println("222222222222222222222222222222222222222222222222222222222222222222222222222222222");
|
||||
long start = System.currentTimeMillis();
|
||||
FTPUtils ftpUtil = null;
|
||||
try {
|
||||
|
@ -143,7 +142,6 @@ public class FileSourceHandleManager {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
System.out.println("4444444444444444444444444444444444444444444444444444444444444444444444444444444444");
|
||||
//初始化FTP客户端对象
|
||||
final FTPProperties ftpProperties = spectrumServiceQuotes.getFtpProperties();
|
||||
this.ftpUtil = new FTPUtils(ftpProperties.getHost(),ftpProperties.getPort(),ftpProperties.getUserName(),
|
||||
|
|
|
@ -63,7 +63,6 @@ public class UndealHandleManager {
|
|||
@Override
|
||||
public void run() {
|
||||
for(;;){
|
||||
System.out.println("1111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
long start = System.currentTimeMillis();
|
||||
FTPUtils ftpUtil = null;
|
||||
try {
|
||||
|
@ -135,7 +134,6 @@ public class UndealHandleManager {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
System.out.println("33333333333333333333333333333333333333333333333333333333333333333333333333333333333");
|
||||
//初始化FTP客户端对象
|
||||
final FTPProperties ftpProperties = spectrumServiceQuotes.getFtpProperties();
|
||||
this.ftpUtil = new FTPUtils(ftpProperties.getHost(),ftpProperties.getPort(),ftpProperties.getUserName(),
|
||||
|
|
|
@ -39,13 +39,17 @@ public class DetbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
//处理流程日志
|
||||
super.handleProcessLog();
|
||||
}catch (Exception e){
|
||||
//异常结束日志
|
||||
super.exceptionEndLog(e);
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//结束流程日志
|
||||
super.storageProcessLogEnd();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
|
|
|
@ -40,13 +40,17 @@ public class GasbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
//处理流程日志
|
||||
super.handleProcessLog();
|
||||
}catch (Exception e){
|
||||
//异常结束日志
|
||||
super.exceptionEndLog(e);
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//结束流程日志
|
||||
super.storageProcessLogEnd();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,233 @@
|
|||
package org.jeecg.modules.spectrum;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.enums.SampleStatus;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* B谱邮件解析流程日志
|
||||
*/
|
||||
public class ParsingProcessLog {
|
||||
|
||||
/**
|
||||
* 日志内容
|
||||
*/
|
||||
private StringBuilder log = new StringBuilder();
|
||||
/**
|
||||
* 日志存储结束标记
|
||||
*/
|
||||
private boolean logStoreEndFlag = false;
|
||||
/**
|
||||
* 日志分析结束标记
|
||||
*/
|
||||
private boolean logAnalyseEndFlag = false;
|
||||
/**
|
||||
* 能谱处理父类
|
||||
*/
|
||||
@Setter
|
||||
private S_D_Q_G_SpectrumHandler spectrumHandler;
|
||||
/**
|
||||
* 能谱分析类
|
||||
*/
|
||||
@Setter
|
||||
private Sample_B_Analysis sample_B_Analysis;
|
||||
/**
|
||||
* 解析过程日志对象
|
||||
*/
|
||||
private StorageProcessLog processLog;
|
||||
|
||||
/**
|
||||
* 存储过程日志处理
|
||||
*/
|
||||
protected class StorageProcessLog{
|
||||
|
||||
private static final String WRITE_INTO_START = "%s Write Data into Database at %s %s";
|
||||
private static final String APPLICATION_PATH = "ApplicationPath:%s,ApplicationName:%s,started by RNAUTO at %s";
|
||||
private static final String DATABASE_CONNECTED = "Successfully connected to database,source:%s,user=%s";
|
||||
private static final String SOURCE_FILE = "SourceFile:%s";
|
||||
private static final String STANDARD_FILE = "StandardFile:%s";
|
||||
private static final String DETECTOR_ID = "Detector ID:%s";
|
||||
private static final String STATION_ID = "Station ID:%s";
|
||||
private static final String SAMPLE_ID = "Sample ID:%s";
|
||||
private static final String INSTANCE_STATUS = "Instance status successfully set to:%s.....";
|
||||
private static final String WRITE_INTO_SUCCESS = "%s Write Data into Database Successfully at %s %s";
|
||||
private static final String FILE_REPEAT = "File: %s repeat";
|
||||
private static final String WRITE_INTO_ERROR = "%s Write Data into Database Error at %s %s";
|
||||
|
||||
/**
|
||||
* 开始处理存储过程日志
|
||||
*/
|
||||
private void start(){
|
||||
//获取数据源属性
|
||||
final String oraUsername = spectrumHandler.spectrumServiceQuotes.getOraDataSourceProperties().getUsername();
|
||||
final String oraUrl = spectrumHandler.spectrumServiceQuotes.getOraDataSourceProperties().getUrl();
|
||||
final String startIntoDatabaseTime = DateUtils.formatDate(spectrumHandler.startIntoDatabaseTime, "yyyy-MM-dd HH:mm:ss");
|
||||
final String standardFile = spectrumHandler.spectrumServiceQuotes.getFtpProperties().getFtpRootPath() + StringConstant.SLASH + spectrumHandler.ftpSavePath;
|
||||
log.append(titleFormat(WRITE_INTO_START,26, StringConstant.DASH,startIntoDatabaseTime,StringConstant.DASH));
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(rowFormat(APPLICATION_PATH,spectrumHandler.getProjectAbsolutePath(),spectrumHandler.getProjectName(),startIntoDatabaseTime));
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(rowFormat(DATABASE_CONNECTED,oraUrl.substring(oraUrl.lastIndexOf(":")+1),oraUsername));
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(rowFormat(SOURCE_FILE,spectrumHandler.mailFile.getAbsolutePath()));
|
||||
log.append(System.lineSeparator());
|
||||
log.append(rowFormat(STANDARD_FILE,standardFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件重复结束日志
|
||||
*/
|
||||
private void endOfFileRepeat(){
|
||||
final String endIntoDatabaseTime = DateUtils.formatDate(spectrumHandler.endIntoDatabaseTime, "yyyy-MM-dd HH:mm:ss");
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(rowFormat(FILE_REPEAT,spectrumHandler.ftpSavePath));
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(titleFormat(WRITE_INTO_ERROR,19,StringConstant.DASH,endIntoDatabaseTime,StringConstant.DASH));
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常结束
|
||||
*/
|
||||
private void end(){
|
||||
final String endIntoDatabaseTime = DateUtils.formatDate(spectrumHandler.endIntoDatabaseTime, "yyyy-MM-dd HH:mm:ss");
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(rowFormat(DETECTOR_ID,spectrumHandler.sampleData.getDetectorId().toString()));
|
||||
log.append(System.lineSeparator());
|
||||
log.append(rowFormat(STATION_ID,spectrumHandler.sampleData.getStationId().toString()));
|
||||
log.append(System.lineSeparator());
|
||||
log.append(rowFormat(SAMPLE_ID,spectrumHandler.sampleData.getSampleId().toString()));
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(rowFormat(INSTANCE_STATUS, SampleStatus.UNTREATED.getValue()));
|
||||
log.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
log.append(titleFormat(WRITE_INTO_SUCCESS,19,StringConstant.DASH,endIntoDatabaseTime,StringConstant.DASH));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分析过程日志
|
||||
*/
|
||||
private class AnalyseProcessLog{
|
||||
private static final String anlyseResultsBegin = "%s Sample Analyse Beginning at %s %s";
|
||||
private static final String titleId = "%s Get DetaId and GasId %s";
|
||||
private static final String getDetaId = "%s Search DetFile :%s SampleID :%s";
|
||||
private static final String titleIdEnd = "%s Get DetaId and GasId finished %s";
|
||||
private static final String titleCalibration = "%s Read calibration data %s";
|
||||
private static final String setSampleBEnergyChannel = "Reading sample beta energy pairs(sampleID: %s).....";
|
||||
private static final String setSampleGEnergyChannel = "Reading sample gamma energy pairs(sampleID: %s).....";
|
||||
private static final String setDetaBEnergyChannel = "Reading DETBK Spectrum beta energy pairs(sampleID: %s).....";
|
||||
private static final String setDetaGEnergyChannel = "Reading DETBK Spectrum gamma energy pairs(sampleID: %s).....";
|
||||
private static final String setGasBEnergyChannel = "Reading GASBK Spectrum beta energy pairs(sampleID: %s).....";
|
||||
private static final String setGasGEnergyChannel = "Reading GASBK Spectrum gamma energy pairs(sampleID: %s)";
|
||||
private static final String getMeasurementTime = "Reading mesurement information.....";
|
||||
|
||||
private static final String dataStore = "Data store %s .....";
|
||||
private static final String setStatus = "Instance status successfully set to: %s .....";
|
||||
private static final String anlyseResultsEnd = "%s Sample Analyse Successfully at %s %s";
|
||||
private static final String dataAnlyseError = "Data Anlyse Error:gas or det file is no exist or is error..";
|
||||
private static final String anlyseResultsErrorEnd="%s Sample Analyse Error at %s %s";
|
||||
|
||||
/**
|
||||
* 开始处理分析过程日志
|
||||
*/
|
||||
private void start(){
|
||||
final String anlyseResultsBegin = "%s Sample Analyse Beginning at %s %s";
|
||||
final String startAnalysisTime = DateUtils.formatDate(sample_B_Analysis.startAnalysisTime, "yyyy-MM-dd HH:mm:ss");
|
||||
log.append(titleFormat(anlyseResultsBegin,26,StringConstant.DASH,startAnalysisTime,StringConstant.DASH));
|
||||
}
|
||||
|
||||
private void setDetAndGasIdLog(){
|
||||
final String titleId = "%s Get DetaId and GasId %s";
|
||||
log.append(titleFormat(titleId,40,StringConstant.DOT,StringConstant.DOT));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始存储流程日志
|
||||
* @return
|
||||
*/
|
||||
protected void storageProcessLogStart(){
|
||||
this.processLog = new StorageProcessLog();
|
||||
this.processLog.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束存储流程日志
|
||||
*/
|
||||
protected void storageProcessLogEnd(){
|
||||
if(this.logStoreEndFlag == false){
|
||||
this.processLog.end();
|
||||
this.logStoreEndFlag = true;
|
||||
this.saveLogToFTP();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件重复异常结束存储流程日志
|
||||
*/
|
||||
protected void endOfFileRepeat(){
|
||||
if(this.logStoreEndFlag == false){
|
||||
this.processLog.endOfFileRepeat();
|
||||
this.logStoreEndFlag = true;
|
||||
this.saveLogToFTP();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存日志到ftp
|
||||
*/
|
||||
private void saveLogToFTP(){
|
||||
//保存日志文件到ftp
|
||||
final SpectrumPathProperties properties = spectrumHandler.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
spectrumHandler.logFilePath = spectrumHandler.getFileSavePath();
|
||||
spectrumHandler.logFileName = spectrumHandler.mailFile.getName().replace(spectrumHandler.currDataType.getSuffix(),SpectrumHandler.LOG_FILE_SUFFIX);
|
||||
|
||||
spectrumHandler.ftpUtil.saveOrAppendFile(properties.getLogPath()+StringConstant.SLASH+spectrumHandler.logFilePath,spectrumHandler.logFileName,new ByteArrayInputStream(log.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
ParsingProcessLog s = new ParsingProcessLog();
|
||||
s.storageProcessLogStart();
|
||||
s.endOfFileRepeat();
|
||||
System.out.println(s.log.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 行日志格式化
|
||||
* @param source 需要格式化的字符串
|
||||
* @param symbolNum 格式化的符号数量
|
||||
* @param args 格式化替换参数数组
|
||||
* @return
|
||||
*/
|
||||
private String titleFormat(String source, Integer symbolNum, String... args){
|
||||
StringBuilder firstParam = new StringBuilder();
|
||||
for (int i=0;i<symbolNum;i++){
|
||||
firstParam.append(args[0]);
|
||||
}
|
||||
args[0] = firstParam.toString();
|
||||
|
||||
StringBuilder lastParam = new StringBuilder();
|
||||
for (int i=0;i<symbolNum;i++){
|
||||
lastParam.append(args[args.length-1]);
|
||||
}
|
||||
args[args.length-1] = lastParam.toString();
|
||||
|
||||
return String.format(source,args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 行格式化
|
||||
* @param source
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
private String rowFormat(String source, String... args){
|
||||
return String.format(source,args);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -39,13 +39,17 @@ public class QcphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
//处理流程日志
|
||||
super.handleProcessLog();
|
||||
}catch (Exception e){
|
||||
//异常结束日志
|
||||
super.exceptionEndLog(e);
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//结束流程日志
|
||||
super.storageProcessLogEnd();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
|
@ -20,15 +19,12 @@ import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
|||
import org.jeecg.modules.service.ISpectrumBlockService;
|
||||
import org.springframework.boot.system.ApplicationHome;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -46,11 +42,11 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
/**
|
||||
* 开始存库时间
|
||||
*/
|
||||
private Date startIntoDatabaseTime = null;
|
||||
protected Date startIntoDatabaseTime = null;
|
||||
/**
|
||||
* 结束存库时间
|
||||
*/
|
||||
private Date endIntoDatabaseTime = null;
|
||||
protected Date endIntoDatabaseTime = null;
|
||||
/**
|
||||
* 基础数据
|
||||
*/
|
||||
|
@ -63,6 +59,10 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
* 日志文件名称
|
||||
*/
|
||||
protected String logFileName;
|
||||
/**
|
||||
* 流程日志对象
|
||||
*/
|
||||
protected ParsingProcessLog parsingProcessLog;
|
||||
|
||||
/**
|
||||
* 前置检查
|
||||
|
@ -121,7 +121,7 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
* 获取文件保存路径
|
||||
* @return
|
||||
*/
|
||||
private String getFileSavePath(){
|
||||
protected String getFileSavePath(){
|
||||
//处理此文件需要保存到ftp服务的路径
|
||||
//measurement_id切割后的字符数组
|
||||
String[] arr = this.sourceData.measurement_id.split(StringConstant.DASH);
|
||||
|
@ -211,8 +211,7 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
if(Objects.nonNull(query)){
|
||||
this.sampleData = query;
|
||||
this.endIntoDatabaseTime = new Date();
|
||||
log.warn("{} file data has been stored",super.mailFile.getName());
|
||||
return;
|
||||
throw new FileRepeatException("file repeat");
|
||||
}
|
||||
DataSourceSwitcher.switchToOracle();
|
||||
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
|
||||
|
@ -238,49 +237,11 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把流程日志写入ftp日志文件
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
protected void saveLogToFtp() throws FileNotFoundException {
|
||||
//获取数据源属性
|
||||
final String oraUsername = spectrumServiceQuotes.getOraDataSourceProperties().getUsername();
|
||||
final String oraUrl = spectrumServiceQuotes.getOraDataSourceProperties().getUrl();
|
||||
//组装日志文件内容
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
logContent.append("-------------------------- Write Data into Database at ").append(DateUtils.formatDate(this.startIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" ---------------------------");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("ApplicationPath:").append(this.getProjectAbsolutePath()).append(",").append("ApplicationName:").append(this.getProjectName()).append(",started by RNAUTO at ").append(this.startIntoDatabaseTime);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Successfully connected to database,source:").append(oraUrl.substring(oraUrl.lastIndexOf(":")+1)).append(",user=").append(oraUsername);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("SourceFile:").append(super.mailFile.getAbsolutePath());
|
||||
logContent.append(System.lineSeparator());
|
||||
logContent.append("StandardFile:").append(spectrumServiceQuotes.getFtpProperties().getFtpRootPath()).append(StringConstant.SLASH).append(super.ftpSavePath);
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Detector ID:").append(this.sampleData.getDetectorId());
|
||||
logContent.append(System.lineSeparator());
|
||||
logContent.append("Station ID:").append(this.sampleData.getStationId());
|
||||
logContent.append(System.lineSeparator());
|
||||
logContent.append("Sample ID:").append(this.sampleData.getSampleId());
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("Instance status successfully set to:").append(this.sampleData.getStatus()).append(".....");
|
||||
logContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
logContent.append("------------------- ").append("Write Data into Database Successfully at ").append(DateUtils.formatDate(this.endIntoDatabaseTime,"yyyy-MM-dd HH:mm:ss")).append(" --------------------");
|
||||
//保存日志文件到ftp
|
||||
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||
this.logFilePath = this.getFileSavePath();
|
||||
this.logFileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
|
||||
|
||||
super.ftpUtil.saveOrAppendFile(properties.getLogPath()+StringConstant.SLASH+logFilePath,logFileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目绝对路径
|
||||
* @return
|
||||
*/
|
||||
private String getProjectAbsolutePath(){
|
||||
protected String getProjectAbsolutePath(){
|
||||
ApplicationHome applicationHome = new ApplicationHome();
|
||||
return applicationHome.getDir().getAbsolutePath();
|
||||
}
|
||||
|
@ -289,7 +250,7 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
* 获取项目名称
|
||||
* @return
|
||||
*/
|
||||
private String getProjectName(){
|
||||
protected String getProjectName(){
|
||||
ApplicationHome applicationHome = new ApplicationHome();
|
||||
File[] files = applicationHome.getDir().listFiles(new FileFilter() {
|
||||
@Override
|
||||
|
@ -307,4 +268,33 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
}
|
||||
return Strings.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建流程日志对象处理解析流程日志
|
||||
*/
|
||||
protected void handleProcessLog(){
|
||||
ParsingProcessLog parsingProcessLog = new ParsingProcessLog();
|
||||
parsingProcessLog.setSpectrumHandler(this);
|
||||
parsingProcessLog.storageProcessLogStart();
|
||||
this.parsingProcessLog = parsingProcessLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常结束日志
|
||||
* @param e
|
||||
*/
|
||||
protected void exceptionEndLog(Exception e){
|
||||
if(e instanceof FileRepeatException){
|
||||
this.parsingProcessLog.endOfFileRepeat();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常结束日志
|
||||
*/
|
||||
protected void storageProcessLogEnd(){
|
||||
if(Objects.nonNull(this.parsingProcessLog)){
|
||||
this.parsingProcessLog.storageProcessLogEnd();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,10 +2,8 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
|
@ -27,10 +25,7 @@ import org.jeecg.modules.service.BlockConstant;
|
|||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -120,11 +115,11 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
/**
|
||||
* 开始分析时间
|
||||
*/
|
||||
private Date startAnalysisTime;
|
||||
protected Date startAnalysisTime;
|
||||
/**
|
||||
* 结束分析时间
|
||||
*/
|
||||
private Date endAnalysisTime;
|
||||
protected Date endAnalysisTime;
|
||||
|
||||
public Sample_B_Analysis() {
|
||||
}
|
||||
|
@ -270,6 +265,8 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
if(flag){
|
||||
throw new FileNotExistException("gas or det file is no exist or is error..");
|
||||
}
|
||||
this.detStruct = EnergySpectrumHandler.getSourceData(detSampleData.getInputFileName());
|
||||
this.gasStruct = EnergySpectrumHandler.getSourceData(gasSampleData.getInputFileName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,11 +292,9 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(sampleData.getSampleId(),analyses.getIdAnalysis(),this.sampleStruct);
|
||||
spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(sampleData.getSampleId(),analyses.getIdAnalysis(),this.sampleStruct);
|
||||
//存储det谱B_Energy和G_Energy块数据
|
||||
this.detStruct = EnergySpectrumHandler.getSourceData(detSampleData.getInputFileName());
|
||||
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(detSampleData.getSampleId(),analyses.getIdAnalysis(),this.detStruct);
|
||||
spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(detSampleData.getSampleId(),analyses.getIdAnalysis(),this.detStruct);
|
||||
//存储gas谱B_Energy和G_Energy块数据
|
||||
this.gasStruct = EnergySpectrumHandler.getSourceData(gasSampleData.getInputFileName());
|
||||
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(gasSampleData.getSampleId(),analyses.getIdAnalysis(),this.gasStruct);
|
||||
spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(gasSampleData.getSampleId(),analyses.getIdAnalysis(),this.gasStruct);
|
||||
|
||||
|
@ -602,6 +597,8 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
List<Double> roi_net_count_err = analyseResult.ROI_net_coutns_err;
|
||||
|
||||
List<String> roi = analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList());
|
||||
//此参数需第一位补0
|
||||
analyseResult.LC_CTS.add(0,0D);
|
||||
List<String> lc = analyseResult.LC_CTS.stream().map(v->formatToStr5(v)).collect(Collectors.toList());
|
||||
List<String> netCount = Lists.newArrayList();
|
||||
String flag = " +/- ";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.jeecg.modules.spectrum;
|
||||
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.base.enums.SampleStatus;
|
||||
import org.jeecg.modules.base.enums.SystemType;
|
||||
|
||||
/**
|
||||
|
@ -40,15 +39,19 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把原始库流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
//处理流程日志
|
||||
super.handleProcessLog();
|
||||
//进行B、G(P)谱分析
|
||||
this.autoAnalysis();
|
||||
}catch (Exception e){
|
||||
//异常结束日志
|
||||
super.exceptionEndLog(e);
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//结束流程日志
|
||||
super.storageProcessLogEnd();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class SpectrumHandler extends Chain{
|
|||
/**
|
||||
* 把流程日志写入ftp日志文件
|
||||
*/
|
||||
protected abstract void saveLogToFtp() throws FileNotFoundException;
|
||||
protected void saveLogToFtp() throws FileNotFoundException{};
|
||||
|
||||
/**
|
||||
* 打印当前能谱类型
|
||||
|
|
|
@ -56,7 +56,7 @@ public class GammaFileUtil {
|
|||
@Autowired
|
||||
private NameStandUtil nameStandUtil;
|
||||
|
||||
public boolean loadFile(String pathName, String fileName, PHDFile phd, Result result){
|
||||
public boolean loadFile(String pathName, String fileName, PHDFile phd, Result result) {
|
||||
phd.setFilepath(pathName);
|
||||
phd.setFilename(fileName);
|
||||
//连接ftp
|
||||
|
@ -1502,9 +1502,9 @@ public class GammaFileUtil {
|
|||
NuclidesIdent(phd, nuclideLinesMap);
|
||||
RunQC(phd);
|
||||
String Warning = "Finish three tasks:\n"+
|
||||
"\t1.Update efficiencies of all peaks;\n"+
|
||||
"\t2.Identify nuclides again;\n"+
|
||||
"\t3.Test QC again.";
|
||||
"\t1.Update efficiencies of all peaks;\n"+
|
||||
"\t2.Identify nuclides again;\n"+
|
||||
"\t3.Test QC again.";
|
||||
} else {
|
||||
if(bSingle) {
|
||||
// AnalyseFlowChart flow_dlg(this);
|
||||
|
@ -2028,7 +2028,7 @@ public class GammaFileUtil {
|
|||
return equation;
|
||||
}
|
||||
|
||||
public void UpdateChartEnergy(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurCentroid, PHDFile phd, Map<String, Object> map) {
|
||||
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){
|
||||
|
@ -2044,7 +2044,7 @@ public class GammaFileUtil {
|
|||
List<Double> vChan = new LinkedList<>();
|
||||
double MaxChan = Double.valueOf(phd.getSpec().getNum_g_channel());
|
||||
double d = 1;
|
||||
double dStep = MaxChan / 30 * 2;
|
||||
double dStep = MaxChan / width * 2;
|
||||
while(d < MaxChan) {
|
||||
vChan.add(d);
|
||||
d+= dStep;
|
||||
|
@ -2093,7 +2093,7 @@ public class GammaFileUtil {
|
|||
return equation;
|
||||
}
|
||||
|
||||
public void UpdateChartResolution(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurReso, PHDFile phd, Map<String, Object> map) {
|
||||
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;
|
||||
|
@ -2111,7 +2111,7 @@ public class GammaFileUtil {
|
|||
|
||||
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP()).counts;
|
||||
double d = vEner.get(0), maxE = vEner.get(1);
|
||||
double dStep = maxE / 30 * 2;
|
||||
double dStep = maxE / width * 2;
|
||||
|
||||
vEner.remove(vEner.size()-1);
|
||||
while(d < maxE) {
|
||||
|
@ -2226,7 +2226,7 @@ public class GammaFileUtil {
|
|||
return equation;
|
||||
}
|
||||
|
||||
public void UpdateChartEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, List<Double> m_vCurEffi, PHDFile phd, Map<String, Object> map) {
|
||||
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;
|
||||
|
@ -2245,7 +2245,7 @@ public class GammaFileUtil {
|
|||
List<Double> vEner = CalValuesHandler.calFcnEval(vChan, phd.getUsedEnerPara().getP()).counts;
|
||||
double d = vEner.get(0);
|
||||
double maxE = vEner.get(1);
|
||||
double dStep = maxE / 30 * 2;
|
||||
double dStep = maxE / width * 2;
|
||||
|
||||
vEner.remove(vEner.size()-1);
|
||||
while(d < maxE) {
|
||||
|
@ -2804,7 +2804,7 @@ public class GammaFileUtil {
|
|||
String subDirSavePath = "";
|
||||
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
||||
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 scacName = fileNames.get("scac");
|
||||
String baselineName = fileNames.get("baseline");
|
||||
|
@ -3510,7 +3510,7 @@ public class GammaFileUtil {
|
|||
// #Acquisition
|
||||
spectrum.append("#Acquisition\r\n");
|
||||
spectrum.append(phd.getAcq().getAcquisition_start_date()+StringPool.SPACE+phd.getAcq().getAcquisition_start_time()+
|
||||
StringPool.SPACE+RightFill(String.format("%.2f", phd.getAcq().getAcquisition_real_time()), 14)+
|
||||
StringPool.SPACE+RightFill(String.format("%.2f", phd.getAcq().getAcquisition_real_time()), 14)+
|
||||
StringPool.SPACE+RightFill(String.format("%.2f", phd.getAcq().getAcquisition_live_time()), 14)+"\r\n");
|
||||
|
||||
// #Processing
|
||||
|
@ -3536,15 +3536,15 @@ public class GammaFileUtil {
|
|||
int fieldWidth = 12;
|
||||
for(int i=0; i<phd.getCertificate().getG_energy().size(); ++i) {
|
||||
spectrum.append(phd.getCertificate().getNuclide_name().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getHalf_life_time().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getTime_unit().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getActivity_nuclide_time_assay().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getUncertainty().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getG_energy().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getG_intensity().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getElectron_decay_mode().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getMaximum_energy().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getIntensity_b_particle().get(i)+"\r\n");
|
||||
StringPool.SPACE+phd.getCertificate().getHalf_life_time().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getTime_unit().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getActivity_nuclide_time_assay().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getUncertainty().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getG_energy().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getG_intensity().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getElectron_decay_mode().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getMaximum_energy().get(i)+
|
||||
StringPool.SPACE+phd.getCertificate().getIntensity_b_particle().get(i)+"\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3559,7 +3559,7 @@ public class GammaFileUtil {
|
|||
GEnergyBlock g_ener = phd.getUsedEnerKD();
|
||||
for(int i=0; i<g_ener.getG_energy().size(); ++i) {
|
||||
spectrum.append(RightFill(String.format("%.9f", Double.valueOf(g_ener.getG_energy().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_ener.getCentroid_channel().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_ener.getCentroid_channel().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill((Objects.isNull(g_ener.getUncertainty().get(i)) ? "0.5" : String.format("%.9f", Double.valueOf(g_ener.getUncertainty().get(i)))), 16)+"\r\n");
|
||||
}
|
||||
|
||||
|
@ -3568,7 +3568,7 @@ public class GammaFileUtil {
|
|||
GResolutionBlock g_reso = phd.getUsedResoKD();
|
||||
for(int i=0; i<g_reso.getFWHM().size(); ++i) {
|
||||
spectrum.append(RightFill(String.format("%.9f", Double.valueOf(g_reso.getG_energy().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_reso.getFWHM().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_reso.getFWHM().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill((Objects.isNull(g_reso.getUncertainty().get(i)) ? "0.5" : String.format("%.9f", Double.valueOf(g_reso.getUncertainty().get(i)))), 16)+"\r\n");
|
||||
}
|
||||
|
||||
|
@ -3577,7 +3577,7 @@ public class GammaFileUtil {
|
|||
GEfficiencyBlock g_effi = phd.getUsedEffiKD();
|
||||
for(int i=0; i<g_effi.getEfficiency().size(); ++i) {
|
||||
spectrum.append(RightFill(String.format("%.9f", Double.valueOf(g_effi.getG_energy().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_effi.getEfficiency().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_effi.getEfficiency().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill((Objects.isNull(g_effi.getUncertainty().get(i)) ? "0.5" : String.format("%.9f", Double.valueOf(g_effi.getUncertainty().get(i)))), 16)+"\r\n");
|
||||
}
|
||||
|
||||
|
@ -3587,7 +3587,7 @@ public class GammaFileUtil {
|
|||
TotaleffBlock g_totE = phd.getUsedTotEKD();
|
||||
for(int i=0; i<g_totE.getRecord_count(); ++i) {
|
||||
spectrum.append(RightFill(String.format("%.9f", Double.valueOf(g_totE.getG_energy().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_totE.getTotal_efficiency().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill(String.format("%.9f", Double.valueOf(g_totE.getTotal_efficiency().get(i))), 16)+
|
||||
StringPool.SPACE+RightFill((Objects.isNull(g_totE.getUncertainty().get(i)) ? "0.5" : String.format("%.9f", Double.valueOf(g_totE.getUncertainty().get(i)))), 16));
|
||||
}
|
||||
}
|
||||
|
@ -3600,11 +3600,11 @@ public class GammaFileUtil {
|
|||
int len = phd.getSpec().getCounts().size();
|
||||
for(; i<len-4; i+=5,j+=5) {
|
||||
spectrum.append(RightFill(String.valueOf(j), 5)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+1)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+2)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+3)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+4)), 10)+"\r\n");
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+1)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+2)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+3)), 10)+
|
||||
StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i+4)), 10)+"\r\n");
|
||||
}
|
||||
if(i < len) {
|
||||
spectrum.append(RightFill(String.valueOf(j), 5)+StringPool.SPACE+RightFill(String.valueOf(phd.getSpec().getCounts().get(i)), 10));
|
||||
|
@ -4032,4 +4032,135 @@ public class GammaFileUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public List<Long> loadCompareData(String compareFileName, String userName, long m_nCount, Result result) {
|
||||
List<Long> m_vecCompare = new LinkedList<>();
|
||||
String compareFilePath = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
//连接ftp
|
||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||
if (Objects.isNull(ftpClient)){
|
||||
result.error500("ftp连接失败");
|
||||
return m_vecCompare;
|
||||
}
|
||||
InputStream inputStream = null;
|
||||
//加载dll工具库
|
||||
System.loadLibrary("ReadPHDFile");
|
||||
try {
|
||||
//切换被动模式
|
||||
ftpClient.enterLocalPassiveMode();
|
||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||
// 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项
|
||||
ftpClient.setControlEncoding("UTF-8");
|
||||
ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
|
||||
ftpClient.changeWorkingDirectory(compareFilePath);
|
||||
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
|
||||
ftpFiles = ftpFiles.stream().filter(item -> item.getName().equals(compareFileName)).collect(Collectors.toList());
|
||||
if (ftpFiles.size() == 0) {
|
||||
result.error500("ftp获取文件数据失败");
|
||||
return m_vecCompare;
|
||||
}
|
||||
FTPFile ftpFile = ftpFiles.get(0);
|
||||
if (Objects.nonNull(ftpFile)) {
|
||||
inputStream = ftpClient.retrieveFileStream(ftpFile.getName());
|
||||
//声明一个临时文件
|
||||
File file = File.createTempFile("tmp", null);
|
||||
//将ftp文件的输入流复制给临时文件
|
||||
FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
//读取文件信息
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
//判断当前用来进行比较的文件的#g_Spectrum数量是否与原文件的大小一致
|
||||
if (struct.num_g_channel != m_nCount) {
|
||||
result.error500("We can't compare two Spectrum files if their number of Counts are different!");
|
||||
return m_vecCompare;
|
||||
}
|
||||
m_vecCompare = struct.g_counts;
|
||||
if (struct.g_begin_channel == 0) {
|
||||
m_vecCompare.add(0L);
|
||||
m_vecCompare.remove(0);
|
||||
}
|
||||
}
|
||||
}catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
try {
|
||||
if (Objects.nonNull(ftpClient)){
|
||||
ftpClient.disconnect();
|
||||
}
|
||||
if (Objects.nonNull(inputStream)){
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return m_vecCompare;
|
||||
}
|
||||
|
||||
public List<ChartData> CompareData(List<Long> m_vecCompare, long m_nCount, Map<String, String> colorMap, List<Double> vEnergy){
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
int size = m_vecCompare.size();
|
||||
if(size == m_nCount) {
|
||||
ChartData data1 = new ChartData();
|
||||
data1.setName("Compare");
|
||||
data1.setGroup("channel");
|
||||
data1.setColor(colorMap.get("Color_Compare"));
|
||||
// Compare two Spectrum in Channel
|
||||
for(int i=0; i<size; ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i+1);
|
||||
seriseData.setY(m_vecCompare.get(i));
|
||||
data1.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data1);
|
||||
if(vEnergy.size() == size) {
|
||||
ChartData data2 = new ChartData();
|
||||
data2.setName("Compare");
|
||||
data2.setGroup("energy");
|
||||
data2.setColor(colorMap.get("Color_Compare"));
|
||||
// Compare two Spectrum in Energy
|
||||
for(int i=0; i<size; ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(vEnergy.get(i));
|
||||
seriseData.setY(m_vecCompare.get(i));
|
||||
data2.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data2);
|
||||
}
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
public List<ChartData> StripData(List<Long> m_vecCompare, List<Long> m_vCount, long m_nCount, Map<String, String> colorMap, List<Double> vEnergy, Double ratioRate) {
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
int size = m_vecCompare.size();
|
||||
if(size == m_nCount) {
|
||||
ChartData data1 = new ChartData();
|
||||
data1.setName("Compare");
|
||||
data1.setGroup("channel");
|
||||
data1.setColor(colorMap.get("Color_Strip"));
|
||||
// type: 1 Add a Spectrum in Channel; -1 Cut a Spectrum in Channel
|
||||
for(int i=0; i<size; ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i+1);
|
||||
seriseData.setY(m_vCount.get(i) + ratioRate * m_vecCompare.get(i));
|
||||
data1.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data1);
|
||||
if(vEnergy.size() == size) {
|
||||
ChartData data2 = new ChartData();
|
||||
data2.setName("Compare");
|
||||
data2.setGroup("energy");
|
||||
data2.setColor(colorMap.get("Color_Strip"));
|
||||
// type: 1 Add a Spectrum in Energy; -1 Cut a Spectrum in Energy
|
||||
for(int i=0; i<size; ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(vEnergy.get(i));
|
||||
seriseData.setY(m_vCount.get(i) + ratioRate * m_vecCompare.get(i));
|
||||
data2.getPointlist().add(seriseData);
|
||||
}
|
||||
datalist.add(data2);
|
||||
}
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.jeecg.modules.entity.vo.*;
|
|||
import org.jeecg.modules.service.IGammaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -37,6 +38,15 @@ public class GammaController {
|
|||
public Result gammaByFile(String fileName, HttpServletRequest request) {
|
||||
return gammaService.gammaByFile(fileName, request);
|
||||
}
|
||||
@GetMapping("Compare")
|
||||
public Result Compare(String fileName, String compareFileName, HttpServletRequest request) {
|
||||
return gammaService.Compare(fileName, compareFileName, request);
|
||||
}
|
||||
|
||||
@GetMapping("Strip")
|
||||
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) {
|
||||
return gammaService.Strip(fileName, stripFileName, ratioRate, request);
|
||||
}
|
||||
|
||||
@GetMapping("configure")
|
||||
@ApiOperation(value = "analyze菜单下configure页面数据", notes = "analyze菜单下configure页面数据")
|
||||
|
@ -175,14 +185,14 @@ public class GammaController {
|
|||
|
||||
@GetMapping("energyCalibration")
|
||||
@ApiOperation(value = "查看Energy Calibration数据", notes = "查看Energy Calibration数据")
|
||||
public Result energyCalibration(Integer sampleId, String fileName, String currentText) {
|
||||
return gammaService.energyCalibration(sampleId, fileName, currentText);
|
||||
public Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width) {
|
||||
return gammaService.energyCalibration(sampleId, fileName, currentText, width);
|
||||
}
|
||||
|
||||
@PostMapping("changeDataEnergy")
|
||||
@ApiOperation(value = "修改Energy Calibration数据", notes = "修改Energy Calibration数据")
|
||||
public Result changeDataEnergy(@RequestBody ChangeData changeData) {
|
||||
return gammaService.changeDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getSampleId(), changeData.getFileName());
|
||||
return gammaService.changeDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getSampleId(), changeData.getFileName(), changeData.getWidth());
|
||||
}
|
||||
|
||||
@PostMapping("applyDataEnergy")
|
||||
|
@ -197,16 +207,22 @@ public class GammaController {
|
|||
gammaService.saveDataEnergy(changeData.getM_vCurCentroid(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), response);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@GetMapping("resolutionCalibration")
|
||||
@ApiOperation(value = "查看Resolution Calibration数据", notes = "查看Resolution Calibration数据")
|
||||
public Result resolutionCalibration(Integer sampleId, String fileName, String currentText) {
|
||||
return gammaService.resolutionCalibration(sampleId, fileName, currentText);
|
||||
public Result resolutionCalibration(Integer sampleId, String fileName, String currentText, Double width) {
|
||||
return gammaService.resolutionCalibration(sampleId, fileName, currentText, width);
|
||||
}
|
||||
|
||||
@PostMapping("changeDataResolution")
|
||||
@ApiOperation(value = "修改Resolution Calibration数据", notes = "修改Resolution Calibration数据")
|
||||
public Result changeDataResolution(@RequestBody ChangeData changeData) {
|
||||
return gammaService.changeDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getSampleId(), changeData.getFileName());
|
||||
return gammaService.changeDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getSampleId(), changeData.getFileName(), changeData.getWidth());
|
||||
}
|
||||
|
||||
@PostMapping("applyDataResolution")
|
||||
|
@ -221,16 +237,22 @@ public class GammaController {
|
|||
gammaService.saveDataResolution(changeData.getM_vCurReso(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), response);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@GetMapping("EfficiencyCalibration")
|
||||
@ApiOperation(value = "查看Efficiency Calibration数据", notes = "查看Efficiency Calibration数据")
|
||||
public Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText) {
|
||||
return gammaService.EfficiencyCalibration(sampleId, fileName, currentText);
|
||||
public Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText, Double width) {
|
||||
return gammaService.EfficiencyCalibration(sampleId, fileName, currentText, width);
|
||||
}
|
||||
|
||||
@PostMapping("changeDataEfficiency")
|
||||
@ApiOperation(value = "修改Efficiency Calibration数据", notes = "修改Efficiency Calibration数据")
|
||||
public Result changeDataEfficiency(@RequestBody ChangeData changeData) {
|
||||
return gammaService.changeDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getFuncId(), changeData.getSampleId(), changeData.getFileName());
|
||||
return gammaService.changeDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getM_curParam(), changeData.getFuncId(), changeData.getSampleId(), changeData.getFileName(), changeData.getWidth());
|
||||
}
|
||||
|
||||
@PostMapping("applyDataEfficiency")
|
||||
|
@ -245,6 +267,12 @@ public class GammaController {
|
|||
gammaService.saveDataEfficiency(changeData.getM_vCurEffi(), changeData.getM_vCurEnergy(), changeData.getM_vCurUncert(), changeData.getFuncId(), response);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@GetMapping("NuclideLibrary")
|
||||
@ApiOperation(value = "查看Nuclide Library页面数据", notes = "查看Nuclide Library页面数据")
|
||||
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {
|
||||
|
@ -277,7 +305,7 @@ public class GammaController {
|
|||
|
||||
@GetMapping("exportPeakInformation")
|
||||
public void exportPeakInformation(Integer sampleId, String fileName,
|
||||
HttpServletResponse response){
|
||||
HttpServletResponse response){
|
||||
gammaService.exportPeakInformation(sampleId, fileName, response);
|
||||
}
|
||||
|
||||
|
@ -311,7 +339,7 @@ public class GammaController {
|
|||
|
||||
@GetMapping("exportRadionuclideActivity")
|
||||
public void exportRadionuclideActivity(Integer sampleId, String fileName,
|
||||
HttpServletResponse response){
|
||||
HttpServletResponse response){
|
||||
gammaService.exportRadionuclideActivity(sampleId, fileName, response);
|
||||
}
|
||||
|
||||
|
@ -387,8 +415,8 @@ public class GammaController {
|
|||
|
||||
@GetMapping("saveToDB")
|
||||
@ApiOperation(value = "Save To DB按钮", notes = "Save To DB按钮")
|
||||
public Result saveToDB(String fileName, String userName) {
|
||||
return gammaService.saveToDB(fileName, userName);
|
||||
public Result saveToDB(String fileName, HttpServletRequest request) {
|
||||
return gammaService.saveToDB(fileName, request);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.modules.entity.vo.ParameterInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
@ -29,4 +28,6 @@ public class ChangeData implements Serializable {
|
|||
|
||||
private Integer funcId;
|
||||
|
||||
private Double width;
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ package org.jeecg.modules.service;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IGammaService{
|
||||
|
||||
|
@ -17,6 +17,10 @@ public interface IGammaService{
|
|||
|
||||
Result gammaByFile(String fileName, HttpServletRequest request);
|
||||
|
||||
Result Compare(String fileName, String compareFileName, HttpServletRequest request);
|
||||
|
||||
Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request);
|
||||
|
||||
Result configure(Integer sampleId, String fileName);
|
||||
|
||||
Result Reprocessing(ConfigureData configureData, HttpServletRequest request);
|
||||
|
@ -63,30 +67,36 @@ public interface IGammaService{
|
|||
|
||||
List<InputData> KorSumInput(CoeffData coeffData);
|
||||
|
||||
Result energyCalibration(Integer sampleId, String fileName, String currentText);
|
||||
Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width);
|
||||
|
||||
Result changeDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName);
|
||||
Result changeDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width);
|
||||
|
||||
Result applyDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName);
|
||||
|
||||
void saveDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
|
||||
|
||||
Result resolutionCalibration(Integer sampleId, String fileName, String currentText);
|
||||
Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText);
|
||||
|
||||
Result changeDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName);
|
||||
Result resolutionCalibration(Integer sampleId, String fileName, String currentText, Double width);
|
||||
|
||||
Result changeDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width);
|
||||
|
||||
Result applyDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName);
|
||||
|
||||
void saveDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, HttpServletResponse response);
|
||||
|
||||
Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText);
|
||||
Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText);
|
||||
|
||||
Result changeDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, Integer sampleId, String fileName);
|
||||
Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText, Double width);
|
||||
|
||||
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 applyDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, String curCalName, Integer sampleId, String fileName);
|
||||
|
||||
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 NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request);
|
||||
|
||||
Result configUserLibrary(Integer sampleId, String fileName, HttpServletRequest request);
|
||||
|
@ -136,6 +146,6 @@ public interface IGammaService{
|
|||
|
||||
Result updateColorConfig(ColorInfo colorInfo, HttpServletRequest request);
|
||||
|
||||
Result saveToDB(String fileName, String userName);
|
||||
Result saveToDB(String fileName, HttpServletRequest request);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsCalibrationPairsOrigSpectrumService extends IService<Gard
|
|||
|
||||
Integer saveGardsCalibrationPairsOrig(EnergySpectrumStruct sourceData, Integer sampleId, List<String> readLines);
|
||||
|
||||
boolean saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsSampleAuxSpectrumService extends IService<GardsSampleAux>
|
|||
|
||||
Integer saveSampleAux(EnergySpectrumStruct sourceData, Integer sampleId, List<String> readLines);
|
||||
|
||||
boolean saveSampleAuxGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveSampleAuxGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public interface IGardsSampleCertLineSpectrumService extends IService<GardsSampl
|
|||
|
||||
Integer saveSampleCertLine(EnergySpectrumStruct sourceData, Integer sampleId);
|
||||
|
||||
boolean saveSampleCertLineGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveSampleCertLineGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public interface IGardsSampleCertSpectrumService extends IService<GardsSampleCer
|
|||
|
||||
Integer saveSampleCert(EnergySpectrumStruct sourceData, Integer sampleId);
|
||||
|
||||
boolean saveSampleCertGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveSampleCertGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsSampleDataSpectrumService extends IService<GardsSampleDat
|
|||
|
||||
Integer saveSampleData(EnergySpectrumStruct sourceData, Integer stationId, Integer detectorId, String filePathName, List<String> readLines);
|
||||
|
||||
boolean saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id);
|
||||
Integer saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface IGardsSpectrumSpectrumService extends IService<GardsSpectrum> {
|
|||
|
||||
Integer saveSpectrum(EnergySpectrumStruct sourceData, Integer sampleId, List<String> readLines, String filePathName);
|
||||
|
||||
boolean saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name);
|
||||
Integer saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public interface IGardsTotalEfficiencyPairsSpectrumService extends IService<Gard
|
|||
|
||||
Integer saveTotalEfficiencyPairs(EnergySpectrumStruct sourceData, Integer sampleId);
|
||||
|
||||
boolean saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId);
|
||||
Integer saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.google.common.cache.Cache;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
|
@ -34,6 +35,8 @@ import org.jeecg.modules.service.*;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -225,6 +228,61 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result Compare(String fileName, String compareFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//获取当前角色配置的颜色信息
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
//获取缓存的phd数据
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
List<Double> vEnergy = phd.getVEnergy();
|
||||
//获取Compare数据
|
||||
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(compareFileName, userName, m_nCount, result);
|
||||
if (CollectionUtils.isNotEmpty(m_vecCompare)) {
|
||||
List<ChartData> chartDataList = gammaFileUtil.CompareData(m_vecCompare, m_nCount, colorMap, vEnergy);
|
||||
result.setSuccess(true);
|
||||
result.setResult(chartDataList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result Strip(String fileName, String stripFileName, Double ratioRate, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//获取当前角色配置的颜色信息
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
//获取缓存的phd数据
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
List<Double> vEnergy = phd.getVEnergy();
|
||||
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||
List<Long> m_vCount = new LinkedList<>();
|
||||
// 确保绘制曲线时所有谱都是从1道开始
|
||||
int i = 0;
|
||||
if(m_nSChan == 0) {
|
||||
i = 1;
|
||||
}
|
||||
for(; i<m_nCount; ++i) {
|
||||
m_vCount.add(phd.getSpec().getCounts().get(i));
|
||||
}
|
||||
if(m_nSChan == 0) {
|
||||
m_vCount.add(0L);
|
||||
}
|
||||
//获取Compare数据
|
||||
List<Long> m_vecCompare = gammaFileUtil.loadCompareData(stripFileName, userName, m_nCount, result);
|
||||
if (CollectionUtils.isNotEmpty(m_vecCompare)) {
|
||||
List<ChartData> chartDataList = gammaFileUtil.StripData(m_vecCompare, m_vCount, m_nCount, colorMap, vEnergy, ratioRate);
|
||||
result.setSuccess(true);
|
||||
result.setResult(chartDataList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result configure(Integer sampleId, String fileName) {
|
||||
Result result = new Result();
|
||||
|
@ -301,8 +359,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.setResult(map);
|
||||
}else {
|
||||
String warning = "The spectrum needn't Analyed. Maybe:\n"+
|
||||
"1. It has already Analyed.\n"+
|
||||
"2. You didn't change any setting or calibration.";
|
||||
"1. It has already Analyed.\n"+
|
||||
"2. You didn't change any setting or calibration.";
|
||||
result.error500(warning);
|
||||
}
|
||||
return result;
|
||||
|
@ -1138,7 +1196,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result energyCalibration(Integer sampleId, String fileName, String currentText) {
|
||||
public Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
System.loadLibrary("GammaAnaly");
|
||||
|
@ -1181,7 +1239,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("table", energyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEnergy(m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEnergy(m_vCurEnergy, m_curParam, m_vCurCentroid, phd, map);
|
||||
gammaFileUtil.UpdateChartEnergy(m_vCurEnergy, m_curParam, m_vCurCentroid, phd, width, map);
|
||||
map.put("rg_low", phd.getBaseCtrls().getRg_low());
|
||||
map.put("rg_high", phd.getBaseCtrls().getRg_high());
|
||||
}
|
||||
|
@ -1191,7 +1249,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result changeDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName) {
|
||||
public Result changeDataEnergy(List<Double> m_vCurCentroid, 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<>();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
|
@ -1200,13 +1258,13 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
DataChangeEnergy(m_vCurCentroid, m_vCurEnergy, m_vCurUncert, m_curParam, phd, map);
|
||||
DataChangeEnergy(m_vCurCentroid, m_vCurEnergy, m_vCurUncert, m_curParam, phd, width, map);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void DataChangeEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, PHDFile phd, Map<String, Object> map) {
|
||||
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;
|
||||
|
@ -1249,7 +1307,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("table", energyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEnergy(m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEnergy(m_vCurEnergy, m_curParam, m_vCurCentroid, phd, map);
|
||||
gammaFileUtil.UpdateChartEnergy(m_vCurEnergy, m_curParam, m_vCurCentroid, phd, width, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1283,7 +1341,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
StringBuffer strBuffer = new StringBuffer();
|
||||
strBuffer.append("#g_Energy").append("\n");
|
||||
for (int i=0; i<m_vCurCentroid.size(); i++) {
|
||||
strBuffer.append(m_vCurEnergy.get(i)).append(" ").append(m_vCurCentroid.get(i)).append(" ").append(m_vCurUncert.get(i)).append("\n");
|
||||
strBuffer.append(m_vCurEnergy.get(i)).append("\t\t").append(m_vCurCentroid.get(i)).append("\t\t").append(m_vCurUncert.get(i)).append("\n");
|
||||
}
|
||||
OutputStream fos = null;
|
||||
try {
|
||||
|
@ -1307,7 +1365,82 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result resolutionCalibration(Integer sampleId, String fileName, String currentText) {
|
||||
public Result callDataEnergy(MultipartFile file, String sampleFileName, Double width, String currentText) {
|
||||
Result result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(sampleFileName);
|
||||
if (Objects.nonNull(file)) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
//从最后一个。切割文件名称 获取文件名称后缀
|
||||
String fileSuffix = fileName.substring(fileName.lastIndexOf(StringPool.DOT));
|
||||
if (fileSuffix.equalsIgnoreCase(".ent")) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<Double> m_vCurCentroid = new LinkedList<>();
|
||||
List<Double> m_vCurEnergy = new LinkedList<>();
|
||||
List<Double> m_vCurUncert = new LinkedList<>();
|
||||
try {
|
||||
//创建临时文件
|
||||
File tmpFile = File.createTempFile("tmp", null);
|
||||
//复制上传文件的输入流到临时文件
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream() ,tmpFile);
|
||||
//读取文件所有行
|
||||
List<String> readLines = FileUtils.readLines(tmpFile, "UTF-8");
|
||||
//遍历文件行数据
|
||||
for (int i=0; i<readLines.size(); i++) {
|
||||
String line = readLines.get(i);
|
||||
if (line.contains("#g_Energy") || line.contains("#Energy")) {
|
||||
for (int j=i+1; j<readLines.size(); j++) {
|
||||
String content = readLines.get(j);
|
||||
if (!content.contains("#")) {
|
||||
List<String> values = Arrays.asList(content.split("\t\t"));
|
||||
if (Double.valueOf(values.get(1))>0) {
|
||||
m_vCurEnergy.add(Double.valueOf(values.get(0)));
|
||||
m_vCurCentroid.add(Double.valueOf(values.get(1)));
|
||||
m_vCurUncert.add(Double.valueOf(values.get(2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("uncert", m_vCurUncert);
|
||||
ParameterInfo m_curParam = new ParameterInfo();
|
||||
if (StringUtils.isNotBlank(currentText)) {
|
||||
m_curParam = phd.getMapEnerPara().get(currentText);
|
||||
}
|
||||
map.put("param", m_curParam);
|
||||
int num = m_vCurEnergy.size();
|
||||
if(num < 1){
|
||||
return result;
|
||||
}
|
||||
List<Double> vFit = CalValuesHandler.calFcnEval(m_vCurCentroid, m_curParam.getP()).counts;
|
||||
List<EnergyData> energyDataList = new LinkedList<>();
|
||||
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.setFit(String.format("%.3f", vFit.get(i)));
|
||||
energyData.setDelta(String.format("%.3f", delta));
|
||||
energyDataList.add(energyData);
|
||||
}
|
||||
map.put("table", energyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEnergy(m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEnergy(m_vCurEnergy, m_curParam, m_vCurCentroid, phd, width, map);
|
||||
map.put("rg_low", phd.getBaseCtrls().getRg_low());
|
||||
map.put("rg_high", phd.getBaseCtrls().getRg_high());
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result resolutionCalibration(Integer sampleId, String fileName, String currentText, Double width) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
System.loadLibrary("GammaAnaly");
|
||||
|
@ -1350,7 +1483,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("table", resolutionDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationResolution(m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartResolution(m_vCurEnergy, m_curParam, m_vCurReso, phd, map);
|
||||
gammaFileUtil.UpdateChartResolution(m_vCurEnergy, m_curParam, m_vCurReso, phd, width, map);
|
||||
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
|
||||
map.put("G_energy_span", phd.getSpec().getG_energy_span());
|
||||
}
|
||||
|
@ -1360,7 +1493,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result changeDataResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName) {
|
||||
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");
|
||||
|
@ -1370,13 +1503,13 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
DataChangeResolution(m_vCurReso, m_vCurEnergy, m_vCurUncert, m_curParam, phd, map);
|
||||
DataChangeResolution(m_vCurReso, m_vCurEnergy, m_vCurUncert, m_curParam, phd, width, map);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void DataChangeResolution(List<Double> m_vCurReso, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, PHDFile phd, Map<String, Object> map) {
|
||||
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);
|
||||
|
@ -1408,7 +1541,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("table", resolutionDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationResolution(m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartResolution(m_vCurEnergy, m_curParam, m_vCurReso, phd, map);
|
||||
gammaFileUtil.UpdateChartResolution(m_vCurEnergy, m_curParam, m_vCurReso, phd, width, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1442,7 +1575,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
StringBuffer strBuffer = new StringBuffer();
|
||||
strBuffer.append("#g_Resolution").append("\n");
|
||||
for (int i=0; i<m_vCurReso.size(); i++) {
|
||||
strBuffer.append(m_vCurEnergy.get(i)).append(" ").append(m_vCurReso.get(i)).append(" ").append(m_vCurUncert.get(i)).append("\n");
|
||||
strBuffer.append(m_vCurEnergy.get(i)).append("\t\t").append(m_vCurReso.get(i)).append("\t\t").append(m_vCurUncert.get(i)).append("\n");
|
||||
}
|
||||
OutputStream fos = null;
|
||||
try {
|
||||
|
@ -1466,7 +1599,82 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText) {
|
||||
public Result callDataResolution(MultipartFile file, String sampleFileName, Double width, String currentText) {
|
||||
Result result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(sampleFileName);
|
||||
if (Objects.nonNull(file)) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
//从最后一个。切割文件名称 获取文件名称后缀
|
||||
String fileSuffix = fileName.substring(fileName.lastIndexOf(StringPool.DOT));
|
||||
if (fileSuffix.equalsIgnoreCase(".ent")) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<Double> m_vCurReso = new LinkedList<>();
|
||||
List<Double> m_vCurEnergy = new LinkedList<>();
|
||||
List<Double> m_vCurUncert = new LinkedList<>();
|
||||
try {
|
||||
//创建临时文件
|
||||
File tmpFile = File.createTempFile("tmp", null);
|
||||
//复制上传文件的输入流到临时文件
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream() ,tmpFile);
|
||||
//读取文件所有行
|
||||
List<String> readLines = FileUtils.readLines(tmpFile, "UTF-8");
|
||||
//遍历文件行数据
|
||||
for (int i=0; i<readLines.size(); i++) {
|
||||
String line = readLines.get(i);
|
||||
if (line.contains("#g_Resolution") || line.contains("#Resolution")) {
|
||||
for (int j=i+1; j<readLines.size(); j++) {
|
||||
String content = readLines.get(j);
|
||||
if (!content.contains("#")) {
|
||||
List<String> values = Arrays.asList(content.split("\t\t"));
|
||||
if (Double.valueOf(values.get(0))>0) {
|
||||
m_vCurEnergy.add(Double.valueOf(values.get(0)));
|
||||
m_vCurReso.add(Double.valueOf(values.get(1)));
|
||||
m_vCurUncert.add(Double.valueOf(values.get(2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("uncert", m_vCurUncert);
|
||||
ParameterInfo m_curParam = new ParameterInfo();
|
||||
if (StringUtils.isNotBlank(currentText)) {
|
||||
m_curParam = phd.getMapResoPara().get(currentText);
|
||||
}
|
||||
map.put("param", m_curParam);
|
||||
int num = m_vCurEnergy.size();
|
||||
if(num < 1){
|
||||
return result;
|
||||
}
|
||||
List<Double> vFit = CalValuesHandler.calFcnEval(m_vCurEnergy, m_curParam.getP()).counts;
|
||||
List<ResolutionData> resolutionDataList = new LinkedList<>();
|
||||
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.setFit(String.format("%.3f", vFit.get(i)));
|
||||
resolutionData.setDelta(String.format("%.3f", delta));
|
||||
resolutionDataList.add(resolutionData);
|
||||
}
|
||||
map.put("table", resolutionDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationResolution(m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartResolution(m_vCurEnergy, m_curParam, m_vCurReso, phd, width, map);
|
||||
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
|
||||
map.put("G_energy_span", phd.getSpec().getG_energy_span());
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result EfficiencyCalibration(Integer sampleId, String fileName, String currentText, Double width) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<String> m_vFuncName = new LinkedList<>();
|
||||
|
@ -1518,7 +1726,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("table", efficiencyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, map);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
|
||||
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
|
||||
map.put("G_energy_span", phd.getSpec().getG_energy_span());
|
||||
}
|
||||
|
@ -1528,7 +1736,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result changeDataEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, Integer sampleId, String fileName) {
|
||||
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");
|
||||
|
@ -1538,13 +1746,13 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
DataChangeEfficiency(m_vCurEffi, m_vCurEnergy, m_vCurUncert, m_curParam, funcId, phd, map);
|
||||
DataChangeEfficiency(m_vCurEffi, m_vCurEnergy, m_vCurUncert, m_curParam, funcId, phd, width, map);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void DataChangeEfficiency(List<Double> m_vCurEffi, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer funcId, PHDFile phd, Map<String, Object> map) {
|
||||
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);
|
||||
|
@ -1562,8 +1770,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
efficiencyData.setDelta(String.format("%.3f", delta));
|
||||
efficiencyDataList.add(efficiencyData);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for(int i=0; i<m_vCurEnergy.size(); ++i) {
|
||||
EfficiencyData efficiencyData = new EfficiencyData();
|
||||
efficiencyData.setEnergy(String.format("%.3f", m_vCurEnergy.get(i)));
|
||||
|
@ -1577,7 +1784,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("table", efficiencyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, map);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1611,7 +1818,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
StringBuffer strBuffer = new StringBuffer();
|
||||
strBuffer.append("#g_Efficiency").append("\n");
|
||||
for (int i=0; i<m_vCurEffi.size(); i++) {
|
||||
strBuffer.append(m_vCurEnergy.get(i)).append(" ").append(m_vCurEffi.get(i)).append(" ").append(m_vCurUncert.get(i)).append("\n");
|
||||
strBuffer.append(m_vCurEnergy.get(i)).append("\t\t").append(m_vCurEffi.get(i)).append("\t\t").append(m_vCurUncert.get(i)).append("\n");
|
||||
}
|
||||
strBuffer.append("FitType = ").append(funId);
|
||||
OutputStream fos = null;
|
||||
|
@ -1635,6 +1842,93 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result callDataEfficiency(MultipartFile file, String sampleFileName, Double width, String currentText) {
|
||||
Result result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(sampleFileName);
|
||||
if (Objects.nonNull(file)) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
//从最后一个。切割文件名称 获取文件名称后缀
|
||||
String fileSuffix = fileName.substring(fileName.lastIndexOf(StringPool.DOT));
|
||||
if (fileSuffix.equalsIgnoreCase(".eft")) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<Double> m_vCurEffi = new LinkedList<>();
|
||||
List<Double> m_vCurEnergy = new LinkedList<>();
|
||||
List<Double> m_vCurUncert = new LinkedList<>();
|
||||
Double m_nFunId = 1.0;
|
||||
try {
|
||||
//创建临时文件
|
||||
File tmpFile = File.createTempFile("tmp", null);
|
||||
//复制上传文件的输入流到临时文件
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream() ,tmpFile);
|
||||
//读取文件所有行
|
||||
List<String> readLines = FileUtils.readLines(tmpFile, "UTF-8");
|
||||
//遍历文件行数据
|
||||
for (int i=0; i<readLines.size(); i++) {
|
||||
String line = readLines.get(i);
|
||||
if (line.contains("#g_Efficiency") || line.contains("#Efficiency")) {
|
||||
for (int j=i+1; j<readLines.size(); j++) {
|
||||
String content = readLines.get(j);
|
||||
if (!content.contains("#") && !content.contains("FitType")) {
|
||||
List<String> values = Arrays.asList(content.split("\t\t"));
|
||||
if (Double.valueOf(values.get(0))>0) {
|
||||
m_vCurEnergy.add(Double.valueOf(values.get(0)));
|
||||
m_vCurEffi.add(Double.valueOf(values.get(1)));
|
||||
m_vCurUncert.add(Double.valueOf(values.get(2)));
|
||||
}
|
||||
}
|
||||
if (content.contains("FitType")) {
|
||||
List<String> values = Arrays.asList(content.split("="));
|
||||
if (values.size() == 2) {
|
||||
m_nFunId = Double.valueOf(values.get(1).trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("uncert", m_vCurUncert);
|
||||
ParameterInfo m_curParam = new ParameterInfo();
|
||||
if (StringUtils.isNotBlank(currentText)) {
|
||||
m_curParam = phd.getMapEffiPara().get(currentText);
|
||||
}
|
||||
if (m_curParam.getP().size()>0){
|
||||
m_curParam.getP().set(0, m_nFunId);
|
||||
} else {
|
||||
m_curParam.getP().add(m_nFunId);
|
||||
}
|
||||
map.put("param", m_curParam);
|
||||
int num = m_vCurEnergy.size();
|
||||
if(num < 1){
|
||||
return result;
|
||||
}
|
||||
List<Double> vFit = CalValuesHandler.calFcnEval(m_vCurEnergy, m_curParam.getP()).counts;
|
||||
List<EfficiencyData> efficiencyDataList = new LinkedList<>();
|
||||
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.setFit(String.format("%.3f", vFit.get(i)));
|
||||
efficiencyData.setDelta(String.format("%.3f", delta));
|
||||
efficiencyDataList.add(efficiencyData);
|
||||
}
|
||||
map.put("table", efficiencyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
|
||||
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
|
||||
map.put("G_energy_span", phd.getSpec().getG_energy_span());
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
@ -1732,9 +2026,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
userLibraryName = userLibraryName.stream().distinct().collect(Collectors.toList());
|
||||
boolean save = defaultNuclideSpectrumService.saveNuclidesByUserName(userLibraryName, userName, phd.getHeader().getSystem_type().toUpperCase());
|
||||
if (save) {
|
||||
result.success("修改成功!");
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.success("修改失败!");
|
||||
result.success("修改失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -2540,12 +2834,17 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result saveToDB(String fileName, String userName) {
|
||||
@Transactional
|
||||
public Result saveToDB(String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
boolean bRet = true;
|
||||
boolean needUploadSpec = false;
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)) {
|
||||
result.error500("请先解析文件!");
|
||||
return result;
|
||||
}
|
||||
//查看分析员是否有权限操作当前台站信息
|
||||
//判断当前分析员是否有过排班任务
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(phd.getHeader().getSite_code());
|
||||
|
@ -2577,8 +2876,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
phd.setStatus(sampleData.getStatus());
|
||||
} else {
|
||||
//如果sampleData为空 存储数据
|
||||
needUploadSpec = SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
bRet = needUploadSpec;
|
||||
SaveSampleToDB(phd, middleData.analyses_save_filePath);
|
||||
}
|
||||
if(!bRet) {
|
||||
result.error500("The Database hasn't this Spectrum("+phd.getFilename()+") and Insert it to Database failed.");
|
||||
|
@ -2671,8 +2969,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
boolean bRet = true;
|
||||
@Transactional
|
||||
public void SaveSampleToDB(PHDFile phd, String input_file_name) {
|
||||
String sit_det_code = phd.getHeader().getSite_code();
|
||||
String detect_code = phd.getHeader().getDetector_code();
|
||||
// 查询 station_id 和 detect_id
|
||||
|
@ -2683,54 +2981,26 @@ public class GammaServiceImpl implements IGammaService {
|
|||
// 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name);
|
||||
// ORIGINAL.GARDS_SAMPLE_AUX 表数据
|
||||
bRet = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId);
|
||||
// ORIGINAL.gards_sample_description 数据表
|
||||
bRet = sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId);
|
||||
// ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表
|
||||
if(phd.getCertificate().getRecord_count() > 0) {
|
||||
bRet = sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
bRet = sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId);
|
||||
sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId);
|
||||
}
|
||||
//gards_ calibration_pairs_orig数据表
|
||||
bRet = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId);
|
||||
// gards_total_efficiency _pairs数据表(IDC没有)
|
||||
bRet = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||
if (!bRet) {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
return bRet;
|
||||
}
|
||||
totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId);
|
||||
//gards_spectrum数据表
|
||||
bRet = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||
if(bRet) {
|
||||
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
||||
if(Objects.nonNull(samplData)) {
|
||||
phd.setId_sample(samplData.getSampleId().toString());
|
||||
phd.setStatus(samplData.getStatus());
|
||||
}
|
||||
} else {
|
||||
String Warning = "Save "+phd.getFilename()+" to original DB failed.";
|
||||
spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name);
|
||||
//根据文件名称获取sample基础数据信息
|
||||
GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name);
|
||||
if(Objects.nonNull(samplData)) {
|
||||
phd.setId_sample(samplData.getSampleId().toString());
|
||||
phd.setStatus(samplData.getStatus());
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsCalibrationPairsOrigSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -109,61 +110,66 @@ public class GardsCalibrationPairsOrigSpectrumServiceImpl extends ServiceImpl<Ga
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId) {
|
||||
List<GardsCalibrationPairsOrig> calibrationPairsOrigList = new LinkedList<>();
|
||||
int t_size = phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEnergyBlock g_ener = phd.getMapEnerKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.ENERGY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_ener.getCentroid_channel().get(i));
|
||||
calibrationPairsOrig.setYValue(g_ener.getG_energy().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_ener.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
if (Objects.nonNull(phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy())) {
|
||||
int t_size = phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEnergyBlock g_ener = phd.getMapEnerKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.ENERGY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_ener.getCentroid_channel().get(i));
|
||||
calibrationPairsOrig.setYValue(g_ener.getG_energy().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_ener.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
t_size = phd.getMapResoKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GResolutionBlock g_reso = phd.getMapResoKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.RESOLUTION_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_reso.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_reso.getFWHM().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_reso.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
if (Objects.nonNull(phd.getMapResoKD().get(CalName.CalPHD.getType()).getG_energy())) {
|
||||
int t_size = phd.getMapResoKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GResolutionBlock g_reso = phd.getMapResoKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++) {
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.RESOLUTION_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_reso.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_reso.getFWHM().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_reso.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
t_size = phd.getMapEffiKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEfficiencyBlock g_effi = phd.getMapEffiKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++){
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.EFFICIENCY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_effi.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_effi.getEfficiency().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_effi.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
if (Objects.nonNull(phd.getMapEffiKD().get(CalName.CalPHD.getType()).getG_energy())) {
|
||||
int t_size = phd.getMapEffiKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
if(t_size > 0) {
|
||||
GEfficiencyBlock g_effi = phd.getMapEffiKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++){
|
||||
GardsCalibrationPairsOrig calibrationPairsOrig = new GardsCalibrationPairsOrig();
|
||||
calibrationPairsOrig.setSampleId(sampleId);
|
||||
calibrationPairsOrig.setSampleType(SystemType.GAMMA.getType());
|
||||
calibrationPairsOrig.setCaltype(CalType.EFFICIENCY_CAL.getType());
|
||||
calibrationPairsOrig.setInput(CalName.CalPHD.getType());
|
||||
calibrationPairsOrig.setIdCalPoint(i);
|
||||
calibrationPairsOrig.setXValue(g_effi.getG_energy().get(i));
|
||||
calibrationPairsOrig.setYValue(g_effi.getEfficiency().get(i));
|
||||
calibrationPairsOrig.setUncYValue(g_effi.getUncertainty().get(i));
|
||||
calibrationPairsOrigList.add(calibrationPairsOrig);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(calibrationPairsOrigList)) {
|
||||
bRet = this.saveBatch(calibrationPairsOrigList);
|
||||
this.saveBatch(calibrationPairsOrigList);
|
||||
}
|
||||
return bRet;
|
||||
return calibrationPairsOrigList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,8 +88,7 @@ public class GardsSampleAuxSpectrumServiceImpl extends ServiceImpl<GardsSampleAu
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleAuxGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSampleAuxGamma(PHDFile phd, Integer sampleId) {
|
||||
GardsSampleAux sampleAux = new GardsSampleAux();
|
||||
String calibTime = "";
|
||||
if(StringUtils.isNotBlank(phd.getCalibration().getDate_calibration())) {
|
||||
|
@ -114,9 +113,6 @@ public class GardsSampleAuxSpectrumServiceImpl extends ServiceImpl<GardsSampleAu
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
int insert = this.baseMapper.insert(sampleAux);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsSampleCertLineSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -45,28 +46,29 @@ public class GardsSampleCertLineSpectrumServiceImpl extends ServiceImpl<GardsSam
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleCertLineGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSampleCertLineGamma(PHDFile phd, Integer sampleId) {
|
||||
List<GardsSampleCertLine> sampleCertLineList = new LinkedList<>();
|
||||
for (int i=0; i<phd.getCertificate().getRecord_count(); i++) {
|
||||
GardsSampleCertLine sampleCertLine = new GardsSampleCertLine();
|
||||
sampleCertLine.setSampleId(sampleId);
|
||||
sampleCertLine.setNuclName(phd.getCertificate().getNuclide_name().get(i));
|
||||
sampleCertLine.setHalflife(phd.getCertificate().getHalf_life_time().get(i));
|
||||
sampleCertLine.setEnergy(phd.getCertificate().getG_energy().get(i));
|
||||
sampleCertLine.setActivity(phd.getCertificate().getActivity_nuclide_time_assay().get(i));
|
||||
sampleCertLine.setError(phd.getCertificate().getUncertainty().get(i));
|
||||
sampleCertLine.setAbundance(phd.getCertificate().getG_intensity().get(i));
|
||||
sampleCertLine.setBAbundance(phd.getCertificate().getIntensity_b_particle().get(i));
|
||||
sampleCertLine.setBEnergy(phd.getCertificate().getMaximum_energy().get(i));
|
||||
sampleCertLine.setDecayMode(phd.getCertificate().getElectron_decay_mode().get(i));
|
||||
sampleCertLine.setHalfliftUnit(phd.getCertificate().getTime_unit().get(i));
|
||||
sampleCertLineList.add(sampleCertLine);
|
||||
if (Objects.nonNull(phd.getCertificate())) {
|
||||
for (int i=0; i<phd.getCertificate().getRecord_count(); i++) {
|
||||
GardsSampleCertLine sampleCertLine = new GardsSampleCertLine();
|
||||
sampleCertLine.setSampleId(sampleId);
|
||||
sampleCertLine.setNuclName(phd.getCertificate().getNuclide_name().get(i));
|
||||
sampleCertLine.setHalflife(phd.getCertificate().getHalf_life_time().get(i));
|
||||
sampleCertLine.setEnergy(phd.getCertificate().getG_energy().get(i));
|
||||
sampleCertLine.setActivity(phd.getCertificate().getActivity_nuclide_time_assay().get(i));
|
||||
sampleCertLine.setError(phd.getCertificate().getUncertainty().get(i));
|
||||
sampleCertLine.setAbundance(phd.getCertificate().getG_intensity().get(i));
|
||||
sampleCertLine.setBAbundance(phd.getCertificate().getIntensity_b_particle().get(i));
|
||||
sampleCertLine.setBEnergy(phd.getCertificate().getMaximum_energy().get(i));
|
||||
sampleCertLine.setDecayMode(phd.getCertificate().getElectron_decay_mode().get(i));
|
||||
sampleCertLine.setHalfliftUnit(phd.getCertificate().getTime_unit().get(i));
|
||||
sampleCertLineList.add(sampleCertLine);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(sampleCertLineList)) {
|
||||
this.saveBatch(sampleCertLineList);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(sampleCertLineList)) {
|
||||
bRet = this.saveBatch(sampleCertLineList);
|
||||
}
|
||||
return bRet;
|
||||
return sampleCertLineList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsSampleCertSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -35,23 +36,22 @@ public class GardsSampleCertSpectrumServiceImpl extends ServiceImpl<GardsSampleC
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleCertGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
String assay_date = phd.getCertificate().getAssay_date() + " " + phd.getCertificate().getAssay_time();
|
||||
try {
|
||||
GardsSampleCert sampleCert = new GardsSampleCert();
|
||||
sampleCert.setSampleId(sampleId);
|
||||
sampleCert.setQuantity(phd.getCertificate().getTotal_source_activity());
|
||||
sampleCert.setAssayDate(DateUtils.parseDate(assay_date));
|
||||
sampleCert.setUnit(phd.getCertificate().getUnits_activity());
|
||||
int insert = this.baseMapper.insert(sampleCert);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
public Integer saveSampleCertGamma(PHDFile phd, Integer sampleId) {
|
||||
int insert = 0;
|
||||
if (Objects.nonNull(phd.getCertificate())) {
|
||||
String assay_date = phd.getCertificate().getAssay_date() + " " + phd.getCertificate().getAssay_time();
|
||||
try {
|
||||
GardsSampleCert sampleCert = new GardsSampleCert();
|
||||
sampleCert.setSampleId(sampleId);
|
||||
sampleCert.setQuantity(phd.getCertificate().getTotal_source_activity());
|
||||
sampleCert.setAssayDate(DateUtils.parseDate(assay_date));
|
||||
sampleCert.setUnit(phd.getCertificate().getUnits_activity());
|
||||
insert = this.baseMapper.insert(sampleCert);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,8 +96,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl<GardsSampleD
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id) {
|
||||
// ORIGINAL.GARDS_SAMPLE_DATA 表数据
|
||||
String status = "U";
|
||||
String transmit_dtg = phd.getHeader().getTransmit_date()+" "+phd.getHeader().getTransmit_time();
|
||||
|
@ -113,7 +112,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl<GardsSampleD
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
String acq_stop = DateUtils.formatDate(new Date(acq_stop_dt), "yyyy/MM/dd HH:mm:ss");
|
||||
String data_type = (StringUtils.isBlank(phd.getMsgInfo().getData_type())? "":phd.getMsgInfo().getData_type());
|
||||
String data_type = phd.getMsgInfo().getData_type().substring(0, 1);
|
||||
GardsSampleData sampleData = new GardsSampleData();
|
||||
try {
|
||||
sampleData.setSiteDetCode(phd.getHeader().getDetector_code());
|
||||
|
@ -137,10 +136,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl<GardsSampleD
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
int insert = this.baseMapper.insert(sampleData);
|
||||
if (insert > 0) {
|
||||
bRet = true;
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,18 +33,16 @@ public class GardsSampleDescriptionSpectrumServiceImpl extends ServiceImpl<Gards
|
|||
@Transactional
|
||||
public boolean saveSampleDescriptionGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
if(StringUtils.isNotBlank(phd.getOriTotalCmt())) {
|
||||
String t_cmt = phd.getOriTotalCmt();
|
||||
if(t_cmt.length() > 1024){
|
||||
t_cmt = t_cmt.substring(0, 1024);
|
||||
}
|
||||
GardsSampleDescription sampleDescription = new GardsSampleDescription();
|
||||
sampleDescription.setSampleId(sampleId);
|
||||
sampleDescription.setDescription(t_cmt);
|
||||
int insert = this.baseMapper.insert(sampleDescription);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
String t_cmt = StringUtils.isNotBlank(phd.getOriTotalCmt())?phd.getOriTotalCmt():"";
|
||||
if(t_cmt.length() > 1024){
|
||||
t_cmt = t_cmt.substring(0, 1024);
|
||||
}
|
||||
GardsSampleDescription sampleDescription = new GardsSampleDescription();
|
||||
sampleDescription.setSampleId(sampleId);
|
||||
sampleDescription.setDescription(t_cmt);
|
||||
int insert = this.baseMapper.insert(sampleDescription);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class GardsSpectrumSpectrumServiceImpl extends ServiceImpl<GardsSpectrumS
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name) {
|
||||
boolean bRet = false;
|
||||
public Integer saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name) {
|
||||
int insert = 0;
|
||||
int t_size = (int) phd.getSpec().getNum_g_channel();
|
||||
if(t_size > 0) {
|
||||
GSpectrumBlock g_spec = phd.getSpec();
|
||||
|
@ -67,12 +67,9 @@ public class GardsSpectrumSpectrumServiceImpl extends ServiceImpl<GardsSpectrumS
|
|||
spectrum.setChannels((int) g_spec.getNum_g_channel());
|
||||
spectrum.setEnergySpan((int) g_spec.getG_energy_span());
|
||||
spectrum.setStartChannel((int) g_spec.getBegin_channel());
|
||||
int insert = this.baseMapper.insert(spectrum);
|
||||
if (insert>0) {
|
||||
bRet = true;
|
||||
}
|
||||
insert = this.baseMapper.insert(spectrum);
|
||||
}
|
||||
return bRet;
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsTotalEfficiencyPairsSpectrumService")
|
||||
@DS("ora")
|
||||
|
@ -40,10 +41,9 @@ public class GardsTotalEfficiencyPairsSpectrumServiceImpl extends ServiceImpl<Ga
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId) {
|
||||
boolean bRet = false;
|
||||
public Integer saveTotalEfficiencyPairsGamma(PHDFile phd, Integer sampleId) {
|
||||
List<GardsTotalEfficiencyPairs> totalEfficiencyPairsList = new LinkedList<>();
|
||||
int t_size = phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy().size();
|
||||
int t_size = Objects.nonNull(phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy())?phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy().size():0;
|
||||
if(t_size > 0) {
|
||||
TotaleffBlock g_tote = phd.getMapTotEKD().get(CalName.CalPHD.getType());
|
||||
for (int i=0; i<t_size; i++){
|
||||
|
@ -58,7 +58,7 @@ public class GardsTotalEfficiencyPairsSpectrumServiceImpl extends ServiceImpl<Ga
|
|||
if (CollectionUtils.isNotEmpty(totalEfficiencyPairsList)) {
|
||||
this.saveBatch(totalEfficiencyPairsList);
|
||||
}
|
||||
return bRet;
|
||||
return totalEfficiencyPairsList.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
|
|||
public void run(String... args) throws Exception {
|
||||
//调用dll
|
||||
System.loadLibrary("ReadPHDFile");
|
||||
autoProcessManager.start();
|
||||
// autoProcessManager.start();
|
||||
undealHandleManager.start();
|
||||
fileSourceHandleManager.start();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user