|
@@ -1,12 +1,12 @@
|
|
package com.smppw.modaq.application.task;
|
|
package com.smppw.modaq.application.task;
|
|
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
import cn.hutool.core.collection.ListUtil;
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import com.smppw.modaq.application.service.EmailParseApiService;
|
|
import com.smppw.modaq.application.service.EmailParseApiService;
|
|
import com.smppw.modaq.common.conts.EmailTypeConst;
|
|
import com.smppw.modaq.common.conts.EmailTypeConst;
|
|
import com.smppw.modaq.domain.entity.TaskRecordDO;
|
|
import com.smppw.modaq.domain.entity.TaskRecordDO;
|
|
import com.smppw.modaq.domain.service.TaskRecordService;
|
|
import com.smppw.modaq.domain.service.TaskRecordService;
|
|
|
|
+import jakarta.annotation.PostConstruct;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
@@ -28,11 +28,11 @@ public class ParseSchedulerTask {
|
|
this.taskRecordService = taskRecordService;
|
|
this.taskRecordService = taskRecordService;
|
|
}
|
|
}
|
|
|
|
|
|
-// @PostConstruct
|
|
|
|
-// public void executeOnStartup() {
|
|
|
|
|
|
+ @PostConstruct
|
|
|
|
+ public void executeOnStartup() {
|
|
// this.letter();
|
|
// this.letter();
|
|
-//// this.report();
|
|
|
|
-// }
|
|
|
|
|
|
+ this.report();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 定时任务每2小时执行一次
|
|
* 定时任务每2小时执行一次
|
|
@@ -47,10 +47,8 @@ public class ParseSchedulerTask {
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
try {
|
|
try {
|
|
- // 尽可能往前找3分钟覆盖可能遗漏的邮件
|
|
|
|
- Date startTime = DateUtil.offsetMinute(task.getStartTime(), -3);
|
|
|
|
// 确认单从 INBOX 默认文件夹获取邮件
|
|
// 确认单从 INBOX 默认文件夹获取邮件
|
|
- this.emailParseApiService.parseEmail(startTime, now,
|
|
|
|
|
|
+ this.emailParseApiService.parseEmail(task.getStartTime(), now,
|
|
null, ListUtil.of(EmailTypeConst.REPORT_LETTER_EMAIL_TYPE));
|
|
null, ListUtil.of(EmailTypeConst.REPORT_LETTER_EMAIL_TYPE));
|
|
task.setStatus(1);
|
|
task.setStatus(1);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -79,10 +77,8 @@ public class ParseSchedulerTask {
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
try {
|
|
try {
|
|
- // 尽可能往前找3分钟覆盖可能遗漏的邮件
|
|
|
|
- Date startTime = DateUtil.offsetMinute(task.getStartTime(), -3);
|
|
|
|
// 定期报告从 我的文件夹.报告公告 文件夹获取邮件
|
|
// 定期报告从 我的文件夹.报告公告 文件夹获取邮件
|
|
- this.emailParseApiService.parseEmail(startTime, now,
|
|
|
|
|
|
+ this.emailParseApiService.parseEmail(task.getStartTime(), now,
|
|
ListUtil.of("其他文件夹/报告公告"), EmailTypeConst.REPORT_EMAIL_TYPES);
|
|
ListUtil.of("其他文件夹/报告公告"), EmailTypeConst.REPORT_EMAIL_TYPES);
|
|
task.setStatus(1);
|
|
task.setStatus(1);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|