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