1.修改实体类主键,适配postgresql
2.修改自动处理工程,添加解析探测系统发来的压缩并编码后的文件 3.修改自动处理工程,根据要求修改dos谱处理逻辑,解析后复制一份到指定位置给西安用
This commit is contained in:
parent
a2224c91e7
commit
f4c3fa55a7
|
@ -74,6 +74,11 @@ public class SpectrumPathProperties implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String errorFilePath;
|
private String errorFilePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dos谱外放目录(西安那边从外放目录拿取dos谱)
|
||||||
|
*/
|
||||||
|
private String dosExternalDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 能谱文件存储路径以能谱系统类型/能谱类型为key,以存储路径为value
|
* 能谱文件存储路径以能谱系统类型/能谱类型为key,以存储路径为value
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.base.entity.configuration;
|
package org.jeecg.modules.base.entity.configuration;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
@ -22,7 +23,7 @@ public class GardsDetectors implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 探测器id
|
* 探测器id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "DETECTOR_ID")
|
@TableId(type = IdType.INPUT)
|
||||||
private Integer detectorId;
|
private Integer detectorId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class GardsAlertData implements Serializable {
|
||||||
@TableField(value = "STATION_CODE")
|
@TableField(value = "STATION_CODE")
|
||||||
private String stationCode;
|
private String stationCode;
|
||||||
|
|
||||||
@TableId(value = "ALERT_ID",type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer alertId;
|
private Integer alertId;
|
||||||
|
|
||||||
@TableField(value = "TIME")
|
@TableField(value = "TIME")
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.jeecg.modules.base.entity.original;
|
package org.jeecg.modules.base.entity.original;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -19,7 +21,7 @@ public class GardsGPSData implements Serializable {
|
||||||
@TableField(value = "STATION_CODE")
|
@TableField(value = "STATION_CODE")
|
||||||
private String stationCode;
|
private String stationCode;
|
||||||
|
|
||||||
@TableField(value = "GPS_ID")
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer gpsId;
|
private Integer gpsId;
|
||||||
|
|
||||||
@TableField(value = "LON")
|
@TableField(value = "LON")
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class GardsMetData implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 气象数据id
|
* 气象数据id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "MET_ID",type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer metId;
|
private Integer metId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class GardsSampleData implements Serializable {
|
||||||
* 样品id
|
* 样品id
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@TableId(value = "SAMPLE_ID",type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer sampleId;
|
private Integer sampleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class GardsSohData implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 报警ID号
|
* 报警ID号
|
||||||
*/
|
*/
|
||||||
@TableId(value = "SOH_ID",type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
@Excel(name = "SID",orderNum = "5")
|
@Excel(name = "SID",orderNum = "5")
|
||||||
private Integer sohId;
|
private Integer sohId;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class GardsAnalyses implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 分析ID号
|
* 分析ID号
|
||||||
*/
|
*/
|
||||||
@TableId(value = "IDANALYSIS",type = IdType.AUTO)
|
@TableId(value = "idanalysis",type = IdType.AUTO)
|
||||||
private Integer idAnalysis;
|
private Integer idAnalysis;
|
||||||
/**
|
/**
|
||||||
* 样品id
|
* 样品id
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.jeecg.modules.base.entity.rnman;
|
package org.jeecg.modules.base.entity.rnman;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -20,7 +22,7 @@ public class GardsAnalyses implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 分析ID号
|
* 分析ID号
|
||||||
*/
|
*/
|
||||||
@TableField(value = "IDANALYSIS")
|
@TableId(value = "idanalysis",type = IdType.AUTO)
|
||||||
private Integer idAnalysis;
|
private Integer idAnalysis;
|
||||||
/**
|
/**
|
||||||
* 样品id
|
* 样品id
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
package org.jeecg.modules.common;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.io.LineIterator;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jeecg.common.util.Md5Util;
|
||||||
|
import org.jeecg.modules.enums.SpectrumSource;
|
||||||
|
import org.springframework.util.Base64Utils;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.zip.InflaterInputStream;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class SpectrumUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS2.0格式邮件判断条件
|
||||||
|
*/
|
||||||
|
private final static String EMAIL_BEGIN = "BEGIN IMS2.0";
|
||||||
|
private final static String MSG_TYPE = "MSG_TYPE DATA";
|
||||||
|
private final static String EMAIL_STOP = "STOP";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验邮件内容完整性
|
||||||
|
* @param mailContent
|
||||||
|
* @param name 如果文件是.eml文件,则名称是邮件主题;如果文件是.phd文件,则名称是phd文件名称
|
||||||
|
* @param file 如果spectrumSource值为0,则file是.eml文件,如果值为1,则file是phd文件
|
||||||
|
* @param spectrumSource 0能谱来源于邮箱,1能谱来源于filesource目录
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean checkMailContent(StringBuilder mailContent, String name, File file,Integer spectrumSource){
|
||||||
|
if (Objects.isNull(file) || !file.exists()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean flag = false;
|
||||||
|
//获取邮件内容
|
||||||
|
mailContent.append(FileUtil.readUtf8String(file));
|
||||||
|
|
||||||
|
//如果内容是普通文本
|
||||||
|
if(StringUtils.isNotBlank(mailContent) && mailContent.indexOf(EMAIL_BEGIN) != -1 &&
|
||||||
|
mailContent.indexOf(MSG_TYPE) != -1 && mailContent.indexOf(EMAIL_STOP) != -1){
|
||||||
|
if(!StringUtils.startsWith(mailContent,EMAIL_BEGIN)){
|
||||||
|
mailContent.delete(0,mailContent.indexOf(EMAIL_BEGIN));
|
||||||
|
}
|
||||||
|
if(!StringUtils.endsWith(mailContent,EMAIL_STOP)){
|
||||||
|
mailContent.delete(mailContent.indexOf(EMAIL_STOP)+EMAIL_STOP.length(),mailContent.length());
|
||||||
|
}
|
||||||
|
flag = true;
|
||||||
|
}else {
|
||||||
|
//如果内容经过压缩
|
||||||
|
LineIterator it = IOUtils.lineIterator(new StringReader(mailContent.toString()));
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String line = it.nextLine();
|
||||||
|
//如果某行,包含3个|字符说明此行是邮件正文
|
||||||
|
//邮件内容压缩格式
|
||||||
|
//1.md5|压缩前字节|压缩后字节|内容(Base64)
|
||||||
|
//2.md5由(压缩前字节|压缩后字节|内容(Base64) )生成
|
||||||
|
//3.内容(Base64)由 邮件内容压缩后,转Base64
|
||||||
|
if(StringUtils.countMatches(line, "|") == 3){
|
||||||
|
String[] contentArr = line.split("\\|");
|
||||||
|
String checkStr = contentArr[1]+"|"+contentArr[2]+"|"+contentArr[3];
|
||||||
|
String checkStrMd5 = Md5Util.md5Encode(checkStr, "utf-8");
|
||||||
|
if(checkStrMd5.equals(contentArr[0])){
|
||||||
|
byte[] bytes = Base64Utils.decodeFromString(contentArr[3]);
|
||||||
|
mailContent.setLength(0);
|
||||||
|
mailContent.append(decompressStream(bytes));
|
||||||
|
//如果文件来自于fileSource,且内容是编码的,则把未解码内容替换为解码后内容
|
||||||
|
if(SpectrumSource.FROM_FILE_SOURCE.getSourceType().equals(spectrumSource)){
|
||||||
|
FileUtil.writeUtf8String(mailContent.toString(),file);
|
||||||
|
}
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag){
|
||||||
|
log.info("{}邮件校验成功,符合IMS2.0格式",name);
|
||||||
|
}else {
|
||||||
|
log.warn("{}邮件校验成功,此邮件不符合IMS2.0格式",name);
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解压缩字节
|
||||||
|
* @param zipBytes
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private static String decompressStream(byte[] zipBytes){
|
||||||
|
try (InflaterInputStream iis = new InflaterInputStream(new ByteArrayInputStream(zipBytes));
|
||||||
|
ByteArrayOutputStream output = new ByteArrayOutputStream();) {
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int len;
|
||||||
|
while ((len = iis.read(buffer)) > 0) {
|
||||||
|
output.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
return output.toString("UTF-8").trim();
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("解压缩邮件失败");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import org.jeecg.common.email.EmailLogManager;
|
||||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||||
import org.jeecg.modules.ErrorLogManager;
|
import org.jeecg.modules.ErrorLogManager;
|
||||||
import org.jeecg.modules.base.enums.DataType;
|
import org.jeecg.modules.base.enums.DataType;
|
||||||
|
import org.jeecg.modules.common.SpectrumUtils;
|
||||||
import org.jeecg.modules.eneity.event.FormatErrorEvent;
|
import org.jeecg.modules.eneity.event.FormatErrorEvent;
|
||||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||||
import org.jeecg.modules.eneity.event.SpectrumLog;
|
import org.jeecg.modules.eneity.event.SpectrumLog;
|
||||||
|
@ -104,8 +105,12 @@ public abstract class AbstractSpectrumHandler extends AbstractChain {
|
||||||
this.spectrumServiceQuotes = spectrumServiceQuotes;
|
this.spectrumServiceQuotes = spectrumServiceQuotes;
|
||||||
this.returnFileName = returnFileName;
|
this.returnFileName = returnFileName;
|
||||||
this.spectrumSource = spectrumSource;
|
this.spectrumSource = spectrumSource;
|
||||||
|
if(SpectrumSource.FROM_FILE_SOURCE.getSourceType().equals(spectrumSource)){
|
||||||
|
StringBuilder mailContent = new StringBuilder();
|
||||||
|
SpectrumUtils.checkMailContent(mailContent,phdFile.getName(),phdFile,SpectrumSource.FROM_FILE_SOURCE.getSourceType());
|
||||||
|
this.mailContent = mailContent.toString();
|
||||||
|
}
|
||||||
this.spectrumFile = phdFile;
|
this.spectrumFile = phdFile;
|
||||||
this.mailContent = FileUtils.readFileToString(spectrumFile,"UTF-8");
|
|
||||||
this.sourceFilePath = spectrumFile.getAbsolutePath();
|
this.sourceFilePath = spectrumFile.getAbsolutePath();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.spectrum;
|
package org.jeecg.modules.spectrum;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.StringConstant;
|
import org.jeecg.common.constant.StringConstant;
|
||||||
|
@ -92,6 +93,8 @@ public class DOSSpectrum extends AbstractSpectrumHandler{
|
||||||
this.updateSpectrumFileName();
|
this.updateSpectrumFileName();
|
||||||
//保存PHD文件到savefile
|
//保存PHD文件到savefile
|
||||||
super.saveFileToSavefile();
|
super.saveFileToSavefile();
|
||||||
|
//把dos谱文件放到扩展目录给西安用
|
||||||
|
this.expandedStorage();
|
||||||
//结构体数据入库
|
//结构体数据入库
|
||||||
this.handlerOriginalData();
|
this.handlerOriginalData();
|
||||||
//把流程日志保存到日志目录
|
//把流程日志保存到日志目录
|
||||||
|
@ -230,4 +233,29 @@ public class DOSSpectrum extends AbstractSpectrumHandler{
|
||||||
|
|
||||||
super.sendSpectrumLogToQueue(finalPath,logContent.toString());
|
super.sendSpectrumLogToQueue(finalPath,logContent.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把dos谱放一份到扩展目录给西安用
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private void expandedStorage() throws IOException {
|
||||||
|
final SpectrumPathProperties properties = this.spectrumServiceQuotes.getSpectrumPathProperties();
|
||||||
|
//把dos谱外放一份到指定位置给西安用
|
||||||
|
File dosExtDir = new File(properties.getDosExternalDirectory());
|
||||||
|
if(dosExtDir.exists() && dosExtDir.isDirectory()){
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
StringBuilder storagePath = new StringBuilder();
|
||||||
|
storagePath.append(dosExtDir.getAbsolutePath());
|
||||||
|
storagePath.append(File.separator);
|
||||||
|
storagePath.append(currentDate.getYear());
|
||||||
|
storagePath.append(File.separator);
|
||||||
|
storagePath.append(currentDate.getMonthValue());
|
||||||
|
if(!FileUtil.exist(storagePath.toString())){
|
||||||
|
FileUtil.mkdir(storagePath.toString());
|
||||||
|
}
|
||||||
|
storagePath.append(File.separator);
|
||||||
|
storagePath.append(this.spectrumFile.getName());
|
||||||
|
FileOperation.copyFile(this.spectrumFile,storagePath.toString(),true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.io.LineIterator;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
import org.jeecg.common.constant.StringConstant;
|
import org.jeecg.common.constant.StringConstant;
|
||||||
|
@ -15,18 +17,23 @@ import org.jeecg.common.email.EmailLogManager;
|
||||||
import org.jeecg.common.email.EmailServiceManager;
|
import org.jeecg.common.email.EmailServiceManager;
|
||||||
import org.jeecg.common.exception.DownloadEmailException;
|
import org.jeecg.common.exception.DownloadEmailException;
|
||||||
import org.jeecg.common.util.DateUtils;
|
import org.jeecg.common.util.DateUtils;
|
||||||
|
import org.jeecg.common.util.Md5Util;
|
||||||
|
import org.jeecg.modules.common.SpectrumUtils;
|
||||||
import org.jeecg.modules.email.EmailProperties;
|
import org.jeecg.modules.email.EmailProperties;
|
||||||
import org.jeecg.modules.enums.SpectrumSource;
|
import org.jeecg.modules.enums.SpectrumSource;
|
||||||
import org.jeecg.modules.exception.AnalySpectrumException;
|
import org.jeecg.modules.exception.AnalySpectrumException;
|
||||||
import org.jeecg.modules.file.FileOperation;
|
import org.jeecg.modules.file.FileOperation;
|
||||||
|
import org.springframework.util.Base64Utils;
|
||||||
|
|
||||||
import javax.mail.Message;
|
import javax.mail.Message;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
|
import javax.mail.Session;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,12 +41,6 @@ import java.util.concurrent.CountDownLatch;
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SpectrumParsingActuator implements Runnable{
|
public class SpectrumParsingActuator implements Runnable{
|
||||||
/**
|
|
||||||
* IMS2.0格式邮件判断条件
|
|
||||||
*/
|
|
||||||
private final static String EMAIL_BEGIN = "BEGIN IMS2.0";
|
|
||||||
private final static String MSG_TYPE = "MSG_TYPE DATA";
|
|
||||||
private final static String EMAIL_STOP = "STOP";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮件对象
|
* 邮件对象
|
||||||
|
@ -114,15 +115,12 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
//保存邮件日志到PG数据库
|
//保存邮件日志到PG数据库
|
||||||
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
|
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
|
||||||
|
|
||||||
//获取邮件内容
|
//封装邮件内容
|
||||||
StringBuilder mailContent = new StringBuilder();
|
StringBuilder mailContent = new StringBuilder();
|
||||||
if(Objects.nonNull(emlFile) && emlFile.length() > 0){
|
|
||||||
mailContent.append(FileUtil.readUtf8String(emlFile));
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断是否是IMS2.0协议文件
|
//校验邮件是否是IMS2.0协议文件,如果是设置邮件内容到mailContent变量
|
||||||
// 如果邮件内容校验成功 将文件保存到eml目录 并删除邮件对象
|
// 如果邮件内容校验成功 将文件保存到eml目录 并删除邮件对象
|
||||||
if(checkMailContent(mailContent,subject)){
|
if(checkMailContent(mailContent,subject,emlFile)){
|
||||||
AbstractSpectrumHandler spectrumHandler = new SamplephdSpectrum();
|
AbstractSpectrumHandler spectrumHandler = new SamplephdSpectrum();
|
||||||
spectrumHandler.init(mailContent.toString(),emlFile.getName(),spectrumServiceQuotes,new StringBuilder(),SpectrumSource.FORM_EMAIL_SERVICE.getSourceType(),batchesCounter);
|
spectrumHandler.init(mailContent.toString(),emlFile.getName(),spectrumServiceQuotes,new StringBuilder(),SpectrumSource.FORM_EMAIL_SERVICE.getSourceType(),batchesCounter);
|
||||||
final boolean matchResult = spectrumHandler.saveEmailToLocal();
|
final boolean matchResult = spectrumHandler.saveEmailToLocal();
|
||||||
|
@ -179,33 +177,16 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验邮件内容完整性
|
* 校验邮件内容是否符合IMS2.0格式
|
||||||
* 1.虽然包含BEGIN IMS2.0,但是有些邮件的第一行不是BEGIN IMS2.0,而是Mime-Version: 1.0 ,Content-Type: multipart/signed;等信息
|
|
||||||
* 2.所以若是IMS2.0协议邮件但是头部包含Mime-Version等信息了要删除
|
|
||||||
* 具体解释如下:
|
|
||||||
* 1.邮件包含附件或特殊内容类型:当邮件包含附件、HTML 内容、图像或其他非纯文本内容时,通常会采用 MIME 格式来处理和传输这些内容。
|
|
||||||
* 因此,这样的邮件可能会在头部中指定 Mime-Version 和适当的 Content-Type。
|
|
||||||
* 2.邮件需要进行签名或加密:如果邮件需要进行数字签名、加密或其他安全操作,通常会使用 multipart/signed 或其他相关的 Content-Type。
|
|
||||||
* 这些类型的邮件在头部中会指定相应的内容类型和协议信息。
|
|
||||||
* 3.简单纯文本邮件:另一方面,简单的纯文本邮件没有特殊的附件或内容类型要求,因此可能不需要使用 MIME 格式。
|
|
||||||
* 这种情况下,邮件文本中可能不包含 Mime-Version: 1.0 和 Content-Type: multipart/signed;。
|
|
||||||
* @param mailContent
|
* @param mailContent
|
||||||
|
* @param subject
|
||||||
|
* @param emlFile
|
||||||
* @return
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private boolean checkMailContent(StringBuilder mailContent,String subject){
|
private boolean checkMailContent(StringBuilder mailContent,String subject,File emlFile) throws IOException, MessagingException {
|
||||||
if(StringUtils.isNotBlank(mailContent) && mailContent.indexOf(EMAIL_BEGIN) != -1 &&
|
return SpectrumUtils.checkMailContent(mailContent,subject,emlFile,SpectrumSource.FORM_EMAIL_SERVICE.getSourceType());
|
||||||
mailContent.indexOf(MSG_TYPE) != -1 && mailContent.indexOf(EMAIL_STOP) != -1){
|
|
||||||
if(!StringUtils.startsWith(mailContent,EMAIL_BEGIN)){
|
|
||||||
mailContent.delete(0,mailContent.indexOf(EMAIL_BEGIN));
|
|
||||||
}
|
|
||||||
if(!StringUtils.endsWith(mailContent,EMAIL_STOP)){
|
|
||||||
mailContent.delete(mailContent.indexOf(EMAIL_STOP)+EMAIL_STOP.length(),mailContent.length());
|
|
||||||
}
|
|
||||||
log.info("{}邮件校验成功,符合IMS2.0格式",subject);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
log.warn("{}邮件校验成功,此邮件不符合IMS2.0格式",subject);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveEmail(File emlFile, String key) throws IOException {
|
private void moveEmail(File emlFile, String key) throws IOException {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
|
||||||
} else {
|
} else {
|
||||||
//Linux版本加载dll工具库
|
//Linux版本加载dll工具库
|
||||||
System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
||||||
System.load("/usr/local/jdk/lib/libGammaAnalyALG.so");
|
System.load("/usr/local/jdk/lib/libGammaAnaly.so");
|
||||||
}
|
}
|
||||||
nuclLibService.getNuclideMap();
|
nuclLibService.getNuclideMap();
|
||||||
//根据配置文件配置邮件获取策略定义时间条件,默认EmailReceivePolicy.HISTORY_ORDER_RECEIVE.getPolicy()
|
//根据配置文件配置邮件获取策略定义时间条件,默认EmailReceivePolicy.HISTORY_ORDER_RECEIVE.getPolicy()
|
||||||
|
|
|
@ -32,7 +32,7 @@ spring:
|
||||||
#Sentinel配置
|
#Sentinel配置
|
||||||
sentinel:
|
sentinel:
|
||||||
transport:
|
transport:
|
||||||
dashboard: jeecg-boot-sentinel:9000
|
dashboard: armd-nacos:9000
|
||||||
# 支持链路限流
|
# 支持链路限流
|
||||||
web-context-unify: false
|
web-context-unify: false
|
||||||
filter:
|
filter:
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
|
||||||
} else {
|
} else {
|
||||||
//Linux版本加载dll工具库
|
//Linux版本加载dll工具库
|
||||||
System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
||||||
System.load("/usr/local/jdk/lib/libGammaAnalyALG.so");
|
System.load("/usr/local/jdk/lib/libGammaAnaly.so");
|
||||||
}
|
}
|
||||||
//创建缓存
|
//创建缓存
|
||||||
betaCache.initCache();
|
betaCache.initCache();
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -476,7 +476,7 @@
|
||||||
<!--当前环境-->
|
<!--当前环境-->
|
||||||
<profile.name>dev</profile.name>
|
<profile.name>dev</profile.name>
|
||||||
<!--Nacos服务地址-->
|
<!--Nacos服务地址-->
|
||||||
<config.server-addr>jeecg-boot-nacos:8848</config.server-addr>
|
<config.server-addr>armd-nacos:8848</config.server-addr>
|
||||||
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
||||||
<config.namespace></config.namespace>
|
<config.namespace></config.namespace>
|
||||||
<!--Nacos配置分组名称-->
|
<!--Nacos配置分组名称-->
|
||||||
|
@ -490,7 +490,7 @@
|
||||||
<!--当前环境-->
|
<!--当前环境-->
|
||||||
<profile.name>test</profile.name>
|
<profile.name>test</profile.name>
|
||||||
<!--Nacos服务地址-->
|
<!--Nacos服务地址-->
|
||||||
<config.server-addr>jeecg-boot-nacos:8848</config.server-addr>
|
<config.server-addr>armd-nacos:8848</config.server-addr>
|
||||||
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
||||||
<config.namespace></config.namespace>
|
<config.namespace></config.namespace>
|
||||||
<!--Nacos配置分组名称-->
|
<!--Nacos配置分组名称-->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user