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("httpCollectHealthStateTask") public class HttpCollectHealthStateTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); @Resource private HttpCollectorForSD httpCollectorForSD; @Override public void run(String params) { logger.info("HttpCollectHealthStateTask定时任务正在执行,参数为:{}", params); try { Map map = new HashMap<>(); map.put("cu_ids", "3"); map.put("t", "1716274632482"); map.put("code", CommonConstant.HTTP_API_SD_HEALTH_STATE); map.put("client_id", "sd"); map.put("X-Forwarded-OrgSet", "1000000000000003"); map.put("X-Forwarded-PrId", "300005001,300005002"); map.put("X-Request-Id", "-c8048bc7-a206-4f71-a512-d6ade2272289"); httpCollectorForSD.getHealthStateValue(map); logger.info("HttpCollectHealthStateTask定时任务完成时间:" + LocalDateTime.now()); } catch (Exception ex) { ex.printStackTrace(); logger.info("HttpCollectHealthStateTask定时任务失败时间:" + LocalDateTime.now()); } } }