|
@@ -110,7 +110,7 @@ public class ScheduleTaskMgr {
|
|
|
}
|
|
|
|
|
|
//TODO 每天整点的十分执行检查小时用水量是否对齐,检查时间范围为当前时间到昨天
|
|
|
- @Scheduled(cron = "0 10 * * * *")
|
|
|
+ @Scheduled(cron = "0 10 0 * * ?")
|
|
|
public void executeTaskEveryHourAtTenMinutesRecord() {
|
|
|
KprAimTapWaterBizFun.checkRecordData();
|
|
|
}
|
|
@@ -169,7 +169,8 @@ public class ScheduleTaskMgr {
|
|
|
// @Override
|
|
|
// public void run() {
|
|
|
// String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
-//
|
|
|
+// KprAimTapWaterBizFun.checkRecordAllData();
|
|
|
+// KprAimTapWaterBizFun.initWaterCollecationReacordAll();
|
|
|
// }
|
|
|
// };
|
|
|
// timer2.schedule(timerTask1, 10000);
|
|
@@ -201,7 +202,7 @@ public class ScheduleTaskMgr {
|
|
|
}
|
|
|
|
|
|
@PostConstruct
|
|
|
- public void initWaterRecordAll(){
|
|
|
+ public void initWaterRecordAllAndYuceWork(){
|
|
|
Timer timer = new Timer();
|
|
|
TimerTask timerTask1 = new TimerTask() {
|
|
|
@Override
|
|
@@ -216,51 +217,15 @@ public class ScheduleTaskMgr {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
KprAimTapWaterBizFun.checkRecordAllData();
|
|
|
- }
|
|
|
- };
|
|
|
- timer2.schedule(timerTask2,11000);//11秒后执行一次
|
|
|
- }
|
|
|
-
|
|
|
- @PostConstruct
|
|
|
- public void initWaterDay(){
|
|
|
- Timer timer = new Timer();
|
|
|
- TimerTask timerTask1 = new TimerTask() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
-// KprAimWaterCollecationBizFun.insertYuceDayData(time);
|
|
|
KprAimWaterCollecationBizFun.insertYuceDayAddData(time);
|
|
|
- }
|
|
|
- };
|
|
|
- timer.schedule(timerTask1,8000);//8秒后执行一次
|
|
|
- }
|
|
|
-
|
|
|
- @PostConstruct
|
|
|
- public void initWaterHour(){
|
|
|
- Timer timer = new Timer();
|
|
|
- TimerTask timerTask1 = new TimerTask() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
-// KprAimWaterCollecationBizFun.insertYuceHourData(time);
|
|
|
KprAimWaterCollecationBizFun.insertYuceHourAddData(time);
|
|
|
- //TODO 实际调用调度模型的接口
|
|
|
-// KprAimWaterCollecationBizFun.insertYucePump(time);
|
|
|
- }
|
|
|
- };
|
|
|
- timer.schedule(timerTask1,9000);//9秒后执行一次
|
|
|
- Timer timer2 = new Timer();
|
|
|
- TimerTask timerTask2 = new TimerTask() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
-// KprAimWaterCollecationBizFun.insertYuceHourDataScheduled(time);//江津的给注释掉
|
|
|
}
|
|
|
};
|
|
|
- timer2.schedule(timerTask2,9000);//9秒后执行一次
|
|
|
+ timer2.schedule(timerTask2,11000);//11秒后执行一次
|
|
|
}
|
|
|
//TODO 启动时跑今天泵的数据,江津的先注释
|
|
|
- @PostConstruct
|
|
|
+ /*@PostConstruct
|
|
|
public void initPumpFourDay(){
|
|
|
Timer timer = new Timer();
|
|
|
TimerTask timerTask1 = new TimerTask() {
|
|
@@ -289,38 +254,38 @@ public class ScheduleTaskMgr {
|
|
|
}
|
|
|
};
|
|
|
timer.schedule(timerTask1,9000);//9秒后执行一次
|
|
|
+ }*/
|
|
|
+
|
|
|
+// TODO 自来水的注释以下俩方法initPumpRecordAll checkPumpRecordAll
|
|
|
+ @PostConstruct
|
|
|
+ public void initPumpRecordAll(){
|
|
|
+ new Timer().schedule(new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ //当前时间到去年对应月份1号0点开始
|
|
|
+ LocalDateTime firstDayOfLastMonth = LocalDateTime.now().minusMonths(1) // 减去一个月
|
|
|
+ .toLocalDate() // 转换为 LocalDate
|
|
|
+ .withDayOfMonth(1) // 设置为当月的第一天
|
|
|
+ .atStartOfDay(); // 转换为当天的起始时间
|
|
|
+ String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
+ KprAimTapWaterBizFun.initWaterPumpReacordAll(formattedDate);
|
|
|
+ }
|
|
|
+ },5000);
|
|
|
}
|
|
|
|
|
|
- //TODO 自来水的注释以下俩方法initPumpRecordAll checkPumpRecordAll
|
|
|
-// @PostConstruct
|
|
|
-// public void initPumpRecordAll(){
|
|
|
-// new Timer().schedule(new TimerTask() {
|
|
|
-// @Override
|
|
|
-// public void run() {
|
|
|
-// //当前时间到去年对应月份1号0点开始
|
|
|
-// LocalDateTime firstDayOfLastMonth = LocalDateTime.now().minusMonths(1) // 减去一个月
|
|
|
-// .toLocalDate() // 转换为 LocalDate
|
|
|
-// .withDayOfMonth(1) // 设置为当月的第一天
|
|
|
-// .atStartOfDay(); // 转换为当天的起始时间
|
|
|
-// String formattedDate = firstDayOfLastMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
-// KprAimTapWaterBizFun.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"));
|
|
|
-// KprAimTapWaterBizFun.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"));
|
|
|
+ KprAimTapWaterBizFun.initWaterPumpReacordAll(formattedDate);
|
|
|
+ }
|
|
|
+ },5000);
|
|
|
+ }
|
|
|
|
|
|
@PostConstruct
|
|
|
public void initDatabaseName(){
|
|
@@ -331,7 +296,7 @@ public class ScheduleTaskMgr {
|
|
|
KprAimWaterCollecationBizFun.initDatabaseName();
|
|
|
}
|
|
|
};
|
|
|
- timer.schedule(timerTask1,6000);//6秒后执行一次
|
|
|
+ timer.schedule(timerTask1,3000);//6秒后执行一次
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "${cron.check.wo.dispatch.plan}")
|