package com.terra.bigdata.util;
|
|
import com.terra.bigdata.service.Yssh3dreliService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
/**
|
* 定时任务处理数据控制器
|
*
|
* @author xingjs
|
* @date 2023/02/06
|
*/
|
//@Component("sqlDataTask")
|
public class ScheduledTasksUtils {
|
|
//定时任务表达式
|
@Value("${task.cron}")
|
private String timingTaskExpression;
|
|
@Autowired
|
private Yssh3dreliService yssh3dreliService;
|
|
|
//每天晚上23:59:00点执行创建第二天的数据表
|
@Scheduled(cron = "0 59 23 * * ?")
|
public void createTable() {
|
System.out.println("执行有参方法,参数为:" + timingTaskExpression);
|
//yssh2dreliService.create2dreliTable();
|
//System.out.println("========创建2维热力表执行完毕======== ");
|
//yssh3dreliService.create3dreliTable();
|
System.out.println("========创建3维热力执行完毕======== ");
|
}
|
|
|
//删除前一年的数据 每天晚上0点执行
|
@Scheduled(cron = "0 0 0 * * ?")
|
public void deletePreviousYearsData() {
|
//yssh2dreliService.drop2dreliTable();
|
//System.out.println("========删除2维热力表执行完毕======== ");
|
yssh3dreliService.drop3dreliTable();
|
System.out.println("========删除3维热力执行完毕======== ");
|
}
|
|
}
|