Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cmeeting
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
翟斌
cmeeting
Commits
78f13c78
提交
78f13c78
authored
8月 02, 2025
作者:
洪东保
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug
父级
c90f621d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
28 行增加
和
23 行删除
+28
-23
src/main/java/com/cmeeting/email/EmailSender.java
+4
-4
src/main/java/com/cmeeting/job/CmeetingJob.java
+7
-7
src/main/java/com/cmeeting/job/EmailPushTask.java
+16
-11
src/main/java/com/cmeeting/job/FileProcessTask.java
+1
-1
没有找到文件。
src/main/java/com/cmeeting/email/EmailSender.java
浏览文件 @
78f13c78
...
@@ -72,7 +72,7 @@ public class EmailSender {
...
@@ -72,7 +72,7 @@ public class EmailSender {
* @param emailPushBuilder
* @param emailPushBuilder
* @return
* @return
*/
*/
public
b
oolean
sendEmailWithAttachment
(
EmailPush
emailPushBuilder
)
{
public
B
oolean
sendEmailWithAttachment
(
EmailPush
emailPushBuilder
)
{
log
.
info
(
"sendEmailWithAttachment start, sender -> {}"
,
SENDER
);
log
.
info
(
"sendEmailWithAttachment start, sender -> {}"
,
SENDER
);
if
(!
pushSwitch
){
if
(!
pushSwitch
){
...
@@ -80,7 +80,7 @@ public class EmailSender {
...
@@ -80,7 +80,7 @@ public class EmailSender {
return
false
;
return
false
;
}
}
AtomicInteger
retryCount
=
new
AtomicInteger
(
0
);
AtomicInteger
retryCount
=
new
AtomicInteger
(
0
);
b
oolean
isSent
=
false
;
B
oolean
isSent
=
false
;
String
toEmail
=
"test"
.
equals
(
environment
)
?
testReceiver
:
emailPushBuilder
.
getToEmail
();
String
toEmail
=
"test"
.
equals
(
environment
)
?
testReceiver
:
emailPushBuilder
.
getToEmail
();
String
subject
=
emailPushBuilder
.
getSubject
();
String
subject
=
emailPushBuilder
.
getSubject
();
String
meetingId
=
emailPushBuilder
.
getMeetingId
();
String
meetingId
=
emailPushBuilder
.
getMeetingId
();
...
@@ -103,7 +103,7 @@ public class EmailSender {
...
@@ -103,7 +103,7 @@ public class EmailSender {
return
false
;
return
false
;
}
}
log
.
info
(
"准备开始邮件推送..."
);
log
.
info
(
"准备开始邮件推送..."
);
while
(
retryCount
.
intValue
()
<
MAX_RETRY
&&
!
isSent
){
while
(
retryCount
.
intValue
()
<
MAX_RETRY
&&
isSent
!=
null
&&
!
isSent
){
try
{
try
{
ClientSecretCredential
clientSecretCredential
=
new
ClientSecretCredentialBuilder
()
ClientSecretCredential
clientSecretCredential
=
new
ClientSecretCredentialBuilder
()
.
clientId
(
CLIENT_ID
)
.
clientId
(
CLIENT_ID
)
...
@@ -139,7 +139,7 @@ public class EmailSender {
...
@@ -139,7 +139,7 @@ public class EmailSender {
long
expireTimestamp
=
ZonedDateTime
.
now
().
plusDays
(
2
).
toInstant
().
toEpochMilli
();
long
expireTimestamp
=
ZonedDateTime
.
now
().
plusDays
(
2
).
toInstant
().
toEpochMilli
();
body
.
content
=
MessageFormat
.
format
(
email_content_template
,
meetingInstanceId
,
toUserCode
,
String
.
valueOf
(
expireTimestamp
));
body
.
content
=
MessageFormat
.
format
(
email_content_template
,
meetingInstanceId
,
toUserCode
,
String
.
valueOf
(
expireTimestamp
));
}
else
{
}
else
{
isSent
=
false
;
isSent
=
null
;
processLogService
.
log
(
meetingId
,
subMeetingId
,
"【邮件推送异常】:邮件模板未设置"
);
processLogService
.
log
(
meetingId
,
subMeetingId
,
"【邮件推送异常】:邮件模板未设置"
);
throw
new
RobotBaseException
(
"邮件模板未设置"
);
throw
new
RobotBaseException
(
"邮件模板未设置"
);
}
}
...
...
src/main/java/com/cmeeting/job/CmeetingJob.java
浏览文件 @
78f13c78
...
@@ -66,7 +66,7 @@ public class CmeetingJob {
...
@@ -66,7 +66,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"0 30 6 * * ?"
)
@Scheduled
(
cron
=
"0 30 6 * * ?"
)
public
void
weComUserSync
()
{
public
void
weComUserSync
()
{
if
(
redisUtils
.
setnx
(
"weComUserSync"
,
"weComUserSync"
,
20
*
60
*
60
)){
if
(
!
redisUtils
.
setnx
(
"weComUserSync"
,
"weComUserSync"
,
20
*
60
*
60
)){
return
;
return
;
}
}
try
{
try
{
...
@@ -88,7 +88,7 @@ public class CmeetingJob {
...
@@ -88,7 +88,7 @@ public class CmeetingJob {
@Scheduled
(
cron
=
"0 0 7 * * ?"
)
@Scheduled
(
cron
=
"0 0 7 * * ?"
)
// @Scheduled(fixedRate = 5 * 60 * 1000)
// @Scheduled(fixedRate = 5 * 60 * 1000)
public
void
TencentUserSync
()
{
public
void
TencentUserSync
()
{
if
(
redisUtils
.
setnx
(
"TencentUserSync"
,
"TencentUserSync"
,
20
*
60
*
60
)){
if
(
!
redisUtils
.
setnx
(
"TencentUserSync"
,
"TencentUserSync"
,
20
*
60
*
60
)){
return
;
return
;
}
}
try
{
try
{
...
@@ -109,7 +109,7 @@ public class CmeetingJob {
...
@@ -109,7 +109,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"0 20 7 * * ?"
)
@Scheduled
(
cron
=
"0 20 7 * * ?"
)
public
void
userBind
()
{
public
void
userBind
()
{
if
(
redisUtils
.
setnx
(
"userBind"
,
"userBind"
,
20
*
60
*
60
)){
if
(
!
redisUtils
.
setnx
(
"userBind"
,
"userBind"
,
20
*
60
*
60
)){
return
;
return
;
}
}
try
{
try
{
...
@@ -129,7 +129,7 @@ public class CmeetingJob {
...
@@ -129,7 +129,7 @@ public class CmeetingJob {
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
if
(
redisUtils
.
setnx
(
"Scheduled-All"
,
"Scheduled-All"
,
18
*
60
)){
if
(
!
redisUtils
.
setnx
(
"Scheduled-All"
,
"Scheduled-All"
,
18
*
60
)){
return
;
return
;
}
}
try
{
try
{
...
@@ -177,7 +177,7 @@ public class CmeetingJob {
...
@@ -177,7 +177,7 @@ public class CmeetingJob {
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
if
(
redisUtils
.
setnx
(
"Scheduled-retry"
,
"Scheduled-retry"
,
28
*
60
)){
if
(
!
redisUtils
.
setnx
(
"Scheduled-retry"
,
"Scheduled-retry"
,
28
*
60
)){
return
;
return
;
}
}
try
{
try
{
...
@@ -227,12 +227,12 @@ public class CmeetingJob {
...
@@ -227,12 +227,12 @@ public class CmeetingJob {
/**
/**
* 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件
* 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件
*/
*/
@Scheduled
(
fixedRate
=
3
0
*
60
*
1000
,
initialDelay
=
15
*
60
*
1000
)
@Scheduled
(
fixedRate
=
1
0
*
60
*
1000
,
initialDelay
=
15
*
60
*
1000
)
public
void
emailPushRetry
()
{
public
void
emailPushRetry
()
{
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
if
(
redisUtils
.
setnx
(
"Scheduled-email-retry"
,
"Scheduled-email-retry"
,
28
*
60
)){
if
(
!
redisUtils
.
setnx
(
"Scheduled-email-retry"
,
"Scheduled-email-retry"
,
28
*
60
)){
return
;
return
;
}
}
try
{
try
{
...
...
src/main/java/com/cmeeting/job/EmailPushTask.java
浏览文件 @
78f13c78
...
@@ -55,17 +55,20 @@ public class EmailPushTask {
...
@@ -55,17 +55,20 @@ public class EmailPushTask {
// 实际处理逻辑
// 实际处理逻辑
public
void
process
()
{
public
void
process
()
{
String
key
=
"meet_process"
+
meetingId
+
"_"
+
(
subMeetingId
==
null
?
""
:
"subMeetingId"
);
String
key
=
"meet_process"
+
meetingId
+
"_"
+
(
subMeetingId
==
null
?
""
:
subMeetingId
);
if
(!
redisUtils
.
setnx
(
key
,
1
,
120
))
{
if
(!
redisUtils
.
setnx
(
key
,
1
,
120
))
{
log
.
warn
(
"key already exists in redis!, key: {}"
,
key
);
log
.
warn
(
"key already exists in redis!, key: {}"
,
key
);
return
;
return
;
}
}
Boolean
isSuccess
=
Boolean
.
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
>()
.
eq
(
MeetingInfo:
:
getMeetingId
,
meetingId
)
.
eq
(
MeetingInfo:
:
getMeetingId
,
meetingId
)
.
eq
(
subMeetingId
!=
null
,
MeetingInfo:
:
getSubMeetingId
,
subMeetingId
));
.
eq
(
subMeetingId
!=
null
,
MeetingInfo:
:
getSubMeetingId
,
subMeetingId
));
if
(
meetingInfo
.
getIsPushed
())
{
log
.
warn
(
"邮件已推送, meetingId: {}"
,
meetingId
);
return
;
}
while
(
retryCount
.
intValue
()
<=
MAX_RETRY
&&
!
isSuccess
)
{
while
(
retryCount
.
intValue
()
<=
MAX_RETRY
&&
!
isSuccess
)
{
String
hostUid
=
meetingInfo
.
getHostUid
();
String
hostUid
=
meetingInfo
.
getHostUid
();
if
(!
tidWidRelations
.
containsKey
(
hostUid
)){
if
(!
tidWidRelations
.
containsKey
(
hostUid
)){
...
@@ -145,14 +148,16 @@ public class EmailPushTask {
...
@@ -145,14 +148,16 @@ public class EmailPushTask {
}
}
}
}
}
}
meetingInfoMapper
.
update
(
meetingInfo
,
if
(
isSuccess
!=
null
)
{
new
LambdaUpdateWrapper
<
MeetingInfo
>()
meetingInfoMapper
.
update
(
meetingInfo
,
.
eq
(
MeetingInfo:
:
getMeetingId
,
meetingId
)
new
LambdaUpdateWrapper
<
MeetingInfo
>()
.
eq
(
subMeetingId
!=
null
,
MeetingInfo:
:
getSubMeetingId
,
subMeetingId
)
.
eq
(
MeetingInfo:
:
getMeetingId
,
meetingId
)
.
set
(
MeetingInfo:
:
getIsPushed
,
isSuccess
)
.
eq
(
subMeetingId
!=
null
,
MeetingInfo:
:
getSubMeetingId
,
subMeetingId
)
.
set
(
MeetingInfo:
:
getStatus
,
isSuccess
?
MeetingState
.
PUSH_SUCCESS
.
getCode
()
:
MeetingState
.
PUSH_ERROR
.
getCode
())
.
set
(
MeetingInfo:
:
getIsPushed
,
isSuccess
)
.
set
(
MeetingInfo:
:
getPushRetry
,
Boolean
.
TRUE
)
.
set
(
MeetingInfo:
:
getStatus
,
isSuccess
?
MeetingState
.
PUSH_SUCCESS
.
getCode
()
:
MeetingState
.
PUSH_ERROR
.
getCode
())
);
.
set
(
MeetingInfo:
:
getPushRetry
,
Boolean
.
TRUE
)
);
}
redisUtils
.
del
(
key
);
redisUtils
.
del
(
key
);
}
}
...
...
src/main/java/com/cmeeting/job/FileProcessTask.java
浏览文件 @
78f13c78
...
@@ -111,7 +111,7 @@ public class FileProcessTask {
...
@@ -111,7 +111,7 @@ public class FileProcessTask {
// 实际处理逻辑
// 实际处理逻辑
public
void
process
()
{
public
void
process
()
{
boolean
isSuccess
=
false
;
boolean
isSuccess
=
false
;
String
key
=
"meet_process"
+
meetingId
+
"_"
+
(
subMeetingId
==
null
?
""
:
"subMeetingId"
);
String
key
=
"meet_process"
+
meetingId
+
"_"
+
(
subMeetingId
==
null
?
""
:
subMeetingId
);
if
(!
redisUtils
.
setnx
(
key
,
1
,
240
))
{
if
(!
redisUtils
.
setnx
(
key
,
1
,
240
))
{
log
.
warn
(
"key already exists in redis!, key: {}"
,
key
);
log
.
warn
(
"key already exists in redis!, key: {}"
,
key
);
return
;
return
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论