提交 b09e9994 作者: 洪东保

debug

父级 febf6b90
...@@ -102,8 +102,8 @@ public class EmailSender { ...@@ -102,8 +102,8 @@ public class EmailSender {
if (StringUtils.isEmpty(toEmail)) { if (StringUtils.isEmpty(toEmail)) {
log.error("收件邮箱为空,推送失败"); log.error("收件邮箱为空,推送失败");
processLogService.log(meetingId, subMeetingId, "收件邮箱为空,推送失败。environment->" + environment + ",testReceiver->" + testReceiver + ",realEmail->" + emailPushBuilder.getToEmail()); processLogService.log(meetingId,subMeetingId,"收件邮箱为空,推送失败。environment->"+environment+",testReceiver->"+testReceiver+",realEmail->"+emailPushBuilder.getToEmail());
return false; throw new RuntimeException("收件邮箱为空,推送失败");
} }
log.info("准备开始邮件推送..."); log.info("准备开始邮件推送...");
while (retryCount.intValue() < MAX_RETRY && isSent != null && !isSent) { while (retryCount.intValue() < MAX_RETRY && isSent != null && !isSent) {
......
...@@ -379,4 +379,65 @@ public class CmeetingJob { ...@@ -379,4 +379,65 @@ public class CmeetingJob {
} }
// @Scheduled(cron = "0 0 * * * ?")
public void errorStatisticsPush() {
log.info("errorStatisticsPush");
Date now = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.HOUR_OF_DAY, -1);
Date start = calendar.getTime();
List<Integer> statusList = new ArrayList<>();
statusList.add(5);
statusList.add(6);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<MeetingInfo> meetingInfoList = meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.notIn(MeetingInfo::getStatus, statusList)
.between(MeetingInfo::getSyncTime, sdf.format(start), sdf.format(now))
.select(MeetingInfo::getStatus)
);
if (meetingInfoList.size() == 0) {
return;
}
List<Integer> collect = meetingInfoList.stream().map(MeetingInfo::getStatus).collect(Collectors.toList());
if (collect.contains(0) || collect.contains(4)) {
return;
}
int sum = collect.size();
int geneError = 0;
int pushEmailError = 0;
for (Integer integer : collect) {
if (integer == 1){
geneError++;
}
if (integer == 4){
pushEmailError++;
}
}
if (sum > geneError + pushEmailError) {
return;
}
String subject = "会议纪要推送报警";
String content = "<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;附件为今天Cmeeting会议纪要生成和发送情况,烦请查收。</p>";
// List<StatisticsEmailPush.Attachment> attachments = new ArrayList<>();
// StatisticsEmailPush.Attachment attachment = new StatisticsEmailPush.Attachment();
// attachment.setName(subject);
// attachment.setBytes(IOUtils.toByteArray(Files.newInputStream(file.toPath())));
// attachments.add(attachment);
StatisticsEmailPush emailPushBuilder = StatisticsEmailPush.builder()
.toEmails(statisticsEmailPushProperties.getToEmails())
// .attachments(attachments)
.subject(subject)
.content(content)
.build();
emailSender.emailStatisticsPush(emailPushBuilder);
}
} }
...@@ -150,7 +150,9 @@ public class EmailPushTask { ...@@ -150,7 +150,9 @@ public class EmailPushTask {
e.printStackTrace(); e.printStackTrace();
log.error("push email error: {}", e.getMessage()); 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);
} else {
// 指数退避 // 指数退避
try { try {
Thread.sleep((long) Math.pow(2, currentRetryCount) * 1000); Thread.sleep((long) Math.pow(2, currentRetryCount) * 1000);
......
...@@ -725,7 +725,26 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -725,7 +725,26 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
} }
} }
private static Map<String, String> DEPT_MAP = new HashMap<>(20);
static {
DEPT_MAP.put("10340", "集团总部");
DEPT_MAP.put("602700", "能化板块");
DEPT_MAP.put("616859", "空港板块");
DEPT_MAP.put("616766", "集装箱集团");
DEPT_MAP.put("616844", "车辆板块");
DEPT_MAP.put("616860", "海工板块");
DEPT_MAP.put("616861", "产城板块");
DEPT_MAP.put("640071", "物流板块");
DEPT_MAP.put("617560", "融资租赁贵公司");
DEPT_MAP.put("640075", "财务公司");
DEPT_MAP.put("641858", "其他类型企业");
DEPT_MAP.put("707435", "集团创新企业");
DEPT_MAP.put("686701", "中集海工");
DEPT_MAP.put("710972", "中集资本");
DEPT_MAP.put("711091", "中集载具");
DEPT_MAP.put("698023", "中集同创");
}
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论