fix:1.移动枚举位置,提供多个模块公用

This commit is contained in:
panbaolin 2023-08-30 18:57:44 +08:00
parent 585d51afe9
commit 37b1eecd7d
18 changed files with 152 additions and 21 deletions

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.emuns; package org.jeecg.modules.base.enums;
/** /**
* 邮件类型 * 邮件类型

View File

@ -0,0 +1,34 @@
package org.jeecg.modules.base.enums;
/**
* 邮件类型
*/
public enum DataTypeAbbr {
/**
* 样品谱
*/
SAMPLEPHD("S"),
/**
* 探测器本地谱
*/
DETBKPHD("D"),
/**
* QC谱
*/
QCPHD("Q"),
/**
* 气体谱
*/
GASBKPHD("G");
private String type;
DataTypeAbbr(String type) {
this.type = type;
}
public String getType(){
return this.type;
}
}

View File

@ -1,4 +1,4 @@
package org.jeecg.common.enums; package org.jeecg.modules.base.enums;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.emuns; package org.jeecg.modules.base.enums;
/** /**
* 邮件类型 * 邮件类型

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.emuns; package org.jeecg.modules.base.enums;
public enum SystemType { public enum SystemType {

View File

@ -5,7 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.EmailConstant; import org.jeecg.common.constant.EmailConstant;
import org.jeecg.common.email.EmailServiceManager; import org.jeecg.common.email.EmailServiceManager;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.emuns.SysMailEnableType; import org.jeecg.modules.base.enums.SysMailEnableType;
import org.jeecg.modules.email.EmailProperties; import org.jeecg.modules.email.EmailProperties;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.properties.TaskProperties; import org.jeecg.common.properties.TaskProperties;

View File

@ -35,4 +35,26 @@ public class BgAnalyseResult {
* 失败原因 * 失败原因
*/ */
public String error_log; public String error_log;
@Override
public String toString() {
return "BgAnalyseResult{" +
"MDC_Xe135=" + MDC_Xe135 +
", MDC_Xe131m=" + MDC_Xe131m +
", MDC_Xe133m=" + MDC_Xe133m +
", MDC_Xe133=" + MDC_Xe133 +
", MDC=" + MDC +
", MDC_CTS=" + MDC_CTS +
", Xe135_con=" + Xe135_con +
", Xe135_uncer=" + Xe135_uncer +
", Xe131m_con=" + Xe131m_con +
", Xe131m_uncer=" + Xe131m_uncer +
", Xe133m_con=" + Xe133m_con +
", Xe133m_uncer=" + Xe133m_uncer +
", Xe133_con=" + Xe133_con +
", Xe133_uncer=" + Xe133_uncer +
", analyse_flag=" + analyse_flag +
", error_log='" + error_log + '\'' +
'}';
}
} }

View File

@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.jeecg.common.email.emuns.SysMailType; import org.jeecg.common.email.emuns.SysMailType;
import org.jeecg.modules.base.entity.postgre.SysEmail; import org.jeecg.modules.base.entity.postgre.SysEmail;
import org.jeecg.modules.base.enums.SysMailEnableType;
import org.jeecg.modules.email.EmailProperties; import org.jeecg.modules.email.EmailProperties;
import org.jeecg.modules.emuns.SysMailEnableType;
import org.jeecg.modules.mapper.SysMailMapper; import org.jeecg.modules.mapper.SysMailMapper;
import org.jeecg.modules.service.ISysMailService; import org.jeecg.modules.service.ISysMailService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;

View File

