From 6cf57cf41abd99b206741a7fcb6c06cd53dc2abd Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 2 Jan 2024 18:00:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=B1=BB=E5=A2=9E=E5=8A=A0=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BB=A3=E7=A0=81=20=E9=82=AE=E4=BB=B6=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=A2=9E=E5=8A=A0=E6=A0=87?= =?UTF-8?q?=E8=AF=86resetFlag=EF=BC=8C=E6=A0=87=E8=AF=86=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E6=98=AF=E5=90=A6=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E8=BF=9B=E8=A1=8C=E6=9B=B4=E6=96=B0=20=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E8=A7=A3=E6=9E=90=E6=89=A7=E8=A1=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0=E9=82=AE=E7=AE=B1=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E4=BF=A1=E6=81=AF=E6=96=B9=E6=B3=95=20=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E8=A7=A3=E6=9E=90=E6=89=A7=E8=A1=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=BA=BF=E7=A8=8B=E6=98=AF=E5=90=A6=E5=A4=84=E4=BA=8E?= =?UTF-8?q?=E4=B8=AD=E6=AD=A2=E7=8A=B6=E6=80=81=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=A4=84=E4=BA=8E=E4=B8=AD=E6=AD=A2=E7=8A=B6=E6=80=81=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E5=BD=93=E5=89=8D=E6=96=B9=E6=B3=95=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A4=84=E7=90=86=E6=A8=A1=E5=9D=97=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=86=99=E5=85=A5=E4=BB=A3=E7=A0=81=E4=B8=AD?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=94=99=E8=AF=AF=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0=E7=9A=84=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/modules/AutoProcessManager.java | 21 ++++++++++++++----- .../jeecg/modules/EmailParsingActuator.java | 9 ++++++++ .../org/jeecg/modules/ErrorLogManager.java | 1 + .../jeecg/modules/email/EmailProperties.java | 5 +++++ 4 files changed, 31 insertions(+), 5 deletions(-) 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; + }