增加rtmp客户端管理功能
This commit is contained in:
parent
fb5b83ffbd
commit
b972e6d172
@ -2,7 +2,7 @@ package ink.wgink.module.file.media.controller.app.srs.rtmp;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.module.file.media.pojo.vos.srs.rtmp.RtmpCallbackVO;
|
||||
import ink.wgink.module.file.media.pojo.vos.rtmp.RtmpCallbackVO;
|
||||
import ink.wgink.pojo.result.SuccessResultCode;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -19,8 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "rtmp回调接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/rtmp-callback")
|
||||
public class RtmpCallbackAppController extends DefaultBaseController {
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/srs-rtmp-callback")
|
||||
public class SrsRtmpCallbackAppController extends DefaultBaseController {
|
||||
|
||||
@PostMapping("on-connect")
|
||||
public SuccessResultCode<Integer> onConnect(@RequestBody RtmpCallbackVO rtmpCallbackVO) {
|
@ -13,10 +13,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -40,12 +38,12 @@ public class VideoRouteController {
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("file/media/video/list");
|
||||
return new ModelAndView("video/list");
|
||||
}
|
||||
|
||||
@GetMapping("upload")
|
||||
public ModelAndView upload() {
|
||||
ModelAndView modelAndView = new ModelAndView("file/media/video/upload");
|
||||
ModelAndView modelAndView = new ModelAndView("video/upload");
|
||||
modelAndView.addObject("types", videoProperties.getTypes());
|
||||
modelAndView.addObject("maxUploadCount", videoProperties.getMaxUploadCount());
|
||||
return modelAndView;
|
||||
@ -53,7 +51,7 @@ public class VideoRouteController {
|
||||
|
||||
@GetMapping("preview")
|
||||
public ModelAndView preview() {
|
||||
return new ModelAndView("file/media/video/preview");
|
||||
return new ModelAndView("video/preview");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "下载视频", notes = "下载视频接口")
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.file.media.pojo.vos.srs.rtmp;
|
||||
package ink.wgink.module.file.media.pojo.vos.rtmp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -0,0 +1,416 @@
|
||||
<?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="ink.wgink.module.file.media.dao.rtmp.IRtmpClientDao">
|
||||
|
||||
<resultMap id="clientDTO" type="ink.wgink.module.file.media.pojo.dtos.rtmp.RtmpClientDTO">
|
||||
<result column="client_id" property="clientId"/>
|
||||
<result column="client_code" property="clientCode"/>
|
||||
<result column="client_name" property="clientName"/>
|
||||
<result column="client_summary" property="clientSummary"/>
|
||||
<result column="client_key" property="clientKey"/>
|
||||
<result column="client_secret" property="clientSecret"/>
|
||||
<result column="client_status" property="clientStatus"/>
|
||||
<result column="client_url" property="clientUrl"/>
|
||||
<result column="expire_time" property="expireTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="modifier" property="modifier"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="clientBO" type="ink.wgink.module.file.media.pojo.bos.rtmp.RtmpClientBO">
|
||||
<result column="client_id" property="clientId"/>
|
||||
<result column="client_code" property="clientCode"/>
|
||||
<result column="client_name" property="clientName"/>
|
||||
<result column="client_summary" property="clientSummary"/>
|
||||
<result column="client_key" property="clientKey"/>
|
||||
<result column="client_secret" property="clientSecret"/>
|
||||
<result column="client_status" property="clientStatus"/>
|
||||
<result column="client_url" property="clientUrl"/>
|
||||
<result column="expire_time" property="expireTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="modifier" property="modifier"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="clientPO" type="ink.wgink.module.file.media.pojo.pos.rtmp.RtmpClientPO">
|
||||
<result column="client_id" property="clientId"/>
|
||||
<result column="client_code" property="clientCode"/>
|
||||
<result column="client_name" property="clientName"/>
|
||||
<result column="client_summary" property="clientSummary"/>
|
||||
<result column="client_key" property="clientKey"/>
|
||||
<result column="client_secret" property="clientSecret"/>
|
||||
<result column="client_status" property="clientStatus"/>
|
||||
<result column="client_url" property="clientUrl"/>
|
||||
<result column="expire_time" property="expireTime"/>
|
||||
<result column="area_code" property="expireTime"/>
|
||||
<result column="area_name" property="expireTime"/>
|
||||
<result column="position_lng" property="expireTime"/>
|
||||
<result column="position_lat" property="expireTime"/>
|
||||
<result column="position_address" property="expireTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="modifier" property="modifier"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `rtmp_client` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`client_id` char(36) DEFAULT NULL COMMENT '主键',
|
||||
`client_code` varchar(255) DEFAULT NULL COMMENT '设备编码',
|
||||
`client_name` varchar(255) DEFAULT NULL COMMENT '客户端名称',
|
||||
`client_summary` varchar(255) DEFAULT NULL COMMENT '客户端描述',
|
||||
`client_key` varchar(255) DEFAULT NULL COMMENT '客户端用户名',
|
||||
`client_secret` varchar(255) DEFAULT NULL COMMENT '客户端密码',
|
||||
`client_status` varchar(20) DEFAULT '1' COMMENT '设备状态',
|
||||
`client_url` text COMMENT '客户端地址',
|
||||
`expire_time` varchar(255) DEFAULT '2099-12-31' COMMENT '过期时间',
|
||||
`area_code` varchar(255) DEFAULT NULL COMMENT '地区编码',
|
||||
`area_name` varchar(255) DEFAULT NULL COMMENT '地区名称',
|
||||
`position_lng` varchar(255) DEFAULT NULL COMMENT '位置经度',
|
||||
`position_lat` varchar(255) DEFAULT NULL COMMENT '位置纬度',
|
||||
`position_address` varchar(500) DEFAULT NULL COMMENT '位置地址',
|
||||
`creator` char(36) DEFAULT NULL COMMENT '创建人',
|
||||
`gmt_create` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`modifier` char(36) DEFAULT NULL COMMENT '修改人',
|
||||
`gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`is_delete` int(1) DEFAULT '0' COMMENT '是否删除',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `client_id` (`client_id`),
|
||||
UNIQUE KEY `client_code` (`client_code`),
|
||||
KEY `area_code` (`area_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='rtmp客户端';
|
||||
</update>
|
||||
|
||||
<!-- 新增rtmp客户端 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO rtmp_client(
|
||||
client_id,
|
||||
client_code,
|
||||
client_name,
|
||||
client_summary,
|
||||
client_key,
|
||||
client_secret,
|
||||
client_status,
|
||||
client_url,
|
||||
expire_time,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
gmt_modified,
|
||||
is_delete
|
||||
) VALUES(
|
||||
#{clientId},
|
||||
#{clientCode},
|
||||
#{clientName},
|
||||
#{clientSummary},
|
||||
#{clientKey},
|
||||
#{clientSecret},
|
||||
#{clientStatus},
|
||||
#{clientUrl},
|
||||
#{expireTime},
|
||||
#{creator},
|
||||
#{gmtCreate},
|
||||
#{modifier},
|
||||
#{gmtModified},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除rtmp客户端 -->
|
||||
<update id="remove" parameterType="map">
|
||||
UPDATE
|
||||
rtmp_client
|
||||
SET
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier},
|
||||
is_delete = 1
|
||||
WHERE
|
||||
client_id IN
|
||||
<foreach collection="clientIds" index="index" open="(" separator="," close=")">
|
||||
#{clientIds[${index}]}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 删除rtmp客户端(物理) -->
|
||||
<update id="delete" parameterType="map">
|
||||
DELETE FROM
|
||||
rtmp_client
|
||||
WHERE
|
||||
client_id IN
|
||||
<foreach collection="clientIds" index="index" open="(" separator="," close=")">
|
||||
#{clientIds[${index}]}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 修改rtmp客户端 -->
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
rtmp_client
|
||||
SET
|
||||
<if test="clientName != null and clientName != ''">
|
||||
client_name = #{clientName},
|
||||
</if>
|
||||
<if test="clientSummary != null and clientSummary != ''">
|
||||
client_summary = #{clientSummary},
|
||||
</if>
|
||||
<if test="clientKey != null and clientKey != ''">
|
||||
client_key = #{clientKey},
|
||||
</if>
|
||||
<if test="clientSecret != null and clientSecret != ''">
|
||||
client_secret = #{clientSecret},
|
||||
</if>
|
||||
<if test="clientStatus != null and clientStatus != ''">
|
||||
client_status = #{clientStatus},
|
||||
</if>
|
||||
<if test="clientUrl != null and clientUrl != ''">
|
||||
client_url = #{clientUrl},
|
||||
</if>
|
||||
<if test="expireTime != null and expireTime != ''">
|
||||
expire_time = #{expireTime},
|
||||
</if>
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier},
|
||||
client_id = client_id
|
||||
WHERE
|
||||
client_id = #{clientId}
|
||||
</update>
|
||||
|
||||
<!-- rtmp客户端详情 -->
|
||||
<select id="get" parameterType="map" resultMap="clientDTO">
|
||||
SELECT
|
||||
t1.client_code,
|
||||
t1.client_name,
|
||||
t1.client_summary,
|
||||
t1.client_key,
|
||||
t1.client_secret,
|
||||
t1.client_status,
|
||||
t1.client_url,
|
||||
t1.expire_time,
|
||||
t1.client_id
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="clientId != null and clientId != ''">
|
||||
AND
|
||||
t1.client_id = #{clientId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- rtmp客户端详情 -->
|
||||
<select id="getBO" parameterType="map" resultMap="clientBO">
|
||||
SELECT
|
||||
t1.client_id,
|
||||
t1.client_code,
|
||||
t1.client_name,
|
||||
t1.client_summary,
|
||||
t1.client_key,
|
||||
t1.client_secret,
|
||||
t1.client_status,
|
||||
t1.client_url,
|
||||
t1.expire_time,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t1.modifier,
|
||||
t1.gmt_modified,
|
||||
t1.is_delete
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="clientId != null and clientId != ''">
|
||||
AND
|
||||
t1.client_id = #{clientId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- rtmp客户端详情 -->
|
||||
<select id="getPO" parameterType="map" resultMap="clientPO">
|
||||
SELECT
|
||||
t1.client_id,
|
||||
t1.client_code,
|
||||
t1.client_name,
|
||||
t1.client_summary,
|
||||
t1.client_key,
|
||||
t1.client_secret,
|
||||
t1.client_status,
|
||||
t1.client_url,
|
||||
t1.expire_time,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t1.modifier,
|
||||
t1.gmt_modified,
|
||||
t1.is_delete
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="clientId != null and clientId != ''">
|
||||
AND
|
||||
t1.client_id = #{clientId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- rtmp客户端列表 -->
|
||||
<select id="list" parameterType="map" resultMap="clientDTO">
|
||||
SELECT
|
||||
t1.client_id,
|
||||
t1.client_code,
|
||||
t1.client_name,
|
||||
t1.client_summary,
|
||||
t1.client_key,
|
||||
t1.client_secret,
|
||||
t1.client_status,
|
||||
t1.client_url,
|
||||
t1.expire_time,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t1.modifier,
|
||||
t1.gmt_modified
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="clientIds != null and clientIds.size > 0">
|
||||
AND
|
||||
t1.client_id IN
|
||||
<foreach collection="clientIds" index="index" open="(" separator="," close=")">
|
||||
#{clientIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- rtmp客户端列表 -->
|
||||
<select id="listBO" parameterType="map" resultMap="clientBO">
|
||||
SELECT
|
||||
t1.client_id,
|
||||
t1.client_code,
|
||||
t1.client_name,
|
||||
t1.client_summary,
|
||||
t1.client_key,
|
||||
t1.client_secret,
|
||||
t1.client_status,
|
||||
t1.client_url,
|
||||
t1.expire_time,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t1.modifier,
|
||||
t1.gmt_modified,
|
||||
t1.is_delete
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="clientIds != null and clientIds.size > 0">
|
||||
AND
|
||||
t1.client_id IN
|
||||
<foreach collection="clientIds" index="index" open="(" separator="," close=")">
|
||||
#{clientIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- rtmp客户端列表 -->
|
||||
<select id="listPO" parameterType="map" resultMap="clientPO">
|
||||
SELECT
|
||||
t1.client_id,
|
||||
t1.client_code,
|
||||
t1.client_name,
|
||||
t1.client_summary,
|
||||
t1.client_key,
|
||||
t1.client_secret,
|
||||
t1.client_status,
|
||||
t1.client_url,
|
||||
t1.expire_time,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t1.modifier,
|
||||
t1.gmt_modified,
|
||||
t1.is_delete
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="clientIds != null and clientIds.size > 0">
|
||||
AND
|
||||
t1.client_id IN
|
||||
<foreach collection="clientIds" index="index" open="(" separator="," close=")">
|
||||
#{clientIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- rtmp客户端统计 -->
|
||||
<select id="count" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
rtmp_client t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 最新客户端 -->
|
||||
<select id="latestClientCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT
|
||||
client_code
|
||||
FROM
|
||||
rtmp_client
|
||||
WHERE
|
||||
is_delete = 0
|
||||
AND
|
||||
client_code LIKE CONCAT(#{_parameter}, '%')
|
||||
ORDER BY
|
||||
client_code DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user