提交 3d4aa2d3 作者: 洪东保

定时器里面都要异步执行

父级 75c404bb
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)) {
} return;
if (!redisUtils.setnx("weComUserSync", "weComUserSync", 20 * 60 * 60)) { }
return; try {
} log.info("-------企微人员定时同步任务开始-------");
try { log.info("当前时间: " + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
log.info("-------企微人员定时同步任务开始-------");
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,22 +97,21 @@ public class CmeetingJob { ...@@ -91,22 +97,21 @@ 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)) {
} return;
if (!redisUtils.setnx("TencentUserSync", "TencentUserSync", 20 * 60 * 60)) { }
return; try {
} log.info("-------腾讯会议人员定时同步任务开始-------");
try {
log.info("-------腾讯会议人员定时同步任务开始-------"); tencentMeetingService.doUsers();
log.info("-------腾讯会议人员定时同步任务结束--------");
tencentMeetingService.doUsers(); } catch (Exception e) {
log.info("-------腾讯会议人员定时同步任务结束--------"); e.printStackTrace();
} catch (Exception e) { } finally {
e.printStackTrace(); redisUtils.del("TencentUserSync");
} finally { }
redisUtils.del("TencentUserSync"); });
}
} }
/** /**
...@@ -114,21 +119,20 @@ public class CmeetingJob { ...@@ -114,21 +119,20 @@ 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)) {
} return;
if (!redisUtils.setnx("userBind", "userBind", 20 * 60 * 60)) { }
return; try {
} log.info("-------关联企微腾会人员定时任务开始-------");
try { weComService.userBind();
log.info("-------关联企微腾会人员定时任务开始-------"); log.info("-------关联企微腾会人员定时任务结束--------");
weComService.userBind(); } catch (Exception e) {
log.info("-------关联企微腾会人员定时任务结束--------"); e.printStackTrace();
} catch (Exception e) { } finally {
e.printStackTrace(); redisUtils.del("userBind");
} finally { }
redisUtils.del("userBind"); });
}
} }
/** /**
...@@ -136,47 +140,47 @@ public class CmeetingJob { ...@@ -136,47 +140,47 @@ 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() {
if (isDev) { ThreadUtil.execute(()-> {
return; if (isDev) {
}
if (!redisUtils.setnx("Scheduled-All", "Scheduled-All", 18 * 60)) {
return;
}
log.info("-------生成纪要定时任务开始-------");
try {
//查出企微id和腾会id的关联关系
List<UserId> userIdRelations = userIdMapper.selectList(null);
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));
//查出企微的人员信息
// List<WeComUser> weComUserList = weComService.list();
// Map<String, WeComUser> weComUserMap = weComUserList.stream().collect(Collectors.toMap(WeComUser::getUserId, Function.identity()));
// //智能体授权人员
// List<UserDTO> accessUserIds = tencentMeetingService.getAccessUserIds(widTidRelations);
// if (CollectionUtils.isEmpty(accessUserIds)) {
// log.info("无生成纪要权限的人员");
// return;
// } else {
// log.info("生成纪要权限人员:->{}", accessUserIds.toString());
// }
List<TencentMeetingVO.RecordFile> meetingFiles = tencentMeetingService.getMeetingFiles();
if (meetingFiles == null || meetingFiles.isEmpty()) {
log.info("没有录制文件需要处理");
return; return;
} }
if (!redisUtils.setnx("Scheduled-All", "Scheduled-All", 18 * 60)) {
return;
}
log.info("-------生成纪要定时任务开始-------");
try {
//查出企微id和腾会id的关联关系
List<UserId> userIdRelations = userIdMapper.selectList(null);
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));
//查出企微的人员信息
List<WeComUser> weComUserList = weComService.list();
Map<String, WeComUser> weComUserMap = weComUserList.stream().collect(Collectors.toMap(WeComUser::getUserId, Function.identity()));
//智能体授权人员
List<UserDTO> accessUserIds = tencentMeetingService.getAccessUserIds(widTidRelations);
if (CollectionUtils.isEmpty(accessUserIds)) {
log.info("无生成纪要权限的人员");
return;
}
List<TencentMeetingVO.RecordFile> meetingFiles = tencentMeetingService.getMeetingFiles(accessUserIds, weComUserMap);
if (meetingFiles == null || meetingFiles.isEmpty()) {
log.info("没有录制文件需要处理");
return;
}
//获取模板授权的人员--待删没用上 //获取模板授权的人员
List<UserDTO.TemplateAuthorizedUserDTO> authorizedUsers = meetingRecordTemplateService.selectAuthorizedUsers(); List<UserDTO.TemplateAuthorizedUserDTO> authorizedUsers = meetingRecordTemplateService.selectAuthorizedUsers();
// 提交处理任务 // 提交处理任务
producer.submitBatchTasks(meetingFiles, authorizedUsers, tidWidRelations, Boolean.FALSE); producer.submitBatchTasks(meetingFiles, authorizedUsers, tidWidRelations, Boolean.FALSE);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
redisUtils.del("Scheduled-All"); redisUtils.del("Scheduled-All");
} }
});
} }
...@@ -185,110 +189,114 @@ public class CmeetingJob { ...@@ -185,110 +189,114 @@ 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() {
if (isDev) { ThreadUtil.execute(()-> {
return; if (isDev) {
}
if (!redisUtils.setnx("Scheduled-retry", "Scheduled-retry", 28 * 60)) {
return;
}
try {
log.info("-------生成纪要重试定时任务开始-------");
//查出所有早于一小时前的,生成失败且未重试过的会议
// 不能用status筛选,因为可能线程执行一般服务终止,status状态没变
List<MeetingInfo> meetingInfoList =
meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.isNotNull(MeetingInfo::getMeetingRecordId)
.eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE)
.eq(MeetingInfo::getEmailGenerateAccess, Boolean.TRUE)
.eq(MeetingInfo::getIsGenerated, Boolean.FALSE)
.eq(MeetingInfo::getGenerateRetry, Boolean.FALSE)
.ne(MeetingInfo::getStatus, MeetingState.EMPTY.getCode())
.le(MeetingInfo::getSyncTime, LocalDateTime.now().minusHours(1))
);
if (meetingInfoList == null || meetingInfoList.isEmpty()) {
log.info("没有生成失败的会议需要重试");
return; return;
} }
List<TencentMeetingVO.RecordFile> meetingFiles = new ArrayList<>(); if (!redisUtils.setnx("Scheduled-retry", "Scheduled-retry", 28 * 60)) {
for (MeetingInfo meetingInfo : meetingInfoList) { return;
TencentMeetingVO.RecordFile recordFile = TencentMeetingVO.RecordFile.builder()
.meetingId(meetingInfo.getMeetingId())
.meetingRecordId(meetingInfo.getMeetingRecordId())
.subMeetingId(meetingInfo.getSubMeetingId())
.recordFileIdList(Arrays.asList(meetingInfo.getRecordFileId().split(","))).build();
meetingFiles.add(recordFile);
} }
try {
//查出企微id和腾会id的关联关系 log.info("-------生成纪要重试定时任务开始-------");
List<UserId> userIdRelations = userIdMapper.selectList(null);
Map<String, String> tidWidRelations = userIdRelations.stream().collect(Collectors.toMap(UserId::getTid, UserId::getWid)); //查出所有早于一小时前的,生成失败且未重试过的会议
// 不能用status筛选,因为可能线程执行一般服务终止,status状态没变
//获取模板授权的人员 List<MeetingInfo> meetingInfoList =
List<UserDTO.TemplateAuthorizedUserDTO> authorizedUsers = meetingRecordTemplateService.selectAuthorizedUsers(); meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.isNotNull(MeetingInfo::getMeetingRecordId)
// 提交处理任务 .eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE)
producer.submitBatchTasks(meetingFiles, authorizedUsers, tidWidRelations, Boolean.TRUE); .eq(MeetingInfo::getEmailGenerateAccess, Boolean.TRUE)
log.info("-------生成纪要重试定时任务结束--------"); .eq(MeetingInfo::getIsGenerated, Boolean.FALSE)
} catch (Exception e) { .eq(MeetingInfo::getGenerateRetry, Boolean.FALSE)
e.printStackTrace(); .ne(MeetingInfo::getStatus, MeetingState.EMPTY.getCode())
} finally { .le(MeetingInfo::getSyncTime, LocalDateTime.now().minusHours(1))
redisUtils.del("Scheduled-retry"); );
}
} if (meetingInfoList == null || meetingInfoList.isEmpty()) {
log.info("没有生成失败的会议需要重试");
/** return;
* 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件 }
*/
@Scheduled(fixedRate = 10 * 60 * 1000, initialDelay = 1 * 60 * 1000)
public void emailPushRetry() {
if (isDev) {
return;
}
if (!redisUtils.setnx("Scheduled-email-retry", "Scheduled-email-retry", 28 * 60)) {
return;
}
try {
log.info("-------邮件推送重试定时任务开始-------");
//查出所有早于一小时前的,邮件推送失败且未重试过的会议
List<MeetingInfo> meetingInfoList =
meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.isNotNull(MeetingInfo::getMeetingRecordId)
.eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE)
.eq(MeetingInfo::getIsGenerated, Boolean.TRUE)
.eq(MeetingInfo::getIsPushed, Boolean.FALSE)
.eq(MeetingInfo::getPushRetry, Boolean.FALSE)
.le(MeetingInfo::getSyncTime, LocalDateTime.now().minusHours(1))
);
if (meetingInfoList == null || meetingInfoList.isEmpty()) {
log.info("没有推送失败的邮件需要重试");
} 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())
.meetingRecordId(meetingInfo.getMeetingRecordId()) .meetingRecordId(meetingInfo.getMeetingRecordId())
.recordFileIdList(Arrays.asList(meetingInfo.getRecordFileId().split(","))) .subMeetingId(meetingInfo.getSubMeetingId())
.build(); .recordFileIdList(Arrays.asList(meetingInfo.getRecordFileId().split(","))).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));
//获取模板授权的人员
List<UserDTO.TemplateAuthorizedUserDTO> authorizedUsers = meetingRecordTemplateService.selectAuthorizedUsers();
// 提交处理任务 // 提交处理任务
producer.submitEmailPushTasks(meetingFiles, tidWidRelations); producer.submitBatchTasks(meetingFiles, authorizedUsers, tidWidRelations, Boolean.TRUE);
log.info("-------生成纪要重试定时任务结束--------");
} catch (Exception e) {
e.printStackTrace();
} finally {
redisUtils.del("Scheduled-retry");
} }
log.info("-------邮件推送重试定时任务结束--------"); });
} catch (Exception e) { }
e.printStackTrace();
} finally { /**
redisUtils.del("Scheduled-email-retry"); * 定时扫描早于一小时之前的,所有邮件推送未重试过的会议,重新推送邮件
} */
@Scheduled(fixedRate = 10 * 60 * 1000, initialDelay = 1 * 60 * 1000)
public void emailPushRetry() {
ThreadUtil.execute(()-> {
if (isDev) {
return;
}
if (!redisUtils.setnx("Scheduled-email-retry", "Scheduled-email-retry", 28 * 60)) {
return;
}
try {
log.info("-------邮件推送重试定时任务开始-------");
//查出所有早于一小时前的,邮件推送失败且未重试过的会议
List<MeetingInfo> meetingInfoList =
meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.isNotNull(MeetingInfo::getMeetingRecordId)
.eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE)
.eq(MeetingInfo::getIsGenerated, Boolean.TRUE)
.eq(MeetingInfo::getIsPushed, Boolean.FALSE)
.eq(MeetingInfo::getPushRetry, Boolean.FALSE)
.le(MeetingInfo::getSyncTime, LocalDateTime.now().minusHours(1))
);
if (meetingInfoList == null || meetingInfoList.isEmpty()) {
log.info("没有推送失败的邮件需要重试");
} else {
List<TencentMeetingVO.RecordFile> meetingFiles = new ArrayList<>();
for (MeetingInfo meetingInfo : meetingInfoList) {
TencentMeetingVO.RecordFile recordFile = TencentMeetingVO.RecordFile.builder()
.meetingId(meetingInfo.getMeetingId())
.subMeetingId(meetingInfo.getSubMeetingId())
.meetingRecordId(meetingInfo.getMeetingRecordId())
.recordFileIdList(Arrays.asList(meetingInfo.getRecordFileId().split(",")))
.build();
meetingFiles.add(recordFile);
}
//查出企微id和腾会id的关联关系
List<UserId> userIdRelations = userIdMapper.selectList(null);
Map<String, String> tidWidRelations = userIdRelations.stream().collect(Collectors.toMap(UserId::getTid, UserId::getWid));
// 提交处理任务
producer.submitEmailPushTasks(meetingFiles, tidWidRelations);
}
log.info("-------邮件推送重试定时任务结束--------");
} catch (Exception e) {
e.printStackTrace();
} finally {
redisUtils.del("Scheduled-email-retry");
}
});
} }
@Resource @Resource
...@@ -305,60 +313,62 @@ public class CmeetingJob { ...@@ -305,60 +313,62 @@ 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() {
if (isDev) { ThreadUtil.execute(()->{
return; if (isDev) {
} return;
log.info("推送统计邮件!");
if (!redisUtils.setnx("emailStatisticsPush", "emailStatisticsPush", 4000)) {
return;
}
log.info("推送统计邮件开始!");
List<StatisticsEmailPush.Attachment> attachments = new ArrayList<>();
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.HOUR_OF_DAY, 1); // 增加 1 小时
Date newDate = calendar.getTime(); // 返回增加后的 Date 对象
String subject = "会议纪要推送记录-" + new SimpleDateFormat("yyyyMMdd HH").format(newDate) + ":00";
String content;
if (CollUtil.isEmpty(statisticsEmailPushProperties.getToEmails())) {
log.error("收件人为空!");
return;
}
File file = new File(savePath + subject + ".xlsx");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<SysUserSyncCategory> tree = sysUserSyncService.getTreeList();
try {
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);
if (b) {
content = "<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;附件为今天Cmeeting会议纪要生成和发送情况,烦请查收。</p>";
StatisticsEmailPush.Attachment attachment = new StatisticsEmailPush.Attachment();
attachment.setName(subject);
attachment.setBytes(IOUtils.toByteArray(Files.newInputStream(file.toPath())));
attachments.add(attachment);
} else {
content = "<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;今天到目前为止没有会议。</p>";
} }
StatisticsEmailPush emailPushBuilder = StatisticsEmailPush.builder() log.info("推送统计邮件!");
.toEmails(statisticsEmailPushProperties.getToEmails()) if (!redisUtils.setnx("emailStatisticsPush", "emailStatisticsPush", 4000)) {
.attachments(attachments) return;
.subject(subject) }
.content(content) log.info("推送统计邮件开始!");
.build(); List<StatisticsEmailPush.Attachment> attachments = new ArrayList<>();
emailSender.emailStatisticsPush(emailPushBuilder);
} catch (IOException | ParseException e) { Date date = new Date();
throw new RuntimeException(e);
} finally { Calendar calendar = Calendar.getInstance();
file.delete(); calendar.setTime(date);
// redisUtils.del("emailStatisticsPush"); calendar.add(Calendar.HOUR_OF_DAY, 1); // 增加 1 小时
} Date newDate = calendar.getTime(); // 返回增加后的 Date 对象
log.info("推送统计邮件完成!"); String subject = "会议纪要推送记录-" + new SimpleDateFormat("yyyyMMdd HH").format(newDate) + ":00";
String content;
if (CollUtil.isEmpty(statisticsEmailPushProperties.getToEmails())) {
log.error("收件人为空!");
return;
}
File file = new File(savePath + subject + ".xlsx");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<SysUserSyncCategory> tree = sysUserSyncService.getTreeList();
try {
boolean b = meetingInfoService.statisticsEmail(subject, simpleDateFormat1.parse(simpleDateFormat.format(date) + " 00:00:00"),
simpleDateFormat1.parse(simpleDateFormat.format(date) + " 23:59:59"), new FileOutputStream(file));
if (b) {
content = "<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;附件为今天Cmeeting会议纪要生成和发送情况,烦请查收。</p>";
StatisticsEmailPush.Attachment attachment = new StatisticsEmailPush.Attachment();
attachment.setName(subject);
attachment.setBytes(IOUtils.toByteArray(Files.newInputStream(file.toPath())));
attachments.add(attachment);
} else {
content = "<p data-olk-copy-source=\\\"MessageBody\\\">Dear all:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;今天到目前为止没有会议。</p>";
}
StatisticsEmailPush emailPushBuilder = StatisticsEmailPush.builder()
.toEmails(statisticsEmailPushProperties.getToEmails())
.attachments(attachments)
.subject(subject)
.content(content)
.build();
emailSender.emailStatisticsPush(emailPushBuilder);
} catch (IOException | ParseException e) {
throw new RuntimeException(e);
} finally {
file.delete();
redisUtils.del("emailStatisticsPush");
}
log.info("推送统计邮件完成!");
});
} }
...@@ -367,13 +377,15 @@ public class CmeetingJob { ...@@ -367,13 +377,15 @@ public class CmeetingJob {
*/ */
@Scheduled(cron = "0 0 6 * * ? ") @Scheduled(cron = "0 0 6 * * ? ")
public void pullAllDate() { public void pullAllDate() {
if (isDev) { ThreadUtil.execute(()-> {
return; if (isDev) {
} return;
log.info("同步用户开始"); }
long l = System.currentTimeMillis(); log.info("同步用户开始");
cimcService.pullCimcData(); long l = System.currentTimeMillis();
log.info("同步用户结束,耗时: {}ms", System.currentTimeMillis() - l); cimcService.pullCimcData();
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() {
String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); ThreadUtil.execute(()-> {
log.info("删除2天前的数据开始,开始时间: {}", date); String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
int count = meetingInfoService.deleteDataAfterThan2Days(date); log.info("删除2天前的数据开始,开始时间: {}", date);
log.info("删除2天前的数据结束,删除数量: {}", count); int count = meetingInfoService.deleteDataAfterThan2Days(date);
log.info("删除2天前的数据结束,删除数量: {}", count);
});
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论