소스 검색

根据机场返航

tags/v1.2.0^2
chengwang 1 년 전
부모
커밋
bca65db2b3
2개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java
  2. +9
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ReversalFlightService.java

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java 파일 보기

inspection.setDeptId(user.getDeptId()); inspection.setDeptId(user.getDeptId());
inspection.setName("应急任务"+code); inspection.setName("应急任务"+code);
inspection.setType(1); inspection.setType(1);
inspection.setStatus(TaskStatusEnum.INFLIGHT.getCode());
inspection.setStatus(TaskStatusEnum.INFLIGHT.getCode());// 设置应急任务状态为飞行中
inspection.setRoadId(""); inspection.setRoadId("");
inspection.setSectionId(""); inspection.setSectionId("");
inspection.setInspectionType(2); inspection.setInspectionType(2);

+ 9
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ReversalFlightService.java 파일 보기

import com.tuoheng.common.core.config.common.CommonConfig; import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException; import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.HttpUtils; import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JacksonUtil;
import com.tuoheng.common.core.utils.JsonResult; import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils; import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
if(null == request.getAirportId()){ if(null == request.getAirportId()){
throw new ServiceException("机场id为空"); throw new ServiceException("机场id为空");
} }
// if(null == request.getTaskId()){
// throw new ServiceException("任务id为空");
// }
//根据任务对应的机场查询对应任务id //根据任务对应的机场查询对应任务id
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getAirportId, request.getAirportId()) .eq(Inspection::getAirportId, request.getAirportId())
if(ObjectUtils.isNotEmpty(inspection)){ if(ObjectUtils.isNotEmpty(inspection)){
request.setTaskId(Integer.valueOf(inspection.getId())); request.setTaskId(Integer.valueOf(inspection.getId()));
} }
request.setTaskId(Integer.valueOf(inspection.getId()));
request.setZhilin("03"); request.setZhilin("03");
//调用机场平台让飞机返航 //调用机场平台让飞机返航
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_REVERSAL_FLIGH; String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_REVERSAL_FLIGH;
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("taskId",request.getTaskId());
jsonObject.put("airportId",request.getAirportId()); jsonObject.put("airportId",request.getAirportId());
jsonObject.put("zhilin",request.getZhilin()); jsonObject.put("zhilin",request.getZhilin());
log.info("调用机场平台,无人机执行定点飞行返航:url:{}",url); log.info("调用机场平台,无人机执行定点飞行返航:url:{}",url);
log.info("调用机场平台,原无人机执行定点飞行,jsonObject:{}",jsonObject);
log.info("调用机场平台,原无人机执行定点飞行返航,jsonObject:{}",jsonObject);


String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
if (StringUtils.isEmpty(airPortStr)) { if (StringUtils.isEmpty(airPortStr)) {
log.info("原无人机执行定点飞行返航:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject);
throw new ServiceException("机场接口返回数据为空,飞行失败");
log.info("原无人机执行定点飞行返航:机场接口返回数据为空,返航失败,jsonObject:{}", jsonObject);
throw new ServiceException("机场接口返回数据为空,返航失败");
}
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
if (0 != jsonResult.getCode()) {
log.info("调用机场平台,无人机执行定点飞行:返航失败,jsonResult:{}", jsonResult.getMsg());
throw new com.tuoheng.common.core.exception.ServiceException("机场平台返回,返航失败");
} }


return JsonResult.success(); return JsonResult.success();

Loading…
취소
저장