提交 672dbede 作者: 洪东保

debug

父级 78f13c78
......@@ -227,7 +227,7 @@ public class CmeetingJob {
/**
* 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件
*/
@Scheduled(fixedRate = 10 * 60 * 1000,initialDelay = 15 * 60 * 1000)
@Scheduled(fixedRate = 10 * 60 * 1000,initialDelay = 1 * 60 * 1000)
public void emailPushRetry() {
if (isDev) {
return;
......@@ -237,7 +237,6 @@ public class CmeetingJob {
}
try {
log.info("-------邮件推送重试定时任务开始-------");
log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
//查出所有早于一小时前的,邮件推送失败且未重试过的会议
List<MeetingInfo> meetingInfoList =
......@@ -251,21 +250,21 @@ public class CmeetingJob {
if (meetingInfoList == null || meetingInfoList.isEmpty()) {
log.info("没有推送失败的邮件需要重试");
return;
}
List<TencentMeetingVO.RecordFile> meetingFiles = new ArrayList<>();
for (MeetingInfo meetingInfo : meetingInfoList) {
TencentMeetingVO.RecordFile recordFile = TencentMeetingVO.RecordFile.builder()
.meetingId(meetingInfo.getMeetingId())
.subMeetingId(meetingInfo.getSubMeetingId()).build();
meetingFiles.add(recordFile);
}
} else {
List<TencentMeetingVO.RecordFile> meetingFiles = new ArrayList<>();
for (MeetingInfo meetingInfo : meetingInfoList) {
TencentMeetingVO.RecordFile recordFile = TencentMeetingVO.RecordFile.builder()
.meetingId(meetingInfo.getMeetingId())
.subMeetingId(meetingInfo.getSubMeetingId()).build();
meetingFiles.add(recordFile);
}
//查出企微id和腾会id的关联关系
List<UserId> userIdRelations = userIdMapper.selectList(null);
Map<String,String> tidWidRelations = userIdRelations.stream().collect(Collectors.toMap(UserId::getTid,UserId::getWid));
// 提交处理任务
producer.submitEmailPushTasks(meetingFiles,tidWidRelations);
//查出企微id和腾会id的关联关系
List<UserId> userIdRelations = userIdMapper.selectList(null);
Map<String, String> tidWidRelations = userIdRelations.stream().collect(Collectors.toMap(UserId::getTid, UserId::getWid));
// 提交处理任务
producer.submitEmailPushTasks(meetingFiles, tidWidRelations);
}
log.info("-------邮件推送重试定时任务结束--------");
} catch (Exception e) {
e.printStackTrace();
......
......@@ -60,6 +60,8 @@ public class EmailPushTask {
log.warn("key already exists in redis!, key: {}", key);
return;
}
log.info("线程开始------------>");
long l = System.currentTimeMillis();
Boolean isSuccess = false;
AtomicInteger retryCount = new AtomicInteger(0);
MeetingInfo meetingInfo = meetingInfoMapper.selectOne(new LambdaQueryWrapper<MeetingInfo>()
......@@ -69,7 +71,7 @@ public class EmailPushTask {
log.warn("邮件已推送, meetingId: {}", meetingId);
return;
}
while (retryCount.intValue() <= MAX_RETRY && !isSuccess) {
while (retryCount.intValue() <= MAX_RETRY && isSuccess != null && !isSuccess) {
String hostUid = meetingInfo.getHostUid();
if(!tidWidRelations.containsKey(hostUid)){
log.error("邮件推送重试失败: 主持人对应关系未配置。meetingId {}", meetingId);
......@@ -101,7 +103,6 @@ public class EmailPushTask {
try (InputStream inputStream = minioUtils.getFile(meetingRecordTemplate.getTemplate())) {
XWPFTemplate template = XWPFTemplate.compile(inputStream).render(dataModel);
template.writeAndClose(new FileOutputStream(dataNetworkMinutesPath));
byte[] recordXmlData = Files.readAllBytes(Paths.get(dataNetworkMinutesPath));
} catch (IOException e) {
e.printStackTrace();
}
......@@ -134,6 +135,8 @@ public class EmailPushTask {
isSuccess = emailSender.sendEmailWithAttachment(emailPushBuilder);
} catch (Exception e) {
// 异常处理
e.printStackTrace();
log.error("push email error: {}", e.getMessage());
int currentRetryCount = retryCount.getAndIncrement();
if (currentRetryCount > MAX_RETRY) {
log.error("达到最大重试次数:meetingId {}", meetingId);
......@@ -159,6 +162,7 @@ public class EmailPushTask {
);
}
redisUtils.del(key);
log.info("线程结束, 耗时: {} ms", System.currentTimeMillis() - l);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论