return JsonResult.error("机场接口返回数据为空"); | return JsonResult.error("机场接口返回数据为空"); | ||||
} | } | ||||
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | ||||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||||
assert jsonResult != null; | |||||
return JsonResult.error(JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("data").toString(), AirExecuteTaskVO.class), "执行任务失败!"); | |||||
} else if (ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0) { | |||||
if (jsonResult.getCode() != 0) { | |||||
return JsonResult.error(jsonResult.getMsg()); | return JsonResult.error(jsonResult.getMsg()); | ||||
} else { | |||||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||||
thMissionUpdate.setId(Integer.parseInt(missionId)); | |||||
//修改执行时间为当前 | |||||
thMissionUpdate.setExecutionStartTime(new Date()); | |||||
missionMapper.updateById(thMissionUpdate); | |||||
//返回执行结果 | |||||
return JsonResult.success(jsonResult.getMsg()); | |||||
} | } | ||||
return JsonResult.success(); | |||||
} | } | ||||
@Override | @Override |
log.info("执行定时执行飞行任务:" + thMission.getId()); | log.info("执行定时执行飞行任务:" + thMission.getId()); | ||||
JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); | JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); | ||||
log.info("执行定时执行飞行任务result:" + jsonResult); | log.info("执行定时执行飞行任务result:" + jsonResult); | ||||
thMission.setExecutionStatus(2); | |||||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | ||||
thMissionUpdate.setId(thMission.getId()); | thMissionUpdate.setId(thMission.getId()); | ||||
thMissionUpdate.setExecutionStatus(2); | thMissionUpdate.setExecutionStatus(2); | ||||
if(jsonResult.getCode()!=0 && ObjectUtil.isEmpty(jsonResult.getData())){ | |||||
thMission.setStatus(TaskStatusEnum.FAIL.getCode()); | |||||
if(jsonResult.getCode()!=0){ | |||||
log.error("执行定时执行机场起飞失败" + thMission.getId()); | |||||
thMissionUpdate.setStatus(TaskStatusEnum.FAIL.getCode()); | |||||
} | } | ||||
missionMapper.updateById(thMissionUpdate); | missionMapper.updateById(thMissionUpdate); | ||||
} | } |