工业级运维app手机api
沈斌
2017-11-20 44bfab8ff28cbeb54686f9398699615324ca879b
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd">
 
    <!--Spring 4 定时器 -->
    <!-- 定时获取 微信AccessToken,频率为一小时一次 -->
    <bean id="getAccessToken" class="com.moral.monitor.listener.quartz.GetAccessToken" scope="singleton" />
 
    <!-- 设备 若10分钟内若没有 收到设备信息,报警通知-->
    <bean id="equipmentCheck" class="com.moral.monitor.listener.quartz.EquipmentCheck" scope="singleton"/>
 
    <!-- 定时通知任务-->
    <bean id="messageNotice" class="com.moral.monitor.listener.quartz.MessageNotice" scope="singleton"/>
 
    <!-- 微信 TOKEN -->
    <bean id="tokenJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="getAccessToken" />
        <property name="targetMethod" value="getat" />
        <property name="concurrent" value="true" />
    </bean>
 
    <!-- 设备检测 -->
    <bean id="checkJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="equipmentCheck" />
        <property name="targetMethod" value="check" />
        <property name="concurrent" value="true" />
    </bean>
 
    <!--通知用户-->
    <bean id="noticeJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="messageNotice" />
        <property name="targetMethod" value="notice" />
        <property name="concurrent" value="true" />
    </bean>
 
    <bean id="tokenJobsimpleTrigger"  class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
        <property name="jobDetail" ref="tokenJob" />
        <!-- 延迟 5 秒-->
        <property name="startDelay" value="5000" />
        <!-- 间隔 微信 acction 半小时一次, 2分钟 -->
        <property name="repeatInterval" value="120000" />
    </bean>
 
    <!-- 设备状态检测 -->
    <bean id="checkJobsimpleTrigger"  class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
        <property name="jobDetail" ref="checkJob" />
        <!-- 延迟 5 秒-->
        <property name="startDelay" value="5000" />
        <!-- 间隔 3分钟180000 -->
        <property name="repeatInterval" value="600000" />
    </bean>
 
    <!--定时查表报警通知用户-->
    <bean id="noticeJobsimpleTrigger"  class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean" >
        <property name="jobDetail" ref="noticeJob" />
        <!-- 延迟 5 秒-->
        <property name="startDelay" value="5000" />
        <!-- 间隔 3分钟180000 -->
        <property name="repeatInterval" value="30000" />
    </bean>
 
    <!-- 设备离线状态检查-->
    <bean id="stopStateCheck" class="com.moral.monitor.listener.quartz.StopStateCheck" scope="singleton"/>
 
    <bean id="stateJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="stopStateCheck" />
        <property name="targetMethod" value="check" />
        <property name="concurrent" value="true" />
    </bean>
 
    <bean id="stateJobsimpleTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
        <property name="jobDetail" ref="stateJob"></property>
        <property name="cronExpression" value="0/15 * * * * ?"></property>
    </bean>
 
    <!-- 总调度用于启动Spring定时器 -->
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
          <list>
                <!--<ref bean="tokenJobsimpleTrigger" />-->
                <!--<ref bean="checkJobsimpleTrigger"/>-->
                <!--<ref bean="noticeJobsimpleTrigger"/>-->
 
                <ref bean="stateJobsimpleTrigger" />
          </list>
         </property>
     </bean>
</beans>