Jay
2024-11-25 ee9f604388a3e77d3f4654e326f3976552e7f532
提交 | 用户 | 时间
a6de49 1 package com.iailab.module.data.job.task;
H 2
3 import com.iailab.module.data.point.collection.PointCollector;
4 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory;
6 import javax.annotation.Resource;
7 import org.springframework.stereotype.Component;
8
9 import java.time.LocalDateTime;
10 import java.util.Calendar;
11
12 /**
13  * Point采集器30s
14  *
15  * @author PanZhibao
16  * @Description
17  * @createTime 2023年05月05日 11:50:00
18  */
19 @Component("pointCollectTaskNet30")
20 public class PointCollectTaskNet30 implements ITask {
21     private Logger logger = LoggerFactory.getLogger(getClass());
22
23     private final String NET = "NET30";
24
25     @Resource
26     private PointCollector pointCollector;
27
28     @Override
29     public void run(String params){
30         // 0/30 * * * * ?
31         logger.debug("PointCollectTaskNet30定时任务正在执行,参数为:{}", params);
32         try {
33             Calendar calendar = Calendar.getInstance();
34             calendar.set(Calendar.MILLISECOND, 0);
35             pointCollector.collect(calendar.getTime(), NET);
36             logger.info("PointCollectTaskNet30定时任务完成时间:" + LocalDateTime.now());
37         } catch (Exception ex) {
38             ex.printStackTrace();
39             logger.error("PointCollectTaskNet30定时任务失败时间:" + LocalDateTime.now());
40         }
41
42     }
43 }