package com.iailab.module.data.job.task; import com.iailab.module.data.common.enums.CommonConstant; import com.iailab.module.data.http.collector.HttpCollectorForSD; 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; /** *山大设备设备列表数据采集 * * @author lirm * @Description * @createTime 2024年05月21日 */ @Component("httpCollectDeviceTask") public class HttpCollectDeviceTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); @Resource private HttpCollectorForSD httpCollectorForSD; @Override public void run(String params) { logger.info("HttpCollectDeviceTask定时任务正在执行,参数为:{}", params); try { Map map = new HashMap<>(); map.put("code", CommonConstant.HTTP_API_SD_DEVICE_LIST); map.put("token", "914df3ebd91bc54b5b294f13477f497611d278aa4a8727249f8490cb274a0ed9"); httpCollectorForSD.getDeviceList(map); logger.info("HttpCollectDeviceTask定时任务完成时间:" + LocalDateTime.now()); } catch (Exception ex) { ex.printStackTrace(); logger.info("HttpCollectDeviceTask定时任务失败时间:" + LocalDateTime.now()); } } }