|
|
@@ -42,18 +42,23 @@ public class PointFlightService { |
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED) |
|
|
|
public JsonResult pointFlight(AccidentFlightRequest request) { |
|
|
|
log.info("执行应急飞行起飞,request={}",request); |
|
|
|
//先创建应急任务--->执行定点飞行任务 |
|
|
|
//校验 |
|
|
|
if(StringUtils.isEmpty(request.getLongitude())){ |
|
|
|
log.info("经度,lon={}",request.getLongitude()); |
|
|
|
return JsonResult.error(AccidentEnum.LONGITUDE_IS_NULL.getCode(),AccidentEnum.LONGITUDE_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(StringUtils.isEmpty(request.getLatitude())){ |
|
|
|
log.info("经度,lat={}",request.getLatitude()); |
|
|
|
return JsonResult.error(AccidentEnum.LATITUDE_IS_NULL.getCode(),AccidentEnum.LATITUDE_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(null == request.getAirportId()){ |
|
|
|
log.info("机场id,id={}",request.getAirportId()); |
|
|
|
return JsonResult.error(AccidentEnum.AIRPORT_ID_IS_NULL.getCode(),AccidentEnum.AIRPORT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(StringUtils.isEmpty(request.getAirportName())){ |
|
|
|
log.info("机场名称,airportName={}",request.getAirportName()); |
|
|
|
return JsonResult.error(AccidentEnum.AIRPORT_NAME_IS_NULL.getCode(),AccidentEnum.AIRPORT_NAME_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//获取当前用户及租户信息 |
|
|
@@ -61,15 +66,15 @@ public class PointFlightService { |
|
|
|
String tenantId = CurrentUserUtil.getTenantId(); |
|
|
|
//获取租户信息 |
|
|
|
Tenant tenant = this.getTenant(tenantId); |
|
|
|
log.info("当前登录用户租户id,tenantId={}",tenant); |
|
|
|
//创建应急任务 |
|
|
|
Inspection inspection = this.createInspection(user, request); |
|
|
|
log.info("生成的应急任务,inspection={}",inspection); |
|
|
|
|
|
|
|
//调用机场平台进行飞行 |
|
|
|
//因任务为原来新的应急任务不用关心其他正在巡检飞行的任务 |
|
|
|
if(inspection.getAirportId() != request.getAirportId()){ |
|
|
|
throw new ServiceException("新的应急任务机场id和选择的机场id不对应"); |
|
|
|
} |
|
|
|
this.callNewAirport(tenant,request,inspection.getId()); |
|
|
|
boolean flag = this.callNewAirport(tenant, request, inspection.getId()); |
|
|
|
log.info("调用机场进行飞行,flag={}",flag); |
|
|
|
|
|
|
|
log.info("调用机场平台方法:执行定点飞行结束"); |
|
|
|
|
|
|
@@ -82,7 +87,7 @@ public class PointFlightService { |
|
|
|
* @param request |
|
|
|
* @param inspectionId |
|
|
|
*/ |
|
|
|
private void callNewAirport(Tenant tenant,AccidentFlightRequest request,String inspectionId){ |
|
|
|
private boolean callNewAirport(Tenant tenant,AccidentFlightRequest request,String inspectionId){ |
|
|
|
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_POINT_FLIGH; |
|
|
|
//高度设置为60 |
|
|
|
request.setAlt("60"); |
|
|
@@ -104,6 +109,8 @@ public class PointFlightService { |
|
|
|
throw new ServiceException("机场接口返回数据为空,飞行失败"); |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |