|
@@ -1,5 +1,7 @@
|
|
package com.simuwang.manage.init;
|
|
package com.simuwang.manage.init;
|
|
|
|
|
|
|
|
+import cn.hutool.crypto.asymmetric.KeyType;
|
|
|
|
+import cn.hutool.crypto.asymmetric.RSA;
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.simuwang.base.common.enums.OpenStatusType;
|
|
import com.simuwang.base.common.enums.OpenStatusType;
|
|
import com.simuwang.base.common.util.QuartzUtils;
|
|
import com.simuwang.base.common.util.QuartzUtils;
|
|
@@ -38,6 +40,9 @@ public class QuartzConfig implements ApplicationRunner {
|
|
|
|
|
|
@Value("${spring.task.groupName}")
|
|
@Value("${spring.task.groupName}")
|
|
private String groupName;
|
|
private String groupName;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DaqProperties properties;
|
|
private String JOB_CLASS="com.simuwang.manage.task.ParseSchedulerTask";
|
|
private String JOB_CLASS="com.simuwang.manage.task.ParseSchedulerTask";
|
|
|
|
|
|
private final Boolean enableQuartz;
|
|
private final Boolean enableQuartz;
|
|
@@ -49,9 +54,9 @@ public class QuartzConfig implements ApplicationRunner {
|
|
@Override
|
|
@Override
|
|
public void run(ApplicationArguments args){
|
|
public void run(ApplicationArguments args){
|
|
// 没有开启定时任务功能时直接退出
|
|
// 没有开启定时任务功能时直接退出
|
|
- if (!enableQuartz) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+// if (!enableQuartz) {
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
List<MailboxInfoDO> mailboxInfoDOS = emailConfigService.getAll();
|
|
List<MailboxInfoDO> mailboxInfoDOS = emailConfigService.getAll();
|
|
for(MailboxInfoDO mailboxInfoDO : mailboxInfoDOS){
|
|
for(MailboxInfoDO mailboxInfoDO : mailboxInfoDOS){
|
|
try{
|
|
try{
|
|
@@ -64,7 +69,15 @@ public class QuartzConfig implements ApplicationRunner {
|
|
//请求参数
|
|
//请求参数
|
|
MailboxInfoDTO paramDTO = new MailboxInfoDTO();
|
|
MailboxInfoDTO paramDTO = new MailboxInfoDTO();
|
|
paramDTO.setAccount(mailboxInfoDO.getEmail());
|
|
paramDTO.setAccount(mailboxInfoDO.getEmail());
|
|
- paramDTO.setPassword(mailboxInfoDO.getPassword());
|
|
|
|
|
|
+ String password = mailboxInfoDO.getPassword();
|
|
|
|
+ try{
|
|
|
|
+ String publicKey = this.properties.getSecurityRsa().getPublicKey();
|
|
|
|
+ String privateKey = this.properties.getSecurityRsa().getPrivateKey();
|
|
|
|
+ password = new RSA(privateKey, publicKey).decryptStr(password, KeyType.PrivateKey);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ logger.error(e.getMessage(),e);
|
|
|
|
+ }
|
|
|
|
+ paramDTO.setPassword(password);
|
|
paramDTO.setPort(mailboxInfoDO.getPort());
|
|
paramDTO.setPort(mailboxInfoDO.getPort());
|
|
paramDTO.setHost(mailboxInfoDO.getServer());
|
|
paramDTO.setHost(mailboxInfoDO.getServer());
|
|
paramDTO.setProtocol(mailboxInfoDO.getProtocol());
|
|
paramDTO.setProtocol(mailboxInfoDO.getProtocol());
|