自动处理模块会删除邮件问题
This commit is contained in:
parent
662d11bfaf
commit
8523e3b2fa
|
@ -645,6 +645,7 @@ public class EmailServiceManager {
|
||||||
boolean exist = false;
|
boolean exist = false;
|
||||||
try {
|
try {
|
||||||
String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
|
String key = RedisConstant.EMAIL_MSG_ID+StringConstant.COLON+messageId;
|
||||||
|
log.info("Check: Remove Email:{},receiveTime:{}",message.getSubject(), DateUtils.formatDate(message.getReceivedDate(),"yyyy-MM-dd HH:mm:ss"));
|
||||||
exist = redisUtil.hasKey(key);
|
exist = redisUtil.hasKey(key);
|
||||||
if(exist){
|
if(exist){
|
||||||
message.setFlag(Flags.Flag.DELETED,true);
|
message.setFlag(Flags.Flag.DELETED,true);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
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.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
|
@ -16,8 +17,10 @@ import org.jeecg.modules.enums.SpectrumSource;
|
||||||
import org.jeecg.modules.file.FileOperation;
|
import org.jeecg.modules.file.FileOperation;
|
||||||
|
|
||||||
import javax.mail.Message;
|
import javax.mail.Message;
|
||||||
|
import javax.mail.MessagingException;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
@ -129,9 +132,15 @@ public class SpectrumParsingActuator implements Runnable{
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 如果不是下载导致的失败,则删除下载的邮件对象
|
// 如果不是下载导致的失败,则删除下载的邮件对象
|
||||||
if(!(e instanceof DownloadEmailException)){
|
if(!(e instanceof DownloadEmailException)){
|
||||||
|
try {
|
||||||
|
log.error("Remove Email:"+ message.getSubject() + StringPool.UNDERSCORE + DateUtils.formatDate(message.getReceivedDate(), "yyyy-MM-dd HH:mm:ss") + StringPool.UNDERSCORE);
|
||||||
|
} catch (MessagingException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
emailServiceManager.removeMail(message,batchesCounter);
|
emailServiceManager.removeMail(message,batchesCounter);
|
||||||
}
|
}
|
||||||
e.printStackTrace();
|
//输出异常信息
|
||||||
|
log.error("邮件处理异常:",e);
|
||||||
}finally {
|
}finally {
|
||||||
try {
|
try {
|
||||||
EmailLogEvent expungeEvent = new EmailLogEvent(this.batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,EmailLogManager.DONE);
|
EmailLogEvent expungeEvent = new EmailLogEvent(this.batchesCounter,Thread.currentThread().getId(),EmailLogManager.GS_TYPE_GET,EmailLogManager.DONE);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user