新火炬后端单体项目初始化代码
cuilei
2 天以前 c71714508fbe3ace3543423c7700d7bbcca90056
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
package org.jeecg.modules.mes.job;
 
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
/**
 * 飞书用户同步定时任务
 */
@Component
@Slf4j
public class FeishuSyncTask implements Job {
 
    @Autowired
    private org.jeecg.modules.mes.job.FeishuUserService feishuUserService;
 
    @Value("${feishu.sync.departmentId:0}")
    private String departmentId;
 
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("开始执行飞书用户同步任务");
        try {
            if (departmentId != null && !"0".equals(departmentId)) {
                feishuUserService.syncFeishuDepartmentUsers(departmentId);
                log.info("飞书用户同步任务执行完成");
            } else {
                log.warn("未配置飞书同步部门ID,跳过同步任务");
            }
        } catch (Exception e) {
            log.error("飞书用户同步任务执行失败", e);
            throw new JobExecutionException(e);
        }
    }
}