fix:1.修改获取邮件内容改为从.eml文件中获取

This commit is contained in:
panbaolin 2023-12-29 20:15:36 +08:00
parent 9b365cfd8e
commit a24ad3db42

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.spectrum; package org.jeecg.modules.spectrum;
import cn.hutool.core.io.FileUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.email.EmailLogEvent; import org.jeecg.common.email.EmailLogEvent;
@ -8,6 +9,7 @@ import org.jeecg.common.email.EmailServiceManager;
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 javax.mail.Message; import javax.mail.Message;
import java.io.File;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
/** /**
@ -68,15 +70,17 @@ public class SpectrumParsingActuator implements Runnable{
//获取邮件主题 //获取邮件主题
subject = emailServiceManager.getMailSubject(message); subject = emailServiceManager.getMailSubject(message);
//获取邮件内容
StringBuilder mailContent = new StringBuilder();
emailServiceManager.getMailContent(message,mailContent);
//所有邮件都需以.eml格式存储到eml文件夹中 //所有邮件都需以.eml格式存储到eml文件夹中
emailServiceManager.downloadEmailToEmlDir(message,emailCounter.getCurrValue()); final File emlFile = emailServiceManager.downloadEmailToEmlDir(message, emailCounter.getCurrValue());
//保存邮件日志到PG数据库 //保存邮件日志到PG数据库
this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties); this.spectrumServiceQuotes.getMailLogService().create(message,emailProperties);
//获取邮件内容
StringBuilder mailContent = new StringBuilder();
if(StringUtils.isNotBlank(emlFile.toString()) && emlFile.length() > 0){
mailContent.append(FileUtil.readUtf8String(emlFile));
}
//判断是否是IMS2.0协议文件 //判断是否是IMS2.0协议文件
if(checkMailContent(mailContent,subject)){ if(checkMailContent(mailContent,subject)){
AbstractSpectrumHandler spectrumHandler = new SamplephdSpectrum(); AbstractSpectrumHandler spectrumHandler = new SamplephdSpectrum();