Browse Source

重构定点飞行代码

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
fb101b13a0
3 changed files with 14 additions and 17 deletions
  1. +1
    -9
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/UpdateEmergencyMissionStatusService.java
  2. +11
    -6
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/AirportCallBackUpdateStatusService.java
  3. +2
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java

+ 1
- 9
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/UpdateEmergencyMissionStatusService.java View File

import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.ThMission; import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.enums.AccidentTaskEnum;
import com.tuoheng.admin.enums.MarkEnum; import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.ThMissionMapper; import com.tuoheng.admin.mapper.ThMissionMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
* @param oldMission * @param oldMission
*/ */
public void updateStatus(ThMission oldMission, Integer status) { public void updateStatus(ThMission oldMission, Integer status) {
log.info("进入修改应急任务数据, type:{}, emergencyDataMissionId:{}, status={}", oldMission.getType(), oldMission.getEmergencyDataMissionId(), status);
if (1 == oldMission.getType()) {
return;
}
if (0 == oldMission.getEmergencyDataMissionId()) {
return;
}
log.info("修改应急任务数据");
log.info("修改应急任务数据, type:{}, emergencyDataMissionId:{}, status={}", oldMission.getType(), oldMission.getEmergencyDataMissionId(), status);
ThMission emergencyMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() ThMission emergencyMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, oldMission.getEmergencyDataMissionId()) .eq(ThMission::getId, oldMission.getEmergencyDataMissionId())
.eq(ThMission::getMark, MarkEnum.VALID.getCode())); .eq(ThMission::getMark, MarkEnum.VALID.getCode()));

+ 11
- 6
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/AirportCallBackUpdateStatusService.java View File

status = TaskStatusEnum.FAIL.getCode(); status = TaskStatusEnum.FAIL.getCode();
// throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "任务分析失败!"); // throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "任务分析失败!");
} }
log.info("机场平台回调,执行中,开始修改应急任务数据");
updateEmergencyMissionStatusService.updateStatus(thMission, status);
log.info("机场平台回调,执行中,修改应急任务数据结束");

if (2 == thMission.getType() && 0 != thMission.getEmergencyDataMissionId()) {
log.info("机场平台回调,执行中,开始修改应急任务数据, status={}", status);
updateEmergencyMissionStatusService.updateStatus(thMission, status);
log.info("机场平台回调,执行中,修改应急任务数据结束");
}
} else if (AirPortTaskStatusEnum.WAIT.getCode() == missionStatusRequest.getStatus()) { } else if (AirPortTaskStatusEnum.WAIT.getCode() == missionStatusRequest.getStatus()) {
log.info("被硬件调用,存任务状态:已完成"); log.info("被硬件调用,存任务状态:已完成");
// 机场飞行完成,立即修改任务状态为已完成 // 机场飞行完成,立即修改任务状态为已完成


status = TaskStatusEnum.COMPLETE.getCode(); status = TaskStatusEnum.COMPLETE.getCode();


log.info("机场平台回调,已完成,开始修改应急任务数据");
updateEmergencyMissionStatusService.updateStatus(thMission, status);
log.info("机场平台回调,已完成,修改应急任务数据结束");
if (2 == thMission.getType() && 0 != thMission.getEmergencyDataMissionId()) {
log.info("机场平台回调,已完成,开始修改应急任务数据, status={}", status);
updateEmergencyMissionStatusService.updateStatus(thMission, status);
log.info("机场平台回调,已完成,修改应急任务数据结束");
}


//硬件停止后,停止AI分析 //硬件停止后,停止AI分析
this.stopAI(missionStatusRequest, thMission); this.stopAI(missionStatusRequest, thMission);

+ 2
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java View File



// 创建应急任务 // 创建应急任务
ThMission mission = this.createMission(user, request); ThMission mission = this.createMission(user, request);
log.info("进入调用机场平台,创建应急任务,mission={}", mission);


// 调用机场平台 // 调用机场平台
// 修改原巡检任务状态为已完成 // 修改原巡检任务状态为已完成
mission.setName("应急任务" + code); mission.setName("应急任务" + code);
mission.setTenantId(user.getTenantId()); mission.setTenantId(user.getTenantId());
mission.setType(2); mission.setType(2);
mission.setStatus(TaskStatusEnum.FLIGHT.getCode()); // 设置应急任务状态为飞行中
mission.setInspectionType(InspectionTypeEnum.AIRPORT.getCode()); mission.setInspectionType(InspectionTypeEnum.AIRPORT.getCode());
mission.setAirportId(request.getAirportId()); mission.setAirportId(request.getAirportId());
mission.setAirportName(request.getAirportName()); mission.setAirportName(request.getAirportName());
mission.setInspectionLine(0); mission.setInspectionLine(0);
mission.setInspectionLineName(""); mission.setInspectionLineName("");
mission.setExecutionStartTime(DateUtils.now()); mission.setExecutionStartTime(DateUtils.now());
mission.setStatus(TaskStatusEnum.FLIGHT.getCode()); // 设置应急任务状态为飞行中
mission.setCreateUser(user.getId()); mission.setCreateUser(user.getId());
mission.setCreateTime(DateUtils.now()); mission.setCreateTime(DateUtils.now());
Integer count = missionMapper.insert(mission); Integer count = missionMapper.insert(mission);

Loading…
Cancel
Save