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
package com.iailab.module.job.task;
 
import com.iailab.module.watch.WatchConstant;
import com.iailab.module.watch.WatchDog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
 
/**
 * ZX2心跳
 * 0/2 * * * * ?
 *
 * @author PanZhibao
 * @Description
 * @createTime 2024年06月05日
 */
@Component("watchDogZX2Task")
public class WatchDogZX2Task implements ITask {
    private Logger logger = LoggerFactory.getLogger(getClass());
 
    @Resource
    private WatchDog watchDog;
 
    private int lastHeat = 0;
 
    private final String mParamCode = "isWriteTime";
 
    @Override
    public void run(String params) {
        // logger.info("WatchDogZX2Task定时任务正在执行,参数为:{}", params);
        try {
            lastHeat = watchDog.writeWatchDogTime(WatchConstant.ZX2_HEART_SET, WatchConstant.ZX2_HEART,
                    WatchConstant.ZX2_STATUS, lastHeat);
        } catch (Exception ex) {
            logger.error("WatchDogZX2Task运行异常");
            ex.printStackTrace();
        }
        logger.info("WatchDogZX2Task运行完成");
    }
}