Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cmeeting
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
翟斌
cmeeting
Commits
3d4aa2d3
提交
3d4aa2d3
authored
11月 28, 2025
作者:
洪东保
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
定时器里面都要异步执行
父级
75c404bb
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
38 行增加
和
24 行删除
+38
-24
src/main/java/com/cmeeting/job/CmeetingJob.java
+38
-24
没有找到文件。
src/main/java/com/cmeeting/job/CmeetingJob.java
浏览文件 @
3d4aa2d3
package
com
.
cmeeting
.
job
;
package
com
.
cmeeting
.
job
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.thread.ThreadUtil
;
import
com.azure.core.credential.AccessToken
;
import
com.azure.core.credential.TokenRequestContext
;
import
com.azure.identity.ClientSecretCredential
;
import
com.azure.identity.ClientSecretCredentialBuilder
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.cmeeting.config.StatisticsEmailPushProperties
;
import
com.cmeeting.config.StatisticsEmailPushProperties
;
import
com.cmeeting.constant.DeptCollect
;
import
com.cmeeting.constant.DeptCollect
;
...
@@ -68,22 +73,23 @@ public class CmeetingJob {
...
@@ -68,22 +73,23 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"0 30 6 * * ?"
)
@Scheduled
(
cron
=
"0 30 6 * * ?"
)
public
void
weComUserSync
()
{
public
void
weComUserSync
()
{
if
(
isDev
)
{
ThreadUtil
.
execute
(()->
{
return
;
}
if
(!
redisUtils
.
setnx
(
"weComUserSync"
,
"weComUserSync"
,
20
*
60
*
60
))
{
if
(!
redisUtils
.
setnx
(
"weComUserSync"
,
"weComUserSync"
,
20
*
60
*
60
))
{
return
;
return
;
}
}
try
{
try
{
log
.
info
(
"-------企微人员定时同步任务开始-------"
);
log
.
info
(
"-------企微人员定时同步任务开始-------"
);
log
.
info
(
"当前时间: "
+
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ISO_LOCAL_DATE
));
weComService
.
doUsers
();
weComService
.
doUsers
();
log
.
info
(
"-------企微人员定时同步任务结束--------"
);
log
.
info
(
"-------企微人员定时同步任务结束--------"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
error
(
"企微人员定时同步失败"
);
}
finally
{
}
finally
{
redisUtils
.
del
(
"weComUserSync"
);
redisUtils
.
del
(
"weComUserSync"
);
}
}
});
}
}
/**
/**
...
@@ -91,9 +97,7 @@ public class CmeetingJob {
...
@@ -91,9 +97,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"0 0 7 * * ?"
)
@Scheduled
(
cron
=
"0 0 7 * * ?"
)
public
void
TencentUserSync
()
{
public
void
TencentUserSync
()
{
if
(
isDev
)
{
ThreadUtil
.
execute
(()->
{
return
;
}
if
(!
redisUtils
.
setnx
(
"TencentUserSync"
,
"TencentUserSync"
,
20
*
60
*
60
))
{
if
(!
redisUtils
.
setnx
(
"TencentUserSync"
,
"TencentUserSync"
,
20
*
60
*
60
))
{
return
;
return
;
}
}
...
@@ -107,6 +111,7 @@ public class CmeetingJob {
...
@@ -107,6 +111,7 @@ public class CmeetingJob {
}
finally
{
}
finally
{
redisUtils
.
del
(
"TencentUserSync"
);
redisUtils
.
del
(
"TencentUserSync"
);
}
}
});
}
}
/**
/**
...
@@ -114,9 +119,7 @@ public class CmeetingJob {
...
@@ -114,9 +119,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"0 20 7 * * ?"
)
@Scheduled
(
cron
=
"0 20 7 * * ?"
)
public
void
userBind
()
{
public
void
userBind
()
{
if
(
isDev
)
{
ThreadUtil
.
execute
(()->
{
return
;
}
if
(!
redisUtils
.
setnx
(
"userBind"
,
"userBind"
,
20
*
60
*
60
))
{
if
(!
redisUtils
.
setnx
(
"userBind"
,
"userBind"
,
20
*
60
*
60
))
{
return
;
return
;
}
}
...
@@ -129,6 +132,7 @@ public class CmeetingJob {
...
@@ -129,6 +132,7 @@ public class CmeetingJob {
}
finally
{
}
finally
{
redisUtils
.
del
(
"userBind"
);
redisUtils
.
del
(
"userBind"
);
}
}
});
}
}
/**
/**
...
@@ -136,6 +140,7 @@ public class CmeetingJob {
...
@@ -136,6 +140,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
fixedRate
=
20
*
60
*
1000
,
initialDelay
=
2
*
60
*
1000
)
@Scheduled
(
fixedRate
=
20
*
60
*
1000
,
initialDelay
=
2
*
60
*
1000
)
public
void
execute
()
{
public
void
execute
()
{
ThreadUtil
.
execute
(()->
{
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
...
@@ -149,25 +154,23 @@ public class CmeetingJob {
...
@@ -149,25 +154,23 @@ public class CmeetingJob {
Map
<
String
,
String
>
widTidRelations
=
userIdRelations
.
stream
().
collect
(
Collectors
.
toMap
(
UserId:
:
getWid
,
UserId:
:
getTid
));
Map
<
String
,
String
>
widTidRelations
=
userIdRelations
.
stream
().
collect
(
Collectors
.
toMap
(
UserId:
:
getWid
,
UserId:
:
getTid
));
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
));
//查出企微的人员信息
//查出企微的人员信息
// List<WeComUser> weComUserList = weComService.list();
List
<
WeComUser
>
weComUserList
=
weComService
.
list
();
// Map<String, WeComUser> weComUserMap = weComUserList.stream().collect(Collectors.toMap(WeComUser::getUserId, Function.identity()));
Map
<
String
,
WeComUser
>
weComUserMap
=
weComUserList
.
stream
().
collect
(
Collectors
.
toMap
(
WeComUser:
:
getUserId
,
Function
.
identity
()));
// //智能体授权人员
//智能体授权人员
// List<UserDTO> accessUserIds = tencentMeetingService.getAccessUserIds(widTidRelations);
List
<
UserDTO
>
accessUserIds
=
tencentMeetingService
.
getAccessUserIds
(
widTidRelations
);
// if (CollectionUtils.isEmpty(accessUserIds)) {
if
(
CollectionUtils
.
isEmpty
(
accessUserIds
))
{
// log.info("无生成纪要权限的人员");
log
.
info
(
"无生成纪要权限的人员"
);
// return;
return
;
// } else {
}
// log.info("生成纪要权限人员:->{}", accessUserIds.toString());
List
<
TencentMeetingVO
.
RecordFile
>
meetingFiles
=
tencentMeetingService
.
getMeetingFiles
(
accessUserIds
,
weComUserMap
);
// }
List
<
TencentMeetingVO
.
RecordFile
>
meetingFiles
=
tencentMeetingService
.
getMeetingFiles
();
if
(
meetingFiles
==
null
||
meetingFiles
.
isEmpty
())
{
if
(
meetingFiles
==
null
||
meetingFiles
.
isEmpty
())
{
log
.
info
(
"没有录制文件需要处理"
);
log
.
info
(
"没有录制文件需要处理"
);
return
;
return
;
}
}
//获取模板授权的人员--待删没用上
//获取模板授权的人员
List
<
UserDTO
.
TemplateAuthorizedUserDTO
>
authorizedUsers
=
meetingRecordTemplateService
.
selectAuthorizedUsers
();
List
<
UserDTO
.
TemplateAuthorizedUserDTO
>
authorizedUsers
=
meetingRecordTemplateService
.
selectAuthorizedUsers
();
// 提交处理任务
// 提交处理任务
...
@@ -177,6 +180,7 @@ public class CmeetingJob {
...
@@ -177,6 +180,7 @@ public class CmeetingJob {
}
finally
{
}
finally
{
redisUtils
.
del
(
"Scheduled-All"
);
redisUtils
.
del
(
"Scheduled-All"
);
}
}
});
}
}
...
@@ -185,6 +189,7 @@ public class CmeetingJob {
...
@@ -185,6 +189,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
fixedRate
=
30
*
60
*
1000
,
initialDelay
=
3
*
60
*
1000
)
@Scheduled
(
fixedRate
=
30
*
60
*
1000
,
initialDelay
=
3
*
60
*
1000
)
public
void
meetingMinutesRetry
()
{
public
void
meetingMinutesRetry
()
{
ThreadUtil
.
execute
(()->
{
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
...
@@ -236,6 +241,7 @@ public class CmeetingJob {
...
@@ -236,6 +241,7 @@ public class CmeetingJob {
}
finally
{
}
finally
{
redisUtils
.
del
(
"Scheduled-retry"
);
redisUtils
.
del
(
"Scheduled-retry"
);
}
}
});
}
}
/**
/**
...
@@ -243,6 +249,7 @@ public class CmeetingJob {
...
@@ -243,6 +249,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
fixedRate
=
10
*
60
*
1000
,
initialDelay
=
1
*
60
*
1000
)
@Scheduled
(
fixedRate
=
10
*
60
*
1000
,
initialDelay
=
1
*
60
*
1000
)
public
void
emailPushRetry
()
{
public
void
emailPushRetry
()
{
ThreadUtil
.
execute
(()->
{
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
...
@@ -289,6 +296,7 @@ public class CmeetingJob {
...
@@ -289,6 +296,7 @@ public class CmeetingJob {
}
finally
{
}
finally
{
redisUtils
.
del
(
"Scheduled-email-retry"
);
redisUtils
.
del
(
"Scheduled-email-retry"
);
}
}
});
}
}
@Resource
@Resource
...
@@ -305,6 +313,7 @@ public class CmeetingJob {
...
@@ -305,6 +313,7 @@ public class CmeetingJob {
@Scheduled
(
cron
=
"50 59 7,9,11,13,15,17,19,21,23 * * ?"
)
@Scheduled
(
cron
=
"50 59 7,9,11,13,15,17,19,21,23 * * ?"
)
public
void
emailStatisticsPush
()
{
public
void
emailStatisticsPush
()
{
ThreadUtil
.
execute
(()->{
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
...
@@ -335,7 +344,7 @@ public class CmeetingJob {
...
@@ -335,7 +344,7 @@ public class CmeetingJob {
try
{
try
{
boolean
b
=
meetingInfoService
.
statisticsEmail
(
subject
,
simpleDateFormat1
.
parse
(
simpleDateFormat
.
format
(
date
)
+
" 00:00:00"
),
boolean
b
=
meetingInfoService
.
statisticsEmail
(
subject
,
simpleDateFormat1
.
parse
(
simpleDateFormat
.
format
(
date
)
+
" 00:00:00"
),
simpleDateFormat1
.
parse
(
simpleDateFormat
.
format
(
date
)
+
" 23:59:59"
),
new
FileOutputStream
(
file
),
DeptCollect
.
DEPT_MAP
);
simpleDateFormat1
.
parse
(
simpleDateFormat
.
format
(
date
)
+
" 23:59:59"
),
new
FileOutputStream
(
file
)
);
if
(
b
)
{
if
(
b
)
{
content
=
"<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br> 附件为今天Cmeeting会议纪要生成和发送情况,烦请查收。</p>"
;
content
=
"<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br> 附件为今天Cmeeting会议纪要生成和发送情况,烦请查收。</p>"
;
StatisticsEmailPush
.
Attachment
attachment
=
new
StatisticsEmailPush
.
Attachment
();
StatisticsEmailPush
.
Attachment
attachment
=
new
StatisticsEmailPush
.
Attachment
();
...
@@ -356,9 +365,10 @@ public class CmeetingJob {
...
@@ -356,9 +365,10 @@ public class CmeetingJob {
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
finally
{
}
finally
{
file
.
delete
();
file
.
delete
();
//
redisUtils.del("emailStatisticsPush");
redisUtils
.
del
(
"emailStatisticsPush"
);
}
}
log
.
info
(
"推送统计邮件完成!"
);
log
.
info
(
"推送统计邮件完成!"
);
});
}
}
...
@@ -367,6 +377,7 @@ public class CmeetingJob {
...
@@ -367,6 +377,7 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"0 0 6 * * ? "
)
@Scheduled
(
cron
=
"0 0 6 * * ? "
)
public
void
pullAllDate
()
{
public
void
pullAllDate
()
{
ThreadUtil
.
execute
(()->
{
if
(
isDev
)
{
if
(
isDev
)
{
return
;
return
;
}
}
...
@@ -374,6 +385,7 @@ public class CmeetingJob {
...
@@ -374,6 +385,7 @@ public class CmeetingJob {
long
l
=
System
.
currentTimeMillis
();
long
l
=
System
.
currentTimeMillis
();
cimcService
.
pullCimcData
();
cimcService
.
pullCimcData
();
log
.
info
(
"同步用户结束,耗时: {}ms"
,
System
.
currentTimeMillis
()
-
l
);
log
.
info
(
"同步用户结束,耗时: {}ms"
,
System
.
currentTimeMillis
()
-
l
);
});
}
}
/**
/**
...
@@ -381,10 +393,12 @@ public class CmeetingJob {
...
@@ -381,10 +393,12 @@ public class CmeetingJob {
*/
*/
@Scheduled
(
cron
=
"00 59 23 * * ?"
)
@Scheduled
(
cron
=
"00 59 23 * * ?"
)
public
void
deleteDataAfterThan3Months
()
{
public
void
deleteDataAfterThan3Months
()
{
ThreadUtil
.
execute
(()->
{
String
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
String
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
log
.
info
(
"删除2天前的数据开始,开始时间: {}"
,
date
);
log
.
info
(
"删除2天前的数据开始,开始时间: {}"
,
date
);
int
count
=
meetingInfoService
.
deleteDataAfterThan2Days
(
date
);
int
count
=
meetingInfoService
.
deleteDataAfterThan2Days
(
date
);
log
.
info
(
"删除2天前的数据结束,删除数量: {}"
,
count
);
log
.
info
(
"删除2天前的数据结束,删除数量: {}"
,
count
);
});
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论