houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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<String,String> 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());
        }
    }
}