#update
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
package com.maibu.uav.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.maibu.core.business.dto.uav.FlightTaskCreateDTO;
|
||||
import com.maibu.core.business.inter.uav.UAVCommandInter;
|
||||
import com.maibu.uav.dto.SK2ResultDTO;
|
||||
import com.maibu.utils.json.JsonUtils;
|
||||
|
||||
@Component
|
||||
public class UAVCommamdHandler implements UAVCommandInter {
|
||||
@@ -13,8 +18,18 @@ public class UAVCommamdHandler implements UAVCommandInter {
|
||||
private UAVService uService;
|
||||
|
||||
@Override
|
||||
public void createFlightTask(FlightTaskCreateDTO dto){
|
||||
uService.createFlightTask(dto);
|
||||
public String createFlightTask(FlightTaskCreateDTO dto) {
|
||||
String json = uService.createFlightTask(dto);
|
||||
SK2ResultDTO res = JsonUtils.parseObject(json, SK2ResultDTO.class);
|
||||
String taskId = null;
|
||||
if (res != null && res.getData() != null) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map<String, Object> map = objectMapper.convertValue(
|
||||
res.getData(),
|
||||
Map.class);
|
||||
taskId = (String) map.get("task_uuid");
|
||||
}
|
||||
return taskId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user