StaticScheduleTaskController.java
2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.songshu.mongo.controller;
import com.songshu.mongo.service.StaticScheduleTaskService;
import com.songshu.mongo.service.UpdateTingcheService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.time.LocalDateTime;
/**
* cw
* 定时任务
*/
@Configuration
@EnableScheduling
@Slf4j
public class StaticScheduleTaskController {
@Autowired
private StaticScheduleTaskService staticScheduleTaskService;
@Autowired
private UpdateTingcheService updateTingcheService;
// /**
// * @Scheduled-cron : 指定定时任务的执行时间
// * 或直接指定时间间隔,例如:5秒
// * @Scheduled(fixedRate=5000) 案例-案例
// */
// @Scheduled(cron = "0/5 * * * * ?")
// private void configureTask() {
// log.info("执行静态定时任务时间: {}", LocalDateTime.now());
// }
// 每隔5秒执行一次:*/5 * * * * ?
// 每隔1分钟执行一次:0 */1 * * * ?
// 每天23点执行一次:0 0 23 * * ?
// 每天凌晨1点执行一次:0 0 1 * * ?
// 每月1号凌晨1点执行一次:0 0 1 1 * ?
// 每月最后一天23点执行一次:0 0 23 L * ?
// 每周星期天凌晨1点实行一次:0 0 1 ? * L
// 在26分、29分、33分执行一次:0 26,29,33 * * * ?
// 每天的0点、13点、18点、21点都执行一次:0 0 0,13,18,21 * * ?
/**
* 租赁合同
*/
@Scheduled(cron = "0 0 1 * * ?")
private void ScheduledTask() {
//room 表
staticScheduleTaskService.SynchronousDataRoom();
//buildings 楼宇表
staticScheduleTaskService.SynchronousDataRuildings();
//客户合同
staticScheduleTaskService.SynchronousDataContracts();
//客户合同-房间
staticScheduleTaskService.SynchronousDataContractsRoom();
//客户
staticScheduleTaskService.SynchronousDataAccounts();
//合同收款表
staticScheduleTaskService.SynchronousDataContractReceipts();
}
/***
* 停车
*/
@Scheduled(cron = "0 */5 * * * ?")
private void ScheduledTask2() {
updateTingcheService.updateTjTcsjtjn();
updateTingcheService.updateTjCljrsctjn();
updateTingcheService.updateTjCljrsctjy();
updateTingcheService.updateTjCljrsctjr();
updateTingcheService.updateTjParkingPayment();
updateTingcheService.updateTjVehicleRecords();
}
}