Bläddra i källkod

重构定点飞行代码

tags/v1.2.0^2
wanjing 1 år sedan
förälder
incheckning
fb101b13a0
3 ändrade filer med 14 tillägg och 17 borttagningar
  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 Visa fil

@@ -3,7 +3,6 @@ package com.tuoheng.admin.service.third;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.enums.AccidentTaskEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.ThMissionMapper;
import lombok.extern.slf4j.Slf4j;
@@ -23,14 +22,7 @@ public class UpdateEmergencyMissionStatusService {
* @param oldMission
*/
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>()
.eq(ThMission::getId, oldMission.getEmergencyDataMissionId())
.eq(ThMission::getMark, MarkEnum.VALID.getCode()));

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

@@ -90,9 +90,12 @@ public class AirportCallBackUpdateStatusService {
status = TaskStatusEnum.FAIL.getCode();
// 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()) {
log.info("被硬件调用,存任务状态:已完成");
// 机场飞行完成,立即修改任务状态为已完成
@@ -114,9 +117,11 @@ public class AirportCallBackUpdateStatusService {

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分析
this.stopAI(missionStatusRequest, thMission);

+ 2
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java Visa fil

@@ -57,7 +57,7 @@ public class PointFlightService {

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

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

Laddar…
Avbryt
Spara