更新心跳逻辑

This commit is contained in:
谷成伟 2024-12-11 09:55:26 +08:00
parent 70b723a15d
commit 59ad680b0e

View File

@ -8,11 +8,13 @@ import com.das.modules.cache.service.CacheService;
import com.das.modules.node.constant.NodeConstant;
import com.das.modules.node.domain.bo.TerminalMessage;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
@Slf4j
@Service(value = NodeConstant.HEARTBEAT)
public class HeartbeatCommand implements BaseCommand{
@ -55,9 +57,11 @@ public class HeartbeatCommand implements BaseCommand{
continue;
}
//判断是不是风机
String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId);
String keyCommFaultState = String.format("RT:%d:commfaultstate",deviceId);
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
log.debug("设备ID:{},在线状态:{},通讯状态: {}", deviceId, online, plcDeviceStatus);
if (plcDeviceStatus == null){
adminRedisTemplate.set(keyCommFaultState, (online == 1) ? 0 : 1);
}