|
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);
|
}
|
}
|
}
|