|
@@ -219,7 +219,7 @@ public class ScheduleTaskMgr {
|
|
|
|
|
|
//TODO 江津相关
|
|
//TODO 江津相关
|
|
|
|
|
|
- @Resource(name = "infulxJiangjinDbUtil")
|
|
|
|
|
|
+ /*@Resource(name = "infulxJiangjinDbUtil")
|
|
private InfulxJiangjinDbUtil infulxJiangjinDbUtil;
|
|
private InfulxJiangjinDbUtil infulxJiangjinDbUtil;
|
|
|
|
|
|
//TODO 启动后5秒初始化所有配置参数
|
|
//TODO 启动后5秒初始化所有配置参数
|
|
@@ -364,145 +364,145 @@ public class ScheduleTaskMgr {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
timer.schedule(timerTask1,9000);//9秒后执行一次
|
|
timer.schedule(timerTask1,9000);//9秒后执行一次
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* TODO 自来水相关
|
|
* TODO 自来水相关
|
|
*/
|
|
*/
|
|
-// @Resource(name = "infulxZilaishuiDbUtil")
|
|
|
|
-// private InfulxZilaishuiDbUtil infulxZilaishuiDbUtil;
|
|
|
|
-//
|
|
|
|
-// //TODO 启动后5秒初始化所有配置参数
|
|
|
|
-// @PostConstruct
|
|
|
|
-// public void initZilaishuiApplication(){
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// try {
|
|
|
|
-// infulxZilaishuiDbUtil.initInfluxDataBase();
|
|
|
|
-// KprZilaishuiWaterBizFun.infulxZilaishuiDbUtil= infulxZilaishuiDbUtil;
|
|
|
|
-// }catch(Exception ex){
|
|
|
|
-// log.error("自来水启动时初始化配置参数失败:"+ex.getLocalizedMessage());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// },5000);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// @PostConstruct
|
|
|
|
-// public void initZilaishuiHisData(){
|
|
|
|
-// //TODO 启动时同步当前月一号到当前时间的所有历史数据
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// try {
|
|
|
|
-// KprZilaishuiWaterBizFun.initHistoryDb(LocalDate.now().withDayOfMonth(1).atStartOfDay());
|
|
|
|
-// }catch(Exception ex){
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// },7000);
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// try {
|
|
|
|
-// }catch(Exception ex){
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// },8000);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //TODO 每小时的第 0, 5, 10, 15, ..., 55 分钟执行一次
|
|
|
|
-// @Scheduled(cron = "0 0/5 * * * ?")
|
|
|
|
-// public void executeZilaishuiTask() {
|
|
|
|
-// KprZilaishuiWaterBizFun.initHistoryDb(LocalDateTime.now()
|
|
|
|
-// .withMinute(0)
|
|
|
|
-// .withSecond(0)
|
|
|
|
-// .withNano(0));
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //TODO 每天凌晨1点执行前一天的
|
|
|
|
-// @Scheduled(cron = "0 0 1 * * ?")
|
|
|
|
-// public void executeZilaishuiHistoryTask() {
|
|
|
|
-// //TODO 执行前一天的数据到当前
|
|
|
|
-// KprZilaishuiWaterBizFun.initHistoryDb(LocalDate.now()
|
|
|
|
-// .minusDays(1)
|
|
|
|
-// .atStartOfDay());
|
|
|
|
-// }
|
|
|
|
-// //TODO 市自来水水位预测相关
|
|
|
|
-// @PostConstruct
|
|
|
|
-// public void initWaterCollecationReacordAll(){
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// LocalDateTime firstDayOfLastMonth = LocalDateTime.now()
|
|
|
|
-// .minusMonths(1)
|
|
|
|
-// .with(TemporalAdjusters.firstDayOfMonth())
|
|
|
|
-// .withHour(0)
|
|
|
|
-// .withMinute(0)
|
|
|
|
-// .withSecond(0)
|
|
|
|
-// .withNano(0);//上个月0点
|
|
|
|
-//
|
|
|
|
-// String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
-// KprZilaishuiLevelBizFun.initWaterLevelReacordAll(formattedDate);
|
|
|
|
-// }
|
|
|
|
-// },5000);
|
|
|
|
-// }
|
|
|
|
-// //TODO 每小时的10分执行原始小时液位数据计算
|
|
|
|
-// @Scheduled(cron = "0 10 * * * *")
|
|
|
|
-// public void initHourWaterCollecationReacordAll(){
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// String formattedDate = LocalDate.now().atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
-// KprZilaishuiLevelBizFun.initWaterLevelReacordAll(formattedDate);
|
|
|
|
-// }
|
|
|
|
-// },5000);
|
|
|
|
-// }
|
|
|
|
-// //TODO 每小时的10分执行原始小时液位数据计算
|
|
|
|
-// @Scheduled(cron = "0 15 * * * *")
|
|
|
|
-// public void initYuceLevel(){
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// KprZilaishuiLevelBizFun.insertDailyData();
|
|
|
|
-// KprZilaishuiLevelBizFun.insertForecastData();
|
|
|
|
-// }
|
|
|
|
-// },5000);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //TODO 市自来水泵数据采集
|
|
|
|
-// @PostConstruct
|
|
|
|
-// public void initPumpRecordAll(){
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// //当前时间到去年对应月份1号0点开始
|
|
|
|
-// LocalDateTime firstDayOfLastMonth = LocalDateTime.now()
|
|
|
|
-// .minusYears(1)
|
|
|
|
-// .with(TemporalAdjusters.firstDayOfMonth())
|
|
|
|
-// .withHour(0)
|
|
|
|
-// .withMinute(0)
|
|
|
|
-// .withSecond(0)
|
|
|
|
-// .withNano(0);//上个月0点
|
|
|
|
-// String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
-// KprZilaishuiPumpBizFun.initWaterPumpReacordAll(formattedDate);
|
|
|
|
-// }
|
|
|
|
-// },5000);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //TODO 每小时的10分执行原始小时泵数据计算
|
|
|
|
-// @Scheduled(cron = "0 10 * * * *")
|
|
|
|
-// public void checkPumpRecordAll(){
|
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
|
-// @Override
|
|
|
|
-// public void run() {
|
|
|
|
-// //当前时间到今天的0点开始
|
|
|
|
-// LocalDateTime firstDayOfLastMonth = LocalDate.now().atStartOfDay();//上个月0点
|
|
|
|
-// String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
-// KprZilaishuiPumpBizFun.initWaterPumpReacordAll(formattedDate);
|
|
|
|
-// }
|
|
|
|
-// },5000);
|
|
|
|
-// }
|
|
|
|
|
|
+ @Resource(name = "infulxZilaishuiDbUtil")
|
|
|
|
+ private InfulxZilaishuiDbUtil infulxZilaishuiDbUtil;
|
|
|
|
+
|
|
|
|
+ //TODO 启动后5秒初始化所有配置参数
|
|
|
|
+ @PostConstruct
|
|
|
|
+ public void initZilaishuiApplication(){
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ infulxZilaishuiDbUtil.initInfluxDataBase();
|
|
|
|
+ KprZilaishuiWaterBizFun.infulxZilaishuiDbUtil= infulxZilaishuiDbUtil;
|
|
|
|
+ }catch(Exception ex){
|
|
|
|
+ log.error("自来水启动时初始化配置参数失败:"+ex.getLocalizedMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },5000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostConstruct
|
|
|
|
+ public void initZilaishuiHisData(){
|
|
|
|
+ //TODO 启动时同步当前月一号到当前时间的所有历史数据
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ KprZilaishuiWaterBizFun.initHistoryDb(LocalDate.now().withDayOfMonth(1).atStartOfDay());
|
|
|
|
+ }catch(Exception ex){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },7000);
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ }catch(Exception ex){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },8000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //TODO 每小时的第 0, 5, 10, 15, ..., 55 分钟执行一次
|
|
|
|
+ @Scheduled(cron = "0 0/5 * * * ?")
|
|
|
|
+ public void executeZilaishuiTask() {
|
|
|
|
+ KprZilaishuiWaterBizFun.initHistoryDb(LocalDateTime.now()
|
|
|
|
+ .withMinute(0)
|
|
|
|
+ .withSecond(0)
|
|
|
|
+ .withNano(0));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //TODO 每天凌晨1点执行前一天的
|
|
|
|
+ @Scheduled(cron = "0 0 1 * * ?")
|
|
|
|
+ public void executeZilaishuiHistoryTask() {
|
|
|
|
+ //TODO 执行前一天的数据到当前
|
|
|
|
+ KprZilaishuiWaterBizFun.initHistoryDb(LocalDate.now()
|
|
|
|
+ .minusDays(1)
|
|
|
|
+ .atStartOfDay());
|
|
|
|
+ }
|
|
|
|
+ //TODO 市自来水水位预测相关
|
|
|
|
+ /*@PostConstruct
|
|
|
|
+ public void initWaterCollecationReacordAll(){
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ LocalDateTime firstDayOfLastMonth = LocalDateTime.now()
|
|
|
|
+ .minusMonths(1)
|
|
|
|
+ .with(TemporalAdjusters.firstDayOfMonth())
|
|
|
|
+ .withHour(0)
|
|
|
|
+ .withMinute(0)
|
|
|
|
+ .withSecond(0)
|
|
|
|
+ .withNano(0);//上个月0点
|
|
|
|
+
|
|
|
|
+ String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ KprZilaishuiLevelBizFun.initWaterLevelReacordAll(formattedDate);
|
|
|
|
+ }
|
|
|
|
+ },5000);
|
|
|
|
+ }
|
|
|
|
+ //TODO 每小时的10分执行原始小时液位数据计算
|
|
|
|
+ @Scheduled(cron = "0 10 * * * *")
|
|
|
|
+ public void initHourWaterCollecationReacordAll(){
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ String formattedDate = LocalDate.now().atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ KprZilaishuiLevelBizFun.initWaterLevelReacordAll(formattedDate);
|
|
|
|
+ }
|
|
|
|
+ },5000);
|
|
|
|
+ }
|
|
|
|
+ //TODO 每小时的10分执行原始小时液位数据计算
|
|
|
|
+ @Scheduled(cron = "0 15 * * * *")
|
|
|
|
+ public void initYuceLevel(){
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ KprZilaishuiLevelBizFun.insertDailyData();
|
|
|
|
+ KprZilaishuiLevelBizFun.insertForecastData();
|
|
|
|
+ }
|
|
|
|
+ },5000);
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ //TODO 市自来水泵数据采集
|
|
|
|
+ @PostConstruct
|
|
|
|
+ public void initPumpRecordAll(){
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ //当前时间到去年对应月份1号0点开始
|
|
|
|
+ LocalDateTime firstDayOfLastMonth = LocalDateTime.now()
|
|
|
|
+ .minusYears(1)
|
|
|
|
+ .with(TemporalAdjusters.firstDayOfMonth())
|
|
|
|
+ .withHour(0)
|
|
|
|
+ .withMinute(0)
|
|
|
|
+ .withSecond(0)
|
|
|
|
+ .withNano(0);//上个月0点
|
|
|
|
+ String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ KprZilaishuiPumpBizFun.initWaterPumpReacordAll(formattedDate);
|
|
|
|
+ }
|
|
|
|
+ },5000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //TODO 每小时的10分执行原始小时泵数据计算
|
|
|
|
+ @Scheduled(cron = "0 10 * * * *")
|
|
|
|
+ public void checkPumpRecordAll(){
|
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ //当前时间到今天的0点开始
|
|
|
|
+ LocalDateTime firstDayOfLastMonth = LocalDate.now().atStartOfDay();//上个月0点
|
|
|
|
+ String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ KprZilaishuiPumpBizFun.initWaterPumpReacordAll(formattedDate);
|
|
|
|
+ }
|
|
|
|
+ },5000);
|
|
|
|
+ }
|
|
}
|
|
}
|