package com.iailab.module.data.job.task; import com.iailab.module.data.common.enums.CommonConstant; import com.iailab.module.data.http.collector.HttpCollectorForUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Resource; import org.springframework.stereotype.Component; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; /** * 同步用户 * 0 0 12 2 * ? * * * @author lirm * @Description * @createTime 2024年05月21日 */ @Component("httpCollectUserTask") public class HttpCollectUserTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); @Resource private HttpCollectorForUser httpCollectorForUser; @Override public void run(String params) { logger.info("HttpCollectUserTask定时任务正在执行,参数为:{}", params); try { Map map1 = new HashMap<>(); map1.put("code", CommonConstant.HTTP_API_JOB_LIST); httpCollectorForUser.saveJobInfo(map1); Map map2 = new HashMap<>(); map2.put("code", CommonConstant.HTTP_API_PERSON_LIST); httpCollectorForUser.saveUserInfo(map2); logger.info("HttpCollectUserTask定时任务完成时间:" + LocalDateTime.now()); } catch (Exception ex) { ex.printStackTrace(); logger.info("HttpCollectUserTask定时任务失败时间:" + LocalDateTime.now()); } } }