|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.enums.AirPortTaskStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.InspectionStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.MarkEnum; |
|
|
|
import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum; |
|
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
@@ -47,7 +48,7 @@ public class UpdateInspectionStatusService { |
|
|
|
} |
|
|
|
|
|
|
|
Inspection inspection = (Inspection) result.getData(); |
|
|
|
|
|
|
|
Integer status = null; |
|
|
|
if (AirPortTaskStatusEnum.FLIGHT.getCode() != missionStatusRequest.getStatus() && AirPortTaskStatusEnum.WAIT.getCode() != missionStatusRequest.getStatus()) { |
|
|
|
log.info("修改任务状态业务接口:飞行状态出错!"); |
|
|
|
return JsonResult.error(EditInspectionStatusCodeEnum.TASK_NOT_STATUS.getCode(), EditInspectionStatusCodeEnum.TASK_NOT_STATUS.getMsg()); |
|
|
@@ -55,12 +56,16 @@ public class UpdateInspectionStatusService { |
|
|
|
|
|
|
|
if (AirPortTaskStatusEnum.FLIGHT.getCode() == missionStatusRequest.getStatus()) { |
|
|
|
log.info("修改任务状态业务接口:修改执行中状态"); |
|
|
|
status = InspectionStatusEnum.IN_FLIGHT.getCode(); |
|
|
|
updateFlightStatusService.updateFlightStatus(inspection, missionStatusRequest); |
|
|
|
} else if (AirPortTaskStatusEnum.WAIT.getCode() == missionStatusRequest.getStatus()) { |
|
|
|
log.info("修改任务状态业务接口:修改待执行状态"); |
|
|
|
status = InspectionStatusEnum.FLIGHT_COMPLETED.getCode(); |
|
|
|
updateWaittStatusService.updateWaittStatus(inspection); |
|
|
|
} |
|
|
|
|
|
|
|
this.updateEmergencyStatus(inspection, status); |
|
|
|
|
|
|
|
log.info("修改任务业务接口:修改任务成功:{}"); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
@@ -83,4 +88,32 @@ public class UpdateInspectionStatusService { |
|
|
|
return JsonResult.success(inspection); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改应急任务数据 |
|
|
|
* |
|
|
|
* @param oldInspection |
|
|
|
* @param status |
|
|
|
*/ |
|
|
|
public void updateEmergencyStatus(Inspection oldInspection, Integer status) { |
|
|
|
log.info("修改应急任务数据, type:{}, emergencyDataInspectionId:{}, status={}", oldInspection.getType(), oldInspection.getEmergencyDataInspectionId(), status); |
|
|
|
Inspection emergencyInspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() |
|
|
|
.eq(Inspection::getEmergencyDataInspectionId, oldInspection.getId()) |
|
|
|
.eq(Inspection::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isNull(emergencyInspection)) { |
|
|
|
log.info("修改应急任务数据,该巡检任务没有对应的应急任务"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 在查询一次,保证数据是最新的 |
|
|
|
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() |
|
|
|
.eq(Inspection::getId, oldInspection.getId()) |
|
|
|
.eq(Inspection::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isNotNull(status)) { |
|
|
|
emergencyInspection.setStatus(status); |
|
|
|
} |
|
|
|
emergencyInspection.setAnalyseStatus(inspection.getAnalyseStatus()); |
|
|
|
emergencyInspection.setVideoUrl(inspection.getVideoUrl()); |
|
|
|
emergencyInspection.setAiVideoUrl(inspection.getAiVideoUrl()); |
|
|
|
inspectionMapper.updateById(inspection); |
|
|
|
log.info("修改应急任务数据完成"); |
|
|
|
} |
|
|
|
} |