天一电厂UPS动环数据对接,SNMP协议
whycxzp
2024-02-29 ac476c867af05823e33c7746eb2ec37dd26abe7a
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
package com.whyc.schedule;
 
import com.whyc.constant.Constant_SNMP_OID_B_247;
import com.whyc.factory.ThreadPoolExecutorFactory;
import com.whyc.service.SNMPConnectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
@EnableScheduling
@Component
public class SNMPScheduleService {
 
    @Autowired
    private SNMPConnectService service;
 
    /**数据4秒钟获取一次*/
    @Scheduled(cron = "0/4 * * * * ? ")
    public void getAndSaveB247(){
        ThreadPoolExecutorFactory.getPoolExecutor().execute(()->{
            service.getAndSaveB247();
        });
    }
 
    @Scheduled(cron = "0/4 * * * * ? ")
    public void getAndSaveA250(){
        ThreadPoolExecutorFactory.getPoolExecutor().execute(()->{
            service.getAndSaveA250();
        });
    }
 
}