diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java index 84718a81..88ec7dac 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java @@ -42,7 +42,7 @@ public class AutoProcessManager{ /** * 以邮件id为key,以邮件执行线程为value */ - private Map emailExecThreadMap = new HashMap<>(); + private Map emailExecThreadMap = new HashMap<>(); /** * 启动自动处理 @@ -79,12 +79,17 @@ public class AutoProcessManager{ EmailProperties next = iterator.next(); if(next.isDelFlag()){ if(emailExecThreadMap.containsKey(next.getId())){ - Thread thread = emailExecThreadMap.get(next.getId()); - thread.interrupt(); + EmailParsingActuator actuator = emailExecThreadMap.get(next.getId()); + actuator.interrupt(); emailExecThreadMap.remove(next.getId()); } iterator.remove(); } + if (next.isResetFlag()) { + EmailParsingActuator actuator = emailExecThreadMap.get(next.getId()); + actuator.updateEmail(next); + next.setResetFlag(false); + } if(next.isNewEmailFlag()){ EmailParsingActuator emailParsingActuator = new EmailParsingActuator(); emailParsingActuator.init(next,spectrumServiceQuotes,emailCounter,systemStartupTime); @@ -185,8 +190,14 @@ public class AutoProcessManager{ } //如果包含邮箱id 并且 邮箱处于启用状态 将邮箱数据进行更新 if (flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())) { - putSysEmailMap(email); - log.info("{}邮箱加入监测队列",email.getEmailServerAddress()); + EmailProperties properties = emailMap.get(email.getId()); + //判断邮箱的用户名,密码是否与原邮箱用户名,密码一致 + //如果不一致则进行更新 + if ( !properties.getUsername().equals(email.getUsername()) || !properties.getPassword().equals(email.getPassword()) ) { + email.setResetFlag(true); + putSysEmailMap(email); + log.info("{}邮箱加入监测队列",email.getEmailServerAddress()); + } } //如果不包含邮箱id 并且 邮箱处于启用状态 将邮箱对象存入到map中 并将新邮箱标识设置为true if(!flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){ diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/EmailParsingActuator.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/EmailParsingActuator.java index 78b8292b..2d1da3f0 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/EmailParsingActuator.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/EmailParsingActuator.java @@ -44,8 +44,15 @@ public class EmailParsingActuator extends Thread{ poolExecutor = new ThreadPoolExecutor(taskProperties.getReceiveNum(),maximumPoolSize,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory); } + public void updateEmail(EmailProperties emailProperties) { + this.emailProperties = emailProperties; + } + @Override public void run() { + if (this.isInterrupted()) { + return; + } for(;;){ long start = System.currentTimeMillis(); final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance(); @@ -87,4 +94,6 @@ public class EmailParsingActuator extends Thread{ } } } + + } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ErrorLogManager.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ErrorLogManager.java index 2e7b6758..6f6d03bc 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ErrorLogManager.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/ErrorLogManager.java @@ -64,6 +64,7 @@ public class ErrorLogManager { } }else if(event.getEventType() == ErrorEventType.DYNAMIC_EVENT.getEventType()){ errorContent = event.getDynamicErrorContent(); + fileName = event.getFileName().substring(0,event.getFileName().lastIndexOf(StringConstant.DOT))+SUFFIX; } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java index 53b3369b..bf02309d 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java @@ -23,4 +23,9 @@ public class EmailProperties extends SysEmail { */ private boolean delFlag; + /** + * 邮箱是否需要进行更新 + */ + private boolean resetFlag; + }