| | |
| | | package com.ard.sample.manage.service.impl; |
| | | |
| | | import com.ard.common.core.redis.RedisConst; |
| | | import com.ard.common.core.redis.RedisOpsUtils; |
| | | import com.ard.sample.component.mqtt.model.CommonTopicReceiver; |
| | | import com.ard.sample.component.websocket.config.ConcurrentWebSocketSession; |
| | | import com.ard.sample.component.websocket.enums.MessageType; |
| | |
| | | //只要状态 "0":"作业准备中","1":"飞行作业中","5":"任务空闲" |
| | | if(code == 0 || code == 1 || code == 5) { |
| | | _deviceService.updateWorkType(deviceSn,code); |
| | | RedisOpsUtils.setWithExpire(RedisConst.OSD_STATUS_PREFIX + deviceSn, code, RedisConst.DEVICE_ALIVE_SECOND); |
| | | } |
| | | } |
| | | } |
| | |
| | | } else if (dockOsdData.contains("network_state")) { |
| | | JsonNode jsonNode = mapper.readTree(dockOsdData); |
| | | if (jsonNode.has("drone_in_dock") && jsonNode.get("sub_device").has("device_online_status")) { |
| | | String childDeviceSn=jsonNode.get("sub_device").get("device_sn").asText(); |
| | | Long inDock=jsonNode.get("drone_in_dock").asLong(); |
| | | Long deviceOnlineStatus=jsonNode.get("sub_device").get("device_online_status").asLong(); |
| | | if(inDock.equals(1L) && deviceOnlineStatus.equals(0L)) |
| | | {// 飞行器在舱内且关机状态为6 |
| | | _deviceService.updateWorkType(childDeviceSn,6L); |
| | | if(jsonNode.get("sub_device").has("device_sn")) { |
| | | String childDeviceSn = jsonNode.get("sub_device").get("device_sn").asText(); |
| | | Long inDock = jsonNode.get("drone_in_dock").asLong(); |
| | | Long deviceOnlineStatus = jsonNode.get("sub_device").get("device_online_status").asLong(); |
| | | if (inDock.equals(1L) && deviceOnlineStatus.equals(0L)) {// 飞行器在舱内且关机状态为6 |
| | | _deviceService.updateWorkType(childDeviceSn, 6L); |
| | | RedisOpsUtils.setWithExpire(RedisConst.OSD_STATUS_PREFIX + device.getChildDeviceSn(), 6, RedisConst.DEVICE_ALIVE_SECOND); |
| | | } |
| | | } |
| | | } |
| | | receiver.setType(MessageType.STATUS.getType()+"-network"); |
| | |
| | | wsMessage.getData().setHost(data); |
| | | sendMessageService.sendBatch(webSessions, wsMessage); |
| | | // 发送给websocket客户端 |
| | | _dockWebSocketHandler.sendMessageToSubscribers(device.getDeviceSn(), MessageType.STATUS.getType(), dockOsd); |
| | | _dockWebSocketHandler.sendMessageToSubscribers(device.getDeviceSn(), MessageType.STATUS.getType(), dockOsd, ""); |
| | | } |
| | | } |
| | | } |