From 4af4b5255ba1881157ef1ef809edee0b4cd721da Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 2 Jan 2024 15:50:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD=EF=BC=8C=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E6=9F=A5=E8=AF=A2=E5=90=AF=E7=94=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E4=BD=9C=E4=B8=BA=E7=BA=A6=E6=9D=9F=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E9=82=AE=E7=AE=B1=E5=AD=98=E5=82=A8map?= =?UTF-8?q?=E4=B8=AD=E5=8C=85=E5=90=AB=E5=BD=93=E5=89=8D=E9=82=AE=E7=AE=B1?= =?UTF-8?q?id=E5=B9=B6=E4=B8=94=E9=82=AE=E7=AE=B1=E5=A4=84=E4=BA=8E?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E7=8A=B6=E6=80=81=E5=88=99=E5=B0=86=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E6=95=B0=E6=8D=AE=E5=AD=98=E5=85=A5=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E5=AD=98=E5=82=A8map=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/modules/AutoProcessManager.java | 14 +++++++++++--- .../modules/service/impl/SysMailServiceImpl.java | 2 +- 2 files changed, 12 insertions(+), 4 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 404ec6c6..79211d6f 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 @@ -59,9 +59,9 @@ public class AutoProcessManager{ monitorThread.start(); //邮件执行线程管理 - final MailExecManager autoProcessThread = new MailExecManager(); - autoProcessThread.setName("mail-exec-thread-manage"); - autoProcessThread.start(); +// final MailExecManager autoProcessThread = new MailExecManager(); +// autoProcessThread.setName("mail-exec-thread-manage"); +// autoProcessThread.start(); } /** @@ -176,11 +176,19 @@ public class AutoProcessManager{ //如果库里已有数据原来已开启使用并且监测Map中已存在,现在关闭使用则添加删除标记 //如果本次查询数据监测Map中不存在,并且已开启使用的则加入监测Map for(EmailProperties email : receiveMails){ + //判断map里是否包含邮箱id final boolean flag = emailMap.containsKey(email.getId()); + //如果包含邮箱id 并且 邮箱处于未启用的状态 将邮箱的删除标识设置为true if(flag && email.getEnabled().equals(SysMailEnableType.NOT_ENABLE.getMailEnableType())){ EmailProperties sourceEmail = emailMap.get(email.getId()); sourceEmail.setDelFlag(true); } + //如果包含邮箱id 并且 邮箱处于启用状态 将邮箱数据进行更新 + if (flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())) { + putSysEmailMap(email); + log.info("{}邮箱加入监测队列",email.getEmailServerAddress()); + } + //如果不包含邮箱id 并且 邮箱处于启用状态 将邮箱对象存入到map中 并将新邮箱标识设置为true if(!flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){ email.setNewEmailFlag(true); putSysEmailMap(email); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java index 5436ed76..835d1999 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java @@ -31,7 +31,7 @@ public class SysMailServiceImpl extends ServiceImpl imp public List findReceiveMails() { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SysEmail::getEmilType, SysMailType.RECEIVE_EMAIL.getEmailType()); - queryWrapper.eq(SysEmail::getEnabled, SysMailEnableType.ENABLE.getMailEnableType()); +// queryWrapper.eq(SysEmail::getEnabled, SysMailEnableType.ENABLE.getMailEnableType()); List sysEmail = this.list(queryWrapper); if(!CollectionUtils.isEmpty(sysEmail)){ List emailPropertiesList = Lists.newArrayList();