| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | |
| | | @Resource |
| | | RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private int waits = 10000; |
| | | private int waits = 30000; |
| | | |
| | | public void check() { |
| | | |
| | |
| | | if(StringUtils.isEmpty(static_equ_json)) { |
| | | //这里为空,直接离线 |
| | | jobDao.updateStateByMac(mac, 4); |
| | | return; |
| | | continue; |
| | | } |
| | | Map<String,String> seJSON = JSON.parseObject(static_equ_json,new TypeReference<Map<String,String>>() {}); |
| | | if(!seJSON.isEmpty()) { |
| | |
| | | |
| | | String key = "state_" + orgId + "_" + areaCode + "_" + monitorpointId + "_" + mac; |
| | | String state_json = RedisUtil.get(redisTemplate, key); |
| | | |
| | | //设备实时state为null,说明未收到该设备的数据,直接离线 |
| | | if(StringUtils.isEmpty(state_json)) { |
| | | //这里为空,直接离线 |
| | | jobDao.updateStateByMac(mac, 4); |
| | | return; |
| | | //这里为空,直接离线 |
| | | jobDao.updateStateByMac(mac, 4); |
| | | continue; |
| | | } |
| | | Map<String,String> stateJSON = JSON.parseObject(state_json,new TypeReference<Map<String,String>>() {}); |
| | | if(!stateJSON.isEmpty()) { |
| | |
| | | if(time + waits < new Date().getTime()) { |
| | | jobDao.updateStateByMac(mac, 4); |
| | | } |
| | | } else { |
| | | } |
| | | else { |
| | | jobDao.updateStateByMac(mac, 4); |
| | | } |
| | | } else { |
| | | } |
| | | else { |
| | | jobDao.updateStateByMac(mac, 4); |
| | | } |
| | | } |