houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
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
package com.iailab.module.job.task;
 
import com.iailab.module.watch.WatchConstant;
import com.iailab.module.watch.WatchDog;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
 
/**
 * 监听旋流分选控制器状态
 * ZX2
 *
 * @author PanZhibao
 * @Description
 * @createTime 2024年06月07日
 */
@Slf4j
@Component("watchControllerOn2Task")
public class WatchControllerOn2Task implements ITask {
    private Logger logger = LoggerFactory.getLogger(getClass());
 
    @Resource
    private WatchDog watchDog;
 
    @Override
    public void run(String params) {
        // logger.info("WatchControllerOn2Task定时任务正在执行,参数为:{}", params);
        try {
            if (!watchDog.isConnect(WatchConstant.ZX2_STATUS)) {
                log.info("通讯异常,投入智能化状态复位!");
                watchDog.stopControllerSts(WatchConstant.CONTROLLER_ONSTS_2);
                return;
            }
            if (watchDog.isUse(WatchConstant.CONTROLLER_USE_2)) {
                watchDog.startControllerSts(WatchConstant.CONTROLLER_ONSTS_2);
            } else {
                watchDog.stopControllerSts(WatchConstant.CONTROLLER_ONSTS_2);
            }
        } catch (Exception ex) {
            logger.error("WatchControllerOn2Task运行异常");
            ex.printStackTrace();
        }
        logger.info("WatchControllerOn2Task运行完成");
    }
 
 
}