@@ -0,0 +1,13 @@ | |||
package com.tuoheng.admin.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@RestController | |||
@RequestMapping("/liveChannel") | |||
public class LiveChannelController { | |||
} |
@@ -0,0 +1,74 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_live_channel") | |||
public class LiveChannel extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 部门id | |||
*/ | |||
private String deptId; | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
*通道编号 | |||
*/ | |||
private String channelCode; | |||
/** | |||
* 直播通道名称 | |||
*/ | |||
private String name; | |||
/** | |||
*无人机推流地址 | |||
*/ | |||
private String pushUrl; | |||
/** | |||
* 无人机拉流地址 | |||
*/ | |||
private String pullUrl; | |||
/** | |||
* AI推流地址 | |||
*/ | |||
private String aipushUrl; | |||
/** | |||
* AI拉流地址 | |||
*/ | |||
private String aipullUrl; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
*状态:1正常 2停用 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public enum QueryVideoServiceEnum { | |||
QUERY_IS_FAILED(1230700, "获取数据失败"), | |||
INSPECTION_ID_IS_NULL(1230701, "任务id为空"), | |||
LIVE_CHANNEL_IS_NOT_EXIST(1230702, "直播通道为空"), | |||
AIPULL_URL_IS_NOT_NULL(1230703, "直播地址为空"), | |||
AIVIDEO_URL_IS_NOT_NULL(1230704, "回放地址为空"), | |||
INSPECTION_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; | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.LiveChannel; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public interface LiveChannelMapper extends BaseMapper<LiveChannel> { | |||
} |
@@ -0,0 +1,8 @@ | |||
package com.tuoheng.admin.service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public interface ILiveChannelService { | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import com.tuoheng.admin.service.ILiveChannelService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class LiveChannelServiceImpl implements ILiveChannelService { | |||
} |
@@ -145,10 +145,6 @@ public class InspectionServiceImpl implements IInspectionService { | |||
return queryInspectionListService.getListByAirportId(dto); | |||
} | |||
// @Override | |||
// public JsonResult getListByAirportId(InspectionDto dto) { | |||
// return queryInspectionListService.getListByAirportId(airportId); | |||
// } | |||
@Override | |||
public JsonResult getVideoById(String id) { |
@@ -1,7 +1,12 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.LiveChannel; | |||
import com.tuoheng.admin.enums.code.inspection.QueryVideoServiceEnum; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.LiveChannelMapper; | |||
import com.tuoheng.admin.vo.LiveChannelVo; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -23,29 +28,48 @@ public class QueryVideoService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private LiveChannelMapper liveChannelMapper; | |||
public JsonResult getVideoById(String id) { | |||
if(StringUtils.isEmpty(id)){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
return JsonResult.error(QueryVideoServiceEnum.INSPECTION_ID_IS_NULL.getCode(),QueryVideoServiceEnum.INSPECTION_ID_IS_NULL.getMsg()); | |||
} | |||
//根据id查询对应的任务 | |||
Inspection inspection = inspectionMapper.selectById(id); | |||
if(null == inspection){ | |||
return JsonResult.error("问题不存在"); | |||
return JsonResult.error(QueryVideoServiceEnum.INSPECTION_IS_NOT_EXIST.getCode(),QueryVideoServiceEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
LiveChannelVo liveChannelVo = new LiveChannelVo(); | |||
if(10 == inspection.getStatus()){ | |||
//任务状态为任务飞行中10 为视频直播,飞行轨迹 | |||
//任务状态为任务飞行中10视频直播 | |||
LiveChannel liveChannel = liveChannelMapper.selectOne(new LambdaQueryWrapper<LiveChannel>() | |||
.eq(LiveChannel::getMark, 1) | |||
.eq(LiveChannel::getInspectionId, inspection.getId()) | |||
.eq(LiveChannel::getStatus, 1)); | |||
if(null == liveChannel){ | |||
return JsonResult.error(QueryVideoServiceEnum.LIVE_CHANNEL_IS_NOT_EXIST.getCode(),QueryVideoServiceEnum.LIVE_CHANNEL_IS_NOT_EXIST.getMsg()); | |||
} | |||
if(liveChannel.getAipullUrl()==null){ | |||
return JsonResult.error(QueryVideoServiceEnum.AIPULL_URL_IS_NOT_NULL.getCode(),QueryVideoServiceEnum.AIPULL_URL_IS_NOT_NULL.getMsg()); | |||
} | |||
liveChannelVo.setAipullUrl(liveChannel.getAipullUrl()); | |||
} | |||
if(15 == inspection.getStatus()){ | |||
//任务状态为任务飞行完成15 为视频回放,飞行轨迹 | |||
//任务状态为任务飞行完成15视频回放 | |||
if(inspection.getAiVideoUrl()==null){ | |||
return JsonResult.error(QueryVideoServiceEnum.AIVIDEO_URL_IS_NOT_NULL.getCode(),QueryVideoServiceEnum.AIVIDEO_URL_IS_NOT_NULL.getMsg()); | |||
} | |||
liveChannelVo.setAiVideoUrl(inspection.getAiVideoUrl()); | |||
} | |||
return null; | |||
return JsonResult.success(liveChannelVo); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.vo; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
public class LiveChannelVo { | |||
/** | |||
* 直播地址 | |||
*/ | |||
private String aipullUrl; | |||
/** | |||
* AI识别后视频地址 | |||
*/ | |||
private String aiVideoUrl; | |||
} |
@@ -0,0 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.LiveChannelMapper"> | |||
</mapper> |