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.Calendar;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
*山大设备温度 振动数据采集
|
*
|
* @author lirm
|
* @Description
|
* @createTime 2024年6月3日
|
*/
|
@Component("httpCollectTemperatureTask")
|
public class HttpCollectTemperatureTask implements ITask {
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
@Resource
|
private HttpCollectorForSD httpCollectorForSD;
|
|
@Override
|
public void run(String params) {
|
logger.info("HttpCollectTemperatureTask定时任务正在执行,参数为:{}", params);
|
Calendar calendar = Calendar.getInstance();
|
calendar.set(Calendar.MILLISECOND, 0);
|
calendar.set(Calendar.SECOND, 0);
|
try {
|
Map<String,String> map = new HashMap<>();
|
map.put("code", CommonConstant.HTTP_API_SD_DEVICE_TEMPERATURE);
|
map.put("X-Forwarded-OrgSet", "1000000000000003");
|
map.put("client_id", "sd");
|
httpCollectorForSD.getTemperatureValue(map, calendar.getTime());
|
logger.info("HttpCollectTemperatureTask定时任务完成时间:" + LocalDateTime.now());
|
} catch (Exception ex) {
|
ex.printStackTrace();
|
logger.info("HttpCollectTemperatureTask定时任务失败时间:" + LocalDateTime.now());
|
}
|
}
|
}
|