自动处理增加逻辑判断,邮箱查询启用状态不再作为约束条件,增加逻辑,如果邮箱存储map中包含当前邮箱id并且邮箱处于启用状态则将邮箱数据存入邮箱存储map中

This commit is contained in:
qiaoqinzheng 2024-01-02 15:50:58 +08:00
parent b3ec34246f
commit 4af4b5255b
2 changed files with 12 additions and 4 deletions

View File

@ -59,9 +59,9 @@ public class AutoProcessManager{
monitorThread.start(); monitorThread.start();
//邮件执行线程管理 //邮件执行线程管理
final MailExecManager autoProcessThread = new MailExecManager(); // final MailExecManager autoProcessThread = new MailExecManager();
autoProcessThread.setName("mail-exec-thread-manage"); // autoProcessThread.setName("mail-exec-thread-manage");
autoProcessThread.start(); // autoProcessThread.start();
} }
/** /**
@ -176,11 +176,19 @@ public class AutoProcessManager{
//如果库里已有数据原来已开启使用并且监测Map中已存在现在关闭使用则添加删除标记 //如果库里已有数据原来已开启使用并且监测Map中已存在现在关闭使用则添加删除标记
//如果本次查询数据监测Map中不存在并且已开启使用的则加入监测Map //如果本次查询数据监测Map中不存在并且已开启使用的则加入监测Map
for(EmailProperties email : receiveMails){ for(EmailProperties email : receiveMails){
//判断map里是否包含邮箱id
final boolean flag = emailMap.containsKey(email.getId()); final boolean flag = emailMap.containsKey(email.getId());
//如果包含邮箱id 并且 邮箱处于未启用的状态 将邮箱的删除标识设置为true
if(flag && email.getEnabled().equals(SysMailEnableType.NOT_ENABLE.getMailEnableType())){ if(flag && email.getEnabled().equals(SysMailEnableType.NOT_ENABLE.getMailEnableType())){
EmailProperties sourceEmail = emailMap.get(email.getId()); EmailProperties sourceEmail = emailMap.get(email.getId());
sourceEmail.setDelFlag(true); 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())){ if(!flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){
email.setNewEmailFlag(true); email.setNewEmailFlag(true);
putSysEmailMap(email); putSysEmailMap(email);

View File

@ -31,7 +31,7 @@ public class SysMailServiceImpl extends ServiceImpl<SysMailMapper, SysEmail> imp
public List<EmailProperties> findReceiveMails() { public List<EmailProperties> findReceiveMails() {
LambdaQueryWrapper<SysEmail> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysEmail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysEmail::getEmilType, SysMailType.RECEIVE_EMAIL.getEmailType()); queryWrapper.eq(SysEmail::getEmilType, SysMailType.RECEIVE_EMAIL.getEmailType());
queryWrapper.eq(SysEmail::getEnabled, SysMailEnableType.ENABLE.getMailEnableType()); // queryWrapper.eq(SysEmail::getEnabled, SysMailEnableType.ENABLE.getMailEnableType());
List<SysEmail> sysEmail = this.list(queryWrapper); List<SysEmail> sysEmail = this.list(queryWrapper);
if(!CollectionUtils.isEmpty(sysEmail)){ if(!CollectionUtils.isEmpty(sysEmail)){
List<EmailProperties> emailPropertiesList = Lists.newArrayList(); List<EmailProperties> emailPropertiesList = Lists.newArrayList();