提交 2e9f0672 作者: 张开石

Merge remote-tracking branch 'origin/old' into old

...@@ -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,21 +250,21 @@ public class CmeetingJob { ...@@ -251,21 +250,21 @@ 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() .meetingId(meetingInfo.getMeetingId())
.meetingId(meetingInfo.getMeetingId()) .subMeetingId(meetingInfo.getSubMeetingId()).build();
.subMeetingId(meetingInfo.getSubMeetingId()).build(); meetingFiles.add(recordFile);
meetingFiles.add(recordFile); }
}
//查出企微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();
......
...@@ -65,6 +65,8 @@ public class EmailPushTask { ...@@ -65,6 +65,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>()
...@@ -74,7 +76,7 @@ public class EmailPushTask { ...@@ -74,7 +76,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);
...@@ -108,7 +110,6 @@ public class EmailPushTask { ...@@ -108,7 +110,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();
} }
...@@ -141,6 +142,8 @@ public class EmailPushTask { ...@@ -141,6 +142,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);
...@@ -166,6 +169,7 @@ public class EmailPushTask { ...@@ -166,6 +169,7 @@ public class EmailPushTask {
); );
} }
redisUtils.del(key); redisUtils.del(key);
log.info("线程结束, 耗时: {} ms", System.currentTimeMillis() - l);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论