提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.quartz; |
A |
2 |
|
|
3 |
import javax.annotation.PostConstruct; |
|
4 |
|
|
5 |
import org.quartz.CronScheduleBuilder; |
|
6 |
import org.quartz.Trigger; |
|
7 |
import org.quartz.TriggerBuilder; |
|
8 |
import org.springframework.context.annotation.Scope; |
|
9 |
import org.springframework.stereotype.Service; |
|
10 |
|
|
11 |
import com.mandi.fendan.util.SendcmErrsheetJob; |
|
12 |
|
|
13 |
@Service |
|
14 |
@Scope("singleton") |
|
15 |
public class JOBInitializer { |
|
16 |
@PostConstruct |
|
17 |
public void init(){ |
|
18 |
checkcmErr(); |
|
19 |
} |
|
20 |
|
|
21 |
//检查出门发送nc错误的:5分钟执行1次 |
|
22 |
public void checkcmErr(){ |
|
23 |
|
|
24 |
String timer="0 */5 * * * ?"; |
|
25 |
//todo 先注销了,防止影响调试 |
|
26 |
/*try{ |
|
27 |
TriggerBuilder<Trigger> tb=TriggerBuilder.newTrigger(); |
|
28 |
tb.withIdentity("sendcmErrsheettg", "sendcmErrsheetgp").withSchedule(CronScheduleBuilder.cronSchedule(timer)); |
|
29 |
Trigger tr=tb.build(); |
|
30 |
Quartzjob.runJob("sendcmErrsheettask",SendcmErrsheetJob.class, tr); |
|
31 |
}catch(Exception e){ |
|
32 |
e.printStackTrace(); |
|
33 |
}*/ |
|
34 |
|
|
35 |
|
|
36 |
} |
|
37 |
} |