|
@@ -1,60 +0,0 @@
|
|
|
-package com.citu.module.menduner.system.scheduled;
|
|
|
-
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
-import com.citu.framework.tenant.core.aop.TenantIgnore;
|
|
|
-import com.citu.module.menduner.system.dal.dataobject.interview.InterviewInviteDO;
|
|
|
-import com.citu.module.menduner.system.dal.mysql.interview.InterviewInviteMapper;
|
|
|
-import com.citu.module.menduner.system.enums.interview.InterviewInviteStatusEnum;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.util.StopWatch;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author rayson
|
|
|
- * 面试定时任务
|
|
|
- * TODO 先暂时这么干
|
|
|
- * @create 2024/7/24 下午2:28
|
|
|
- **/
|
|
|
-@Slf4j
|
|
|
-@Configuration
|
|
|
-@RequiredArgsConstructor
|
|
|
-public class InterviewInviteScheduled {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private InterviewInviteMapper mapper;
|
|
|
-
|
|
|
- /**
|
|
|
- * 即将到达的面试提醒
|
|
|
- * 每隔3分钟扫描一遍
|
|
|
- **/
|
|
|
- @Async
|
|
|
- @TenantIgnore
|
|
|
-// @Scheduled(cron = "0 */3 * * * ?")
|
|
|
- // 10s
|
|
|
- @Scheduled(cron = "*/10 * * * * *")
|
|
|
- public void approachingInterview() {
|
|
|
- List<InterviewInviteDO> list = mapper.getApproachingInterviewList();
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(list)) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- StopWatch stopWatch = new StopWatch();
|
|
|
- stopWatch.start("即将到达的面试提醒");
|
|
|
-
|
|
|
- for (InterviewInviteDO inviteDO : list) {
|
|
|
- inviteDO.setStatus(InterviewInviteStatusEnum.APPROACHING_INTERVIEW.getStatus());
|
|
|
- mapper.updateById(inviteDO);
|
|
|
- // TODO 发送消息提醒
|
|
|
-
|
|
|
- }
|
|
|
- stopWatch.stop();
|
|
|
- stopWatch.prettyPrint();
|
|
|
- }
|
|
|
-}
|