@@ -126,4 +126,15 @@ public class MissionController { | |||
return JsonResult.success(missionService.live(id)); | |||
} | |||
/** | |||
* 根据id获取任务视频回放和直播 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/videoById/{id}") | |||
public JsonResult videoById(@PathVariable("id") String id) { | |||
return missionService.getVideoById(id); | |||
} | |||
} |
@@ -5,12 +5,9 @@ import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest; | |||
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest; | |||
import com.tuoheng.admin.service.warning.IWarningService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import io.swagger.models.auth.In; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* @desc: 预警 前端控制器 | |||
* @team: tuoheng |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
public class LiveChannelVO { | |||
/** | |||
* 直播地址 | |||
*/ | |||
private String aiPullUrl; | |||
/** | |||
* AI识别后视频地址 | |||
*/ | |||
private String aiVideoUrl; | |||
} |
@@ -0,0 +1,44 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/8 | |||
*/ | |||
public enum MissionEnum { | |||
MISSION_IS_NOT_EXIST(1230901, "任务为空"), | |||
MISSION_ID_IS_NULL(1230902, "任务id不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
MissionEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public enum QueryVideoServiceEnum { | |||
QUERY_IS_FAILED(1230700, "获取数据失败"), | |||
MISSION_ID_IS_NULL(1230701, "任务id为空"), | |||
LIVE_CHANNEL_IS_NOT_EXIST(1230702, "直播通道为空"), | |||
AIPULL_URL_IS_NOT_NULL(1230703, "直播地址为空"), | |||
AIVIDEO_URL_IS_NOT_NULL(1230704, "回放地址为空"), | |||
MISSION_IS_NOT_EXIST(1230705, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryVideoServiceEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -13,7 +13,7 @@ public enum WarningStatusEnum { | |||
WAIT_CONFIRM (1,"待确认"), | |||
CONFIRM(2,"确认"), | |||
IGNORE(3,"确认"); | |||
IGNORE(3,"忽略"); | |||
WarningStatusEnum(int code, String description){ | |||
this.code = code; |
@@ -60,4 +60,6 @@ public interface IMissionService extends IBaseService<ThMission> { | |||
boolean deleteBatch(List<Integer> idList); | |||
MissionLiveVO live(Integer id); | |||
JsonResult getVideoById(String id); | |||
} |
@@ -14,6 +14,7 @@ import com.tuoheng.admin.entity.request.MissionRequest; | |||
import com.tuoheng.admin.entity.request.MissionQuery; | |||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.vo.AirWeatherVO; | |||
import com.tuoheng.admin.entity.vo.LiveChannelVO; | |||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.admin.enums.*; | |||
@@ -378,4 +379,31 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
return missionLiveVO; | |||
} | |||
@Override | |||
public JsonResult getVideoById(String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(QueryVideoServiceEnum.MISSION_ID_IS_NULL.getCode(), QueryVideoServiceEnum.MISSION_ID_IS_NULL.getMsg()); | |||
} | |||
ThMission thMission = thMissionMapper.selectById(id); | |||
if (ObjectUtil.isNull(thMission)) { | |||
return JsonResult.error(QueryVideoServiceEnum.MISSION_IS_NOT_EXIST.getCode(), QueryVideoServiceEnum.MISSION_IS_NOT_EXIST.getMsg()); | |||
} | |||
LiveChannelVO liveChannelVo = new LiveChannelVO(); | |||
if(TaskStatusEnum.FLIGHT.getCode() == thMission.getStatus()){ | |||
//任务飞行中进行直播 | |||
if(StringUtils.isNotEmpty(thMission.getAipullUrl())){ | |||
liveChannelVo.setAiPullUrl(thMission.getAipullUrl()); | |||
} | |||
} | |||
if(TaskStatusEnum.COMPLETE.getCode() == thMission.getStatus()){ | |||
//任务飞行完成,回放视频 | |||
if(StringUtils.isNotEmpty(thMission.getAiVideoUrl())){ | |||
liveChannelVo.setAiVideoUrl(thMission.getAiVideoUrl()); | |||
} | |||
} | |||
return JsonResult.success(liveChannelVo); | |||
} | |||
} |
@@ -16,12 +16,15 @@ import com.tuoheng.admin.enums.*; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.service.IQuestionService; | |||
import com.tuoheng.admin.service.IQuestionTypeService; | |||
import com.tuoheng.admin.service.warning.IWarningService; | |||
import com.tuoheng.admin.service.warning.WarningServiceImpl; | |||
import com.tuoheng.admin.utils.TimeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpStatus; | |||
@@ -40,6 +43,7 @@ import java.util.*; | |||
* @since 2022-08-03 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Question> implements IQuestionService { | |||
@Autowired | |||
@@ -60,6 +64,12 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Autowired | |||
private IQuestionTypeService questionTypeService; | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private IWarningService iWarningService; | |||
private final static SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
@Override | |||
@@ -325,6 +335,9 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
//获取当前飞行坐标,存问题的经纬度 | |||
List<ThInspection> flightDataList = getThInspections(mission); | |||
List<Question> questionList = getQuestionList(mission, questionFiles, flightDataList); | |||
//保存问题数据时调用saveWarningData方法保存预警数据入库 | |||
saveWarningData(mission, questionFiles, flightDataList); | |||
log.info("预警表数据入库结束"); | |||
if(questionList.size()==0){ | |||
return true; | |||
} | |||
@@ -369,6 +382,35 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
return questionList; | |||
} | |||
//根据获取的问题列表问题类型code为002004,添加数据入库到预警表 | |||
private Boolean saveWarningData(ThMission mission, List<CallbackRequest.QuestionFilesDTO> questionFiles, List<ThInspection> flightDataList){ | |||
log.info("预警表数据入库开始..."); | |||
List<Warning> warningList = new ArrayList<>(); | |||
List<QuestionType> questionType = questionTypeService.getQuestionType(); | |||
Map<String,QuestionType> typeMap=new HashMap<>(); | |||
for (QuestionType type : questionType) { | |||
typeMap.put(type.getCode(),type); | |||
} | |||
//调用添加问题列表接口 | |||
List<Question> questionList = this.getQuestionList(mission, questionFiles, flightDataList); | |||
for (Question question : questionList) { | |||
Warning warning = new Warning(); | |||
//问题类型为火灾隐患时添加数据 | |||
if(question.getType().equals(QuestionTypeEnum.Q4.getCode())){ | |||
warning.setTenantId(question.getTenantId()); | |||
warning.setDiscoveryWay(DiscoveryWayEnum.UAV_PATROL.getCode()); | |||
warning.setLocation(""); | |||
warning.setStatus(WarningStatusEnum.WAIT_CONFIRM.getCode()); | |||
warning.setQuestionId(question.getId()); | |||
warning.setCreateUser(question.getCreateUser()); | |||
warning.setCreateTime(question.getCreateTime()); | |||
warning.setMark(MarkTypeEnum.VALID.getCode()); | |||
warningList.add(warning); | |||
} | |||
} | |||
return iWarningService.saveBatch(warningList); | |||
} | |||
private ThMission getThMission(String requestId) { | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()) |