对比新文件 |
| | |
| | | package com.iailab.module.data.job.task; |
| | | |
| | | import com.iailab.module.data.point.collection.PointCollector; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * Point采集器日 |
| | | * 59 23 * * * |
| | | * |
| | | * @author DongYukun |
| | | * @Description |
| | | * @createTime 2025年03月21日 16:54:00 |
| | | */ |
| | | @Component("pointCollectTaskNetDay") |
| | | public class PointCollectTaskNetDay implements ITask { |
| | | private final Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | private static final String NET = "Day"; |
| | | |
| | | @Resource |
| | | private PointCollector pointCollector; |
| | | |
| | | @Override |
| | | public void run(String params) { |
| | | // 59 23 * * * ? |
| | | logger.info("pointCollectTaskNetDay定时任务正在执行,参数为:{}", params); |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | pointCollector.collect(calendar.getTime(), NET); |
| | | logger.info("pointCollectTaskNetDay定时任务完成时间:" + LocalDateTime.now()); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | logger.error("pointCollectTaskNetDay定时任务失败时间:" + LocalDateTime.now()); |
| | | } |
| | | |
| | | } |
| | | } |