提交 672dbede 作者: 洪东保

debug

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