Open
Description
The "online" key value is not entered in the redis server, so when running the mission, "The device is offline, pleas try again later." An error occurs. Why can't I register online with redis? HMS continues to fly through mqtt
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Override
public TopicRequestsResponse<MqttReply<FlighttaskResourceGetResponse>> flighttaskResourceGet(TopicRequestsRequest<FlighttaskResourceGetRequest> response, MessageHeaders headers) {
String jobId = response.getData().getFlightId();
Optional<DeviceDTO> deviceOpt = deviceRedisService.getDeviceOnline(response.getGateway());
if (deviceOpt.isEmpty()) {
log.error("The device is offline, please try again later.");
return new TopicRequestsResponse().setData(MqttReply.error(CommonErrorEnum.DEVICE_OFFLINE));
}
Optional<WaylineJobDTO> waylineJobOpt = waylineJobService.getJobByJobId(deviceOpt.get().getWorkspaceId(), jobId);
if (waylineJobOpt.isEmpty()) {
log.error("The wayline job does not exist.");
return new TopicRequestsResponse().setData(MqttReply.error(CommonErrorEnum.ILLEGAL_ARGUMENT));
}
WaylineJobDTO waylineJob = waylineJobOpt.get();
// get wayline file
Optional<GetWaylineListResponse> waylineFile = waylineFileService.getWaylineByWaylineId(waylineJob.getWorkspaceId(), waylineJob.getFileId());
if (waylineFile.isEmpty()) {
log.error("The wayline file does not exist.");
return new TopicRequestsResponse().setData(MqttReply.error(CommonErrorEnum.ILLEGAL_ARGUMENT));
}
// get file url
try {
URL url = waylineFileService.getObjectUrl(waylineJob.getWorkspaceId(), waylineFile.get().getId());
return new TopicRequestsResponse<MqttReply<FlighttaskResourceGetResponse>>().setData(
MqttReply.success(new FlighttaskResourceGetResponse()
.setFile(new FlighttaskFile()
.setUrl(url.toString())
.setFingerprint(waylineFile.get().getSign()))));
} catch (SQLException | NullPointerException e) {
e.printStackTrace();
return new TopicRequestsResponse().setData(MqttReply.error(CommonErrorEnum.SYSTEM_ERROR));
}
}
Metadata
Metadata
Assignees
Labels
No labels