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采集器10s
14  * 0/10 * * * * ?
15  *
16  * @author PanZhibao
17  * @Description
18  * @createTime 2023年05月05日 11:49:00
19  */
20 @Component("pointCollectTaskNet10")
21 public class PointCollectTaskNet10 implements ITask {
22     private Logger logger = LoggerFactory.getLogger(getClass());
23
24     private final String NET = "NET10";
25
26     @Resource
27     private PointCollector pointCollector;
28
29     @Override
30     public void run(String params){
31         logger.debug("PointCollectTaskNet10定时任务正在执行,参数为:{}", params);
32         try {
33             Calendar calendar = Calendar.getInstance();
34             calendar.set(Calendar.MILLISECOND, 0);
35             pointCollector.collect(calendar.getTime(), NET);
36             logger.info("PointCollectTaskNet10定时任务完成时间:" + LocalDateTime.now());
37         } catch (Exception ex) {
38             ex.printStackTrace();
39             logger.error("PointCollectTaskNet10定时任务失败时间:" + LocalDateTime.now());
40         }
41
42     }
43 }