Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
561533c6c3
|
@ -39,7 +39,12 @@ public class SpectrumPathProperties implements Serializable {
|
|||
/**
|
||||
* 用户上传文件路径
|
||||
*/
|
||||
private String uploadPath;
|
||||
private String uploadPath;;
|
||||
|
||||
/**
|
||||
* 能谱解析失败文件存储路径
|
||||
*/
|
||||
private String failPath;
|
||||
|
||||
/**
|
||||
* 能谱文件存储路径以能谱系统类型/能谱类型为key,以存储路径为value
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package org.jeecg.modules.base.entity.postgre;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName(value = "sys_user_color")
|
||||
public class SysUserColor implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 原谱曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_spec")
|
||||
private String colorSpec;
|
||||
|
||||
/**
|
||||
* 拟合峰曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_peak")
|
||||
private String colorPeak;
|
||||
|
||||
/**
|
||||
* LC曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_lc")
|
||||
private String colorLc;
|
||||
|
||||
/**
|
||||
* BaseLine曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_base")
|
||||
private String colorBase;
|
||||
|
||||
/**
|
||||
* Scac曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_scac")
|
||||
private String colorScac;
|
||||
|
||||
/**
|
||||
* 比较谱曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_compare")
|
||||
private String colorCompare;
|
||||
|
||||
/**
|
||||
* 拟合基线颜色
|
||||
*/
|
||||
@TableField(value = "color_fitbase")
|
||||
private String colorFitbase;
|
||||
|
||||
/**
|
||||
* 两谱和曲线颜色
|
||||
*/
|
||||
@TableField(value = "color_strip")
|
||||
private String colorStrip;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "create_by")
|
||||
private String createBy;
|
||||
|
||||
}
|
|
@ -124,13 +124,46 @@ public class FTPUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* 写入文件,若文件或文件目录不存在则自行创建
|
||||
* 写入文件,若文件或文件目录不存在则自行创建,存在先删除再创建
|
||||
* @param filePath 文件路径
|
||||
* @param fileName 文件名称
|
||||
* @param inputStream 文件输入流
|
||||
* @return 返回值true/false
|
||||
*/
|
||||
public boolean saveFile(String filePath,String fileName,InputStream inputStream){
|
||||
try{
|
||||
final boolean flag = this.checkDirectory(filePath);
|
||||
if(flag){
|
||||
final FTPFile[] ftpFiles = this.client.listFiles(fileName);
|
||||
if(ArrayUtils.isNotEmpty(ftpFiles)){
|
||||
client.deleteFile(fileName);
|
||||
}
|
||||
return client.storeFile(fileName, inputStream);
|
||||
}
|
||||
}catch (IOException e){
|
||||
log.error("{}文件创建失败,原因为:{}",filePath+"/"+fileName,e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}finally {
|
||||
if(null != inputStream){
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入文件,若文件或文件目录不存在则自行创建,存在则追加内容
|
||||
* @param filePath 文件路径
|
||||
* @param fileName 文件名称
|
||||
* @param inputStream 文件输入流
|
||||
* @return 返回值true/false
|
||||
*/
|
||||
public boolean saveOrAppendFile(String filePath,String fileName,InputStream inputStream){
|
||||
try{
|
||||
final boolean flag = this.checkDirectory(filePath);
|
||||
if(flag){
|
||||
|
|
|
@ -426,7 +426,7 @@ public class EnergySpectrumStruct {
|
|||
/**
|
||||
* γ-energy (keV)
|
||||
*/
|
||||
public List<String> t_g_energy;
|
||||
public List<Double> t_g_energy;
|
||||
/**
|
||||
* total efficiency (counts/photon emitted)
|
||||
*/
|
||||
|
@ -551,4 +551,4 @@ public class EnergySpectrumStruct {
|
|||
", t_record_count=" + t_record_count +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TotalEffBlockServiceImpl extends ServiceImpl<GardsTotalEfficiencyPa
|
|||
for(int i=0;i<struct.t_record_count;i++){
|
||||
GardsTotalEfficiencyPairs totalEfficiencyPairs = new GardsTotalEfficiencyPairs();
|
||||
totalEfficiencyPairs.setSampleId(sampleData.getSampleId());
|
||||
totalEfficiencyPairs.setEfficEnergy(struct.t_g_energy.get(i));
|
||||
totalEfficiencyPairs.setEfficEnergy(struct.t_g_energy.get(i).toString());
|
||||
totalEfficiencyPairs.setTotalEfficiency(struct.total_efficiency.get(i));
|
||||
totalEfficiencyPairs.setTotalEfficError(struct.t_uncertainty.get(i));
|
||||
totalEfficiencyPairs.setModdate(new Date());
|
||||
|
|
|
@ -45,7 +45,7 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new HealthStatusSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
super.currDataType,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -67,8 +67,6 @@ public class AlertSpectrum extends SpectrumHandler{
|
|||
this.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
this.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志写入ftp日志文件
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.base.enums.SampleStatus;
|
||||
|
||||
/**
|
||||
* 探测器本地谱处理
|
||||
|
@ -15,7 +16,7 @@ public class DetbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new QcphdSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
super.currDataType,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -26,24 +27,31 @@ public class DetbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
@Override
|
||||
protected void handler() throws Exception {
|
||||
if(DataType.DETBKPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
try{
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
}catch (Exception e){
|
||||
//修改状态为解析失败
|
||||
this.spectrumServiceQuotes.getSampleDataService().updateStatus(SampleStatus.FAIL.getValue(),super.sampleData.getInputFileName());
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
}else{
|
||||
super.next.handler();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.base.enums.SampleStatus;
|
||||
|
||||
/**
|
||||
* 气体谱处理
|
||||
|
@ -16,7 +17,7 @@ public class GasbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new MetSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
super.currDataType,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -27,24 +28,31 @@ public class GasbkphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
@Override
|
||||
protected void handler() throws Exception {
|
||||
if(DataType.GASBKPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
try{
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
}catch (Exception e){
|
||||
//修改状态为解析失败
|
||||
this.spectrumServiceQuotes.getSampleDataService().updateStatus(SampleStatus.FAIL.getValue(),super.sampleData.getInputFileName());
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
}else{
|
||||
super.next.handler();
|
||||
}
|
||||
|
|
|
@ -68,8 +68,6 @@ public class HealthStatusSpectrum extends SpectrumHandler{
|
|||
this.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
this.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志写入ftp日志文件
|
||||
|
|
|
@ -46,7 +46,7 @@ public class MetSpectrum extends SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new AlertSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
super.currDataType,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -65,8 +65,6 @@ public class MetSpectrum extends SpectrumHandler{
|
|||
this.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
this.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志写入ftp日志文件
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.spectrum;
|
||||
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.base.enums.SampleStatus;
|
||||
|
||||
/**
|
||||
* QC谱处理
|
||||
|
@ -14,7 +15,7 @@ public class QcphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new GasbkphdSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
super.currDataType,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -26,24 +27,31 @@ public class QcphdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void handler() throws Exception {
|
||||
//判断当前邮件内容是否是QC谱
|
||||
if(DataType.QCPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
try{
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
}catch (Exception e){
|
||||
//修改状态为解析失败
|
||||
this.spectrumServiceQuotes.getSampleDataService().updateStatus(SampleStatus.FAIL.getValue(),super.sampleData.getInputFileName());
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
}else{
|
||||
super.next.handler();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.spectrum;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
|
@ -35,6 +36,7 @@ import java.util.Objects;
|
|||
/**
|
||||
* 样品谱(Samplephd)、探测器本地谱(Detbkphd)、QC谱(Qcphd)、气体谱(Gasbkphd)
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
||||
|
||||
/**
|
||||
|
@ -202,11 +204,14 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
*/
|
||||
@Override
|
||||
protected void handlerOriginalData() throws Exception {
|
||||
this.startIntoDatabaseTime = new Date();
|
||||
//如果数据已经存储,不在重复存储
|
||||
final boolean exist = spectrumServiceQuotes.getSampleDataService().fileExist(super.ftpSavePath);
|
||||
if(exist){
|
||||
throw new FileRepeatException("file repeat");
|
||||
this.endIntoDatabaseTime = new Date();
|
||||
log.warn("{} file data has been stored",super.mailFile.getName());
|
||||
return;
|
||||
}
|
||||
this.startIntoDatabaseTime = new Date();
|
||||
DataSourceSwitcher.switchToOracle();
|
||||
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
|
||||
try{
|
||||
|
@ -266,7 +271,7 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{
|
|||
this.logFilePath = properties.getLogPath()+StringConstant.SLASH+this.getFileSavePath();
|
||||
this.logFileName = super.mailFile.getName().replace(this.currDataType.getSuffix(),LOG_FILE_SUFFIX);
|
||||
|
||||
super.ftpUtil.saveFile(logFilePath,logFileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
super.ftpUtil.saveOrAppendFile(logFilePath,logFileName,new ByteArrayInputStream(logContent.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@ 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;
|
||||
|
@ -36,6 +37,7 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* B谱分析过程
|
||||
*/
|
||||
@Slf4j
|
||||
public class Sample_B_Analysis implements BlockConstant {
|
||||
|
||||
/**
|
||||
|
@ -141,8 +143,8 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
/**
|
||||
* 执行解析过程
|
||||
*/
|
||||
public void start(){
|
||||
try {
|
||||
public void start() throws BAnalyseException {
|
||||
try{
|
||||
//修改状态为解析中
|
||||
this.updateStatus(SampleStatus.IN_PROCESS.getValue());
|
||||
//查询det、gas数据(sampleId,inputFileName),sample数据在构造函数已经传过来
|
||||
|
@ -158,15 +160,19 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
//生成报告
|
||||
Sample_B_Analysis.B_AnalysisReport report = new Sample_B_Analysis.B_AnalysisReport();
|
||||
report.start();
|
||||
//删除下载的det和gas临时文件
|
||||
this.deleteLocalTemporaryFile();
|
||||
//修改状态为解析成功
|
||||
this.updateStatus(SampleStatus.COMPLETE.getValue());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
throw new BAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
}finally {
|
||||
//删除下载的det和gas临时文件
|
||||
this.deleteLocalTemporaryFile();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态为解析中
|
||||
* 修改状态
|
||||
* @param analysesStatus
|
||||
*/
|
||||
private void updateStatus(String analysesStatus){
|
||||
|
@ -270,6 +276,12 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
private void storageDataToDatabase(){
|
||||
String logFileRelativePath = this.logFilePath+StringConstant.SLASH+this.logFileName;
|
||||
String arrFileRelativePath = this.arrFilePath+StringConstant.SLASH+this.arrFileName;
|
||||
//如果数据已经存储,不在重复存储
|
||||
final Integer idAnalysis = spectrumServiceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
||||
if(Objects.nonNull(idAnalysis)){
|
||||
log.warn("{} file analysis data has been stored",new File(this.sampleTempFilePath).getName());
|
||||
return;
|
||||
}
|
||||
DataSourceSwitcher.switchToOracle();
|
||||
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
|
||||
try{
|
||||
|
@ -312,14 +324,17 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
* 删除下载的det和gas临时文件
|
||||
*/
|
||||
private void deleteLocalTemporaryFile(){
|
||||
File detFile = new File(this.detTempFilePath);
|
||||
if(detFile.exists() && detFile.isFile()){
|
||||
detFile.delete();
|
||||
if(StringUtils.isNotBlank(this.detTempFilePath)){
|
||||
File detFile = new File(this.detTempFilePath);
|
||||
if(detFile.exists() && detFile.isFile()){
|
||||
detFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
File gasFile = new File(this.gasTempFilePath);
|
||||
if(gasFile.exists() && gasFile.isFile()){
|
||||
gasFile.delete();
|
||||
if(StringUtils.isNotBlank(this.gasTempFilePath)){
|
||||
File gasFile = new File(this.gasTempFilePath);
|
||||
if(gasFile.exists() && gasFile.isFile()){
|
||||
gasFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +16,7 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
protected void setChina() {
|
||||
SpectrumHandler spectrumHandler = new DetbkphdSpectrum();
|
||||
spectrumHandler.initNext(super.spectrumServiceQuotes,super.mailFile,
|
||||
super.currDataType,super.message,super.emailProperties,super.ftpUtil,super.mailContent);
|
||||
super.currDataType,super.ftpUtil,super.mailContent);
|
||||
spectrumHandler.setPrevious(this);
|
||||
super.setNext(spectrumHandler);
|
||||
}
|
||||
|
@ -26,26 +27,33 @@ public class SamplephdSpectrum extends S_D_Q_G_SpectrumHandler{
|
|||
@Override
|
||||
protected void handler() throws Exception {
|
||||
if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType())){
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//保存email日志
|
||||
super.saveEmailLog();
|
||||
//把原始库流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
//进行B、G(P)谱分析
|
||||
this.autoAnalysis();
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
try{
|
||||
//前置检查
|
||||
this.preCheck();
|
||||
//打印当前处理的能谱类型
|
||||
super.printCurrDataType();
|
||||
//解析邮件内容
|
||||
super.parseingEmail();
|
||||
//读取邮件内容标签
|
||||
super.readFileLabel();
|
||||
//保存PHD文件到ftp
|
||||
super.saveFileToFtp();
|
||||
//结构体数据入库
|
||||
super.handlerOriginalData();
|
||||
//把原始库流程日志写入ftp日志文件
|
||||
super.saveLogToFtp();
|
||||
//进行B、G(P)谱分析
|
||||
this.autoAnalysis();
|
||||
}catch (Exception e){
|
||||
//修改状态为解析失败
|
||||
this.spectrumServiceQuotes.getSampleDataService().updateStatus(SampleStatus.FAIL.getValue(),super.sampleData.getInputFileName());
|
||||
//处理解析失败的文件,上传到ftp->undeal目录
|
||||
super.handleParseingFailFile();
|
||||
throw e;
|
||||
}finally {
|
||||
//删除本地临时文件
|
||||
super.deleteLocalTemporaryFile();
|
||||
}
|
||||
}else{
|
||||
super.next.handler();
|
||||
}
|
||||
|
|
|
@ -4,11 +4,9 @@ import cn.hutool.core.io.FileUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.base.enums.DataType;
|
||||
import org.jeecg.modules.email.EmailProperties;
|
||||
import org.jeecg.modules.exception.PHD_ReadException;
|
||||
import org.jeecg.modules.ftp.FTPUtils;
|
||||
import javax.mail.Message;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -22,14 +20,6 @@ public abstract class SpectrumHandler extends Chain{
|
|||
private final static String DATA_TYPE_PREFIX = "DATA_TYPE ";
|
||||
|
||||
protected final static String LOG_FILE_SUFFIX = ".log";
|
||||
/**
|
||||
* 当前邮件信息
|
||||
*/
|
||||
protected Message message;
|
||||
/**
|
||||
* 邮件属性
|
||||
*/
|
||||
protected EmailProperties emailProperties;
|
||||
/**
|
||||
* 处理能谱数据相关Service引用
|
||||
*/
|
||||
|
@ -63,12 +53,9 @@ public abstract class SpectrumHandler extends Chain{
|
|||
/**
|
||||
* 初始化参数
|
||||
*/
|
||||
protected void init(String mailContent,SpectrumServiceQuotes spectrumServiceQuotes,Message message,
|
||||
EmailProperties emailProperties,FTPUtils ftpUtil) throws Exception{
|
||||
protected void init(String mailContent,SpectrumServiceQuotes spectrumServiceQuotes,FTPUtils ftpUtil) throws Exception{
|
||||
this.mailContent = mailContent;
|
||||
this.spectrumServiceQuotes = spectrumServiceQuotes;
|
||||
this.message = message;
|
||||
this.emailProperties = emailProperties;
|
||||
this.ftpUtil = ftpUtil;
|
||||
}
|
||||
|
||||
|
@ -76,12 +63,10 @@ public abstract class SpectrumHandler extends Chain{
|
|||
* 初始化参数
|
||||
*/
|
||||
protected void initNext(SpectrumServiceQuotes spectrumServiceQuotes,File mailFile,DataType currDataType,
|
||||
Message message,EmailProperties emailProperties,FTPUtils ftpUtil,String mailContent){
|
||||
FTPUtils ftpUtil,String mailContent){
|
||||
this.spectrumServiceQuotes = spectrumServiceQuotes;
|
||||
this.mailFile = mailFile;
|
||||
this.currDataType = currDataType;
|
||||
this.message = message;
|
||||
this.emailProperties = emailProperties;
|
||||
this.ftpUtil = ftpUtil;
|
||||
this.mailContent = mailContent;
|
||||
this.setChina();
|
||||
|
@ -153,11 +138,11 @@ public abstract class SpectrumHandler extends Chain{
|
|||
}
|
||||
|
||||
/**
|
||||
* 保存邮件日志到PG数据库
|
||||
* @throws Exception
|
||||
* 处理解析失败的文件,上传到ftp->undeal目录
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
protected void saveEmailLog() throws Exception {
|
||||
this.spectrumServiceQuotes.getMailLogService().create(this.message,this.emailProperties);
|
||||
protected void handleParseingFailFile() throws FileNotFoundException {
|
||||
this.ftpUtil.saveFile(spectrumServiceQuotes.getSpectrumPathProperties().getFailPath(),this.mailFile.getName(),new FileInputStream(this.mailFile));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.jeecg.modules.spectrum;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
|
@ -10,8 +9,8 @@ import org.jeecg.common.util.DateUtils;
|
|||
import org.jeecg.modules.email.EmailProperties;
|
||||
import org.jeecg.modules.ftp.FTPProperties;
|
||||
import org.jeecg.modules.ftp.FTPUtils;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeUtility;
|
||||
import java.util.Date;
|
||||
|
@ -99,22 +98,28 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
//判断是否是IMS2.0协议文件
|
||||
if(checkMailContent(mailContent,subject)){
|
||||
SpectrumHandler spectrumHandler = new SamplephdSpectrum();
|
||||
spectrumHandler.init(mailContent.toString(),spectrumServiceQuotes,message,emailProperties,ftpUtil);
|
||||
spectrumHandler.init(mailContent.toString(),spectrumServiceQuotes,ftpUtil);
|
||||
final boolean matchResult = spectrumHandler.saveEmailToLocal();
|
||||
if(matchResult){
|
||||
//保存邮件解析日志到PG数据库
|
||||
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
|
||||
//开始解析
|
||||
spectrumHandler.handler();
|
||||
}else{
|
||||
log.warn("此邮件{}匹配失败,不在气象谱、警告谱、健康状态谱、样品谱、探测器本地谱、QC谱、气体谱之列",subject);
|
||||
}
|
||||
}
|
||||
//删除邮箱中已处理过的邮件
|
||||
emailServiceManager.removeMail(message);
|
||||
} catch (Exception e) {
|
||||
log.error(mailContent.toString());
|
||||
log.error("邮件解析失败,邮件主题为:{},发送时间为:{},接收时间为:{},失败原因为:{}",subject,sendTime,receiveTime,e.getMessage());
|
||||
this.handleErrorLog(e);
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
//删除邮箱中已处理过的邮件
|
||||
try {
|
||||
emailServiceManager.removeMail(message);
|
||||
} catch (MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.taskLatch.countDown();
|
||||
ftpUtil.close();
|
||||
}
|
||||
|
@ -181,13 +186,4 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
fileName.append(SAVE_EML_SUFFIX);
|
||||
ftpUtil.saveFile(spectrumPathProperties.getEmlPath(),fileName.toString(),message.getInputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理解析报错日志
|
||||
* @param e
|
||||
*/
|
||||
private void handleErrorLog(Exception e){
|
||||
StringBuilder logContent = new StringBuilder();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1175,7 +1175,7 @@ public class GammaFileUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateChart(PHDFile phd, Map<String, Object> map){
|
||||
public void UpdateChart(PHDFile phd, Map<String, Object> map, Map<String, String> colorMap){
|
||||
List<Long> m_vCount = new LinkedList<>();
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||
|
@ -1191,11 +1191,11 @@ public class GammaFileUtil {
|
|||
if(m_nSChan == 0) {
|
||||
m_vCount.add(0L);
|
||||
}
|
||||
ChartData shadowEnergyChart = this.Energy_Count(phd, m_vCount, m_nCount);
|
||||
ChartData shadowChannelChart = this.Channel_Count(m_vCount, m_nCount);
|
||||
ChartData shadowEnergyChart = this.Energy_Count(phd, m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
||||
ChartData shadowChannelChart = this.Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
||||
map.put("shadowEnergyChart", shadowEnergyChart);
|
||||
map.put("shadowChannelChart", shadowChannelChart);
|
||||
List<ChartData> allData = AllData(false, phd, m_vCount, m_nCount);
|
||||
List<ChartData> allData = AllData(false, phd, m_vCount, m_nCount, colorMap);
|
||||
map.put("allData", allData);
|
||||
List<ShapeData> shapeEnergyData = Energy_BaseCP(phd);
|
||||
map.put("shapeEnergyData", shapeEnergyData);
|
||||
|
@ -1203,7 +1203,7 @@ public class GammaFileUtil {
|
|||
map.put("shapeChannelData", shapeChannelData);
|
||||
}
|
||||
|
||||
public ChartData Energy_Count(PHDFile phd, List<Long> m_vCount, long m_nCount){
|
||||
public ChartData Energy_Count(PHDFile phd, List<Long> m_vCount, long m_nCount, String color){
|
||||
int start = 0;
|
||||
long end = -1;
|
||||
//Energy
|
||||
|
@ -1223,12 +1223,12 @@ public class GammaFileUtil {
|
|||
}
|
||||
data1.setName("Energy");
|
||||
data1.setGroup("energy");
|
||||
data1.setColor("255,255,0");
|
||||
data1.setColor(color);
|
||||
}
|
||||
return data1;
|
||||
}
|
||||
|
||||
public ChartData Channel_Count(List<Long> m_vCount, long m_nCount){
|
||||
public ChartData Channel_Count(List<Long> m_vCount, long m_nCount, String color){
|
||||
int start = 1;
|
||||
long end = -1;
|
||||
ChartData data1 = new ChartData();
|
||||
|
@ -1247,12 +1247,12 @@ public class GammaFileUtil {
|
|||
}
|
||||
data1.setName("Count");
|
||||
data1.setGroup("channel");
|
||||
data1.setColor("255,255,0");
|
||||
data1.setColor(color);
|
||||
}
|
||||
return data1;
|
||||
}
|
||||
|
||||
public List<ChartData> Lc_Scac_base(boolean showLc, PHDFile phd, long m_nCount){
|
||||
public List<ChartData> Lc_Scac_base(boolean showLc, PHDFile phd, long m_nCount, Map<String, String> colorMap){
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
int start = 0;
|
||||
long end = -1;
|
||||
|
@ -1306,26 +1306,26 @@ public class GammaFileUtil {
|
|||
// 颜色:原谱:0;峰:1;Lc:2;BaseLine:3;Scac:4;比较谱:5;
|
||||
data2.setGroup("channel");
|
||||
data2.setName("Lc");
|
||||
data2.setColor("255,0,0");
|
||||
data2.setColor(colorMap.get("Color_Lc"));
|
||||
data2.setShow(showLc);
|
||||
data3.setGroup("channel");
|
||||
data3.setName("Scac");
|
||||
data3.setColor("244,112,247");
|
||||
data3.setColor(colorMap.get("Color_Scac"));
|
||||
data3.setShow(showLc);
|
||||
data4.setGroup("channel");
|
||||
data4.setName("BaseLine");
|
||||
data4.setColor("0,246,255");
|
||||
data4.setColor(colorMap.get("Color_Base"));
|
||||
data6.setGroup("energy");
|
||||
data6.setName("Lc");
|
||||
data6.setColor("255,0,0");
|
||||
data6.setColor(colorMap.get("Color_Lc"));
|
||||
data6.setShow(showLc);
|
||||
data7.setGroup("energy");
|
||||
data7.setName("Scac");
|
||||
data7.setColor("244,112,247");
|
||||
data7.setColor(colorMap.get("Color_Scac"));
|
||||
data7.setShow(showLc);
|
||||
data8.setGroup("energy");
|
||||
data8.setName("BaseLine");
|
||||
data8.setColor("0,246,255");
|
||||
data8.setColor(colorMap.get("Color_Base"));
|
||||
data2.setType("Line");
|
||||
data3.setType("Line");
|
||||
data4.setType("Line");
|
||||
|
@ -1342,15 +1342,15 @@ public class GammaFileUtil {
|
|||
return datalist;
|
||||
}
|
||||
|
||||
public List<ChartData> Channel_Peak(PHDFile phd, long m_nCount){
|
||||
return PeakSet(phd.getVPeak(), phd.getVBase(), m_nCount, null, false);
|
||||
public List<ChartData> Channel_Peak(PHDFile phd, long m_nCount, String color){
|
||||
return PeakSet(phd.getVPeak(), phd.getVBase(), color, m_nCount, null, false);
|
||||
}
|
||||
|
||||
public List<ChartData> Energy_Peak(PHDFile phd, long m_nCount){
|
||||
return PeakSet(phd.getVPeak(), phd.getVBase(), m_nCount, phd.getUsedEnerPara().getP(), true);
|
||||
public List<ChartData> Energy_Peak(PHDFile phd, long m_nCount, String color){
|
||||
return PeakSet(phd.getVPeak(), phd.getVBase(), color, m_nCount, phd.getUsedEnerPara().getP(), true);
|
||||
}
|
||||
|
||||
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, long m_nCount, List<Double> p, boolean bEnergy){
|
||||
public List<ChartData> PeakSet(List<PeakInfo> vPeak, List<Double> vBase, String color, long m_nCount, List<Double> p, boolean bEnergy){
|
||||
System.loadLibrary("GammaAnaly");
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
int peakNum = vPeak.size();
|
||||
|
@ -1386,7 +1386,7 @@ public class GammaFileUtil {
|
|||
PeakInfo peak = vPeak.get(i);
|
||||
|
||||
ChartData cData = new ChartData();
|
||||
cData.setColor("255,127,39");
|
||||
cData.setColor(color);
|
||||
cData.setName("Peak");
|
||||
|
||||
List<Double> regChan = new LinkedList<>();
|
||||
|
@ -1464,13 +1464,13 @@ public class GammaFileUtil {
|
|||
return shapes;
|
||||
}
|
||||
|
||||
public List<ChartData> AllData(boolean showLc, PHDFile phd, List<Long> m_vCount, long m_nCount){
|
||||
public List<ChartData> AllData(boolean showLc, PHDFile phd, List<Long> m_vCount, long m_nCount, Map<String, String> colorMap){
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
datalist.add(Channel_Count(m_vCount, m_nCount));
|
||||
datalist.add(Energy_Count(phd, m_vCount, m_nCount));
|
||||
datalist.addAll(Lc_Scac_base(showLc, phd, m_nCount));
|
||||
datalist.addAll(Channel_Peak(phd, m_nCount));
|
||||
datalist.addAll(Energy_Peak(phd, m_nCount));
|
||||
datalist.add(Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec")));
|
||||
datalist.add(Energy_Count(phd, m_vCount, m_nCount, colorMap.get("Color_Spec")));
|
||||
datalist.addAll(Lc_Scac_base(showLc, phd, m_nCount, colorMap));
|
||||
datalist.addAll(Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak")));
|
||||
datalist.addAll(Energy_Peak(phd, m_nCount, colorMap.get("Color_Peak")));
|
||||
return datalist;
|
||||
}
|
||||
|
||||
|
@ -1864,7 +1864,7 @@ public class GammaFileUtil {
|
|||
return mapLines;
|
||||
}
|
||||
|
||||
public ChartData Channel_BaseLine(PHDFile phd, long m_nCount) {
|
||||
public ChartData Channel_BaseLine(PHDFile phd, long m_nCount, String color) {
|
||||
ChartData cData = new ChartData();
|
||||
int start =0;
|
||||
long end = -1;
|
||||
|
@ -1884,7 +1884,7 @@ public class GammaFileUtil {
|
|||
}
|
||||
cData.setGroup("channel");
|
||||
cData.setName("BaseLine");
|
||||
cData.setColor("0,246,255");
|
||||
cData.setColor(color);
|
||||
cData.setType("Line");
|
||||
}
|
||||
return cData;
|
||||
|
@ -2038,7 +2038,7 @@ public class GammaFileUtil {
|
|||
if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
|
||||
// 拟合曲线
|
||||
ChartData lData = new ChartData();
|
||||
lData.setColor("255, 255, 0");
|
||||
lData.setColor("rgb(255, 255, 0)");
|
||||
lData.setType("Line");
|
||||
|
||||
List<Double> vChan = new LinkedList<>();
|
||||
|
@ -2102,7 +2102,7 @@ public class GammaFileUtil {
|
|||
if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
|
||||
// 拟合曲线
|
||||
ChartData lData = new ChartData();
|
||||
lData.setColor("255, 255, 0");
|
||||
lData.setColor("rgb(255, 255, 0)");
|
||||
lData.setType("Line");
|
||||
|
||||
List<Double> vChan = new LinkedList<>();
|
||||
|
@ -2235,7 +2235,7 @@ public class GammaFileUtil {
|
|||
if(CollectionUtils.isNotEmpty(m_curParam.getP())) {
|
||||
// 拟合曲线
|
||||
ChartData lData = new ChartData();
|
||||
lData.setColor("255, 255, 0");
|
||||
lData.setColor("rgb(255, 255, 0)");
|
||||
lData.setType("Line");
|
||||
|
||||
List<Double> vChan = new LinkedList<>();
|
||||
|
@ -3637,13 +3637,13 @@ public class GammaFileUtil {
|
|||
return nuclideList;
|
||||
}
|
||||
|
||||
public void InitTable(String name, Map<String, Object> map, PHDFile phd){
|
||||
public void InitTable(String name, Map<String, Object> map, PHDFile phd, Map<String, String> colorMap){
|
||||
InitNuclideInfo(name, map);
|
||||
long span = phd.getSpec().getG_energy_span();
|
||||
List<GardsNuclLinesLib> nuclideTableList = spectrumAnalysisMapper.getNuclideTable(name, span);
|
||||
if (CollectionUtils.isNotEmpty(nuclideTableList)){
|
||||
map.put("table", nuclideTableList);
|
||||
InitChart(nuclideTableList, phd, map);
|
||||
InitChart(nuclideTableList, phd, map, colorMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3679,13 +3679,13 @@ public class GammaFileUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public void InitChart(List<GardsNuclLinesLib> nuclideTableList, PHDFile phd, Map<String, Object> map){
|
||||
public void InitChart(List<GardsNuclLinesLib> nuclideTableList, PHDFile phd, Map<String, Object> map, Map<String, String> colorMap){
|
||||
List<Map<String, Object>> chartList = new LinkedList<>();
|
||||
for (int i=0; i < nuclideTableList.size(); i++){
|
||||
Map<String, Object> chartMap = new HashMap<>();
|
||||
GardsNuclLinesLib item = nuclideTableList.get(i);
|
||||
double energy = item.getEnergy();
|
||||
List<ChartData> chartData = Energy_Count_Base(energy, 30, phd);
|
||||
List<ChartData> chartData = Energy_Count_Base(energy, 30, phd, colorMap);
|
||||
String title = "Line" + (i+1);
|
||||
String bottom = "Abundance:" + item.getYield();
|
||||
String selPos = energy+"";
|
||||
|
@ -3700,7 +3700,7 @@ public class GammaFileUtil {
|
|||
map.put("chart", chartList);
|
||||
}
|
||||
|
||||
public List<ChartData> Energy_Count_Base(double energy, int chanNum, PHDFile phd) {
|
||||
public List<ChartData> Energy_Count_Base(double energy, int chanNum, PHDFile phd, Map<String, String> colorMap) {
|
||||
List<ChartData> datalist = new LinkedList<>();
|
||||
int channel = GetChannelByEnergy(energy, 0, phd);
|
||||
int start = channel-chanNum/2, end = channel+chanNum/2;
|
||||
|
@ -3711,12 +3711,12 @@ public class GammaFileUtil {
|
|||
end = (int) phd.getSpec().getNum_g_channel();
|
||||
start = end - chanNum;
|
||||
}
|
||||
datalist.add(Energy_CountCahrt(start, end, phd));
|
||||
datalist.add(Energy_BaseLine(start, end, phd));
|
||||
datalist.add(Energy_CountChart(start, end, phd, colorMap.get("Color_Spec")));
|
||||
datalist.add(Energy_BaseLine(start, end, phd, colorMap.get("Color_Base")));
|
||||
return datalist;
|
||||
}
|
||||
|
||||
public ChartData Energy_CountCahrt(int start, int end, PHDFile phd) {
|
||||
public ChartData Energy_CountChart(int start, int end, PHDFile phd, String color) {
|
||||
ChartData data1 = new ChartData();
|
||||
if(phd.getSpec().getNum_g_channel() > 1 && phd.getVEnergy().size() == phd.getSpec().getNum_g_channel()) {
|
||||
if(start < 1){
|
||||
|
@ -3734,12 +3734,12 @@ public class GammaFileUtil {
|
|||
}
|
||||
data1.setName("Energy");
|
||||
data1.setGroup("energy");
|
||||
data1.setColor("255,255,0"); // 颜色:原谱:0;峰:1;Lc:2;BaseLine:3;Scac:4;比较谱:5;
|
||||
data1.setColor(color); // 颜色:原谱:0;峰:1;Lc:2;BaseLine:3;Scac:4;比较谱:5;
|
||||
}
|
||||
return data1;
|
||||
}
|
||||
|
||||
public ChartData Energy_BaseLine(int start, int end, PHDFile phd) {
|
||||
public ChartData Energy_BaseLine(int start, int end, PHDFile phd, String color) {
|
||||
ChartData cData = new ChartData();
|
||||
if(phd.getSpec().getNum_g_channel() > 1 && phd.getVEnergy().size() == phd.getSpec().getNum_g_channel() && phd.getVBase().size() == phd.getSpec().getNum_g_channel()) {
|
||||
if(start < 1){
|
||||
|
@ -3757,7 +3757,7 @@ public class GammaFileUtil {
|
|||
}
|
||||
cData.setGroup("energy");
|
||||
cData.setName("BaseLine");
|
||||
cData.setColor("0,246,255");
|
||||
cData.setColor(color);
|
||||
cData.setType("Line");
|
||||
}
|
||||
return cData;
|
||||
|
|
|
@ -49,8 +49,8 @@ public class GammaController {
|
|||
}
|
||||
|
||||
@GetMapping("gammaByDB")
|
||||
public Result gammaByDB(@RequestParam Integer sampleId, @RequestParam String dbName){
|
||||
return gammaService.gammaByDB(dbName, sampleId);
|
||||
public Result gammaByDB(@RequestParam Integer sampleId, @RequestParam String dbName, HttpServletRequest request){
|
||||
return gammaService.gammaByDB(dbName, sampleId, request);
|
||||
}
|
||||
|
||||
@GetMapping("gammaByFile")
|
||||
|
@ -73,8 +73,8 @@ public class GammaController {
|
|||
|
||||
@GetMapping("InteractiveTool")
|
||||
@ApiOperation(value = "analyze菜单下InteractiveTool页面数据", notes = "analyze菜单下InteractiveTool页面数据")
|
||||
public Result InteractiveTool(@RequestParam Integer sampleId, @RequestParam String fileName) {
|
||||
return gammaService.InteractiveTool(sampleId, fileName);
|
||||
public Result InteractiveTool(@RequestParam Integer sampleId, @RequestParam String fileName, HttpServletRequest request) {
|
||||
return gammaService.InteractiveTool(sampleId, fileName, request);
|
||||
}
|
||||
|
||||
@GetMapping("insertPeak")
|
||||
|
@ -85,20 +85,20 @@ public class GammaController {
|
|||
|
||||
@PostMapping("acceptResults")
|
||||
@ApiOperation(value = "InteractiveTool页面Insert页面save", notes = "InteractiveTool页面Insert页面save")
|
||||
public Result acceptResults(@RequestBody AcceptInfo acceptInfo) {
|
||||
return gammaService.acceptResults(acceptInfo.getFileName(), acceptInfo.isAccept(), acceptInfo.getOldPeak());
|
||||
public Result acceptResults(@RequestBody AcceptInfo acceptInfo, HttpServletRequest request) {
|
||||
return gammaService.acceptResults(acceptInfo.getFileName(), acceptInfo.isAccept(), acceptInfo.getOldPeak(), request);
|
||||
}
|
||||
|
||||
@GetMapping("deletePeak")
|
||||
@ApiOperation(value = "InteractiveTool页面delete按钮", notes = "InteractiveTool页面delete按钮")
|
||||
public Result deletePeak(String fileName, int curRow) {
|
||||
return gammaService.deletePeak(fileName, curRow);
|
||||
public Result deletePeak(String fileName, int curRow, HttpServletRequest request) {
|
||||
return gammaService.deletePeak(fileName, curRow, request);
|
||||
}
|
||||
|
||||
@GetMapping("getSelPosNuclide")
|
||||
@ApiOperation(value = "InteractiveTool页面选择channel加载对应核素信息接口", notes = "InteractiveTool页面选择channel加载对应核素信息接口")
|
||||
public Result getSelPosNuclide(Integer sampleId, String fileName, int channel, String nuclides, HttpServletRequest request) {
|
||||
return gammaService.getSelPosNuclide(sampleId, fileName, channel, nuclides, request);
|
||||
public Result getSelPosNuclide(Integer sampleId, String fileName, int channel, HttpServletRequest request) {
|
||||
return gammaService.getSelPosNuclide(sampleId, fileName, channel, request);
|
||||
}
|
||||
|
||||
@PostMapping("addNuclide")
|
||||
|
@ -145,8 +145,8 @@ public class GammaController {
|
|||
|
||||
@GetMapping("changeNuclide")
|
||||
@ApiOperation(value = "Nuclide Review页面切换nuclide数据", notes = "Nuclide Review页面切换nuclide数据")
|
||||
public Result changeNuclide(Integer sampleId, String fileName, String nuclideName) {
|
||||
return gammaService.changeNuclide(sampleId, fileName, nuclideName);
|
||||
public Result changeNuclide(Integer sampleId, String fileName, String nuclideName, HttpServletRequest request) {
|
||||
return gammaService.changeNuclide(sampleId, fileName, nuclideName, request);
|
||||
}
|
||||
|
||||
@GetMapping("searchNuclide")
|
||||
|
@ -349,6 +349,24 @@ public class GammaController {
|
|||
return gammaService.viewGammaviewerLog(sampleId, fileName);
|
||||
}
|
||||
|
||||
@GetMapping("clickPeakInformation")
|
||||
@ApiOperation(value = "gamma主页面点击peakInformation返回信息接口", notes = "gamma主页面点击peakInformation返回信息接口")
|
||||
public Result clickPeakInformation(String fileName, int index) {
|
||||
return gammaService.clickPeakInformation(fileName, index);
|
||||
}
|
||||
|
||||
@GetMapping("viewColorConfig")
|
||||
@ApiOperation(value = "查看颜色配置信息", notes = "查看颜色配置信息")
|
||||
public Result viewColorConfig(HttpServletRequest request) {
|
||||
return gammaService.viewColorConfig(request);
|
||||
}
|
||||
|
||||
@PutMapping("updateColorConfig")
|
||||
@ApiOperation(value = "修改颜色配置信息", notes = "修改颜色配置信息")
|
||||
public Result updateColorConfig(@RequestBody ColorInfo colorInfo, HttpServletRequest request) {
|
||||
return gammaService.updateColorConfig(colorInfo, request);
|
||||
}
|
||||
|
||||
@GetMapping("saveToDB")
|
||||
@ApiOperation(value = "Save To DB按钮", notes = "Save To DB按钮")
|
||||
public Result saveToDB(String fileName, String userName) {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ColorInfo implements Serializable {
|
||||
|
||||
private String colorSpec;
|
||||
|
||||
private String colorPeak;
|
||||
|
||||
private String colorLc;
|
||||
|
||||
private String colorBase;
|
||||
|
||||
private String colorScac;
|
||||
|
||||
private String colorCompare;
|
||||
|
||||
private String colorFitbase;
|
||||
|
||||
private String colorStrip;
|
||||
|
||||
|
||||
}
|
|
@ -146,6 +146,8 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
void deleteROIResults(Integer idAnalysis);
|
||||
|
||||
void insertROIResults(List<GardsROIResultsSpectrum> roiResultsSpectrumList);
|
||||
|
||||
String getIdAnalysisByIdAnalyst(@Param(value = "sampleId") String sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
void deletePeaks(Integer idAnalysis);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUserColor;
|
||||
|
||||
public interface SysUserColorMapper extends BaseMapper<SysUserColor> {
|
||||
}
|
|
@ -931,6 +931,42 @@
|
|||
DELETE FROM RNMAN.GARDS_ROI_RESULTS WHERE IDANALYSIS=#{idAnalysis}
|
||||
</delete>
|
||||
|
||||
<insert id="insertROIResults">
|
||||
<foreach collection="roiResultsSpectrumList" item="roiResultsSpectrum" open="(" separator="," close=")">
|
||||
INSERT INTO
|
||||
RNMAN.GARDS_ROI_RESULTS(SAMPLE_ID,
|
||||
IDANALYSIS,
|
||||
ROI,
|
||||
LC,
|
||||
S_GROSS,
|
||||
G_GROSS,
|
||||
B_GROSS,
|
||||
S_NET,
|
||||
G_NET,
|
||||
NET,
|
||||
NET_ERR,
|
||||
CONC,
|
||||
CONC_ERR,
|
||||
MDC,
|
||||
NID_FLAG)
|
||||
VALUES(#{roiResultsSpectrum.sampleId},
|
||||
#{roiResultsSpectrum.idAnalysis},
|
||||
#{roiResultsSpectrum.roi},
|
||||
#{roiResultsSpectrum.lc},
|
||||
#{roiResultsSpectrum.sGross},
|
||||
#{roiResultsSpectrum.gGross},
|
||||
#{roiResultsSpectrum.bGross},
|
||||
#{roiResultsSpectrum.sNet},
|
||||
#{roiResultsSpectrum.gNet},
|
||||
#{roiResultsSpectrum.net},
|
||||
#{roiResultsSpectrum.netErr},
|
||||
#{roiResultsSpectrum.conc},
|
||||
#{roiResultsSpectrum.concErr},
|
||||
#{roiResultsSpectrum.mdc},
|
||||
#{roiResultsSpectrum.nidFlag})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getIdAnalysisByIdAnalyst" resultType="java.lang.String">
|
||||
SELECT IDANALYSIS FROM RNMAN.GARDS_ANALYSES WHERE SAMPLE_ID = #{sampleId} AND ANALYST = #{userName}
|
||||
</select>
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface IGammaService{
|
|||
|
||||
Result initValue(Integer sampleId, String dbName);
|
||||
|
||||
Result gammaByDB(String dbName, Integer sampleId);
|
||||
Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request);
|
||||
|
||||
Result gammaByFile(String fileName, HttpServletRequest request);
|
||||
|
||||
|
@ -21,15 +21,15 @@ public interface IGammaService{
|
|||
|
||||
Result Reprocessing(ConfigureData configureData, HttpServletRequest request);
|
||||
|
||||
Result InteractiveTool(Integer sampleId, String fileName);
|
||||
Result InteractiveTool(Integer sampleId, String fileName, HttpServletRequest request);
|
||||
|
||||
Result insertPeak(Integer sampleId, String fileName, Integer curChan);
|
||||
|
||||
Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak);
|
||||
Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak, HttpServletRequest request);
|
||||
|
||||
Result deletePeak(String fileName, int curRow);
|
||||
Result deletePeak(String fileName, int curRow, HttpServletRequest request);
|
||||
|
||||
Result getSelPosNuclide(Integer sampleId, String fileName, int channel, String nuclides, HttpServletRequest request);
|
||||
Result getSelPosNuclide(Integer sampleId, String fileName, int channel, HttpServletRequest request);
|
||||
|
||||
Result addNuclide(Integer curRow, String nuclideName, String fileName, List<String> list_identify, HttpServletRequest request);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public interface IGammaService{
|
|||
|
||||
Result nuclideReview(Integer sampleId, String fileName, Double channel, HttpServletRequest request);
|
||||
|
||||
Result changeNuclide(Integer sampleId, String fileName, String nuclideName);
|
||||
Result changeNuclide(Integer sampleId, String fileName, String nuclideName, HttpServletRequest request);
|
||||
|
||||
Result searchNuclide(Integer sampleId, String fileName, Double energy, Double tolerance, HttpServletRequest request);
|
||||
|
||||
|
@ -114,6 +114,12 @@ public interface IGammaService{
|
|||
|
||||
Result viewGammaviewerLog(Integer sampleId, String fileName);
|
||||
|
||||
Result clickPeakInformation(String fileName, int index);
|
||||
|
||||
Result viewColorConfig(HttpServletRequest request);
|
||||
|
||||
Result updateColorConfig(ColorInfo colorInfo, HttpServletRequest request);
|
||||
|
||||
Result saveToDB(String fileName, String userName);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUserColor;
|
||||
import org.jeecg.modules.entity.vo.ColorInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ISysUserColorService extends IService<SysUserColor> {
|
||||
|
||||
Map<String, String> initColor(String userName);
|
||||
|
||||
Map<String, String> updateColor(ColorInfo colorInfo, String userName);
|
||||
|
||||
}
|
|
@ -5,18 +5,16 @@ import cn.hutool.core.collection.ListUtil;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
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 com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.google.common.cache.Cache;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.jeecg.common.Excel.ExportExcel;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.LocalCache;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
|
@ -32,11 +30,8 @@ import org.jeecg.modules.entity.*;
|
|||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||
import org.jeecg.modules.native_jni.CalValuesHandler;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
|
@ -73,6 +68,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
@Autowired
|
||||
private ISysDefaultNuclideSpectrumService defaultNuclideSpectrumService;
|
||||
@Autowired
|
||||
private ISysUserColorService sysUserColorService;
|
||||
@Autowired
|
||||
private SpectrumAnalysisMapper spectrumAnalysisMapper;
|
||||
@Autowired
|
||||
private SpectrumPathProperties spectrumPathProperties;
|
||||
|
@ -146,8 +143,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result gammaByDB(String dbName, Integer sampleId) {
|
||||
public Result gammaByDB(String dbName, Integer sampleId, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = new PHDFile();
|
||||
|
@ -171,6 +169,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
if (!bRet){
|
||||
return result;
|
||||
}
|
||||
//获取当前角色配置的颜色信息
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
// 更新 ‘QC Flags’ 状态
|
||||
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
||||
map.put("QCFlag", qcstate);
|
||||
|
@ -183,7 +183,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("live_time", String.format("%.2f", phd.getAcq().getAcquisition_live_time()));
|
||||
double deadTime = (phd.getAcq().getAcquisition_real_time() - phd.getAcq().getAcquisition_live_time()) / phd.getAcq().getAcquisition_real_time();
|
||||
map.put("dead_time", String.format("%.2f", deadTime*100));
|
||||
gammaFileUtil.UpdateChart(phd, map);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
phdCache.put(fileName, phd);
|
||||
localCache.setPHDCache(phdCache);
|
||||
result.setSuccess(true);
|
||||
|
@ -194,13 +194,16 @@ public class GammaServiceImpl implements IGammaService {
|
|||
@Override
|
||||
public Result gammaByFile(String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
//上传文件路径
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + JwtUtil.getUserNameByToken(request);
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
PHDFile phd = new PHDFile();
|
||||
//加载文件内容
|
||||
gammaFileUtil.loadFile(path, fileName, phd, result);
|
||||
//获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
// 更新 ‘QC Flags’ 状态
|
||||
List<String> qcstate = gammaFileUtil.Qcstate(phd);
|
||||
map.put("QCFlag", qcstate);
|
||||
|
@ -213,7 +216,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
map.put("live_time", String.format("%.2f", phd.getAcq().getAcquisition_live_time()));
|
||||
double deadTime = (phd.getAcq().getAcquisition_real_time() - phd.getAcq().getAcquisition_live_time()) / phd.getAcq().getAcquisition_real_time();
|
||||
map.put("dead_time", String.format("%.2f", deadTime*100));
|
||||
gammaFileUtil.UpdateChart(phd, map);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
phdCache.put(fileName, phd);
|
||||
localCache.setPHDCache(phdCache);
|
||||
result.setSuccess(true);
|
||||
|
@ -269,6 +272,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
//查询当前用户关联的核素信息
|
||||
List<String> nuclides = new LinkedList<>();
|
||||
//从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的
|
||||
|
@ -290,7 +295,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
phd.getUsedSetting().setRiskLevelK(configureData.getRiskLevelK());
|
||||
phd.getUsedSetting().setRefTime_act(configureData.getRefTime_act());
|
||||
phd.getUsedSetting().setRefTime_conc(configureData.getRefTime_conc());
|
||||
gammaFileUtil.UpdateChart(phd, map);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
}else {
|
||||
|
@ -303,8 +308,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result InteractiveTool(Integer sampleId, String fileName) {
|
||||
public Result InteractiveTool(Integer sampleId, String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
|
@ -312,6 +318,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
//表单
|
||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||
map.put("table", vPeak);
|
||||
|
@ -330,9 +337,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
if(m_nSChan == 0) {
|
||||
m_vCount.add(0L);
|
||||
}
|
||||
ChartData channelCountChart = gammaFileUtil.Channel_Count(m_vCount, m_nCount);
|
||||
ChartData channelBaseLineChart = gammaFileUtil.Channel_BaseLine(phd, m_nCount);
|
||||
List<ChartData> channelPeakChart = gammaFileUtil.Channel_Peak(phd, m_nCount);
|
||||
ChartData channelCountChart = gammaFileUtil.Channel_Count(m_vCount, m_nCount, colorMap.get("Color_Spec"));
|
||||
ChartData channelBaseLineChart = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
|
||||
List<ChartData> channelPeakChart = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
||||
List<ShapeData> channelBaseCPChart = gammaFileUtil.Channel_BaseCP(phd);
|
||||
map.put("channelCountChart", channelCountChart);
|
||||
map.put("channelBaseLineChart", channelBaseLineChart);
|
||||
|
@ -485,8 +492,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak) {
|
||||
public Result acceptResults(String fileName, boolean accept, List<PeakInfo> oldPeak, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)){
|
||||
|
@ -496,7 +504,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
List<Long> m_vCount = new LinkedList<>();
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
long m_nSChan = phd.getSpec().getBegin_channel();
|
||||
|
||||
//获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
// 确保绘制曲线时所有谱都是从1道开始
|
||||
int i = 0;
|
||||
if(m_nSChan == 0){
|
||||
|
@ -516,19 +525,19 @@ public class GammaServiceImpl implements IGammaService {
|
|||
|
||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||
map.put("table", vPeak);
|
||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount);
|
||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
||||
map.put("channelPeakChart", channelPeak);
|
||||
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount);
|
||||
ChartData channelBaseLine = gammaFileUtil.Channel_BaseLine(phd, m_nCount, colorMap.get("Color_Base"));
|
||||
map.put("channelBaseLineChart", channelBaseLine);
|
||||
List<SeriseData> differance = gammaFileUtil.Differance(phd, phd.getVPeak(), m_vCount, m_nCount);
|
||||
map.put("barChart", differance);
|
||||
gammaFileUtil.UpdateChart(phd, map);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
} else {//如果不保留 根据下标移除对应的vPeak数据
|
||||
if (CollectionUtils.isNotEmpty(oldPeak)) {
|
||||
phd.getVPeak().clear();
|
||||
phd.setVPeak(oldPeak);
|
||||
map.put("table", phd.getVPeak());
|
||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount);
|
||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
||||
map.put("channelPeakChart", channelPeak);
|
||||
}
|
||||
}
|
||||
|
@ -538,14 +547,16 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result deletePeak(String fileName, int curRow) {
|
||||
public Result deletePeak(String fileName, int curRow, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)){
|
||||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
long m_nCount = phd.getSpec().getNum_g_channel();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
int peakNum = phd.getVPeak().size();
|
||||
|
@ -563,9 +574,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
List<PeakInfo> vPeak = gammaFileUtil.InitPeakTable(phd.getVPeak());
|
||||
map.put("table", vPeak);
|
||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount);
|
||||
List<ChartData> channelPeak = gammaFileUtil.Channel_Peak(phd, m_nCount, colorMap.get("Color_Peak"));
|
||||
map.put("channelPeakChart", channelPeak);
|
||||
gammaFileUtil.UpdateChart(phd, map);
|
||||
gammaFileUtil.UpdateChart(phd, map, colorMap);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
|
@ -573,9 +584,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result getSelPosNuclide(Integer sampleId, String fileName, int channel, String nuclides, HttpServletRequest request) {
|
||||
public Result getSelPosNuclide(Integer sampleId, String fileName, int channel, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
|
@ -598,11 +609,10 @@ public class GammaServiceImpl implements IGammaService {
|
|||
double min = phd.getVPeak().get(index).energy - phd.getSetting().getEnergyTolerance();
|
||||
double max = phd.getVPeak().get(index).energy + phd.getSetting().getEnergyTolerance();
|
||||
List<String> list_possible = spectrumAnalysisMapper.getPossibleNuclide(userLib, min, max);
|
||||
//用户当前已选中的核素名称
|
||||
List<String> list_identify = phd.getVPeak().get(index).nuclides;
|
||||
|
||||
List<String> list_identify = new LinkedList<>();
|
||||
List<String> identify = Arrays.asList(nuclides.split(";"));
|
||||
list_identify.addAll(identify);
|
||||
|
||||
map.put("index", index);
|
||||
map.put("possible", list_possible);
|
||||
map.put("identify", list_identify);
|
||||
result.setSuccess(true);
|
||||
|
@ -779,6 +789,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
double value = gammaFileUtil.GetEnergyByFloatChan(phd, channel.intValue());
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(value);
|
||||
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
@ -794,7 +805,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
if(CollectionUtils.isNotEmpty(nuclideList)) {
|
||||
map.put("list", nuclideList);
|
||||
String name = nuclideList.get(0);
|
||||
gammaFileUtil.InitTable(name, map, phd);
|
||||
gammaFileUtil.InitTable(name, map, phd, colorMap);
|
||||
} else {
|
||||
map.put("list", nuclideList);
|
||||
map.put("chart", new LinkedList<>());
|
||||
|
@ -810,8 +821,9 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result changeNuclide(Integer sampleId, String fileName, String nuclideName) {
|
||||
public Result changeNuclide(Integer sampleId, String fileName, String nuclideName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
|
@ -819,7 +831,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
gammaFileUtil.InitTable(nuclideName, map, phd);
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
gammaFileUtil.InitTable(nuclideName, map, phd, colorMap);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
|
@ -836,6 +849,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(energy);
|
||||
bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
map.put("energy", bigDecimal);
|
||||
|
@ -850,7 +864,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
if(CollectionUtils.isNotEmpty(nuclideList)) {
|
||||
map.put("list", nuclideList);
|
||||
String name = nuclideList.get(0);
|
||||
gammaFileUtil.InitTable(name, map, phd);
|
||||
gammaFileUtil.InitTable(name, map, phd, colorMap);
|
||||
} else {
|
||||
map.put("list", nuclideList);
|
||||
map.put("chart", new LinkedList<>());
|
||||
|
@ -1616,15 +1630,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
tablePeak.setAreaErr(peak.area>0?String.format("%.3f",(peak.areaErr/peak.area)*100):"0");
|
||||
tablePeak.setSignificant(String.format("%.3f", peak.significance));
|
||||
tablePeak.setSensitivity(String.format("%.3f", peak.sensitivity));
|
||||
List<String> nuclides = peak.nuclides;
|
||||
String nuclide = "";
|
||||
if (CollectionUtils.isNotEmpty(nuclides)){
|
||||
for (String name:nuclides) {
|
||||
nuclide+=name+StringPool.COMMA;
|
||||
}
|
||||
nuclide = nuclide.substring(0, nuclide.length()-1);
|
||||
}
|
||||
tablePeak.setIndentify(nuclide);
|
||||
tablePeak.setIndentify(StringUtils.join(peak.nuclides, ";"));
|
||||
tablePeaks.add(tablePeak);
|
||||
}
|
||||
}
|
||||
|
@ -2226,6 +2232,50 @@ public class GammaServiceImpl implements IGammaService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result clickPeakInformation(String fileName, int index) {
|
||||
Result result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
if (Objects.isNull(phd)){
|
||||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
int size = phd.getVPeak().size();
|
||||
//vPeak的数组大小大于0 当前下标在范围内
|
||||
if (size>0 && index<size && index>=0) {
|
||||
PeakInfo peak = phd.getVPeak().get(index);
|
||||
String message = "Peak:"+String.format("%.2f", peak.peakCentroid)+" = "+String.format("%.2f", peak.energy)+" keV\n" +
|
||||
"FWHM:"+String.format("%.2f", peak.fwhmc)+" keV\n" +
|
||||
"Net Area:"+String.format("%.2f", peak.area)+"\n" +
|
||||
"BaseLine:"+String.format("%.2f", phd.getVBase().get((int) Math.round(peak.peakCentroid)))+"\n" +
|
||||
"NID:"+ StringUtils.join(peak.nuclides, ";");
|
||||
result.setSuccess(true);
|
||||
result.setResult(message);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result viewColorConfig(HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
result.setSuccess(true);
|
||||
result.setResult(colorMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateColorConfig(ColorInfo colorInfo, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
Map<String, String> colorMap = sysUserColorService.updateColor(colorInfo, userName);
|
||||
result.setSuccess(true);
|
||||
result.setResult(colorMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result saveToDB(String fileName, String userName) {
|
||||
Result result = new Result();
|
||||
|
|
|
@ -253,7 +253,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
result.error500("ftp文件查询失败");
|
||||
return result;
|
||||
}
|
||||
String sampleFileName = fileName;
|
||||
String sampleFileName = matchFileName;
|
||||
String sampleSystemType = fileData.get("sampleSystemType");
|
||||
if (sampleSystemType.equals(SystemType.BETA.getType())) {
|
||||
//加载并获取当前路径下所有的文件名称并进行名称格式化 仅需要格式化和sample文件同一个台站 名称格式化为最终名称
|
||||
|
@ -2532,10 +2532,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
}
|
||||
map.put("XeData", xeDataList);
|
||||
|
@ -2603,10 +2606,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
}
|
||||
map.put("XeData", xeDataList);
|
||||
|
@ -2623,6 +2629,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Override
|
||||
public Result saveToDB(BgDataAnlyseResultIn anlyseResultIn) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String beginDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
//判断当前分析员是否有过排班任务
|
||||
|
@ -2636,29 +2643,35 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
getChannelAndEnergy(anlyseResultIn);
|
||||
//获取ROI Limit数据
|
||||
// getROILimit(anlyseResultIn);
|
||||
//计算得到各文件的边界值
|
||||
BgBoundary sampleBoundary = phdFileUtil.CalBoundary(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
BgBoundary gasBoundary = phdFileUtil.CalBoundary(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
BgBoundary detBoundary = phdFileUtil.CalBoundary(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
//处理文件名称
|
||||
String sampleFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
String gasFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
String detFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
//判断文件是否存储过 如果没有则解析文件并进行存储
|
||||
if ( !OriginalDataStore(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName(), gasFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("file save failed");
|
||||
result.error500("gasFile save failed");
|
||||
return result;
|
||||
}
|
||||
if ( !OriginalDataStore(anlyseResultIn.getDetFilePath(), anlyseResultIn.getGasFileName(), detFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("file save failed");
|
||||
result.error500("detFile save failed");
|
||||
return result;
|
||||
}
|
||||
if ( !OriginalDataStore(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName(), sampleFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("file save failed");
|
||||
result.error500("sampleFile save failed");
|
||||
return result;
|
||||
}
|
||||
//判断当前分析员是否有过历史分析当前文件
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleFilePathName, anlyseResultIn.getUserName());
|
||||
//获取sample,gas,det对应的临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
if (Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp)) {
|
||||
result.error500("ftp文件获取失败!");
|
||||
return result;
|
||||
}
|
||||
//解析文件内容获取对应数据
|
||||
BgDataAnlyseResultIn resultIn = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, map);
|
||||
//根据文件名称查询对应的sampleId--- sampleFile gasFile detFile
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName);
|
||||
Integer gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName);
|
||||
|
@ -2678,79 +2691,88 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
gardsAnalyses.setUsedgasphdId(gasId);
|
||||
gardsAnalyses.setUseddetphdId(detId);
|
||||
gardsAnalyses.setAnalyst(anlyseResultIn.getUserName());
|
||||
map.put("gardsAnalyses", gardsAnalyses);
|
||||
if (Objects.nonNull(isExist)){
|
||||
spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
//spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
}else {//如果没有分析过就新增--GARDS_ANALYSES
|
||||
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
//spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
}
|
||||
//查询analysisId根据sampleId 分析员名称--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum analysis = spectrumAnalysisMapper.getAnalysis("RNMAN.GARDS_ANALYSES", sampleId);
|
||||
Integer idAnalysis = analysis.getIdAnalysis();
|
||||
//获取sample,gas,det三个文件分别对应的beta,gamma数据集合
|
||||
List<GardsCalibrationPairsSpectrum> calibrationPairsList = getCalibrationPairs(anlyseResultIn, sampleId, gasId, detId, idAnalysis);
|
||||
map.put("calibrationPairsList", calibrationPairsList);
|
||||
//如果分析过--删除GARDS_CALIBRATION_PAIRS表数据 新增GARDS_CALIBRATION_PAIRS表数据
|
||||
if (Objects.nonNull(isExist)){
|
||||
//根据idAnalysis删除GARDS_CALIBRATION_PAIRS表数据
|
||||
spectrumAnalysisMapper.deleteCalibrationPairs(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteCalibrationPairs(idAnalysis);
|
||||
//新增GARDS_CALIBRATION_PAIRS表数据
|
||||
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
//spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
}else {//如果没有分析过--新增GARDS_CALIBRATION_PAIRS表数据
|
||||
//新增GARDS_CALIBRATION_PAIRS表数据
|
||||
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
//spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
}
|
||||
//gards_calibration 数据表
|
||||
List<GardsCalibrationSpectrum> calibrationList = getCalibration(anlyseResultIn, sampleId, gasId, detId, idAnalysis);
|
||||
map.put("calibrationList", calibrationList);
|
||||
//判断是否分析过
|
||||
if (Objects.nonNull(isExist)) {
|
||||
//删除Gards_Calibration表数据
|
||||
spectrumAnalysisMapper.deleteCalibration(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteCalibration(idAnalysis);
|
||||
//新增数据
|
||||
spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
//spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
} else {
|
||||
//新增数据
|
||||
spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
//spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
}
|
||||
//gards_roi_channels数据表
|
||||
List<GardsROIChannelsSpectrum> roiChannelsList = new LinkedList<>();
|
||||
getROIChannel(sampleId, idAnalysis, sampleBoundary, roiChannelsList);
|
||||
getROIChannel(gasId, idAnalysis, gasBoundary, roiChannelsList);
|
||||
getROIChannel(detId, idAnalysis, detBoundary, roiChannelsList);
|
||||
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = (List<GardsROIChannelsSpectrum>) map.get("roiChannelsSpectrumList");
|
||||
getROIChannel(sampleId, idAnalysis, roiChannelsSpectrumList, roiChannelsList);
|
||||
getROIChannel(gasId, idAnalysis, roiChannelsSpectrumList, roiChannelsList);
|
||||
getROIChannel(detId, idAnalysis, roiChannelsSpectrumList, roiChannelsList);
|
||||
map.put("roiChannelsList", roiChannelsList);
|
||||
//如果分析过数据
|
||||
if (Objects.nonNull(isExist)){
|
||||
//删除gards_roi_channels数据表数据
|
||||
spectrumAnalysisMapper.deleteROIChannels(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteROIChannels(idAnalysis);
|
||||
//新增gards_roi_channels数据表数据
|
||||
spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
//spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
}else {//没有分析过
|
||||
//新增gards_roi_channels数据表数据
|
||||
spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
//spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
}
|
||||
//gards_Xe_results数据表
|
||||
List<GardsXeResultsSpectrum> xeResults = getXeResults(anlyseResultIn, sampleId, idAnalysis);
|
||||
map.put("xeResults", xeResults);
|
||||
if(Objects.nonNull(isExist)) {
|
||||
//删除gards_Xe_results数据表数据
|
||||
spectrumAnalysisMapper.deleteXeResult(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteXeResult(idAnalysis);
|
||||
//新增gards_Xe_results数据表数据
|
||||
spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
//spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
} else {
|
||||
//新增gards_Xe_results数据表数据
|
||||
spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
//spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
}
|
||||
//gards_roi_results数据表
|
||||
List<GardsROIResultsSpectrum> roiResultsSpectrumList = getROIResult(anlyseResultIn, sampleId, idAnalysis, isExist);
|
||||
map.put("roiResultsSpectrumList", roiResultsSpectrumList);
|
||||
if(Objects.nonNull(isExist)) {
|
||||
//删除gards_roi_results数据表数据
|
||||
spectrumAnalysisMapper.deleteROIResults(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteROIResults(idAnalysis);
|
||||
//新增gards_roi_results数据表数据
|
||||
|
||||
//spectrumAnalysisMapper.insertROIResults(roiResultsSpectrumList);
|
||||
} else {
|
||||
//新增gards_roi_results数据表数据
|
||||
|
||||
//spectrumAnalysisMapper.insertROIResults(roiResultsSpectrumList);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn){
|
||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn) {
|
||||
//获取ftp文件路径下临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
|
@ -2958,7 +2980,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
uncertaintyList.add(String.valueOf(uncertainty.get(pos)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<GardsCalibrationSpectrum> getCalibration(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
|
||||
|
@ -3052,16 +3073,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return calibrationSpectrumList;
|
||||
}
|
||||
|
||||
public void getROIChannel(Integer sampleId, Integer idAnalysis, BgBoundary bgBoundary, List<GardsROIChannelsSpectrum> roiChannelsList) {
|
||||
for (int i=0; i<bgBoundary.ROI_B_Boundary_start.size(); i++){
|
||||
public void getROIChannel(Integer sampleId, Integer idAnalysis, List<GardsROIChannelsSpectrum> roiChannelsSpectrumList, List<GardsROIChannelsSpectrum> roiChannelsList) {
|
||||
for (int i=0; i<roiChannelsSpectrumList.size(); i++){
|
||||
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
||||
roiChannels.setSampleId(sampleId);
|
||||
roiChannels.setIdAnalysis(idAnalysis);
|
||||
roiChannels.setRoi(i);
|
||||
roiChannels.setBChanStart(bgBoundary.ROI_B_Boundary_start.get(i));
|
||||
roiChannels.setBChanStop(bgBoundary.ROI_B_Boundary_stop.get(i));
|
||||
roiChannels.setGChanStart(bgBoundary.ROI_G_Boundary_start.get(i));
|
||||
roiChannels.setGChanStop(bgBoundary.ROI_G_Boundary_stop.get(i));
|
||||
roiChannels.setBChanStart(roiChannelsSpectrumList.get(i).getBChanStart());
|
||||
roiChannels.setBChanStop(roiChannelsSpectrumList.get(i).getBChanStop());
|
||||
roiChannels.setGChanStart(roiChannelsSpectrumList.get(i).getGChanStart());
|
||||
roiChannels.setGChanStop(roiChannelsSpectrumList.get(i).getGChanStop());
|
||||
roiChannelsList.add(roiChannels);
|
||||
}
|
||||
}
|
||||
|
@ -3116,6 +3137,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
public boolean OriginalDataStore(String filePath, String fileName, String filePathName, String userName) {
|
||||
//根据新的文件路径名称查询数据是否存在
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(filePathName, userName);
|
||||
//如果数据已经存入过数据库 则 修改状态后返回
|
||||
if (Objects.nonNull(isExist)){
|
||||
//如果文件已经存入过数据库则修改状态
|
||||
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
||||
return true;
|
||||
}
|
||||
//连接ftp
|
||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||
InputStream inputStream = null;
|
||||
|
@ -3163,14 +3192,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
//获取文件中块名信息
|
||||
List<String> readLines = getFileBlockList(file);
|
||||
//根据新的文件路径名称查询数据是否存在
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(filePathName, userName);
|
||||
//如果数据已经存入过数据库 则 修改状态后返回
|
||||
if (Objects.nonNull(isExist)){
|
||||
//如果文件已经存入过数据库则修改状态
|
||||
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
||||
return true;
|
||||
}
|
||||
//查询台站id
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(sourceData.site_code);
|
||||
Integer detectorId = spectrumAnalysisMapper.getDetectorId(sourceData.detector_code);
|
||||
|
@ -3237,35 +3258,28 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
public List<GardsROIResultsSpectrum> getROIResult(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer idAnalysis, Integer isExist) {
|
||||
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
|
||||
//第一种 直接从数据库获取的 并没有进行过改变
|
||||
if (Objects.nonNull(isExist) && !anlyseResultIn.isBProcessed()) {
|
||||
for (int i=0; i<anlyseResultIn.getS_roi_cts().size(); i++) {
|
||||
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
|
||||
roiResults.setSampleId(sampleId);
|
||||
roiResults.setIdAnalysis(idAnalysis);
|
||||
roiResults.setRoi(i);
|
||||
roiResults.setLc(anlyseResultIn.getLC().get(i));
|
||||
roiResults.setSGross(anlyseResultIn.getS_roi_cts().get(i));
|
||||
roiResults.setGGross(anlyseResultIn.getG_roi_cts().get(i));
|
||||
roiResults.setBGross(anlyseResultIn.getD_roi_cts().get(i));
|
||||
roiResults.setSNet(anlyseResultIn.getS_deduct_d_cts().get(i));
|
||||
roiResults.setGNet(anlyseResultIn.getG_deduct_d_cts().get(i));
|
||||
roiResults.setNet(anlyseResultIn.getROI_net_coutns().get(i));
|
||||
roiResults.setNetErr(anlyseResultIn.getROI_net_err().get(i));
|
||||
roiResults.setConc(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setConcErr(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setMdc(anlyseResultIn.getMDC().get(i));
|
||||
if(anlyseResultIn.getROI_con_uncer().get(i)>anlyseResultIn.getMDC().get(i)) {
|
||||
roiResults.setNidFlag(1);
|
||||
} else {
|
||||
roiResults.setNidFlag(0);
|
||||
}
|
||||
roiResultsSpectrumList.add(roiResults);
|
||||
for (int i=0; i<anlyseResultIn.getS_roi_cts().size(); i++) {
|
||||
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
|
||||
roiResults.setSampleId(sampleId);
|
||||
roiResults.setIdAnalysis(idAnalysis);
|
||||
roiResults.setRoi(i);
|
||||
roiResults.setLc(anlyseResultIn.getLC().get(i));
|
||||
roiResults.setSGross(anlyseResultIn.getS_roi_cts().get(i));
|
||||
roiResults.setGGross(anlyseResultIn.getG_roi_cts().get(i));
|
||||
roiResults.setBGross(anlyseResultIn.getD_roi_cts().get(i));
|
||||
roiResults.setSNet(anlyseResultIn.getS_deduct_d_cts().get(i));
|
||||
roiResults.setGNet(anlyseResultIn.getG_deduct_d_cts().get(i));
|
||||
roiResults.setNet(anlyseResultIn.getROI_net_coutns().get(i));
|
||||
roiResults.setNetErr(anlyseResultIn.getROI_net_err().get(i));
|
||||
roiResults.setConc(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setConcErr(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setMdc(anlyseResultIn.getMDC().get(i));
|
||||
if(anlyseResultIn.getROI_con_uncer().get(i)>anlyseResultIn.getMDC().get(i)) {
|
||||
roiResults.setNidFlag(1);
|
||||
} else {
|
||||
roiResults.setNidFlag(0);
|
||||
}
|
||||
} else if (Objects.nonNull(isExist) && anlyseResultIn.isBProcessed()) {//第二种 从数据库获取的但是进行过改变
|
||||
|
||||
} else if (Objects.isNull(isExist) && anlyseResultIn.isBProcessed()) {//第三种 文件加载的数据
|
||||
|
||||
roiResultsSpectrumList.add(roiResults);
|
||||
}
|
||||
return roiResultsSpectrumList;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUserColor;
|
||||
import org.jeecg.modules.entity.vo.ColorInfo;
|
||||
import org.jeecg.modules.mapper.SysUserColorMapper;
|
||||
import org.jeecg.modules.service.ISysUserColorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("sysUserColorService")
|
||||
@DS("master")
|
||||
public class SysUserColorServiceImpl extends ServiceImpl<SysUserColorMapper, SysUserColor> implements ISysUserColorService {
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public Map<String, String> initColor(String userName) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
//查询数据库是否存在当前用户名的颜色数据 如果存在返回查询结果 如果不存在初始化当前用户的颜色信息
|
||||
LambdaQueryWrapper<SysUserColor> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUserColor::getCreateBy, userName);
|
||||
SysUserColor userColor = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.isNull(userColor)) {
|
||||
userColor = new SysUserColor();
|
||||
userColor.setId(String.valueOf(IdWorker.getId()));
|
||||
userColor.setColorSpec("yellow");
|
||||
userColor.setColorPeak("rgb(255, 127, 39)");
|
||||
userColor.setColorLc("red");
|
||||
userColor.setColorBase("rgb(0, 246, 255)");
|
||||
userColor.setColorScac("rgb(244, 112, 247)");
|
||||
userColor.setColorCompare("green");
|
||||
userColor.setColorFitbase("white");
|
||||
userColor.setColorStrip("blue");
|
||||
userColor.setCreateBy(userName);
|
||||
this.baseMapper.insert(userColor);
|
||||
}
|
||||
map.put("Color_Spec", userColor.getColorSpec());
|
||||
map.put("Color_Peak", userColor.getColorPeak());
|
||||
map.put("Color_Lc", userColor.getColorLc());
|
||||
map.put("Color_Base", userColor.getColorBase());
|
||||
map.put("Color_Scac", userColor.getColorScac());
|
||||
map.put("Color_Compare", userColor.getColorCompare());
|
||||
map.put("Color_Fitbase", userColor.getColorFitbase());
|
||||
map.put("Color_Strip", userColor.getColorStrip());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public Map<String, String> updateColor(ColorInfo colorInfo, String userName) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
LambdaQueryWrapper<SysUserColor> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUserColor::getCreateBy, userName);
|
||||
SysUserColor userColor = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(userColor)) {
|
||||
userColor.setColorSpec(colorInfo.getColorSpec());
|
||||
userColor.setColorPeak(colorInfo.getColorPeak());
|
||||
userColor.setColorLc(colorInfo.getColorLc());
|
||||
userColor.setColorBase(colorInfo.getColorBase());
|
||||
userColor.setColorScac(colorInfo.getColorScac());
|
||||
userColor.setColorCompare(colorInfo.getColorCompare());
|
||||
userColor.setColorFitbase(colorInfo.getColorFitbase());
|
||||
userColor.setColorStrip(colorInfo.getColorStrip());
|
||||
this.baseMapper.updateById(userColor);
|
||||
}
|
||||
map.put("Color_Spec", userColor.getColorSpec());
|
||||
map.put("Color_Peak", userColor.getColorPeak());
|
||||
map.put("Color_Lc", userColor.getColorLc());
|
||||
map.put("Color_Base", userColor.getColorBase());
|
||||
map.put("Color_Scac", userColor.getColorScac());
|
||||
map.put("Color_Compare", userColor.getColorCompare());
|
||||
map.put("Color_Fitbase", userColor.getColorFitbase());
|
||||
map.put("Color_Strip", userColor.getColorStrip());
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user