@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.vo.warning.WarningRecordVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface WarningRecordConverMapper { | |||
WarningRecordConverMapper INSTANCE = Mappers.getMapper(WarningRecordConverMapper.class); | |||
List<WarningRecordVo> fromWarningRecordListToWarningRecordListVoList(List<WarningRecord> warningRecordList); | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.entity.vo.warning; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 预警记录对象 th_warning_record | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class WarningRecordVo extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 预警ID | |||
*/ | |||
private Integer warningId; | |||
/** | |||
* 记录名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 应急任务ID | |||
*/ | |||
private Integer emergencyMissionId; | |||
/** | |||
* 任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成 | |||
*/ | |||
private Integer status; | |||
} |
@@ -205,24 +205,6 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
log.info("修改飞行状态:{}",JSONObject.toJSONString(thMissionUpdate)); | |||
return thMissionMapper.updateById(thMissionUpdate) > 0; | |||
}else if(AirPortTaskStatusEnum.WAIT.getCode()==missionStatusRequest.getStatus()){ | |||
// 机场飞行完成,立即修改任务状态为已完成,设置天气 | |||
ThMission thMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getId, missionStatusRequest.getRequestId()) | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode())); | |||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setId(Integer.parseInt(missionStatusRequest.getRequestId())); | |||
thMissionUpdate.setStatus(TaskStatusEnum.COMPLETE.getCode()); | |||
thMissionUpdate.setExecutionEndTime(new Date()); | |||
try { | |||
AirWeatherVO weather = inspectionService.getWeather(thMission.getAirportId()); | |||
String weatherStr = WeatherUtil.getWeather(weather); | |||
thMissionUpdate.setWeather(weatherStr); | |||
} catch (Exception e){ | |||
thMissionUpdate.setWeather(""); | |||
log.info("获取天气信息失败,请重试"); | |||
} | |||
thMissionMapper.updateById(thMissionUpdate); | |||
//硬件停止后,停止AI分析 | |||
return stopAI(missionStatusRequest); | |||
}else{ | |||
@@ -277,6 +259,15 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
thMissionUpdate.setId(thMission.getId()); | |||
thMissionUpdate.setMileage(missionStatusRequest.getMileage()); | |||
boolean result=false; | |||
try { | |||
AirWeatherVO weather = inspectionService.getWeather(thMission.getAirportId()); | |||
String weatherStr = WeatherUtil.getWeather(weather); | |||
thMissionUpdate.setWeather(weatherStr); | |||
}catch (Exception e){ | |||
thMissionUpdate.setWeather(""); | |||
log.info("获取天气信息失败,请重试"); | |||
} | |||
//任务调用完成之后,调用发送通道,请求DSP关闭请求 | |||
//调用DSP接口 | |||
JSONObject jsonObject = new JSONObject(); |
@@ -303,12 +303,12 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
if (aBoolean) { | |||
setComplate(callbackRequest, mission, thMissionUpdate); | |||
} else { | |||
// setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FAIL, mission); | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FAIL, mission); | |||
} | |||
return JsonResult.success(); | |||
} | |||
private void setTaskStatusEnum2(ThMission thMissionUpdate, TaskStatusEnum statusEnum, ThMission mission) { | |||
private void setTaskStatusEnum(ThMission thMissionUpdate, TaskStatusEnum statusEnum, ThMission mission) { | |||
thMissionUpdate.setStatus(statusEnum.getCode()); | |||
thMissionUpdate.setId(mission.getId()); | |||
thMissionUpdate.setExecutionEndTime(new Date()); | |||
@@ -326,12 +326,12 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
} else { | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.SUCCESS.getCode()); | |||
} | |||
// setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.COMPLETE, mission); | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.COMPLETE, mission); | |||
} else if (callbackRequest.getAnalyseStatus() == AiAnalyseStatusEnum.FAILED.getCode()) { | |||
// setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FAIL, mission); | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FAIL, mission); | |||
} else { | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.RUNNING.getCode()); | |||
// setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FLIGHT, mission); | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FLIGHT, mission); | |||
} | |||
} | |||
@@ -426,7 +426,7 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
lambdaQueryWrapper | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()) | |||
.eq(ThMission::getRequestId, requestId) | |||
.eq(ThMission::getStatus, TaskStatusEnum.COMPLETE.getCode()) | |||
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode()) | |||
.orderByDesc(ThMission::getExecutionStartTime); | |||
List<ThMission> thMissions = missionMapper.selectList(lambdaQueryWrapper); | |||
if (ObjectUtil.isEmpty(thMissions) || thMissions.size() == 0) { |
@@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</resultMap> | |||
<sql id="selectWarningRecordVo"> | |||
select id, tenant_id, warning_id, name, mission_id, create_user, create_time, update_user, update_time, mark from th_warning_record | |||
select id, tenant_id, warning_id, name, mission_id, emergency_mission_id, create_user, create_time, update_user, update_time, mark from th_warning_record | |||
</sql> | |||
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest" resultMap="WarningRecordResult"> |