package com.yssh.controller;
|
|
|
import com.yssh.service.Yssh2dreliService;
|
import com.yssh.service.Yssh3dreliService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
|
/**
|
* 定时任务处理数据控制器
|
*
|
* @author xingjs
|
* @date 2023/02/06
|
*/
|
@Component("sqlDataTask")
|
public class DealDataTaksController {
|
|
@Autowired
|
private Yssh2dreliService yssh2dreliService;
|
|
@Autowired
|
private Yssh3dreliService yssh3dreliService;
|
|
|
//每天晚上23:59:00点执行
|
@Scheduled(cron = "0 59 23 * * ?")
|
public void createTable() {
|
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维热力执行完毕======== ");
|
}
|
|
|
|
}
|