onlyDownload后续代码放开

This commit is contained in:
qiaoqinzheng 2024-04-29 18:29:23 +08:00
parent 1e0d499b7a
commit f58d629bd7

View File

@ -110,47 +110,47 @@ public class SpectrumParsingActuator implements Runnable{
//保存邮件日志到PG数据库
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
// //获取邮件内容
// StringBuilder mailContent = new StringBuilder();
// if(Objects.nonNull(emlFile) && emlFile.length() > 0){
// mailContent.append(FileUtil.readUtf8String(emlFile));
// }
//
// //判断是否是IMS2.0协议文件
// // 如果邮件内容校验成功 将文件保存到eml目录 并删除邮件对象
// if(checkMailContent(mailContent,subject)){
// AbstractSpectrumHandler spectrumHandler = new SamplephdSpectrum();
// spectrumHandler.init(mailContent.toString(),emlFile.getName(),spectrumServiceQuotes,new StringBuilder(),SpectrumSource.FORM_EMAIL_SERVICE.getSourceType(),batchesCounter);
// final boolean matchResult = spectrumHandler.saveEmailToLocal();
// if(matchResult){
// try {
// //开始解析
// spectrumHandler.handler();
// spectrumServiceQuotes.getRedisUtil().del(key);
// } catch (Exception e) {
// //如果是gamma谱的分析异常
// if (e instanceof AnalySpectrumException) {
// // 如果邮件内容校验失败(邮件内容不完整) 将错误邮件从eml移动到emlError
// if (Objects.nonNull(emlFile) && emlFile.exists()){
// moveEmail(emlFile, key);
// }
// //删除邮件
// emailServiceManager.removeMail(message,batchesCounter);
// } else {
// throw e;
// }
// }
// }else{
// log.warn("This email {} parsing failed and is not listed in the Met, Alert, SOH, Sample, Detbkphd, QC, Gasbkphd spectra.",subject);
// }
// emailServiceManager.removeMail(message,batchesCounter);
// }else {
// // 如果邮件内容校验失败(邮件内容不完整) 将错误邮件从eml移动到emlError
// if (Objects.nonNull(emlFile) && emlFile.exists()){
// moveEmail(emlFile, key);
// throw new DownloadEmailException("邮件移走后手动抛出DownloadEmailException");
// }
// }
//获取邮件内容
StringBuilder mailContent = new StringBuilder();
if(Objects.nonNull(emlFile) && emlFile.length() > 0){
mailContent.append(FileUtil.readUtf8String(emlFile));
}
//判断是否是IMS2.0协议文件
// 如果邮件内容校验成功 将文件保存到eml目录 并删除邮件对象
if(checkMailContent(mailContent,subject)){
AbstractSpectrumHandler spectrumHandler = new SamplephdSpectrum();
spectrumHandler.init(mailContent.toString(),emlFile.getName(),spectrumServiceQuotes,new StringBuilder(),SpectrumSource.FORM_EMAIL_SERVICE.getSourceType(),batchesCounter);
final boolean matchResult = spectrumHandler.saveEmailToLocal();
if(matchResult){
try {
//开始解析
spectrumHandler.handler();
spectrumServiceQuotes.getRedisUtil().del(key);
} catch (Exception e) {
//如果是gamma谱的分析异常
if (e instanceof AnalySpectrumException) {
// 如果邮件内容校验失败(邮件内容不完整) 将错误邮件从eml移动到emlError
if (Objects.nonNull(emlFile) && emlFile.exists()){
moveEmail(emlFile, key);
}
//删除邮件
emailServiceManager.removeMail(message,batchesCounter);
} else {
throw e;
}
}
}else{
log.warn("This email {} parsing failed and is not listed in the Met, Alert, SOH, Sample, Detbkphd, QC, Gasbkphd spectra.",subject);
}
emailServiceManager.removeMail(message,batchesCounter);
}else {
// 如果邮件内容校验失败(邮件内容不完整) 将错误邮件从eml移动到emlError
if (Objects.nonNull(emlFile) && emlFile.exists()){
moveEmail(emlFile, key);
throw new DownloadEmailException("邮件移走后手动抛出DownloadEmailException");
}
}
} catch (Exception e) {
// 如果不是下载导致的失败 并且 下载成功则删除下载的邮件对象
if(!(e instanceof DownloadEmailException) && downloadFlag){