@ -6,7 +6,7 @@ import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.original.GardsAlertData; import org.jeecg.modules.base.entity.original.GardsAlertData;
import org.jeecg.modules.emuns.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.AlertSpectrumStruct; import org.jeecg.modules.native_jni.struct.AlertSpectrumStruct;

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import org.jeecg.modules.emuns.DataType;
import org.jeecg.modules.base.enums.DataType;
/** /**
* 探测器本地谱处理 * 探测器本地谱处理

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.emuns.DataType; import org.jeecg.modules.base.enums.DataType;
/** /**
* 气体谱处理 * 气体谱处理

View File

@ -6,7 +6,7 @@ import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.original.GardsSohData; import org.jeecg.modules.base.entity.original.GardsSohData;
import org.jeecg.modules.emuns.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.exception.AirSamplerFlowException; import org.jeecg.modules.exception.AirSamplerFlowException;
import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.SOHSpectrumStruct; import org.jeecg.modules.native_jni.struct.SOHSpectrumStruct;

View File

@ -6,7 +6,7 @@ import org.jeecg.common.constant.StringConstant;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.base.entity.original.GardsMetData; import org.jeecg.modules.base.entity.original.GardsMetData;
import org.jeecg.modules.emuns.DataType; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.MetSpectrumStruct; import org.jeecg.modules.native_jni.struct.MetSpectrumStruct;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.emuns.DataType;
/** /**
* QC谱处理 * QC谱处理

View File

@ -1,12 +1,33 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import org.jeecg.modules.emuns.DataType; import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.StringConstant;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.DataTypeAbbr;
import org.jeecg.modules.base.enums.SampleStatus;
import org.jeecg.modules.exception.FileNotExistException;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
/** /**
* 样品谱处理 * 样品谱处理
*/ */
public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
/**
* 正常分析过程日志
*/
private StringBuilder analysesLog = new StringBuilder();
/**
* 分析过程当前状态
*/
private String currAnalysesStatus = null;
/** /**
* 设置过滤链路 * 设置过滤链路
*/ */
@ -53,8 +74,64 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
* *
* @param struct * @param struct
*/ */
@Override protected void handlerAnalysisResult() throws FileNotExistException, IOException {
protected void handlerAnalysisResult() {
final String sampleFilePath = super.ftpSavePath;
String detFilePath = null;
String gasFilePath = null;
//修改状态为解析中
this.currAnalysesStatus = SampleStatus.IN_PROCESS.getValue();
super.spectrumServiceQuotes.getSampleDataService().updateStatus(this.currAnalysesStatus,sampleFilePath);
//查询det和gas能谱文件
GardsSampleData detSampleData = super.spectrumServiceQuotes.getSampleDataService().getDetInputFileName(super.sourceData.detector_bk_measurement_id, DataTypeAbbr.DETBKPHD.getType());
GardsSampleData gasSampleData = super.spectrumServiceQuotes.getSampleDataService().getGasInputFileName(super.sourceData.gas_bk_measurement_id, DataTypeAbbr.GASBKPHD.getType());
//如果找不到sampledetgas谱文件数据则解析失败修改记录状态
if(StringUtils.isEmpty(sampleFilePath) || Objects.isNull(detSampleData) || StringUtils.isEmpty(detSampleData.getInputFileName()) || Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName())){
this.currAnalysesStatus = SampleStatus.FAIL.getValue();
super.spectrumServiceQuotes.getSampleDataService().updateStatus(this.currAnalysesStatus,sampleFilePath);
throw new FileNotExistException("gas or det file is no exist or is error..");
}
//下载det谱PHD文件到本地临时路径
final String detFileName = detSampleData.getInputFileName().substring(detSampleData.getInputFileName().lastIndexOf(StringConstant.SLASH) + 1);
detFilePath = detSampleData.getInputFileName().substring(0, detSampleData.getInputFileName().lastIndexOf(StringConstant.SLASH));
ftpUtil.downloadFTPFile(detFilePath,detFileName,this.spectrumServiceQuotes.getTaskProperties().getTemporaryStoragePath());
detFilePath = this.spectrumServiceQuotes.getTaskProperties().getTemporaryStoragePath()+File.separator+detFileName;
//下载gas谱PHD文件到本地临时路径
String gasFileName = gasSampleData.getInputFileName().substring(gasSampleData.getInputFileName().lastIndexOf(StringConstant.SLASH) + 1);
gasFilePath = gasSampleData.getInputFileName().substring(0, gasSampleData.getInputFileName().lastIndexOf(StringConstant.SLASH));
ftpUtil.downloadFTPFile(gasFilePath,gasFileName,this.spectrumServiceQuotes.getTaskProperties().getTemporaryStoragePath());
gasFilePath = this.spectrumServiceQuotes.getTaskProperties().getTemporaryStoragePath()+File.separator+gasFileName;
//分析结果
final BgAnalyseResult analyseResult = EnergySpectrumHandler.bgAnalyse(sampleFilePath, gasFilePath, detFilePath);
System.out.println(analyseResult);
if(Objects.nonNull(analyseResult) && analyseResult.analyse_flag){
//存储数据
super.spectrumServiceQuotes.getAnalysesService().create(analyseResult,super.sampleData.getSampleId());
//修改分析状态为已完成
this.currAnalysesStatus = SampleStatus.COMPLETE.getValue();
super.spectrumServiceQuotes.getSampleDataService().updateStatus(this.currAnalysesStatus,sampleFilePath);
//调用原始数据dll获取gasdet谱数据入库sample已有数据直接入库 EnergySpectrumHandler.getSourceData()
//存储gards_calibration表数据sampledetgas谱数据
//存储GARDS_ROI_CHANNELS表数据sampledetgas谱数据-乔钦政那边已和周雨涵调试过
//gards_ Xe_results数据表
}
}
/**
* 下载FTP文件到临时目录
* @param filePath
*/
private void downFTPFileToTemporaryDirectory(String filePath){
} }
} }

View File

@ -3,8 +3,8 @@ package org.jeecg.modules.spectrum;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.email.EmailProperties; import org.jeecg.modules.email.EmailProperties;
import org.jeecg.modules.emuns.DataType;
import org.jeecg.modules.ftp.FTPUtils; import org.jeecg.modules.ftp.FTPUtils;
import javax.mail.Message; import javax.mail.Message;
import java.io.File; import java.io.File;

View File

@ -13,7 +13,7 @@ import org.apache.commons.net.ftp.FTPFile;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.Prompt; import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.enums.SampleFileHeader; import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.modules.entity.data.HistogramData; import org.jeecg.modules.entity.data.HistogramData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -24,8 +24,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import static org.jeecg.common.constant.enums.FileTypeEnum.txt;
@Component @Component
@Slf4j @Slf4j
public class ReadLineUtil { public class ReadLineUtil {

View File

@ -14,7 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.enums.SampleFileHeader; import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.ExportUtil; import org.jeecg.common.util.ExportUtil;
import org.jeecg.common.util.ReadLineUtil; import org.jeecg.common.util.ReadLineUtil;