| | |
| | | import org.springframework.integration.annotation.ServiceActivator; |
| | | import org.springframework.messaging.MessageHeaders; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | @Override |
| | | public ResponseResult takeoffToPoint(String sn, TakeoffToPointParam param) { |
| | | checkTakeoffCondition(sn); |
| | | |
| | | param.setFlightId(UUID.randomUUID().toString()); |
| | | if (!StringUtils.hasText(param.getFlightId())){ |
| | | param.setFlightId(UUID.randomUUID().toString()); |
| | | } |
| | | ServiceReply reply = messageSenderService.publishServicesTopic(sn, DroneControlMethodEnum.TAKE_OFF_TO_POINT.getMethod(), param, param.getFlightId()); |
| | | return ResponseResult.CODE_SUCCESS != reply.getResult() ? |
| | | ResponseResult.error("无人机起飞失败 " + reply.getResult()) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult payloadCommands(PayloadCommandsParam param, String bid) throws Exception { |
| | | param.getCmd().getClazz() |
| | | .getDeclaredConstructor(DronePayloadParam.class) |
| | | .newInstance(param.getData()) |
| | | .checkCondition(param.getSn()); |
| | | |
| | | ResponseResult result = ResponseResult.success(); |
| | | result.setTraceid(bid); |
| | | |
| | | ServiceReply serviceReply = messageSenderService.publishServicesTopic(param.getSn(), param.getCmd().getCmd(), param.getData(),bid); |
| | | return ResponseResult.CODE_SUCCESS != serviceReply.getResult() ? |
| | | ResponseResult.error(serviceReply.getResult(), "错误码:" + serviceReply.getResult()) |
| | | : result; |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult requestsConfig(String sn, String method, RequestsParam param) { |
| | | ServiceReply serviceReply = messageSenderService.publishRequestsTopic(sn, method, param); |
| | | return ResponseResult.CODE_SUCCESS != serviceReply.getResult() ? |