From bcc049191cf2bcfe013dd4c158381fd7efc8280a Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 2 Jan 2024 19:00:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E5=A2=9E=E5=8A=A0=E5=81=9C=E6=AD=A2=E6=A0=87=E8=AF=86?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E9=82=AE=E7=AE=B1=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=9C=AA=E5=90=AF=E7=94=A8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E5=81=9C=E6=AD=A2=E6=A0=87=E8=AF=86=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BAtrue=EF=BC=8C=E5=81=9C=E6=AD=A2=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E4=BB=A3=E7=A0=81=E7=9A=84=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/email/EmailServiceManager.java | 7 ++++++- .../java/org/jeecg/modules/AutoProcessManager.java | 2 +- .../java/org/jeecg/modules/EmailParsingActuator.java | 10 +++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java index 47b58bdd..58a6fdfc 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java @@ -115,7 +115,12 @@ public class EmailServiceManager { properties.put("mail.store.protocol", "imap"); properties.put("mail.imap.host", email.getEmailServerAddress()); properties.put("mail.imap.port",email.getPort()); - properties.put("mail.imap.ssl.enable", "true"); + if (email.getIsQiye() == 1) { + properties.put("mail.imap.ssl.enable", "true"); + } else { + properties.put("mail.imap.ssl.enable", "false"); + } + //获取邮件回话 final Session session = Session.getDefaultInstance(properties); 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 88ec7dac..9d9eaeac 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 @@ -80,7 +80,7 @@ public class AutoProcessManager{ if(next.isDelFlag()){ if(emailExecThreadMap.containsKey(next.getId())){ EmailParsingActuator actuator = emailExecThreadMap.get(next.getId()); - actuator.interrupt(); + actuator.setStop(true); emailExecThreadMap.remove(next.getId()); } iterator.remove(); 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 2d1da3f0..2d2c0ca5 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 @@ -1,5 +1,6 @@ package org.jeecg.modules; +import lombok.Setter; import org.apache.commons.lang3.ArrayUtils; import org.jeecg.common.email.EmailLogManager; import org.jeecg.common.email.EmailServiceManager; @@ -26,6 +27,8 @@ public class EmailParsingActuator extends Thread{ private SpectrumServiceQuotes spectrumServiceQuotes; private EmailCounter emailCounter; private Date systemStartupTime; + @Setter + private boolean isStop; public void init(EmailProperties emailProperties,SpectrumServiceQuotes spectrumServiceQuotes, EmailCounter emailCounter,Date systemStartupTime){ @@ -50,10 +53,11 @@ public class EmailParsingActuator extends Thread{ @Override public void run() { - if (this.isInterrupted()) { - return; - } for(;;){ + if (isStop) { + System.out.println("EmailParsingActuator is Stop!"); + return; + } long start = System.currentTimeMillis(); final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance(); emailServiceManager.init(this.emailProperties,this.taskProperties.getReceiveNum(),this.taskProperties.getTemporaryStoragePath(),this.systemStartupTime, spectrumServiceQuotes.getSpectrumPathProperties());