refactor(video): Media/Stream 域 ORM 改造 + 全域硬删除转逻辑删除

- MediaServer 继承 BaseDO(共享表无 tenant_id)
- StreamProxy/StreamPush/CloudRecord/RecordPlan DO 改造
- 5 个 Mapper 继承 BaseMapperX
- 32 处 @Delete 硬删除转为逻辑删除(default 方法或 @Update SET deleted=1)
- Service/Controller/RPC 适配 int→Long 类型变化

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lzh
2026-04-07 01:14:16 +08:00
parent 0b0c264dca
commit f48c1846fb
71 changed files with 464 additions and 1031 deletions

View File

@@ -11,7 +11,7 @@ public class InviteInfo {
private String deviceId;
private Integer channelId;
private Long channelId;
private String stream;
@@ -42,7 +42,7 @@ public class InviteInfo {
private String endTime;
public static InviteInfo getInviteInfo(String deviceId, Integer channelId, String stream, SSRCInfo ssrcInfo, String mediaServerId,
public static InviteInfo getInviteInfo(String deviceId, Long channelId, String stream, SSRCInfo ssrcInfo, String mediaServerId,
String receiveIp, Integer receivePort, String streamMode,
InviteSessionType type, InviteSessionStatus status, Boolean record) {
InviteInfo inviteInfo = new InviteInfo();

View File

@@ -20,7 +20,7 @@ public class StreamInfo implements Serializable, Cloneable{
@Schema(description = "设备编号")
private String deviceId;
@Schema(description = "通道ID")
private Integer channelId;
private Long channelId;
@Schema(description = "IP")
private String ip;

View File

@@ -121,8 +121,8 @@ public class MediaConfig{
if (recordPath != null) {
mediaServer.setRecordPath(recordPath);
}
mediaServer.setCreateTime(DateUtil.getNow());
mediaServer.setUpdateTime(DateUtil.getNow());
mediaServer.setCreateTime(java.time.LocalDateTime.now());
mediaServer.setUpdateTime(java.time.LocalDateTime.now());
return mediaServer;
}

View File

@@ -331,7 +331,7 @@ public class ABLMediaNodeServerService implements IMediaNodeServerService {
if (inviteInfo == null || inviteInfo.getStreamInfo() == null) {
return;
}
List<CloudRecordItem> cloudRecordItemList = cloudRecordServiceMapper.getList(null, event.getApp(), event.getStream(),
List<CloudRecordItem> cloudRecordItemList = cloudRecordServiceMapper.getListAll(null, event.getApp(), event.getStream(),
null, null, null, null, null, null);
if (cloudRecordItemList.isEmpty()) {
return;
@@ -356,7 +356,7 @@ public class ABLMediaNodeServerService implements IMediaNodeServerService {
@Override
public Long updateDownloadProcess(MediaServer mediaServer, String app, String stream) {
List<CloudRecordItem> list = cloudRecordServiceMapper.getList(null, app, stream, null,
List<CloudRecordItem> list = cloudRecordServiceMapper.getListAll(null, app, stream, null,
null, null, null, null, null);
if (list.isEmpty()) {
return null;

View File

@@ -1,15 +1,20 @@
package com.viewsh.module.video.media.bean;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.mybatis.core.dataobject.BaseDO;
import com.viewsh.module.video.media.abl.bean.AblServerConfig;
import com.viewsh.module.video.media.zlm.dto.ZLMServerConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.ObjectUtils;
@Schema(description = "流媒体服务信息")
@Data
public class MediaServer {
@TableName("wvp_media_server")
@EqualsAndHashCode(callSuper = true)
public class MediaServer extends BaseDO {
@Schema(description = "ID")
private String id;
@@ -89,12 +94,6 @@ public class MediaServer {
@Schema(description = "assist服务端口")
private int recordAssistPort;
@Schema(description = "创建时间")
private String createTime;
@Schema(description = "更新时间")
private String updateTime;
@Schema(description = "上次心跳时间")
private String lastKeepaliveTime;

View File

@@ -381,12 +381,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
result.add(mediaServer);
}
result.sort((serverItem1, serverItem2)->{
int sortResult = 0;
LocalDateTime localDateTime1 = LocalDateTime.parse(serverItem1.getCreateTime(), DateUtil.formatter);
LocalDateTime localDateTime2 = LocalDateTime.parse(serverItem2.getCreateTime(), DateUtil.formatter);
sortResult = localDateTime1.compareTo(localDateTime2);
return sortResult;
if (serverItem1.getCreateTime() == null) return -1;
if (serverItem2.getCreateTime() == null) return 1;
return serverItem1.getCreateTime().compareTo(serverItem2.getCreateTime());
});
return result;
}
@@ -481,8 +478,8 @@ public class MediaServerServiceImpl implements IMediaServerService {
@Override
public void add(MediaServer mediaServer) {
mediaServer.setCreateTime(DateUtil.getNow());
mediaServer.setUpdateTime(DateUtil.getNow());
mediaServer.setCreateTime(LocalDateTime.now());
mediaServer.setUpdateTime(LocalDateTime.now());
if (mediaServer.getHookAliveInterval() == null || mediaServer.getHookAliveInterval() == 0F) {
mediaServer.setHookAliveInterval(10F);
}

View File

@@ -1,13 +1,13 @@
package com.viewsh.module.video.service;
import com.alibaba.fastjson2.JSONArray;
import com.viewsh.framework.common.pojo.PageResult;
import com.viewsh.module.video.common.StreamInfo;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.service.bean.CloudRecordItem;
import com.viewsh.module.video.service.bean.DownloadFileInfo;
import com.viewsh.module.video.service.bean.ErrorCallback;
import com.viewsh.module.video.vmanager.cloudRecord.bean.CloudRecordUrl;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Set;
@@ -21,7 +21,7 @@ public interface ICloudRecordService {
/**
* 分页回去云端录像列表
*/
PageInfo<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId, Boolean ascOrder);
PageResult<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId, Boolean ascOrder);
/**
* 获取所有的日期
@@ -48,14 +48,14 @@ public interface ICloudRecordService {
/**
* 添加指定录像收藏
*/
int changeCollectById(Integer recordId, boolean result);
int changeCollectById(Long recordId, boolean result);
/**
* 获取播放地址
*/
DownloadFileInfo getPlayUrlPath(Integer recordId);
DownloadFileInfo getPlayUrlPath(Long recordId);
List<CloudRecordItem> getAllList(String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId, List<Integer> ids);
List<CloudRecordItem> getAllList(String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId, List<Long> ids);
/**
* 加载录像文件,形成录像流
@@ -66,11 +66,11 @@ public interface ICloudRecordService {
void setRecordSpeed(String mediaServerId, String app, String stream, Integer speed, String schema);
void deleteFileByIds(Set<Integer> ids);
void deleteFileByIds(Set<Long> ids);
void loadMP4File(String app, String stream, int cloudRecordId, ErrorCallback<StreamInfo> callback);
void loadMP4File(String app, String stream, Long cloudRecordId, ErrorCallback<StreamInfo> callback);
List<CloudRecordUrl> getUrlListByIds(List<Integer> ids);
List<CloudRecordUrl> getUrlListByIds(List<Long> ids);
List<CloudRecordUrl> getUrlList(String app, String stream, String callId);
}

View File

@@ -1,31 +1,31 @@
package com.viewsh.module.video.service;
import com.viewsh.framework.common.pojo.PageResult;
import com.viewsh.module.video.gb28181.bean.CommonGBChannel;
import com.viewsh.module.video.service.bean.RecordPlan;
import com.github.pagehelper.PageInfo;
import java.util.List;
public interface IRecordPlanService {
RecordPlan get(Integer planId);
RecordPlan get(Long planId);
void update(RecordPlan plan);
void delete(Integer planId);
void delete(Long planId);
PageInfo<RecordPlan> query(Integer page, Integer count, String query);
PageResult<RecordPlan> query(Integer page, Integer count, String query);
void add(RecordPlan plan);
void link(List<Integer> channelIds, Integer planId);
void link(List<Long> channelIds, Long planId);
PageInfo<CommonGBChannel> queryChannelList(int page, int count, String query, Integer channelType, Boolean online, Integer planId, Boolean hasLink);
PageResult<CommonGBChannel> queryChannelList(int page, int count, String query, Integer channelType, Boolean online, Long planId, Boolean hasLink);
void linkAll(Integer planId);
void linkAll(Long planId);
void cleanAll(Integer planId);
void cleanAll(Long planId);
Integer recording(String app, String stream);
Long recording(String app, String stream);
}

View File

@@ -1,18 +0,0 @@
package com.viewsh.module.video.service;
import com.viewsh.module.video.storager.dao.dto.Role;
import java.util.List;
public interface IRoleService {
Role getRoleById(int id);
int add(Role role);
int delete(int id);
List<Role> getAll();
int update(Role role);
}

View File

@@ -8,14 +8,14 @@ import java.util.List;
public interface ISendRtpServerService {
SendRtpInfo createSendRtpInfo(MediaServer mediaServer, String ip, Integer port, String ssrc, String requesterId,
String deviceId, Integer channelId, Boolean isTcp, Boolean rtcp);
String deviceId, Long channelId, Boolean isTcp, Boolean rtcp);
SendRtpInfo createSendRtpInfo(MediaServer mediaServer, String ip, Integer port, String ssrc, String platformId,
String app, String stream, Integer channelId, Boolean tcp, Boolean rtcp);
String app, String stream, Long channelId, Boolean tcp, Boolean rtcp);
void update(SendRtpInfo sendRtpItem);
SendRtpInfo queryByChannelId(Integer channelId, String targetId);
SendRtpInfo queryByChannelId(Long channelId, String targetId);
SendRtpInfo queryByCallId(String callId);
@@ -29,15 +29,15 @@ public interface ISendRtpServerService {
void deleteByStream(String Stream, String targetId);
void deleteByChannel(Integer channelId, String targetId);
void deleteByChannel(Long channelId, String targetId);
List<SendRtpInfo> queryAll();
boolean isChannelSendingRTP(Integer channelId);
boolean isChannelSendingRTP(Long channelId);
List<SendRtpInfo> queryForPlatform(String platformId);
List<SendRtpInfo> queryByChannelId(int id);
List<SendRtpInfo> queryByChannelId(Long id);
void deleteByStream(String stream);

View File

@@ -1,25 +0,0 @@
package com.viewsh.module.video.service;
import com.viewsh.module.video.storager.dao.dto.UserApiKey;
import com.github.pagehelper.PageInfo;
public interface IUserApiKeyService {
int addApiKey(UserApiKey userApiKey);
boolean isApiKeyExists(String apiKey);
PageInfo<UserApiKey> getUserApiKeys(int page, int count);
int enable(Integer id);
int disable(Integer id);
int remark(Integer id, String remark);
int delete(Integer id);
UserApiKey getUserApiKeyById(Integer id);
int reset(Integer id, String apiKey);
}

View File

@@ -1,31 +0,0 @@
package com.viewsh.module.video.service;
import com.viewsh.module.video.storager.dao.dto.User;
import com.github.pagehelper.PageInfo;
import java.util.List;
public interface IUserService {
User getUser(String username, String password);
boolean changePassword(int id, String password);
User getUserById(int id);
User getUserByUsername(String username);
int addUser(User user);
int deleteUser(int id);
List<User> getAllUsers();
int updateUsers(User user);
boolean checkPushAuthority(String callId, String sign);
PageInfo<User> getUsers(int page, int count);
int changePushKey(int id, String pushKey);
}

View File

@@ -1,9 +1,14 @@
package com.viewsh.module.video.service.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.module.video.media.event.media.MediaRecordMp4Event;
import com.viewsh.module.video.media.event.media.MediaRecordProcessEvent;
import com.viewsh.module.video.utils.MediaServerUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Map;
@@ -11,11 +16,14 @@ import java.util.Map;
* 云端录像数据
*/
@Data
public class CloudRecordItem {
@TableName("wvp_cloud_record")
@EqualsAndHashCode(callSuper = true)
public class CloudRecordItem extends TenantBaseDO {
/**
* 主键
*/
private int id;
@TableId(type = IdType.AUTO)
private Long id;
/**
* 应用名

View File

@@ -15,7 +15,7 @@ public class GPSMsgInfo {
/**
* 通道ID
*/
private Integer channelId;
private Long channelId;
/**
*

View File

@@ -1,32 +1,37 @@
package com.viewsh.module.video.service.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@TableName("wvp_record_plan")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "录制计划")
public class RecordPlan {
public class RecordPlan extends TenantBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "计划数据库ID")
private int id;
private Long id;
@Schema(description = "计划名称")
private String name;
@TableField(exist = false)
@Schema(description = "计划关联通道数量")
private int channelCount;
@Schema(description = "是否开启定时截图")
private Boolean snap;
@Schema(description = "创建时间")
private String createTime;
@Schema(description = "更新时间")
private String updateTime;
@TableField(exist = false)
@Schema(description = "计划内容")
private List<RecordPlanItem> planItemList;
}

View File

@@ -1,14 +1,22 @@
package com.viewsh.module.video.service.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_record_plan_item")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "录制计划项")
public class RecordPlanItem {
public class RecordPlanItem extends TenantBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "计划项数据库ID")
private int id;
private Long id;
@Schema(description = "计划开始时间的序号, 从0点开始每半个小时增加1")
private Integer start;
@@ -20,6 +28,6 @@ public class RecordPlanItem {
private Integer weekDay;
@Schema(description = "所属计划ID")
private Integer planId;
private Long planId;
}

View File

@@ -21,8 +21,9 @@ import com.viewsh.module.video.storager.dao.CloudRecordServiceMapper;
import com.viewsh.module.video.utils.DateUtil;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.cloudRecord.bean.CloudRecordUrl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.viewsh.framework.common.pojo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,7 +63,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
private IRedisRpcPlayService redisRpcPlayService;
@Override
public PageInfo<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime,
public PageResult<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime,
String endTime, List<MediaServer> mediaServerItems, String callId, Boolean ascOrder) {
// 开始时间和结束时间在数据库中都是以秒为单位的
Long startTimeStamp = null;
@@ -81,15 +82,15 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
endTimeStamp = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestampMs(endTime);
}
PageHelper.startPage(page, count);
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<CloudRecordItem> all = cloudRecordServiceMapper.getList(query, app, stream, startTimeStamp, endTimeStamp,
IPage<CloudRecordItem> ipage = new Page<>(page, count);
IPage<CloudRecordItem> result = cloudRecordServiceMapper.getList(ipage, query, app, stream, startTimeStamp, endTimeStamp,
callId, mediaServerItems, null, ascOrder);
return new PageInfo<>(all);
return new PageResult<>(result.getRecords(), result.getTotal());
}
@Override
@@ -103,7 +104,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
}
long startTimeStamp = startDate.atStartOfDay().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
long endTimeStamp = endDate.atStartOfDay().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
List<CloudRecordItem> cloudRecordItemList = cloudRecordServiceMapper.getList(null, app, stream, startTimeStamp,
List<CloudRecordItem> cloudRecordItemList = cloudRecordServiceMapper.getListAll(null, app, stream, startTimeStamp,
endTimeStamp, null, mediaServerItems, null, null);
if (cloudRecordItemList.isEmpty()) {
return new ArrayList<>();
@@ -216,7 +217,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
mediaServerItems = null;
}
List<CloudRecordItem> all = cloudRecordServiceMapper.getList(null, app, stream, startTimeStamp, endTimeStamp,
List<CloudRecordItem> all = cloudRecordServiceMapper.getListAll(null, app, stream, startTimeStamp, endTimeStamp,
callId, mediaServerItems, null, null);
if (all.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到待收藏的视频");
@@ -239,12 +240,12 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
}
@Override
public int changeCollectById(Integer recordId, boolean result) {
public int changeCollectById(Long recordId, boolean result) {
return cloudRecordServiceMapper.changeCollectById(result, recordId);
}
@Override
public DownloadFileInfo getPlayUrlPath(Integer recordId) {
public DownloadFileInfo getPlayUrlPath(Long recordId) {
CloudRecordItem recordItem = cloudRecordServiceMapper.queryOne(recordId);
if (recordItem == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "资源不存在");
@@ -259,7 +260,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
}
@Override
public List<CloudRecordItem> getAllList(String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId, List<Integer> ids) {
public List<CloudRecordItem> getAllList(String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId, List<Long> ids) {
// 开始时间和结束时间在数据库中都是以秒为单位的
Long startTimeStamp = null;
Long endTimeStamp = null;
@@ -277,12 +278,12 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
endTimeStamp = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestampMs(endTime);
}
return cloudRecordServiceMapper.getList(query, app, stream, startTimeStamp, endTimeStamp,
return cloudRecordServiceMapper.getListAll(query, app, stream, startTimeStamp, endTimeStamp,
callId, mediaServerItems, ids, null);
}
@Override
public void loadMP4File(String app, String stream, int cloudRecordId, ErrorCallback<StreamInfo> callback) {
public void loadMP4File(String app, String stream, Long cloudRecordId, ErrorCallback<StreamInfo> callback) {
CloudRecordItem recordItem = cloudRecordServiceMapper.queryOne(cloudRecordId);
if (recordItem == null) {
@@ -315,7 +316,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
long startTimestamp = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestampMs(date + " 00:00:00");
long endTimestamp = startTimestamp + 24 * 60 * 60 * 1000;
List<CloudRecordItem> recordItemList = cloudRecordServiceMapper.getList(null, app, stream, startTimestamp, endTimestamp, null, null, null, false);
List<CloudRecordItem> recordItemList = cloudRecordServiceMapper.getListAll(null, app, stream, startTimestamp, endTimestamp, null, null, null, false);
if (recordItemList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此时间无录像");
}
@@ -352,7 +353,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
}
@Override
public void deleteFileByIds(Set<Integer> ids) {
public void deleteFileByIds(Set<Long> ids) {
log.info("[删除录像文件] ids: {}", ids.toArray());
List<CloudRecordItem> cloudRecordItemList = cloudRecordServiceMapper.queryRecordByIds(ids);
if (cloudRecordItemList.isEmpty()) {
@@ -388,7 +389,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
}
@Override
public List<CloudRecordUrl> getUrlListByIds(List<Integer> ids) {
public List<CloudRecordUrl> getUrlListByIds(List<Long> ids) {
List<CloudRecordItem> cloudRecordItems = cloudRecordServiceMapper.queryRecordByIds(ids);
if (cloudRecordItems.isEmpty()) {
return List.of();

View File

@@ -20,7 +20,6 @@ import com.viewsh.module.video.media.zlm.dto.StreamAuthorityInfo;
import com.viewsh.module.video.service.IMediaService;
import com.viewsh.module.video.service.IRecordPlanService;
import com.viewsh.module.video.service.ISendRtpServerService;
import com.viewsh.module.video.service.IUserService;
import com.viewsh.module.video.storager.IRedisCatchStorage;
import com.viewsh.module.video.streamProxy.bean.StreamProxy;
import com.viewsh.module.video.streamProxy.service.IStreamProxyService;
@@ -54,9 +53,6 @@ public class MediaServiceImpl implements IMediaService {
@Qualifier("videoRedisTemplate")
private RedisTemplate<Object, Object> redisTemplate;
@Autowired
private IUserService userService;
@Autowired
private IInviteStreamService inviteStreamService;
@@ -139,8 +135,8 @@ public class MediaServiceImpl implements IMediaService {
}
// 推流自定义播放鉴权码
String callId = paramMap.get("callId");
// 鉴权配置
boolean hasAuthority = userService.checkPushAuthority(callId, sign);
// TODO: 推流 pushKey 鉴权尚未对接 viewsh-module-system暂时拒绝所有推流鉴权请求
boolean hasAuthority = false;
if (!hasAuthority) {
log.info("推流鉴权失败: sign 无权限: callId={}. sign={}", callId, sign);
throw new ControllerException(ErrorCode.ERROR401.getCode(), "Unauthorized");
@@ -192,7 +188,7 @@ public class MediaServiceImpl implements IMediaService {
redisCatchStorage.updateStreamAuthorityInfo(app, ssrcTransaction.getStream(), streamAuthorityInfo);
String deviceId = ssrcTransaction.getDeviceId();
Integer channelId = ssrcTransaction.getChannelId();
Long channelId = ssrcTransaction.getChannelId();
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channelId);
if (deviceChannel != null) {
result.setEnable_audio(deviceChannel.isHasAudio());

View File

@@ -106,7 +106,7 @@ public class MobilePositionServiceImpl implements IMobilePositionService {
mobilePositionMapper.batchadd(mobilePositions);
}
log.info("[移动位置订阅]更新通道位置: {}", mobilePositions.size());
Map<String, Map<Integer, DeviceChannel>> updateChannelMap = new HashMap<>();
Map<String, Map<Long, DeviceChannel>> updateChannelMap = new HashMap<>();
for (MobilePosition mobilePosition : mobilePositions) {
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setId(mobilePosition.getChannelId());
@@ -114,7 +114,6 @@ public class MobilePositionServiceImpl implements IMobilePositionService {
deviceChannel.setLongitude(mobilePosition.getLongitude());
deviceChannel.setLatitude(mobilePosition.getLatitude());
deviceChannel.setGpsTime(mobilePosition.getTime());
deviceChannel.setUpdateTime(DateUtil.getNow());
if (mobilePosition.getLongitude() > 0 || mobilePosition.getLatitude() > 0) {
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
deviceChannel.setGbLongitude(wgs84Position[0]);
@@ -132,7 +131,7 @@ public class MobilePositionServiceImpl implements IMobilePositionService {
}
List<Device> deviceList = deviceMapper.queryByDeviceIds(deviceIds);
for (Device device : deviceList) {
Map<Integer, DeviceChannel> channelMap = updateChannelMap.get(device.getDeviceId());
Map<Long, DeviceChannel> channelMap = updateChannelMap.get(device.getDeviceId());
if (device.getGeoCoordSys().equalsIgnoreCase("GCJ02")) {
channelMap.values().forEach(channel -> {
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(channel.getLongitude(), channel.getLatitude());

View File

@@ -15,8 +15,9 @@ import com.viewsh.module.video.service.bean.RecordPlanItem;
import com.viewsh.module.video.storager.dao.RecordPlanMapper;
import com.viewsh.module.video.utils.DateUtil;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.viewsh.framework.common.pojo.PageResult;
import com.google.common.base.Joiner;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,7 +56,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
@EventListener
public void onApplicationEvent(MediaDepartureEvent event) {
// 流断开,检查是否还处于录像状态, 如果是则继续录像
Integer channelId = recording(event.getApp(), event.getStream());
Long channelId = recording(event.getApp(), event.getStream());
if(channelId == null) {
return;
}
@@ -77,23 +78,23 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}));
}
Map<Integer, StreamInfo> recordStreamMap = new HashMap<>();
Map<Long, StreamInfo> recordStreamMap = new HashMap<>();
@Scheduled(fixedRate = 1, timeUnit = TimeUnit.MINUTES)
public void execution() {
// 查询现在需要录像的通道Id
List<Integer> startChannelIdList = queryCurrentChannelRecord();
List<Long> startChannelIdList = queryCurrentChannelRecord();
if (startChannelIdList.isEmpty()) {
// 当前没有录像任务, 如果存在旧的正在录像的就移除
if(!recordStreamMap.isEmpty()) {
Set<Integer> recordStreamSet = new HashSet<>(recordStreamMap.keySet());
Set<Long> recordStreamSet = new HashSet<>(recordStreamMap.keySet());
stopStreams(recordStreamSet, recordStreamMap);
recordStreamMap.clear();
}
}else {
// 当前存在录像任务, 获取正在录像中存在但是当前录制列表不存在的内容,进行停止; 获取正在录像中没有但是当前需录制的列表中存在的进行开启.
Set<Integer> recordStreamSet = new HashSet<>(recordStreamMap.keySet());
Set<Long> recordStreamSet = new HashSet<>(recordStreamMap.keySet());
startChannelIdList.forEach(recordStreamSet::remove);
if (!recordStreamSet.isEmpty()) {
// 正在录像中存在但是当前录制列表不存在的内容,进行停止;
@@ -128,7 +129,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
/**
* 获取当前时间段应该录像的通道Id列表
*/
private List<Integer> queryCurrentChannelRecord(){
private List<Long> queryCurrentChannelRecord(){
// 获取当前时间在一周内的序号, 数据库存储的从第几个30分钟开始, 0-47, 包括首尾
LocalDateTime now = LocalDateTime.now();
int week = now.getDayOfWeek().getValue();
@@ -138,8 +139,8 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
return recordPlanMapper.queryRecordIng(week, index);
}
private void stopStreams(Collection<Integer> channelIds, Map<Integer, StreamInfo> recordStreamMap) {
for (Integer channelId : channelIds) {
private void stopStreams(Collection<Long> channelIds, Map<Long, StreamInfo> recordStreamMap) {
for (Long channelId : channelIds) {
try {
StreamInfo streamInfo = recordStreamMap.get(channelId);
if (streamInfo == null) {
@@ -160,8 +161,8 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}
@Override
public Integer recording(String app, String stream) {
for (Integer channelId : recordStreamMap.keySet()) {
public Long recording(String app, String stream) {
for (Long channelId : recordStreamMap.keySet()) {
StreamInfo streamInfo = recordStreamMap.get(channelId);
if (streamInfo != null && streamInfo.getApp().equals(app) && streamInfo.getStream().equals(stream)) {
return channelId;
@@ -173,10 +174,8 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
@Override
@Transactional
public void add(RecordPlan plan) {
plan.setCreateTime(DateUtil.getNow());
plan.setUpdateTime(DateUtil.getNow());
recordPlanMapper.add(plan);
if (plan.getId() > 0 && !plan.getPlanItemList().isEmpty()) {
if (plan.getId() != null && plan.getId() > 0 && !plan.getPlanItemList().isEmpty()) {
for (RecordPlanItem recordPlanItem : plan.getPlanItemList()) {
recordPlanItem.setPlanId(plan.getId());
}
@@ -186,7 +185,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}
@Override
public RecordPlan get(Integer planId) {
public RecordPlan get(Long planId) {
RecordPlan recordPlan = recordPlanMapper.get(planId);
if (recordPlan == null) {
return null;
@@ -201,7 +200,6 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
@Override
@Transactional
public void update(RecordPlan plan) {
plan.setUpdateTime(DateUtil.getNow());
recordPlanMapper.update(plan);
recordPlanMapper.cleanItems(plan.getId());
if (plan.getPlanItemList() != null && !plan.getPlanItemList().isEmpty()){
@@ -225,7 +223,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
@Override
@Transactional
public void delete(Integer planId) {
public void delete(Long planId) {
RecordPlan recordPlan = recordPlanMapper.get(planId);
if (recordPlan == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "录制计划不存在");
@@ -238,19 +236,19 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}
@Override
public PageInfo<RecordPlan> query(Integer page, Integer count, String query) {
PageHelper.startPage(page, count);
public PageResult<RecordPlan> query(Integer page, Integer count, String query) {
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<RecordPlan> all = recordPlanMapper.query(query);
return new PageInfo<>(all);
IPage<RecordPlan> ipage = new Page<>(page, count);
IPage<RecordPlan> result = recordPlanMapper.query(ipage, query);
return new PageResult<>(result.getRecords(), result.getTotal());
}
@Override
public void link(List<Integer> channelIds, Integer planId) {
public void link(List<Long> channelIds, Long planId) {
if (channelIds == null || channelIds.isEmpty()) {
log.info("[录制计划] 关联/移除关联时, 通道编号必须存在");
throw new ControllerException(ErrorCode.ERROR100.getCode(), "通道编号必须存在");
@@ -265,24 +263,24 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}
@Override
public PageInfo<CommonGBChannel> queryChannelList(int page, int count, String query, Integer dataType, Boolean online, Integer planId, Boolean hasLink) {
PageHelper.startPage(page, count);
public PageResult<CommonGBChannel> queryChannelList(int page, int count, String query, Integer dataType, Boolean online, Long planId, Boolean hasLink) {
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<CommonGBChannel> all = channelMapper.queryForRecordPlanForWebList(planId, query, dataType, online, hasLink);
return new PageInfo<>(all);
IPage<CommonGBChannel> ipage = new Page<>(page, count);
IPage<CommonGBChannel> result = channelMapper.queryForRecordPlanForWebList(ipage, planId, query, dataType, online, hasLink);
return new PageResult<>(result.getRecords(), result.getTotal());
}
@Override
public void linkAll(Integer planId) {
public void linkAll(Long planId) {
channelMapper.addRecordPlanForAll(planId);
}
@Override
public void cleanAll(Integer planId) {
public void cleanAll(Long planId) {
channelMapper.removeRecordPlanByPlanId(planId);
}
}

View File

@@ -1,41 +0,0 @@
package com.viewsh.module.video.service.impl;
import com.viewsh.module.video.service.IRoleService;
import com.viewsh.module.video.storager.dao.RoleMapper;
import com.viewsh.module.video.storager.dao.dto.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RoleServerImpl implements IRoleService {
@Autowired
private RoleMapper roleMapper;
@Override
public Role getRoleById(int id) {
return roleMapper.selectById(id);
}
@Override
public int add(Role role) {
return roleMapper.add(role);
}
@Override
public int delete(int id) {
return roleMapper.delete(id);
}
@Override
public List<Role> getAll() {
return roleMapper.selectAll();
}
@Override
public int update(Role role) {
return roleMapper.update(role);
}
}

View File

@@ -34,7 +34,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
@Override
public SendRtpInfo createSendRtpInfo(MediaServer mediaServer, String ip, Integer port, String ssrc, String requesterId,
String deviceId, Integer channelId, Boolean isTcp, Boolean rtcp) {
String deviceId, Long channelId, Boolean isTcp, Boolean rtcp) {
int localPort = getNextPort(mediaServer);
if (localPort <= 0) {
return null;
@@ -45,7 +45,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
@Override
public SendRtpInfo createSendRtpInfo(MediaServer mediaServer, String ip, Integer port, String ssrc, String platformId,
String app, String stream, Integer channelId, Boolean tcp, Boolean rtcp){
String app, String stream, Long channelId, Boolean tcp, Boolean rtcp){
int localPort = getNextPort(mediaServer);
if (localPort <= 0) {
@@ -69,7 +69,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
}
@Override
public SendRtpInfo queryByChannelId(Integer channelId, String targetId) {
public SendRtpInfo queryByChannelId(Long channelId, String targetId) {
String key = VideoManagerConstants.SEND_RTP_INFO_CHANNEL + channelId;
return JsonUtil.redisHashJsonToObject(redisTemplate, key, targetId, SendRtpInfo.class);
}
@@ -136,7 +136,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
}
@Override
public void deleteByChannel(Integer channelId, String targetId) {
public void deleteByChannel(Long channelId, String targetId) {
SendRtpInfo sendRtpInfo = queryByChannelId(channelId, targetId);
if (sendRtpInfo == null) {
return;
@@ -145,7 +145,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
}
@Override
public List<SendRtpInfo> queryByChannelId(int channelId) {
public List<SendRtpInfo> queryByChannelId(Long channelId) {
String key = VideoManagerConstants.SEND_RTP_INFO_CHANNEL + channelId;
List<Object> values = redisTemplate.opsForHash().values(key);
List<SendRtpInfo> result= new ArrayList<>();
@@ -170,7 +170,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
* 查询某个通道是否存在上级点播RTP推送
*/
@Override
public boolean isChannelSendingRTP(Integer channelId) {
public boolean isChannelSendingRTP(Long channelId) {
List<SendRtpInfo> sendRtpInfoList = queryByChannelId(channelId);
return !sendRtpInfoList.isEmpty();
}

View File

@@ -1,80 +0,0 @@
package com.viewsh.module.video.service.impl;
import com.viewsh.module.video.service.IUserApiKeyService;
import com.viewsh.module.video.storager.dao.UserApiKeyMapper;
import com.viewsh.module.video.storager.dao.dto.UserApiKey;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserApiKeyServiceImpl implements IUserApiKeyService {
@Autowired
UserApiKeyMapper userApiKeyMapper;
@Autowired
@Qualifier("videoRedisTemplate")
private RedisTemplate<Object, Object> redisTemplate;
@Override
public int addApiKey(UserApiKey userApiKey) {
return userApiKeyMapper.add(userApiKey);
}
@Override
public boolean isApiKeyExists(String apiKey) {
return userApiKeyMapper.isApiKeyExists(apiKey);
}
@Override
public PageInfo<UserApiKey> getUserApiKeys(int page, int count) {
PageHelper.startPage(page, count);
List<UserApiKey> userApiKeys = userApiKeyMapper.getUserApiKeys();
return new PageInfo<>(userApiKeys);
}
@Cacheable(cacheNames = "userApiKey", key = "#id", sync = true)
@Override
public UserApiKey getUserApiKeyById(Integer id) {
return userApiKeyMapper.selectById(id);
}
@CacheEvict(cacheNames = "userApiKey", key = "#id")
@Override
public int enable(Integer id) {
return userApiKeyMapper.enable(id);
}
@CacheEvict(cacheNames = "userApiKey", key = "#id")
@Override
public int disable(Integer id) {
return userApiKeyMapper.disable(id);
}
@CacheEvict(cacheNames = "userApiKey", key = "#id")
@Override
public int remark(Integer id, String remark) {
return userApiKeyMapper.remark(id, remark);
}
@CacheEvict(cacheNames = "userApiKey", key = "#id")
@Override
public int delete(Integer id) {
return userApiKeyMapper.delete(id);
}
@CacheEvict(cacheNames = "userApiKey", key = "#id")
@Override
public int reset(Integer id, String apiKey) {
return userApiKeyMapper.apiKey(id, apiKey);
}
}

View File

@@ -1,97 +0,0 @@
package com.viewsh.module.video.service.impl;
import com.viewsh.module.video.service.IUserService;
import com.viewsh.module.video.storager.dao.UserMapper;
import com.viewsh.module.video.storager.dao.dto.User;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import java.util.List;
@Service
public class UserServiceImpl implements IUserService {
@Autowired
private UserMapper userMapper;
@Override
public User getUser(String username, String password) {
return userMapper.select(username, password);
}
@Override
public boolean changePassword(int id, String password) {
User user = userMapper.selectById(id);
user.setPassword(password);
return userMapper.update(user) > 0;
}
@Override
public User getUserById(int id) {
return userMapper.selectById(id);
}
@Override
public User getUserByUsername(String username) {
return userMapper.getUserByUsername(username);
}
@Override
public int addUser(User user) {
User userByUsername = userMapper.getUserByUsername(user.getUsername());
if (userByUsername != null) {
return 0;
}
return userMapper.add(user);
}
@Override
public int deleteUser(int id) {
return userMapper.delete(id);
}
@Override
public List<User> getAllUsers() {
return userMapper.selectAll();
}
@Override
public int updateUsers(User user) {
return userMapper.update(user);
}
@Override
public boolean checkPushAuthority(String callId, String sign) {
List<User> users = userMapper.getUsers();
if (users.size() == 0) {
return false;
}
for (User user : users) {
if (user.getPushKey() == null) {
continue;
}
String checkStr = callId == null? user.getPushKey():(callId + "_" + user.getPushKey()) ;
String checkSign = DigestUtils.md5DigestAsHex(checkStr.getBytes());
if (checkSign.equals(sign)) {
return true;
}
}
return false;
}
@Override
public PageInfo<User> getUsers(int page, int count) {
PageHelper.startPage(page, count);
List<User> users = userMapper.getUsers();
return new PageInfo<>(users);
}
@Override
public int changePushKey(int id, String pushKey) {
return userMapper.changePushKey(id,pushKey);
}
}

View File

@@ -10,29 +10,29 @@ import com.viewsh.module.video.vmanager.bean.AudioBroadcastResult;
public interface IRedisRpcPlayService {
void play(String serverId, Integer channelId, ErrorCallback<StreamInfo> callback);
void play(String serverId, Long channelId, ErrorCallback<StreamInfo> callback);
void stop(String serverId, InviteSessionType type, int channelId, String stream);
void stop(String serverId, InviteSessionType type, Long channelId, String stream);
void playback(String serverId, Integer channelId, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
void playback(String serverId, Long channelId, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
void playbackPause(String serverId, String streamId);
void playbackResume(String serverId, String streamId);
void download(String serverId, Integer channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
void download(String serverId, Long channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
void queryRecordInfo(String serverId, Integer channelId, String startTime, String endTime, ErrorCallback<RecordInfo> callback);
void queryRecordInfo(String serverId, Long channelId, String startTime, String endTime, ErrorCallback<RecordInfo> callback);
String frontEndCommand(String serverId, Integer channelId, int cmdCode, int parameter1, int parameter2, int combindCode2);
String frontEndCommand(String serverId, Long channelId, int cmdCode, int parameter1, int parameter2, int combindCode2);
void playPush(String serverId, Integer id, ErrorCallback<StreamInfo> callback);
void playPush(String serverId, Long id, ErrorCallback<StreamInfo> callback);
void playProxy(String serverId, int id, ErrorCallback<StreamInfo> callback);
void playProxy(String serverId, Long id, ErrorCallback<StreamInfo> callback);
void stopProxy(String serverId, int id);
void stopProxy(String serverId, Long id);
DownloadFileInfo getRecordPlayUrl(String serverId, Integer recordId);
DownloadFileInfo getRecordPlayUrl(String serverId, Long recordId);
AudioBroadcastResult audioBroadcast(String serverId, String deviceId, String channelDeviceId, Boolean broadcastMode);
}

View File

@@ -17,7 +17,7 @@ public interface IRedisRpcService {
WVPResult stopSendRtp(String callId);
long waitePushStreamOnline(SendRtpInfo sendRtpItem, CommonCallback<Integer> callback);
long waitePushStreamOnline(SendRtpInfo sendRtpItem, CommonCallback<Long> callback);
void stopWaitePushStreamOnline(SendRtpInfo sendRtpItem);
@@ -35,17 +35,17 @@ public interface IRedisRpcService {
boolean updatePlatform(String serverId, Platform platform);
boolean deletePlatform(String serverId, Integer platformId);
boolean deletePlatform(String serverId, Long platformId);
int addPlatformChannelList(String serverGBId, ChannelListForRpcParam channelListForRpcParam);
int removeAllPlatformChannel(String serverId, Integer platformId);
int removeAllPlatformChannel(String serverId, Long platformId);
int removePlatformChannelList(String serverId, ChannelListForRpcParam channelListForRpcParam);
boolean updateCustomPlatformChannel(String serverId, PlatformChannel channel);
boolean pushPlatformChannel(String serverId, Integer platformId);
boolean pushPlatformChannel(String serverId, Long platformId);
void catalogEventPublish(String serverId, CatalogEvent catalogEvent);

View File

@@ -96,7 +96,6 @@ public class RedisAlarmMsgListener implements MessageListener {
String chanelId = alarmChannelMessage.getGbId();
DeviceAlarm deviceAlarm = new DeviceAlarm();
deviceAlarm.setCreateTime(DateUtil.getNow());
deviceAlarm.setChannelId(chanelId);
deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());

View File

@@ -8,7 +8,6 @@ import com.viewsh.module.video.gb28181.bean.Group;
import com.viewsh.module.video.gb28181.bean.RedisGroupMessage;
import com.viewsh.module.video.gb28181.service.IGroupService;
import com.viewsh.module.video.streamPush.service.IStreamPushService;
import com.viewsh.module.video.utils.DateUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
@@ -118,8 +117,6 @@ public class RedisGroupChangeListener implements MessageListener {
group.setParentId(parentGroup.getId());
group.setParentDeviceId(parentGroup.getDeviceId());
}
group.setCreateTime(DateUtil.getNow());
group.setUpdateTime(DateUtil.getNow());
groupService.add(group);
break;
@@ -134,7 +131,6 @@ public class RedisGroupChangeListener implements MessageListener {
continue;
}
group.setName(groupMessage.getGroupName());
group.setUpdateTime(DateUtil.getNow());
if (groupMessage.getParentGAlias() != null) {
Group parentGroup = groupService.queryGroupByAlias(groupMessage.getParentGAlias());
if (parentGroup == null) {

View File

@@ -10,7 +10,6 @@ import com.viewsh.module.video.gb28181.bean.Group;
import com.viewsh.module.video.gb28181.bean.RedisGroupMessage;
import com.viewsh.module.video.gb28181.service.IGroupService;
import com.viewsh.module.video.storager.IRedisCatchStorage;
import com.viewsh.module.video.utils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -100,7 +99,6 @@ public class RedisGroupMsgListener implements MessageListener {
group.setDeviceId(deviceId);
group.setAlias(groupMessage.getGroupAlias());
group.setName(groupMessage.getGroupName());
group.setCreateTime(DateUtil.getNow());
}
if (!isTop) {
@@ -138,7 +136,6 @@ public class RedisGroupMsgListener implements MessageListener {
group.setBusinessGroup(group.getDeviceId());
group.setParentDeviceId(null);
}
group.setUpdateTime(DateUtil.getNow());
aliasGroupToSave.put(group.getAlias(), group);
}
log.info("[业务分组同步回复-存储分组数据] {}", JSONObject.toJSONString(aliasGroupToSave.values()));

View File

@@ -8,7 +8,6 @@ import com.viewsh.module.video.storager.IRedisCatchStorage;
import com.viewsh.module.video.streamPush.bean.RedisPushStreamMessage;
import com.viewsh.module.video.streamPush.bean.StreamPush;
import com.viewsh.module.video.streamPush.service.IStreamPushService;
import com.viewsh.module.video.utils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
@@ -91,8 +90,6 @@ public class RedisPushStreamListMsgListener implements MessageListener {
continue;
}
StreamPush streamPush = pushStreamMessage.buildstreamPush();
streamPush.setCreateTime(DateUtil.getNow());
streamPush.setUpdateTime(DateUtil.getNow());
streamPush.setMediaServerId(mediaServerService.getDefaultMediaServer().getId());
streamPushItemForSave.add(streamPush);
allGBId.put(streamPush.getGbDeviceId(), streamPush);
@@ -107,7 +104,6 @@ public class RedisPushStreamListMsgListener implements MessageListener {
continue;
}
StreamPush streamPush = allAppAndStream.get(app + stream);
streamPush.setUpdateTime(DateUtil.getNow());
streamPush.setGbDeviceId(pushStreamMessage.getGbId());
streamPush.setGbName(pushStreamMessage.getName());
if (pushStreamMessage.getStatus() != null) {

View File

@@ -62,7 +62,7 @@ public class RedisRpcChannelPlayController extends RpcController {
*/
@RedisRpcMapping("play")
public RedisRpcResponse playChannel(RedisRpcRequest request) {
int channelId = Integer.parseInt(request.getParam().toString());
long channelId = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
if (channelId <= 0) {
@@ -100,7 +100,7 @@ public class RedisRpcChannelPlayController extends RpcController {
@RedisRpcMapping("queryRecordInfo")
public RedisRpcResponse queryRecordInfo(RedisRpcRequest request) {
JSONObject paramJson = JSONObject.parseObject(request.getParam().toString());
int channelId = paramJson.getIntValue("channelId");
long channelId = paramJson.getLongValue("channelId");
String startTime = paramJson.getString("startTime");
String endTime = paramJson.getString("endTime");
RedisRpcResponse response = request.getResponse();
@@ -197,8 +197,8 @@ public class RedisRpcChannelPlayController extends RpcController {
RedisRpcResponse response = request.getResponse();
Integer channelId = jsonObject.getIntValue("channelId");
if (channelId == null || channelId <= 0) {
long channelId = jsonObject.getLongValue("channelId");
if (channelId <= 0) {
response.setStatusCode(ErrorCode.ERROR400.getCode());
response.setBody("param error");
return response;
@@ -230,7 +230,7 @@ public class RedisRpcChannelPlayController extends RpcController {
@RedisRpcMapping("playback")
public RedisRpcResponse playbackChannel(RedisRpcRequest request) {
JSONObject paramJson = JSONObject.parseObject(request.getParam().toString());
int channelId = paramJson.getIntValue("channelId");
long channelId = paramJson.getLongValue("channelId");
String startTime = paramJson.getString("startTime");
String endTime = paramJson.getString("endTime");
RedisRpcResponse response = request.getResponse();
@@ -271,7 +271,7 @@ public class RedisRpcChannelPlayController extends RpcController {
@RedisRpcMapping("download")
public RedisRpcResponse downloadChannel(RedisRpcRequest request) {
JSONObject paramJson = JSONObject.parseObject(request.getParam().toString());
int channelId = paramJson.getIntValue("channelId");
long channelId = paramJson.getLongValue("channelId");
String startTime = paramJson.getString("startTime");
String endTime = paramJson.getString("endTime");
int downloadSpeed = paramJson.getIntValue("downloadSpeed");
@@ -314,7 +314,7 @@ public class RedisRpcChannelPlayController extends RpcController {
@RedisRpcMapping("ptz/frontEndCommand")
public RedisRpcResponse frontEndCommand(RedisRpcRequest request) {
JSONObject paramJson = JSONObject.parseObject(request.getParam().toString());
int channelId = paramJson.getIntValue("channelId");
long channelId = paramJson.getLongValue("channelId");
int cmdCode = paramJson.getIntValue("cmdCode");
int parameter1 = paramJson.getIntValue("parameter1");
int parameter2 = paramJson.getIntValue("parameter2");

View File

@@ -47,7 +47,7 @@ public class RedisRpcCloudRecordController extends RpcController {
*/
@RedisRpcMapping("play")
public RedisRpcResponse play(RedisRpcRequest request) {
int id = Integer.parseInt(request.getParam().toString());
Long id = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
if (id <= 0) {
response.setStatusCode(ErrorCode.ERROR400.getCode());

View File

@@ -74,7 +74,7 @@ public class RedisRpcPlatformController extends RpcController {
*/
@RedisRpcMapping("delete")
public RedisRpcResponse delete(RedisRpcRequest request) {
Integer platformId = Integer.parseInt(request.getParam().toString());
Long platformId = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
try {
boolean result = platformService.delete(platformId);
@@ -91,7 +91,7 @@ public class RedisRpcPlatformController extends RpcController {
*/
@RedisRpcMapping("pushChannel")
public RedisRpcResponse pushChannel(RedisRpcRequest request) {
Integer platformId = Integer.parseInt(request.getParam().toString());
Long platformId = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
try {
platformChannelService.pushChannel(platformId);
@@ -127,7 +127,7 @@ public class RedisRpcPlatformController extends RpcController {
*/
@RedisRpcMapping("removeAllChannel")
public RedisRpcResponse removeAllChannel(RedisRpcRequest request) {
Integer platformId = Integer.parseInt(request.getParam().toString());
Long platformId = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
try {
int result = platformChannelService.removeAllChannel(platformId);

View File

@@ -51,7 +51,7 @@ public class RedisRpcStreamProxyController extends RpcController {
*/
@RedisRpcMapping("play")
public RedisRpcResponse play(RedisRpcRequest request) {
int id = Integer.parseInt(request.getParam().toString());
long id = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
if (id <= 0) {
response.setStatusCode(ErrorCode.ERROR400.getCode());
@@ -78,7 +78,7 @@ public class RedisRpcStreamProxyController extends RpcController {
*/
@RedisRpcMapping("stop")
public RedisRpcResponse stop(RedisRpcRequest request) {
int id = Integer.parseInt(request.getParam().toString());
long id = Long.parseLong(request.getParam().toString());
RedisRpcResponse response = request.getResponse();
if (id <= 0) {
response.setStatusCode(ErrorCode.ERROR400.getCode());

View File

@@ -184,7 +184,7 @@ public class RedisRpcStreamPushController extends RpcController {
@RedisRpcMapping("play")
public RedisRpcResponse play(RedisRpcRequest request) {
JSONObject paramJson = JSONObject.parseObject(request.getParam().toString());
int id = paramJson.getInteger("id");
long id = paramJson.getLongValue("id");
RedisRpcResponse response = request.getResponse();
if (id <= 0) {
response.setStatusCode(ErrorCode.ERROR400.getCode());

View File

@@ -43,7 +43,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void play(String serverId, Integer channelId, ErrorCallback<StreamInfo> callback) {
public void play(String serverId, Long channelId, ErrorCallback<StreamInfo> callback) {
RedisRpcRequest request = buildRequest("channel/play", channelId);
request.setToId(serverId);
RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.MILLISECONDS);
@@ -60,7 +60,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void stop(String serverId, InviteSessionType type, int channelId, String stream) {
public void stop(String serverId, InviteSessionType type, Long channelId, String stream) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("channelId", channelId);
jsonObject.put("stream", stream);
@@ -78,7 +78,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void queryRecordInfo(String serverId, Integer channelId, String startTime, String endTime, ErrorCallback<RecordInfo> callback) {
public void queryRecordInfo(String serverId, Long channelId, String startTime, String endTime, ErrorCallback<RecordInfo> callback) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("channelId", channelId);
jsonObject.put("startTime", startTime);
@@ -99,7 +99,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void playback(String serverId, Integer channelId, String startTime, String endTime, ErrorCallback<StreamInfo> callback) {
public void playback(String serverId, Long channelId, String startTime, String endTime, ErrorCallback<StreamInfo> callback) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("channelId", channelId);
@@ -149,7 +149,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void download(String serverId, Integer channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback) {
public void download(String serverId, Long channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("channelId", channelId);
@@ -172,7 +172,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public String frontEndCommand(String serverId, Integer channelId, int cmdCode, int parameter1, int parameter2, int combindCode2) {
public String frontEndCommand(String serverId, Long channelId, int cmdCode, int parameter1, int parameter2, int combindCode2) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("channelId", channelId);
jsonObject.put("cmdCode", cmdCode);
@@ -193,7 +193,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void playPush(String serverId, Integer id, ErrorCallback<StreamInfo> callback) {
public void playPush(String serverId, Long id, ErrorCallback<StreamInfo> callback) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", id);
RedisRpcRequest request = buildRequest("streamPush/play", jsonObject);
@@ -212,7 +212,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void playProxy(String serverId, int id, ErrorCallback<StreamInfo> callback) {
public void playProxy(String serverId, Long id, ErrorCallback<StreamInfo> callback) {
RedisRpcRequest request = buildRequest("streamProxy/play", id);
request.setToId(serverId);
RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS);
@@ -229,7 +229,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public void stopProxy(String serverId, int id) {
public void stopProxy(String serverId, Long id) {
RedisRpcRequest request = buildRequest("streamProxy/stop", id);
RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS);
if (response != null && response.getStatusCode() == ErrorCode.SUCCESS.getCode()) {
@@ -240,7 +240,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
}
@Override
public DownloadFileInfo getRecordPlayUrl(String serverId, Integer recordId) {
public DownloadFileInfo getRecordPlayUrl(String serverId, Long recordId) {
RedisRpcRequest request = buildRequest("cloudRecord/play", recordId);
RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS);
if (response != null && response.getStatusCode() == ErrorCode.SUCCESS.getCode()) {

View File

@@ -99,7 +99,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public long waitePushStreamOnline(SendRtpInfo sendRtpItem, CommonCallback<Integer> callback) {
public long waitePushStreamOnline(SendRtpInfo sendRtpItem, CommonCallback<Long> callback) {
log.info("[请求所有WVP监听流上线] {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream());
// 监听流上线。 流上线直接发送sendRtpItem消息给实际的信令处理者
Hook hook = Hook.getInstance(HookType.on_media_arrival, sendRtpItem.getApp(), sendRtpItem.getStream(), null);
@@ -132,7 +132,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
log.info("[请求所有WVP监听流上线] 流上线 {}/{}->{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.toString());
if (callback != null) {
callback.run(Integer.parseInt(response.getBody().toString()));
callback.run(Long.parseLong(response.getBody().toString()));
}
hookSubscribe.removeSubscribe(hook);
});
@@ -242,7 +242,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public boolean deletePlatform(String serverId, Integer platformId) {
public boolean deletePlatform(String serverId, Long platformId) {
RedisRpcRequest request = buildRequest("platform/delete", platformId);
request.setToId(serverId);
RedisRpcResponse response = redisRpcConfig.request(request, 20, TimeUnit.SECONDS);
@@ -264,7 +264,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public int removeAllPlatformChannel(String serverId, Integer platformId) {
public int removeAllPlatformChannel(String serverId, Long platformId) {
RedisRpcRequest request = buildRequest("platform/removeAllChannel", platformId);
request.setToId(serverId);
RedisRpcResponse response = redisRpcConfig.request(request, 20, TimeUnit.SECONDS);
@@ -297,7 +297,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public boolean pushPlatformChannel(String serverId, Integer platformId) {
public boolean pushPlatformChannel(String serverId, Long platformId) {
RedisRpcRequest request = buildRequest("platform/pushChannel", platformId);
request.setToId(serverId);
RedisRpcResponse response = redisRpcConfig.request(request, 20, TimeUnit.SECONDS);

View File

@@ -1,5 +1,8 @@
package com.viewsh.module.video.storager.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
import com.viewsh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.service.bean.CloudRecordItem;
import org.apache.ibatis.annotations.*;
@@ -8,7 +11,7 @@ import java.util.Collection;
import java.util.List;
@Mapper
public interface CloudRecordServiceMapper {
public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Insert(" <script>" +
"INSERT INTO wvp_cloud_record (" +
@@ -59,10 +62,34 @@ public interface CloudRecordServiceMapper {
" <if test= 'ascOrder != null and ascOrder == true'> order by start_time asc</if>" +
" <if test= 'ascOrder == null or ascOrder == false'> order by start_time desc</if>" +
" </script>")
List<CloudRecordItem> getList(@Param("query") String query, @Param("app") String app, @Param("stream") String stream,
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
@Param("callId")String callId, List<MediaServer> mediaServerItemList,
List<Integer> ids, @Param("ascOrder") Boolean ascOrder);
IPage<CloudRecordItem> getList(IPage<CloudRecordItem> page, @Param("query") String query, @Param("app") String app, @Param("stream") String stream,
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
@Param("callId")String callId, List<MediaServer> mediaServerItemList,
List<Long> ids, @Param("ascOrder") Boolean ascOrder);
@Select(" <script>" +
"select * " +
" from wvp_cloud_record " +
" where 1 = 1" +
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') escape '/' OR stream LIKE concat('%',#{query},'%') escape '/' )</if> " +
" <if test= 'app != null '> and app=#{app}</if>" +
" <if test= 'stream != null '> and stream=#{stream}</if>" +
" <if test= 'startTimeStamp != null '> and end_time &gt;= #{startTimeStamp}</if>" +
" <if test= 'endTimeStamp != null '> and start_time &lt;= #{endTimeStamp}</if>" +
" <if test= 'callId != null '> and call_id = #{callId}</if>" +
" <if test= 'mediaServerItemList != null ' > and media_server_id in " +
" <foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </if>" +
" <if test= 'ids != null ' > and id in " +
" <foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </if>" +
" <if test= 'ascOrder != null and ascOrder == true'> order by start_time asc</if>" +
" <if test= 'ascOrder == null or ascOrder == false'> order by start_time desc</if>" +
" </script>")
List<CloudRecordItem> getListAll(@Param("query") String query, @Param("app") String app, @Param("stream") String stream,
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
@Param("callId")String callId, @Param("mediaServerItemList") List<MediaServer> mediaServerItemList,
@Param("ids") List<Long> ids, @Param("ascOrder") Boolean ascOrder);
@Select(" <script>" +
@@ -88,11 +115,11 @@ public interface CloudRecordServiceMapper {
" </script>")
int updateCollectList(@Param("collect") boolean collect, List<CloudRecordItem> cloudRecordItemList);
@Delete(" <script>" +
"delete from wvp_cloud_record where media_server_id=#{mediaServerId} and file_path in " +
@Update(" <script>" +
"UPDATE wvp_cloud_record SET deleted = 1 WHERE media_server_id=#{mediaServerId} and file_path in " +
" <foreach collection='filePathList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>")
void deleteByFileList(List<String> filePathList, @Param("mediaServerId") String mediaServerId);
void deleteByFileList(@Param("filePathList") List<String> filePathList, @Param("mediaServerId") String mediaServerId);
@Select(" <script>" +
@@ -105,13 +132,13 @@ public interface CloudRecordServiceMapper {
@Update(" <script>" +
"update wvp_cloud_record set collect = #{collect} where id = #{recordId} " +
" </script>")
int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId);
int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Long recordId);
@Delete(" <script>" +
"delete from wvp_cloud_record where id in " +
" <foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>")
int deleteList(List<CloudRecordItem> cloudRecordItemIdList);
default int deleteList(List<CloudRecordItem> cloudRecordItemIdList) {
if (cloudRecordItemIdList == null || cloudRecordItemIdList.isEmpty()) return 0;
List<Long> ids = cloudRecordItemIdList.stream().map(CloudRecordItem::getId).collect(java.util.stream.Collectors.toList());
return deleteBatch(CloudRecordItem::getId, ids);
}
@Select(" <script>" +
"select *" +
@@ -125,7 +152,7 @@ public interface CloudRecordServiceMapper {
" from wvp_cloud_record " +
"where id = #{id}" +
" </script>")
CloudRecordItem queryOne(@Param("id") Integer id);
CloudRecordItem queryOne(@Param("id") Long id);
@Select(" <script>" +
"select *" +
@@ -137,7 +164,7 @@ public interface CloudRecordServiceMapper {
@Update(" <script>" +
"update wvp_cloud_record set time_len = #{time}, end_time = #{endTime} where id = #{id} " +
" </script>")
void updateTimeLen(@Param("id") int id, @Param("time") Long time, @Param("endTime") long endTime);
void updateTimeLen(@Param("id") Long id, @Param("time") Long time, @Param("endTime") long endTime);
@Select(" <script>" +
"select media_server_id " +
@@ -159,7 +186,7 @@ public interface CloudRecordServiceMapper {
" from wvp_cloud_record where id in " +
" <foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>")
List<CloudRecordItem> queryRecordByIds(Collection<Integer> ids);
List<CloudRecordItem> queryRecordByIds(Collection<Long> ids);
@Select(" <script>" +
"select * " +

View File

@@ -1,5 +1,7 @@
package com.viewsh.module.video.storager.dao;
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
import com.viewsh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.viewsh.module.video.media.bean.MediaServer;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
@@ -10,7 +12,7 @@ import java.util.List;
@Mapper
@Repository
public interface MediaServerMapper {
public interface MediaServerMapper extends BaseMapperX<MediaServer> {
@Insert("INSERT INTO wvp_media_server (" +
"id,"+
@@ -146,8 +148,11 @@ public interface MediaServerMapper {
@Select("SELECT * FROM wvp_media_server where default_server=false AND server_id = #{serverId}")
List<MediaServer> queryAllWithOutDefault(@Param("serverId") String serverId);
@Delete("DELETE FROM wvp_media_server WHERE id=#{id} and server_id = #{serverId}")
void delOne(String id, @Param("serverId") String serverId);
default void delOne(String id, String serverId) {
delete(new LambdaQueryWrapperX<MediaServer>()
.eq(MediaServer::getId, id)
.eq(MediaServer::getServerId, serverId));
}
@Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port} and server_id = #{serverId}")
MediaServer queryOneByHostAndPort(@Param("host") String host, @Param("port") int port, @Param("serverId") String serverId);
@@ -158,6 +163,9 @@ public interface MediaServerMapper {
@Select("SELECT * FROM wvp_media_server WHERE record_assist_port > 0 and server_id = #{serverId}")
List<MediaServer> queryAllWithAssistPort(@Param("serverId") String serverId);
@Delete("DELETE FROM wvp_media_server WHERE default_server=true and server_id = #{serverId}")
void deleteDefault(@Param("serverId") String serverId);
default void deleteDefault(String serverId) {
delete(new LambdaQueryWrapperX<MediaServer>()
.eq(MediaServer::isDefaultServer, true)
.eq(MediaServer::getServerId, serverId));
}
}

View File

@@ -1,5 +1,7 @@
package com.viewsh.module.video.storager.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
import com.viewsh.module.video.service.bean.RecordPlan;
import com.viewsh.module.video.service.bean.RecordPlanItem;
import org.apache.ibatis.annotations.*;
@@ -7,19 +9,15 @@ import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface RecordPlanMapper {
public interface RecordPlanMapper extends BaseMapperX<RecordPlan> {
@Insert(" <script>" +
"INSERT INTO wvp_record_plan (" +
" name," +
" snap," +
" create_time," +
" update_time) " +
" snap) " +
"VALUES (" +
" #{name}," +
" #{snap}," +
" #{createTime}," +
" #{updateTime})" +
" #{snap})" +
" </script>")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void add(RecordPlan plan);
@@ -35,33 +33,34 @@ public interface RecordPlanMapper {
"(#{item.start}, #{item.stop}, #{item.weekDay},#{planId})" +
"</foreach> " +
" </script>")
void batchAddItem(@Param("planId") int planId, List<RecordPlanItem> planItemList);
void batchAddItem(@Param("planId") Long planId, List<RecordPlanItem> planItemList);
@Select("select * from wvp_record_plan where id = #{planId}")
RecordPlan get(@Param("planId") Integer planId);
RecordPlan get(@Param("planId") Long planId);
@Select(" <script>" +
" SELECT wrp.*, (select count(1) from wvp_device_channel where record_plan_id = wrp.id) AS channelCount\n" +
" FROM wvp_record_plan wrp where 1=1" +
" <if test='query != null'> AND (name LIKE concat('%',#{query},'%') escape '/' )</if> " +
" </script>")
List<RecordPlan> query(@Param("query") String query);
IPage<RecordPlan> query(IPage<RecordPlan> page, @Param("query") String query);
@Update("UPDATE wvp_record_plan SET update_time=#{updateTime}, name=#{name}, snap=#{snap} WHERE id=#{id}")
@Update("UPDATE wvp_record_plan SET name=#{name}, snap=#{snap} WHERE id=#{id}")
void update(RecordPlan plan);
@Delete("DELETE FROM wvp_record_plan WHERE id=#{planId}")
void delete(@Param("planId") Integer planId);
default void delete(Long planId) {
deleteById(planId);
}
@Select("select * from wvp_record_plan_item where plan_id = #{planId}")
List<RecordPlanItem> getItemList(@Param("planId") Integer planId);
List<RecordPlanItem> getItemList(@Param("planId") Long planId);
@Delete("DELETE FROM wvp_record_plan_item WHERE plan_id = #{planId}")
void cleanItems(@Param("planId") Integer planId);
@Update("UPDATE wvp_record_plan_item SET deleted = 1 WHERE plan_id = #{planId}")
void cleanItems(@Param("planId") Long planId);
@Select(" <script>" +
" select wdc.id from wvp_device_channel wdc left join wvp_record_plan_item wrpi on wrpi.plan_id = wdc.record_plan_id " +
" where wrpi.week_day = #{week} and wrpi.start &lt;= #{index} and stop &gt;= #{index} group by wdc.id" +
" </script>")
List<Integer> queryRecordIng(@Param("week") int week, @Param("index") int index);
List<Long> queryRecordIng(@Param("week") int week, @Param("index") int index);
}

View File

@@ -1,28 +0,0 @@
package com.viewsh.module.video.storager.dao;
import com.viewsh.module.video.storager.dao.dto.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* WVP RoleMapper stub. Role management is provided by viewsh-module-system.
* TODO: Phase 6 - remove all WVP role management code
*
* @deprecated
*/
@Mapper
@Deprecated
public interface RoleMapper {
Role selectById(@Param("id") int id);
List<Role> selectAll();
int add(Role role);
int update(Role role);
int delete(@Param("id") int id);
}

View File

@@ -1,38 +0,0 @@
package com.viewsh.module.video.storager.dao;
import com.viewsh.module.video.storager.dao.dto.UserApiKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* WVP UserApiKeyMapper stub. API Key management is provided by viewsh-module-system.
* TODO: Phase 6 - remove all WVP API key management code
*
* @deprecated
*/
@Mapper
@Deprecated
public interface UserApiKeyMapper {
int add(UserApiKey userApiKey);
boolean isApiKeyExists(@Param("apiKey") String apiKey);
List<UserApiKey> getUserApiKeys();
int enable(@Param("id") Integer id);
int disable(@Param("id") Integer id);
int remark(@Param("id") Integer id, @Param("remark") String remark);
int delete(@Param("id") Integer id);
UserApiKey selectById(@Param("id") Integer id);
int apiKey(@Param("id") Integer id, @Param("apiKey") String apiKey);
int reset(@Param("id") Integer id, @Param("apiKey") String apiKey);
}

View File

@@ -1,36 +0,0 @@
package com.viewsh.module.video.storager.dao;
import com.viewsh.module.video.storager.dao.dto.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* WVP UserMapper stub. User management is provided by viewsh-module-system.
* TODO: Phase 6 - remove all WVP user management code
*
* @deprecated
*/
@Mapper
@Deprecated
public interface UserMapper {
User select(@Param("username") String username, @Param("password") String password);
User selectById(@Param("id") int id);
User getUserByUsername(@Param("username") String username);
List<User> selectAll();
List<User> getUsers();
int add(User user);
int update(User user);
int delete(@Param("id") int id);
int changePushKey(@Param("id") int id, @Param("pushKey") String pushKey);
}

View File

@@ -1,19 +0,0 @@
package com.viewsh.module.video.storager.dao.dto;
import lombok.Data;
/**
* WVP Role DTO stub. Role management is provided by viewsh-module-system.
* This class exists to satisfy compilation of legacy code.
* TODO: Phase 6 - remove all WVP user/role management code, use viewsh role model
*
* @deprecated Use viewsh-module-system role management instead
*/
@Data
@Deprecated
public class Role {
private int id;
private String roleName;
}

View File

@@ -1,22 +0,0 @@
package com.viewsh.module.video.storager.dao.dto;
import lombok.Data;
/**
* WVP User DTO stub. User management is provided by viewsh-module-system.
* This class exists to satisfy compilation of legacy code.
* TODO: Phase 6 - remove all WVP user management code, use viewsh user model
*
* @deprecated Use viewsh-module-system user management instead
*/
@Data
@Deprecated
public class User {
private int id;
private String username;
private String password;
private String pushKey;
private int roleId;
}

View File

@@ -1,151 +0,0 @@
package com.viewsh.module.video.storager.dao.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
/**
* 用户信息
*/
@Schema(description = "用户ApiKey信息")
public class UserApiKey implements Serializable {
/**
* Id
*/
@Schema(description = "Id")
private int id;
/**
* 用户Id
*/
@Schema(description = "用户Id")
private int userId;
/**
* 应用名
*/
@Schema(description = "应用名")
private String app;
/**
* ApiKey
*/
@Schema(description = "ApiKey")
private String apiKey;
/**
* 过期时间null=永不过期)
*/
@Schema(description = "过期时间null=永不过期)")
private long expiredAt;
/**
* 备注信息
*/
@Schema(description = "备注信息")
private String remark;
/**
* 是否启用
*/
@Schema(description = "是否启用")
private boolean enable;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private String createTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
private String updateTime;
/**
* 用户名
*/
private String username;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public long getExpiredAt() {
return expiredAt;
}
public void setExpiredAt(long expiredAt) {
this.expiredAt = expiredAt;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}

View File

@@ -441,7 +441,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
channel.getDeviceId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
sendRtpItem.getMediaServerId());
messageForPushChannel.setPlatFormIndex(platform.getId());
messageForPushChannel.setPlatFormIndex(platform.getId().intValue());
String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;
log.info("[redis发送通知] 发送 推流被上级平台观看 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), platform.getServerGBId());
redisTemplate.convertAndSend(key, JSON.toJSON(messageForPushChannel));
@@ -453,7 +453,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
MessageForPushChannel msg = MessageForPushChannel.getInstance(0,
sendRtpItem.getApp(), sendRtpItem.getStream(), channel.getGbDeviceId(),
sendRtpItem.getTargetId(), platform.getName(), userSetting.getServerId(), sendRtpItem.getMediaServerId());
msg.setPlatFormIndex(platform.getId());
msg.setPlatFormIndex(platform.getId().intValue());
String key = VideoManagerConstants.VM_MSG_STREAM_STOP_PLAY_NOTIFY;
log.info("[redis发送通知] 发送 上级平台停止观看 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), platform.getServerGBId());

View File

@@ -1,5 +1,8 @@
package com.viewsh.module.video.streamProxy.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.module.video.common.enums.ChannelDataType;
import com.viewsh.module.video.gb28181.bean.CommonGBChannel;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -11,6 +14,7 @@ import org.springframework.util.ObjectUtils;
* @author lin
*/
@Data
@TableName("wvp_stream_proxy")
@Schema(description = "拉流代理的信息")
@EqualsAndHashCode(callSuper = true)
public class StreamProxy extends CommonGBChannel {
@@ -18,8 +22,9 @@ public class StreamProxy extends CommonGBChannel {
/**
* 数据库自增ID
*/
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")
private int id;
private Long id;
@Schema(description = "类型取值default 流媒体直接拉流默认ffmpeg ffmpeg实现拉流")
private String type;

View File

@@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSONObject;
import com.viewsh.module.video.common.StreamInfo;
import com.viewsh.module.video.framework.config.UserSetting;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.media.service.IMediaServerService;
import com.viewsh.module.video.service.bean.ErrorCallback;
@@ -15,7 +14,7 @@ import com.viewsh.module.video.streamProxy.service.IStreamProxyService;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.bean.StreamContent;
import com.viewsh.module.video.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import com.viewsh.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -55,7 +54,7 @@ public class StreamProxyController {
private UserSetting userSetting;
@Operation(summary = "分页查询流代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "分页查询流代理", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "page", description = "当前页")
@Parameter(name = "count", description = "每页查询数量")
@Parameter(name = "query", description = "查询内容")
@@ -63,7 +62,7 @@ public class StreamProxyController {
@Parameter(name = "mediaServerId", description = "流媒体ID")
@GetMapping(value = "/list")
@ResponseBody
public PageInfo<StreamProxy> list(@RequestParam(required = false)Integer page,
public PageResult<StreamProxy> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count,
@RequestParam(required = false)String query,
@RequestParam(required = false)Boolean pulling,
@@ -78,7 +77,7 @@ public class StreamProxyController {
return streamProxyService.getAll(page, count, query, pulling, mediaServerId);
}
@Operation(summary = "查询流代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "查询流代理", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "app", description = "应用名")
@Parameter(name = "stream", description = "流Id")
@GetMapping(value = "/one")
@@ -88,7 +87,7 @@ public class StreamProxyController {
return streamProxyService.getStreamProxyByAppAndStream(app, stream);
}
@Operation(summary = "新增代理", security = @SecurityRequirement(name = JwtUtils.HEADER), parameters = {
@Operation(summary = "新增代理", security = @SecurityRequirement(name = "Authorization"), parameters = {
@Parameter(name = "param", description = "代理参数", required = true),
})
@PostMapping(value = "/add")
@@ -109,7 +108,7 @@ public class StreamProxyController {
return param;
}
@Operation(summary = "更新代理", security = @SecurityRequirement(name = JwtUtils.HEADER), parameters = {
@Operation(summary = "更新代理", security = @SecurityRequirement(name = "Authorization"), parameters = {
@Parameter(name = "param", description = "代理参数", required = true),
})
@PostMapping(value = "/update")
@@ -131,7 +130,7 @@ public class StreamProxyController {
@GetMapping(value = "/ffmpeg_cmd/list")
@ResponseBody
@Operation(summary = "获取ffmpeg.cmd模板", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取ffmpeg.cmd模板", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "mediaServerId", description = "流媒体ID", required = true)
public Map<String, String> getFFmpegCMDs(@RequestParam String mediaServerId){
log.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId );
@@ -145,7 +144,7 @@ public class StreamProxyController {
@DeleteMapping(value = "/del")
@ResponseBody
@Operation(summary = "移除代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "移除代理", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "app", description = "应用名", required = true)
@Parameter(name = "stream", description = "流id", required = true)
public void del(@RequestParam String app, @RequestParam String stream){
@@ -159,18 +158,18 @@ public class StreamProxyController {
@DeleteMapping(value = "/delete")
@ResponseBody
@Operation(summary = "移除代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "移除代理", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "id", description = "代理ID", required = true)
public void delte(int id){
public void delte(Long id){
log.info("移除代理: {}", id);
streamProxyService.delete(id);
}
@GetMapping(value = "/start")
@ResponseBody
@Operation(summary = "播放代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "播放代理", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "id", description = "代理Id", required = true)
public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, int id){
public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, Long id){
log.info("播放代理: {}", id);
StreamProxy streamProxy = streamProxyService.getStreamProxy(id);
Assert.notNull(streamProxy, "代理信息不存在");
@@ -214,9 +213,9 @@ public class StreamProxyController {
@GetMapping(value = "/stop")
@ResponseBody
@Operation(summary = "停止播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "停止播放", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "id", description = "代理Id", required = true)
public void stop(int id){
public void stop(Long id){
log.info("停止播放: {}", id);
streamProxyPlayService.stop(id);
}

View File

@@ -1,5 +1,8 @@
package com.viewsh.module.video.streamProxy.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
import com.viewsh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.viewsh.module.video.streamProxy.bean.StreamProxy;
import com.viewsh.module.video.streamProxy.dao.provider.StreamProxyProvider;
import org.apache.ibatis.annotations.*;
@@ -9,14 +12,14 @@ import java.util.List;
@Mapper
@Repository
public interface StreamProxyMapper {
public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
@Insert("INSERT INTO wvp_stream_proxy (type, app, stream,relates_media_server_id, src_url, " +
"timeout, ffmpeg_cmd_key, rtsp_type, enable_audio, enable_mp4, enable, pulling, " +
"enable_disable_none_reader, server_id, create_time, camera_code, camera_name, area_id, edge_device_id) VALUES" +
"enable_disable_none_reader, server_id, camera_code, camera_name, area_id, edge_device_id) VALUES" +
"(#{type}, #{app}, #{stream}, #{relatesMediaServerId}, #{srcUrl}, " +
"#{timeout}, #{ffmpegCmdKey}, #{rtspType}, #{enableAudio}, #{enableMp4}, #{enable}, #{pulling}, " +
"#{enableDisableNoneReader}, #{serverId}, #{createTime}, #{cameraCode}, #{cameraName}, #{areaId}, #{edgeDeviceId} )")
"#{enableDisableNoneReader}, #{serverId}, #{cameraCode}, #{cameraName}, #{areaId}, #{edgeDeviceId} )")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int add(StreamProxy streamProxyDto);
@@ -40,11 +43,14 @@ public interface StreamProxyMapper {
"WHERE id=#{id}")
int update(StreamProxy streamProxyDto);
@Delete("DELETE FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
int delByAppAndStream(String app, String stream);
default int delByAppAndStream(String app, String stream) {
return delete(new LambdaQueryWrapperX<StreamProxy>()
.eq(StreamProxy::getApp, app)
.eq(StreamProxy::getStream, stream));
}
@SelectProvider(type = StreamProxyProvider.class, method = "selectAll")
List<StreamProxy> selectAll(@Param("query") String query, @Param("pulling") Boolean pulling, @Param("mediaServerId") String mediaServerId);
IPage<StreamProxy> selectAll(IPage<StreamProxy> page, @Param("query") String query, @Param("pulling") Boolean pulling, @Param("mediaServerId") String mediaServerId);
@SelectProvider(type = StreamProxyProvider.class, method = "selectOneByAppAndStream")
StreamProxy selectOneByAppAndStream(@Param("app") String app, @Param("stream") String stream);
@@ -59,36 +65,34 @@ public interface StreamProxyMapper {
@Select("select count(1) from wvp_stream_proxy where pulling = true")
int getOnline();
@Delete("DELETE FROM wvp_stream_proxy WHERE id=#{id}")
int delete(@Param("id") int id);
default int delete(Long id) {
return deleteById(id);
}
@Delete(value = "<script>" +
"DELETE FROM wvp_stream_proxy WHERE id in (" +
"<foreach collection='streamProxiesForRemove' index='index' item='item' separator=','> " +
"#{item.id}"+
"</foreach>" +
")" +
"</script>")
void deleteByList(List<StreamProxy> streamProxiesForRemove);
default void deleteByList(List<StreamProxy> streamProxiesForRemove) {
if (streamProxiesForRemove == null || streamProxiesForRemove.isEmpty()) return;
List<Long> ids = streamProxiesForRemove.stream().map(StreamProxy::getId).collect(java.util.stream.Collectors.toList());
deleteBatch(StreamProxy::getId, ids);
}
@Update("UPDATE wvp_stream_proxy " +
"SET pulling=true " +
"WHERE id=#{id}")
int online(@Param("id") int id);
int online(@Param("id") Long id);
@Update("UPDATE wvp_stream_proxy " +
"SET pulling=false " +
"WHERE id=#{id}")
int offline(@Param("id") int id);
int offline(@Param("id") Long id);
@SelectProvider(type = StreamProxyProvider.class, method = "select")
StreamProxy select(@Param("id") int id);
StreamProxy select(@Param("id") Long id);
@Update("UPDATE wvp_stream_proxy " +
" SET pulling=false, media_server_id = null," +
" stream_key = null " +
" WHERE id=#{id}")
void removeStream(@Param("id")int id);
void removeStream(@Param("id") Long id);
@Update("UPDATE wvp_stream_proxy " +
" SET pulling=#{pulling}, media_server_id = #{mediaServerId}, " +
@@ -114,7 +118,7 @@ public interface StreamProxyMapper {
* 更新指定记录的 camera_code
*/
@Update("UPDATE wvp_stream_proxy SET camera_code = #{cameraCode} WHERE id = #{id}")
int updateCameraCode(@Param("id") int id, @Param("cameraCode") String cameraCode);
int updateCameraCode(@Param("id") Long id, @Param("cameraCode") String cameraCode);
/**
* 查询指定前缀的最大 camera_code用于生成新编码的序号

View File

@@ -8,11 +8,11 @@ import jakarta.validation.constraints.NotNull;
public interface IStreamProxyPlayService {
void start(int id, Boolean record, ErrorCallback<StreamInfo> callback);
void start(Long id, Boolean record, ErrorCallback<StreamInfo> callback);
void startProxy(@NotNull StreamProxy streamProxy, ErrorCallback<StreamInfo> callback);
void stop(int id);
void stop(Long id);
void stopProxy(StreamProxy streamProxy);
}

View File

@@ -1,11 +1,11 @@
package com.viewsh.module.video.streamProxy.service;
import com.viewsh.framework.common.pojo.PageResult;
import com.viewsh.module.video.common.StreamInfo;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.service.bean.ErrorCallback;
import com.viewsh.module.video.streamProxy.bean.StreamProxy;
import com.viewsh.module.video.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageInfo;
import java.util.Map;
@@ -17,7 +17,7 @@ public interface IStreamProxyService {
* @param count
* @return
*/
PageInfo<StreamProxy> getAll(Integer page, Integer count, String query, Boolean pulling,String mediaServerId);
PageResult<StreamProxy> getAll(Integer page, Integer count, String query, Boolean pulling,String mediaServerId);
/**
* 删除视频代理
@@ -83,9 +83,9 @@ public interface IStreamProxyService {
void add(StreamProxy streamProxy);
StreamProxy getStreamProxy(int id);
StreamProxy getStreamProxy(Long id);
void delete(int id);
void delete(Long id);
/**
* 根据 camera_code 获取拉流代理

View File

@@ -51,7 +51,7 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
private IRedisRpcPlayService redisRpcPlayService;
@Override
public void start(int id, Boolean record, ErrorCallback<StreamInfo> callback) {
public void start(Long id, Boolean record, ErrorCallback<StreamInfo> callback) {
log.info("[拉流代理] 开始拉流ID{}", id);
StreamProxy streamProxy = streamProxyMapper.select(id);
if (streamProxy == null) {
@@ -128,7 +128,7 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
}
@Override
public void stop(int id) {
public void stop(Long id) {
StreamProxy streamProxy = streamProxyMapper.select(id);
if (streamProxy == null) {
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");

View File

@@ -25,8 +25,9 @@ import com.viewsh.module.video.streamProxy.service.IStreamProxyService;
import com.viewsh.module.video.utils.DateUtil;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.viewsh.framework.common.pojo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
@@ -159,9 +160,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "摄像头名称不能为空");
}
streamProxy.setCreateTime(DateUtil.getNow());
streamProxy.setUpdateTime(DateUtil.getNow());
try {
if (streamProxy.getGbDeviceId() != null) {
gbChannelService.add(streamProxy.buildCommonGBChannel());
@@ -175,7 +173,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
@Override
public void delete(int id) {
public void delete(Long id) {
StreamProxy streamProxy = getStreamProxy(id);
if (streamProxy == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "代理不存在");
@@ -219,7 +217,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
*/
@Override
public boolean update(StreamProxy streamProxy) {
streamProxy.setUpdateTime(DateUtil.getNow());
StreamProxy streamProxyInDb = streamProxyMapper.select(streamProxy.getId());
if (streamProxyInDb == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "代理不存在");
@@ -230,7 +227,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
!streamProxyInDb.getStream().equals(streamProxy.getStream())) {
StreamProxy duplicate = streamProxyMapper.selectOneByAppAndStream(
streamProxy.getApp(), streamProxy.getStream());
if (duplicate != null && duplicate.getId() != streamProxy.getId()) {
if (duplicate != null && !duplicate.getId().equals(streamProxy.getId())) {
throw new ControllerException(ErrorCode.ERROR100.getCode(),
"应用名 [" + streamProxy.getApp() + "] 下的流ID [" + streamProxy.getStream() + "] 已存在");
}
@@ -248,15 +245,15 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
@Override
public PageInfo<StreamProxy> getAll(Integer page, Integer count, String query, Boolean pulling, String mediaServerId) {
PageHelper.startPage(page, count);
public PageResult<StreamProxy> getAll(Integer page, Integer count, String query, Boolean pulling, String mediaServerId) {
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<StreamProxy> all = streamProxyMapper.selectAll(query, pulling, mediaServerId);
return new PageInfo<>(all);
IPage<StreamProxy> ipage = new Page<>(page, count);
IPage<StreamProxy> result = streamProxyMapper.selectAll(ipage, query, pulling, mediaServerId);
return new PageResult<>(result.getRecords(), result.getTotal());
}
@@ -405,7 +402,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
streamProxy.setPulling(status);
streamProxy.setMediaServerId(mediaServerId);
streamProxy.setUpdateTime(DateUtil.getNow());
streamProxyMapper.updateStream(streamProxy);
}
@@ -419,7 +415,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
@Override
public StreamProxy getStreamProxy(int id) {
public StreamProxy getStreamProxy(Long id) {
return streamProxyMapper.select(id);
}

View File

@@ -6,5 +6,5 @@ import java.util.Set;
@Data
public class BatchRemoveParam {
private Set<Integer> ids;
private Set<Long> ids;
}

View File

@@ -1,10 +1,12 @@
package com.viewsh.module.video.streamPush.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.module.video.common.StreamInfo;
import com.viewsh.module.video.common.enums.ChannelDataType;
import com.viewsh.module.video.gb28181.bean.CommonGBChannel;
import com.viewsh.module.video.media.event.media.MediaArrivalEvent;
import com.viewsh.module.video.utils.DateUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -14,6 +16,7 @@ import org.springframework.util.ObjectUtils;
@Data
@TableName("wvp_stream_push")
@Schema(description = "推流信息")
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@@ -22,8 +25,9 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
/**
* id
*/
@TableId(type = IdType.AUTO)
@Schema(description = "id")
private Integer id;
private Long id;
/**
* 应用名
@@ -55,18 +59,6 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
@Schema(description = "推流时间")
private String pushTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
private String updateTime;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private String createTime;
/**
* 是否正在推流
*/
@@ -110,8 +102,9 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
@Override
public int compareTo(@NotNull StreamPush streamPushItem) {
return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(this.createTime)
- DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue();
if (this.getCreateTime() == null) return -1;
if (streamPushItem.getCreateTime() == null) return 1;
return this.getCreateTime().compareTo(streamPushItem.getCreateTime());
}
public static StreamPush getInstance(StreamInfo streamInfo) {
@@ -122,7 +115,6 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
}
streamPush.setStream(streamInfo.getStream());
streamPush.setCreateTime(DateUtil.getNow());
streamPush.setServerId(streamInfo.getServerId());
return streamPush;
@@ -133,7 +125,6 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
streamPushItem.setApp(event.getApp());
streamPushItem.setMediaServerId(event.getMediaServer().getId());
streamPushItem.setStream(event.getStream());
streamPushItem.setCreateTime(DateUtil.getNow());
streamPushItem.setServerId(serverId);
return streamPushItem;
}

View File

@@ -7,7 +7,6 @@ import cn.idev.excel.read.metadata.ReadSheet;
import com.viewsh.module.video.common.enums.ChannelDataType;
import com.viewsh.module.video.framework.config.UserSetting;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.gb28181.transmit.callback.DeferredResultHolder;
import com.viewsh.module.video.gb28181.transmit.callback.RequestMessage;
import com.viewsh.module.video.media.service.IMediaServerService;
@@ -21,7 +20,7 @@ import com.viewsh.module.video.streamPush.service.IStreamPushService;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.bean.StreamContent;
import com.viewsh.module.video.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import com.viewsh.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -72,13 +71,13 @@ public class StreamPushController {
@GetMapping(value = "/list")
@ResponseBody
@Operation(summary = "推流列表查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "推流列表查询", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "page", description = "当前页")
@Parameter(name = "count", description = "每页查询数量")
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "pushing", description = "是否正在推流")
@Parameter(name = "mediaServerId", description = "流媒体ID")
public PageInfo<StreamPush> list(@RequestParam(required = false)Integer page,
public PageResult<StreamPush> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count,
@RequestParam(required = false)String query,
@RequestParam(required = false)Boolean pushing,
@@ -90,16 +89,16 @@ public class StreamPushController {
if (ObjectUtils.isEmpty(mediaServerId)) {
mediaServerId = null;
}
PageInfo<StreamPush> pushList = streamPushService.getPushList(page, count, query, pushing, mediaServerId);
PageResult<StreamPush> pushList = streamPushService.getPushList(page, count, query, pushing, mediaServerId);
return pushList;
}
@PostMapping(value = "/remove")
@ResponseBody
@Operation(summary = "删除", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "删除", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "id", description = "应用名", required = true)
public void delete(int id){
public void delete(Long id){
if (streamPushService.delete(id) <= 0){
throw new ControllerException(ErrorCode.ERROR100);
}
@@ -215,7 +214,7 @@ public class StreamPushController {
*/
@PostMapping(value = "/add")
@ResponseBody
@Operation(summary = "添加推流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "添加推流信息", security = @SecurityRequirement(name = "Authorization"))
public StreamPush add(@RequestBody StreamPush stream){
if (ObjectUtils.isEmpty(stream.getGbId())) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "国标ID不可为空");
@@ -235,7 +234,7 @@ public class StreamPushController {
@PostMapping(value = "/update")
@ResponseBody
@Operation(summary = "更新推流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "更新推流信息", security = @SecurityRequirement(name = "Authorization"))
public void update(@RequestBody StreamPush stream){
if (ObjectUtils.isEmpty(stream.getId())) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "ID不可为空");
@@ -247,7 +246,7 @@ public class StreamPushController {
@DeleteMapping(value = "/batchRemove")
@ResponseBody
@Operation(summary = "删除多个推流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "删除多个推流", security = @SecurityRequirement(name = "Authorization"))
public void batchStop(@RequestBody BatchRemoveParam ids){
if(ids.getIds().isEmpty()) {
return;
@@ -257,8 +256,8 @@ public class StreamPushController {
@GetMapping(value = "/start")
@ResponseBody
@Operation(summary = "开始播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, Integer id){
@Operation(summary = "开始播放", security = @SecurityRequirement(name = "Authorization"))
public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, Long id){
Assert.notNull(id, "推流ID不可为NULL");
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
result.onTimeout(()->{
@@ -287,7 +286,7 @@ public class StreamPushController {
@GetMapping(value = "/forceClose")
@ResponseBody
@Operation(summary = "强制停止推流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "强制停止推流", security = @SecurityRequirement(name = "Authorization"))
public void stop(String app, String stream){
streamPushPlayService.stop(app, stream);

View File

@@ -1,5 +1,8 @@
package com.viewsh.module.video.streamPush.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
import com.viewsh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.viewsh.module.video.common.enums.ChannelDataType;
import com.viewsh.module.video.streamPush.bean.StreamPush;
import com.viewsh.module.video.service.bean.StreamPushItemFromRedis;
@@ -12,19 +15,19 @@ import java.util.Set;
@Mapper
@Repository
public interface StreamPushMapper {
public interface StreamPushMapper extends BaseMapperX<StreamPush> {
Integer dataType = ChannelDataType.GB28181;
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) VALUES" +
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime} ,#{updateTime}, #{createTime}, #{pushing}, #{startOfflinePush})")
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, pushing, start_offline_push) VALUES" +
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime}, #{pushing}, #{startOfflinePush})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int add(StreamPush streamPushItem);
@Update(value = {" <script>" +
"UPDATE wvp_stream_push " +
"SET update_time=#{updateTime}" +
"SET update_time=NOW()" +
"<if test=\"app != null\">, app=#{app}</if>" +
"<if test=\"stream != null\">, stream=#{stream}</if>" +
"<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
@@ -32,12 +35,13 @@ public interface StreamPushMapper {
"<if test=\"pushTime != null\">, push_time=#{pushTime}</if>" +
"<if test=\"pushing != null\">, pushing=#{pushing}</if>" +
"<if test=\"startOfflinePush != null\">, start_offline_push=#{startOfflinePush}</if>" +
"WHERE id = #{id}"+
" WHERE id = #{id}"+
" </script>"})
int update(StreamPush streamPushItem);
@Delete("DELETE FROM wvp_stream_push WHERE id=#{id}")
int del(@Param("id") int id);
default int del(Long id) {
return deleteById(id);
}
@Select(value = {" <script>" +
" SELECT " +
@@ -58,16 +62,37 @@ public interface StreamPushMapper {
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
" order by st.pushing desc, st.create_time desc" +
" </script>"})
List<StreamPush> selectAll(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
IPage<StreamPush> selectAll(IPage<StreamPush> page, @Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
@Select(value = {" <script>" +
" SELECT " +
" st.*, " +
" st.id as data_device_id, " +
" wdc.*, " +
" wdc.id as gb_id" +
" from " +
" wvp_stream_push st " +
" LEFT join wvp_device_channel wdc " +
" on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" WHERE " +
" 1=1 " +
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " +
" OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')</if> " +
" <if test='pushing == true' > AND st.pushing=true</if>" +
" <if test='pushing == false' > AND st.pushing=false </if>" +
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
" order by st.pushing desc, st.create_time desc" +
" </script>"})
List<StreamPush> selectAllList(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.app=#{app} AND st.stream=#{stream}")
StreamPush selectByAppAndStream(@Param("app") String app, @Param("stream") String stream);
@Insert("<script>" +
"Insert INTO wvp_stream_push ( " +
" app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) " +
" app, stream, media_server_id, server_id, push_time, pushing, start_offline_push) " +
" VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
" ( #{item.app}, #{item.stream}, #{item.mediaServerId},#{item.serverId} ,#{item.pushTime}, #{item.updateTime}, #{item.createTime}, #{item.pushing}, #{item.startOfflinePush} )" +
" ( #{item.app}, #{item.stream}, #{item.mediaServerId},#{item.serverId} ,#{item.pushTime}, #{item.pushing}, #{item.startOfflinePush} )" +
" </foreach>" +
" </script>")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@@ -120,7 +145,7 @@ public interface StreamPushMapper {
Map<String, StreamPush> getAllGBId();
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.id=#{id}")
StreamPush queryOne(@Param("id") int id);
StreamPush queryOne(@Param("id") Long id);
@Select("<script> "+
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
@@ -129,23 +154,20 @@ public interface StreamPushMapper {
" #{item} " +
" </foreach>" +
" )</script>")
List<StreamPush> selectInSet(Set<Integer> ids);
List<StreamPush> selectInSet(Set<Long> ids);
@Delete("<script> "+
"DELETE FROM wvp_stream_push WHERE" +
" id in (" +
"<foreach collection='streamPushList' item='item' separator=','>" +
" #{item.id} " +
"</foreach>" +
")</script>")
void batchDel(List<StreamPush> streamPushList);
default void batchDel(List<StreamPush> streamPushList) {
if (streamPushList == null || streamPushList.isEmpty()) return;
List<Long> ids = streamPushList.stream().map(StreamPush::getId).collect(java.util.stream.Collectors.toList());
deleteBatch(StreamPush::getId, ids);
}
@Update({"<script>" +
"<foreach collection='streamPushItemForUpdate' item='item' separator=';'>" +
" UPDATE" +
" wvp_stream_push" +
" SET update_time=#{item.updateTime}" +
" SET update_time=NOW()" +
", app=#{item.app}" +
", stream=#{item.stream}" +
", media_server_id=#{item.mediaServerId}" +
@@ -158,13 +180,13 @@ public interface StreamPushMapper {
"</script>"})
int batchUpdate(List<StreamPush> streamPushItemForUpdate);
@Delete(" DELETE FROM wvp_stream_push" +
@Update(" UPDATE wvp_stream_push SET deleted = 1" +
" WHERE server_id = #{serverId}" +
" AND NOT EXISTS (" +
" SELECT 1 " +
" FROM wvp_device_channel wdc " +
" WHERE wdc.data_type = 2 " +
" AND wvp_stream_push.id = wdc.data_device_id" +
" );")
" )")
void deleteWithoutGBId(@Param("serverId") String serverId);
}

View File

@@ -105,12 +105,10 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
streamPush.setStream(streamPushExcelDto.getStream());
streamPush.setGbDeviceId(streamPushExcelDto.getGbDeviceId());
streamPush.setGbStatus(streamPushExcelDto.isStatus()?"ON":"OFF");
streamPush.setCreateTime(DateUtil.getNow());
streamPush.setMediaServerId(defaultMediaServerId);
streamPush.setGbName(streamPushExcelDto.getName());
streamPush.setGbLongitude(streamPushExcelDto.getLongitude());
streamPush.setGbLatitude(streamPushExcelDto.getLatitude());
streamPush.setUpdateTime(DateUtil.getNow());
streamPushItemForSave.put(streamPush.getApp() + streamPush.getStream(), streamPush);
loadedSize ++;

View File

@@ -4,9 +4,9 @@ import com.viewsh.module.video.common.StreamInfo;
import com.viewsh.module.video.service.bean.ErrorCallback;
public interface IStreamPushPlayService {
void start(Integer id, ErrorCallback<StreamInfo> callback, String platformDeviceId, String platformName );
void start(Long id, ErrorCallback<StreamInfo> callback, String platformDeviceId, String platformName );
void stop(String app, String stream);
void stop(Integer id);
void stop(Long id);
}

View File

@@ -1,10 +1,10 @@
package com.viewsh.module.video.streamPush.service;
import com.viewsh.framework.common.pojo.PageResult;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.service.bean.StreamPushItemFromRedis;
import com.viewsh.module.video.streamPush.bean.StreamPush;
import com.viewsh.module.video.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Map;
@@ -18,7 +18,7 @@ public interface IStreamPushService {
/**
* 获取
*/
PageInfo<StreamPush> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId);
PageResult<StreamPush> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId);
List<StreamPush> getPushList(String mediaSererId);
@@ -93,8 +93,8 @@ public interface IStreamPushService {
void batchUpdateForRedisMsg(List<StreamPush> streamPushItemForUpdate);
int delete(int id);
int delete(Long id);
void batchRemove(Set<Integer> ids);
void batchRemove(Set<Long> ids);
}

View File

@@ -53,7 +53,7 @@ public class StreamPushPlayServiceImpl implements IStreamPushPlayService {
private RedisPushStreamResponseListener redisPushStreamResponseListener;
@Override
public void start(Integer id, ErrorCallback<StreamInfo> callback, String platformDeviceId, String platformName ) {
public void start(Long id, ErrorCallback<StreamInfo> callback, String platformDeviceId, String platformName ) {
StreamPush streamPush = streamPushMapper.queryOne(id);
Assert.notNull(streamPush, "推流信息未找到");
@@ -130,7 +130,7 @@ public class StreamPushPlayServiceImpl implements IStreamPushPlayService {
}
@Override
public void stop(Integer id) {
public void stop(Long id) {
StreamPush streamPush = streamPushMapper.queryOne(id);
if (streamPush == null || !streamPush.isPushing()) {
return;

View File

@@ -24,8 +24,9 @@ import com.viewsh.module.video.streamPush.service.IStreamPushService;
import com.viewsh.module.video.utils.DateUtil;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.bean.ResourceBaseInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.viewsh.framework.common.pojo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
@@ -90,11 +91,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
StreamPush streamPush = StreamPush.getInstance(event, userSetting.getServerId());
streamPush.setPushing(true);
streamPush.setServerId(userSetting.getServerId());
streamPush.setUpdateTime(DateUtil.getNow());
streamPush.setPushTime(DateUtil.getNow());
add(streamPush);
}else {
streamPushInDb.setPushTime(DateUtil.getNow());
streamPushInDb.setPushing(true);
streamPushInDb.setServerId(userSetting.getServerId());
streamPushInDb.setMediaServerId(mediaInfo.getMediaServer().getId());
@@ -173,15 +172,15 @@ public class StreamPushServiceImpl implements IStreamPushService {
}
@Override
public PageInfo<StreamPush> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId) {
PageHelper.startPage(page, count);
public PageResult<StreamPush> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId) {
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<StreamPush> all = streamPushMapper.selectAll(query, pushing, mediaServerId);
return new PageInfo<>(all);
IPage<StreamPush> ipage = new Page<>(page, count);
IPage<StreamPush> result = streamPushMapper.selectAll(ipage, query, pushing, mediaServerId);
return new PageResult<>(result.getRecords(), result.getTotal());
}
@Override
@@ -203,8 +202,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
if (streamPushInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "应用名+流ID已存在");
}
stream.setUpdateTime(DateUtil.getNow());
stream.setCreateTime(DateUtil.getNow());
int addResult = streamPushMapper.add(stream);
if (addResult <= 0) {
return false;
@@ -251,7 +248,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "应用名+流ID已存在");
}
}
streamPush.setUpdateTime(DateUtil.getNow());
streamPushMapper.update(streamPush);
if (streamPush.getGbId() > 0) {
gbChannelService.update(streamPush.buildCommonGBChannel());
@@ -297,7 +293,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
}
}
sendRtpServerService.deleteByStream(streamPush.getStream());
streamPush.setUpdateTime(DateUtil.getNow());
streamPushMapper.update(streamPush);
return true;
}
@@ -449,7 +444,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
public void allOfflineForRedisMsg() {
String serverId = redisCatchStorage.chooseOneServer(null);
boolean permission = userSetting.getServerId().equals(serverId);
List<StreamPush> streamPushList = streamPushMapper.selectAll(null, null, null);
List<StreamPush> streamPushList = streamPushMapper.selectAllList(null, null, null);
if (streamPushList.isEmpty()) {
return;
}
@@ -579,7 +574,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
@Override
@Transactional
public int delete(int id) {
public int delete(Long id) {
StreamPush streamPush = streamPushMapper.queryOne(id);
if (streamPush == null) {
return 0;
@@ -596,12 +591,12 @@ public class StreamPushServiceImpl implements IStreamPushService {
@Override
@Transactional
public void batchRemove(Set<Integer> ids) {
public void batchRemove(Set<Long> ids) {
List<StreamPush> streamPushList = streamPushMapper.selectInSet(ids);
if (streamPushList.isEmpty()) {
return;
}
Set<Integer> channelIds = new HashSet<>();
Set<Long> channelIds = new HashSet<>();
streamPushList.stream().forEach(streamPush -> {
if (streamPush.getGbDeviceId() != null) {
channelIds.add(streamPush.getGbId());

View File

@@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSONArray;
import com.viewsh.module.video.common.StreamInfo;
import com.viewsh.module.video.framework.config.UserSetting;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.media.service.IMediaServerService;
import com.viewsh.module.video.service.ICloudRecordService;
@@ -19,7 +18,7 @@ import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.bean.StreamContent;
import com.viewsh.module.video.vmanager.bean.WVPResult;
import com.viewsh.module.video.vmanager.cloudRecord.bean.CloudRecordUrl;
import com.github.pagehelper.PageInfo;
import com.viewsh.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -40,6 +39,7 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -63,7 +63,7 @@ public class CloudRecordController {
@ResponseBody
@GetMapping("/date/list")
@Operation(summary = "查询存在云端录像的日期", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "查询存在云端录像的日期", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "app", description = "应用名", required = true)
@Parameter(name = "stream", description = "流ID", required = true)
@Parameter(name = "year", description = "年,置空则查询当年", required = false)
@@ -105,7 +105,7 @@ public class CloudRecordController {
@ResponseBody
@GetMapping("/list")
@Operation(summary = "分页查询云端录像", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "分页查询云端录像", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "query", description = "检索内容", required = false)
@Parameter(name = "app", description = "应用名", required = false)
@Parameter(name = "stream", description = "流ID", required = false)
@@ -116,7 +116,7 @@ public class CloudRecordController {
@Parameter(name = "mediaServerId", description = "流媒体ID置空则查询全部流媒体", required = false)
@Parameter(name = "callId", description = "每次录像的唯一标识,置空则查询全部流媒体", required = false)
@Parameter(name = "ascOrder", description = "是否升序排序, 升序: true 降序: false", required = false)
public PageInfo<CloudRecordItem> openRtpServer(@RequestParam(required = false) String query,
public PageResult<CloudRecordItem> openRtpServer(@RequestParam(required = false) String query,
@RequestParam(required = false) String app,
@RequestParam(required = false) String stream,
@RequestParam int page,
@@ -213,7 +213,7 @@ public class CloudRecordController {
@Parameter(name = "endTime", description = "鉴权ID", required = false)
@Parameter(name = "callId", description = "鉴权ID", required = false)
@Parameter(name = "recordId", description = "录像记录的ID用于精准收藏一个视频文件", required = false)
public int addCollect(@RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String callId, @RequestParam(required = false) Integer recordId) {
public int addCollect(@RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String callId, @RequestParam(required = false) Long recordId) {
log.info("[云端录像] 添加收藏app={}stream={},mediaServerId={},startTime={},endTime={},callId={},recordId={}", app, stream, mediaServerId, startTime, endTime, callId, recordId);
if (recordId != null) {
return cloudRecordService.changeCollectById(recordId, true);
@@ -232,7 +232,7 @@ public class CloudRecordController {
@Parameter(name = "endTime", description = "鉴权ID", required = false)
@Parameter(name = "callId", description = "鉴权ID", required = false)
@Parameter(name = "recordId", description = "录像记录的ID用于精准精准移除一个视频文件的收藏", required = false)
public int deleteCollect(@RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String callId, @RequestParam(required = false) Integer recordId) {
public int deleteCollect(@RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String callId, @RequestParam(required = false) Long recordId) {
log.info("[云端录像] 移除收藏app={}stream={},mediaServerId={},startTime={},endTime={},callId={},recordId={}", app, stream, mediaServerId, startTime, endTime, callId, recordId);
if (recordId != null) {
return cloudRecordService.changeCollectById(recordId, false);
@@ -245,7 +245,7 @@ public class CloudRecordController {
@GetMapping("/play/path")
@Operation(summary = "获取播放地址")
@Parameter(name = "recordId", description = "录像记录的ID", required = true)
public DownloadFileInfo getPlayUrlPath(@RequestParam(required = true) Integer recordId) {
public DownloadFileInfo getPlayUrlPath(@RequestParam(required = true) Long recordId) {
return cloudRecordService.getPlayUrlPath(recordId);
}
@@ -259,7 +259,7 @@ public class CloudRecordController {
HttpServletRequest request,
@RequestParam(required = true) String app,
@RequestParam(required = true) String stream,
@RequestParam(required = true) int cloudRecordId
@RequestParam(required = true) Long cloudRecordId
) {
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>();
@@ -355,14 +355,15 @@ public class CloudRecordController {
@Operation(summary = "删除录像文件")
@Parameter(name = "ids", description = "文件ID集合", required = true)
public void deleteFileByIds(@RequestBody BatchRemoveParam ids) {
cloudRecordService.deleteFileByIds(ids.getIds());
Set<Long> longIds = new java.util.HashSet<>(ids.getIds());
cloudRecordService.deleteFileByIds(longIds);
}
@ResponseBody
@GetMapping("/download/zip")
public void downloadZipFileFromUrl(HttpServletResponse response, Integer[] ids) {
public void downloadZipFileFromUrl(HttpServletResponse response, Long[] ids) {
log.info("[下载指定录像文件的压缩包] 查询 ids->{}", ids);
List<Integer> arrayList = new ArrayList<>(List.of(ids));
List<Long> arrayList = new ArrayList<>(List.of(ids));
List<CloudRecordUrl> cloudRecordItemList = cloudRecordService.getUrlListByIds(arrayList);
if (ObjectUtils.isEmpty(cloudRecordItemList)) {
log.warn("[下载指定录像文件的压缩包] 未找到录像文件ids->{}", ids);
@@ -423,7 +424,7 @@ public class CloudRecordController {
*/
@ResponseBody
@GetMapping("/zip")
public void downloadZipFile(HttpServletResponse response, @RequestParam(required = false) String query, @RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String callId, @RequestParam(required = false) List<Integer> ids
public void downloadZipFile(HttpServletResponse response, @RequestParam(required = false) String query, @RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String callId, @RequestParam(required = false) List<Long> ids
) {
log.info("[下载指定录像文件的压缩包] 查询 app->{}, stream->{}, mediaServerId->{}, startTime->{}, endTime->{}, callId->{}", app, stream, mediaServerId, startTime, endTime, callId);
@@ -517,7 +518,7 @@ public class CloudRecordController {
*/
@ResponseBody
@GetMapping("/list-url")
@Operation(summary = "分页查询云端录像", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "分页查询云端录像", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "query", description = "检索内容", required = false)
@Parameter(name = "app", description = "应用名", required = false)
@Parameter(name = "stream", description = "流ID", required = false)
@@ -527,7 +528,7 @@ public class CloudRecordController {
@Parameter(name = "endTime", description = "结束时间(yyyy-MM-dd HH:mm:ss)", required = false)
@Parameter(name = "mediaServerId", description = "流媒体ID置空则查询全部流媒体", required = false)
@Parameter(name = "callId", description = "每次录像的唯一标识,置空则查询全部流媒体", required = false)
public PageInfo<CloudRecordUrl> getListWithUrl(HttpServletRequest request, @RequestParam(required = false) String query, @RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam int page, @RequestParam int count, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String callId, @RequestParam(required = false) String remoteHost
public PageResult<CloudRecordUrl> getListWithUrl(HttpServletRequest request, @RequestParam(required = false) String query, @RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam int page, @RequestParam int count, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String callId, @RequestParam(required = false) String remoteHost
) {
log.info("[云端录像] 查询URL app->{}, stream->{}, mediaServerId->{}, page->{}, count->{}, startTime->{}, endTime->{}, callId->{}", app, stream, mediaServerId, page, count, startTime, endTime, callId);
@@ -568,27 +569,9 @@ public class CloudRecordController {
if (remoteHost == null) {
remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + (request.getScheme().equals("https") ? mediaServer.getHttpSSlPort() : mediaServer.getHttpPort());
}
PageInfo<CloudRecordItem> cloudRecordItemPageInfo = cloudRecordService.getList(page, count, query, app, stream, startTime, endTime, mediaServers, callId, null);
PageInfo<CloudRecordUrl> cloudRecordUrlPageInfo = new PageInfo<>();
if (!ObjectUtils.isEmpty(cloudRecordItemPageInfo)) {
cloudRecordUrlPageInfo.setPageNum(cloudRecordItemPageInfo.getPageNum());
cloudRecordUrlPageInfo.setPageSize(cloudRecordItemPageInfo.getPageSize());
cloudRecordUrlPageInfo.setSize(cloudRecordItemPageInfo.getSize());
cloudRecordUrlPageInfo.setEndRow(cloudRecordItemPageInfo.getEndRow());
cloudRecordUrlPageInfo.setStartRow(cloudRecordItemPageInfo.getStartRow());
cloudRecordUrlPageInfo.setPages(cloudRecordItemPageInfo.getPages());
cloudRecordUrlPageInfo.setPrePage(cloudRecordItemPageInfo.getPrePage());
cloudRecordUrlPageInfo.setNextPage(cloudRecordItemPageInfo.getNextPage());
cloudRecordUrlPageInfo.setIsFirstPage(cloudRecordItemPageInfo.isIsFirstPage());
cloudRecordUrlPageInfo.setIsLastPage(cloudRecordItemPageInfo.isIsLastPage());
cloudRecordUrlPageInfo.setHasPreviousPage(cloudRecordItemPageInfo.isHasPreviousPage());
cloudRecordUrlPageInfo.setHasNextPage(cloudRecordItemPageInfo.isHasNextPage());
cloudRecordUrlPageInfo.setNavigatePages(cloudRecordItemPageInfo.getNavigatePages());
cloudRecordUrlPageInfo.setNavigateFirstPage(cloudRecordItemPageInfo.getNavigateFirstPage());
cloudRecordUrlPageInfo.setNavigateLastPage(cloudRecordItemPageInfo.getNavigateLastPage());
cloudRecordUrlPageInfo.setNavigatepageNums(cloudRecordItemPageInfo.getNavigatepageNums());
cloudRecordUrlPageInfo.setTotal(cloudRecordItemPageInfo.getTotal());
List<CloudRecordUrl> cloudRecordUrlList = new ArrayList<>(cloudRecordItemPageInfo.getList().size());
PageResult<CloudRecordItem> cloudRecordItemPageInfo = cloudRecordService.getList(page, count, query, app, stream, startTime, endTime, mediaServers, callId, null);
List<CloudRecordUrl> cloudRecordUrlList = new ArrayList<>();
if (cloudRecordItemPageInfo != null && cloudRecordItemPageInfo.getList() != null) {
List<CloudRecordItem> cloudRecordItemList = cloudRecordItemPageInfo.getList();
for (CloudRecordItem cloudRecordItem : cloudRecordItemList) {
CloudRecordUrl cloudRecordUrl = new CloudRecordUrl();
@@ -597,8 +580,7 @@ public class CloudRecordController {
cloudRecordUrl.setPlayUrl(remoteHost + "/index/api/downloadFile?file_path=" + cloudRecordItem.getFilePath());
cloudRecordUrlList.add(cloudRecordUrl);
}
cloudRecordUrlPageInfo.setList(cloudRecordUrlList);
}
return cloudRecordUrlPageInfo;
return new PageResult<>(cloudRecordUrlList, cloudRecordItemPageInfo != null ? cloudRecordItemPageInfo.getTotal() : 0L);
}
}

View File

@@ -11,6 +11,6 @@ public class CloudRecordUrl {
private String playUrl;
private String downloadUrl;
private String fileName;
private int id;
private Long id;
}

View File

@@ -1,7 +1,6 @@
package com.viewsh.module.video.vmanager.log;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.service.ILogService;
import com.viewsh.module.video.service.bean.LogFileInfo;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
@@ -37,7 +36,7 @@ public class LogController {
@ResponseBody
@GetMapping("/list")
@Operation(summary = "分页查询日志文件", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "分页查询日志文件", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "query", description = "检索内容", required = false)
@Parameter(name = "startTime", description = "开始时间(yyyy-MM-dd HH:mm:ss)", required = false)
@Parameter(name = "endTime", description = "结束时间(yyyy-MM-dd HH:mm:ss)", required = false)

View File

@@ -4,7 +4,6 @@ import com.viewsh.module.video.common.VideoManagerConstants;
import com.viewsh.module.video.framework.config.DynamicTask;
import com.viewsh.module.video.framework.config.UserSetting;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.gb28181.bean.SendRtpInfo;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.media.event.hook.Hook;
@@ -63,7 +62,7 @@ public class PsController {
@GetMapping(value = "/receive/open")
@ResponseBody
@Operation(summary = "开启收流和获取发流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "开启收流和获取发流信息", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "isSend", description = "是否发送false时只开启收流 true同时返回推流信息", required = true)
@Parameter(name = "callId", description = "整个过程的唯一标识,为了与后续接口关联", required = true)
@Parameter(name = "ssrc", description = "来源流的SSRC不传则不校验来源ssrc", required = false)
@@ -146,7 +145,7 @@ public class PsController {
@GetMapping(value = "/receive/close")
@ResponseBody
@Operation(summary = "关闭收流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "关闭收流", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "stream", description = "流的ID", required = true)
public void closeRtpServer(String stream) {
log.info("[第三方PS服务对接->关闭收流] stream->{}", stream);
@@ -164,7 +163,7 @@ public class PsController {
@GetMapping(value = "/send/start")
@ResponseBody
@Operation(summary = "发送流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "发送流", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "ssrc", description = "发送流的SSRC", required = true)
@Parameter(name = "dstIp", description = "目标收流IP", required = true)
@Parameter(name = "dstPort", description = "目标收流端口", required = true)

View File

@@ -1,14 +1,13 @@
package com.viewsh.module.video.vmanager.recordPlan;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.gb28181.bean.CommonGBChannel;
import com.viewsh.module.video.gb28181.service.IDeviceChannelService;
import com.viewsh.module.video.service.IRecordPlanService;
import com.viewsh.module.video.service.bean.RecordPlan;
import com.viewsh.module.video.vmanager.bean.ErrorCode;
import com.viewsh.module.video.vmanager.recordPlan.bean.RecordPlanParam;
import com.github.pagehelper.PageInfo;
import com.viewsh.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -37,7 +36,7 @@ public class RecordPlanController {
@ResponseBody
@PostMapping("/add")
@Operation(summary = "添加录制计划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "添加录制计划", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "plan", description = "计划", required = true)
public void add(@RequestBody RecordPlan plan) {
if (plan.getPlanItemList() == null || plan.getPlanItemList().isEmpty()) {
@@ -48,7 +47,7 @@ public class RecordPlanController {
@ResponseBody
@PostMapping("/link")
@Operation(summary = "通道关联录制计划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "通道关联录制计划", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "param", description = "通道关联录制计划", required = true)
public void link(@RequestBody RecordPlanParam param) {
if (param.getAllLink() != null) {
@@ -64,11 +63,11 @@ public class RecordPlanController {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "通道ID和国标设备ID不可都为NULL");
}
List<Integer> channelIds = new ArrayList<>();
List<Long> channelIds = new ArrayList<>();
if (param.getChannelIds() != null) {
channelIds.addAll(param.getChannelIds());
}else {
List<Integer> chanelIdList = deviceChannelService.queryChaneIdListByDeviceDbIds(param.getDeviceDbIds());
List<Long> chanelIdList = deviceChannelService.queryChaneIdListByDeviceDbIds(param.getDeviceDbIds());
if (chanelIdList != null && !chanelIdList.isEmpty()) {
channelIds = chanelIdList;
}
@@ -78,9 +77,9 @@ public class RecordPlanController {
@ResponseBody
@GetMapping("/get")
@Operation(summary = "查询录制计划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "查询录制计划", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "planId", description = "计划ID", required = true)
public RecordPlan get(Integer planId) {
public RecordPlan get(Long planId) {
if (planId == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "计划ID不可为NULL");
}
@@ -89,18 +88,18 @@ public class RecordPlanController {
@ResponseBody
@GetMapping("/query")
@Operation(summary = "查询录制计划列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "查询录制计划列表", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "query", description = "检索内容", required = false)
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
public PageInfo<RecordPlan> query(@RequestParam(required = false) String query, @RequestParam Integer page, @RequestParam Integer count) {
public PageResult<RecordPlan> query(@RequestParam(required = false) String query, @RequestParam Integer page, @RequestParam Integer count) {
if (query != null && ObjectUtils.isEmpty(query.trim())) {
query = null;
}
return recordPlanService.query(page, count, query);
}
@Operation(summary = "分页查询录制计划关联的所有通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "分页查询录制计划关联的所有通道", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true)
@Parameter(name = "planId", description = "录制计划ID")
@@ -110,8 +109,8 @@ public class RecordPlanController {
@Parameter(name = "hasLink", description = "是否已经关联")
@GetMapping("/channel/list")
@ResponseBody
public PageInfo<CommonGBChannel> queryChannelList(int page, int count,
@RequestParam(required = false) Integer planId,
public PageResult<CommonGBChannel> queryChannelList(int page, int count,
@RequestParam(required = false) Long planId,
@RequestParam(required = false) String query,
@RequestParam(required = false) Integer channelType,
@RequestParam(required = false) Boolean online,
@@ -127,10 +126,10 @@ public class RecordPlanController {
@ResponseBody
@PostMapping("/update")
@Operation(summary = "更新录制计划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "更新录制计划", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "plan", description = "计划", required = true)
public void update(@RequestBody RecordPlan plan) {
if (plan == null || plan.getId() == 0) {
if (plan == null || plan.getId() == null || plan.getId() == 0L) {
throw new ControllerException(ErrorCode.ERROR400);
}
recordPlanService.update(plan);
@@ -138,9 +137,9 @@ public class RecordPlanController {
@ResponseBody
@DeleteMapping("/delete")
@Operation(summary = "删除录制计划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "删除录制计划", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "planId", description = "计划ID", required = true)
public void delete(Integer planId) {
public void delete(Long planId) {
if (planId == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "计划IDID不可为NULL");
}

View File

@@ -10,14 +10,14 @@ import java.util.List;
public class RecordPlanParam {
@Schema(description = "关联的通道ID")
private List<Integer> channelIds;
private List<Long> channelIds;
@Schema(description = "关联的设备ID会为设备下的所有通道关联此录制计划channelId存在是此项不生效")
private List<Integer> deviceDbIds;
private List<Long> deviceDbIds;
@Schema(description = "全部关联/全部取消关联")
private Boolean allLink;
@Schema(description = "录制计划ID, ID为空是删除关联的计划")
private Integer planId;
private Long planId;
}

View File

@@ -4,7 +4,6 @@ import com.viewsh.module.video.common.VideoManagerConstants;
import com.viewsh.module.video.framework.config.DynamicTask;
import com.viewsh.module.video.framework.config.UserSetting;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.gb28181.bean.SendRtpInfo;
import com.viewsh.module.video.media.bean.MediaServer;
import com.viewsh.module.video.media.event.hook.Hook;
@@ -63,7 +62,7 @@ public class RtpController {
@GetMapping(value = "/receive/open")
@ResponseBody
@Operation(summary = "开启收流和获取发流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "开启收流和获取发流信息", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "isSend", description = "是否发送false时只开启收流 true同时返回推流信息", required = true)
@Parameter(name = "callId", description = "整个过程的唯一标识,为了与后续接口关联", required = true)
@Parameter(name = "ssrc", description = "来源流的SSRC不传则不校验来源ssrc", required = false)
@@ -149,7 +148,7 @@ public class RtpController {
@GetMapping(value = "/receive/close")
@ResponseBody
@Operation(summary = "关闭收流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "关闭收流", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "stream", description = "流的ID", required = true)
public void closeRtpServer(String stream) {
log.info("[第三方服务对接->关闭收流] stream->{}", stream);
@@ -168,7 +167,7 @@ public class RtpController {
@GetMapping(value = "/send/start")
@ResponseBody
@Operation(summary = "发送流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "发送流", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "ssrc", description = "发送流的SSRC", required = true)
@Parameter(name = "dstIpForAudio", description = "目标音频收流IP", required = false)
@Parameter(name = "dstIpForVideo", description = "目标视频收流IP", required = false)
@@ -291,7 +290,7 @@ public class RtpController {
@GetMapping(value = "/send/stop")
@ResponseBody
@Operation(summary = "关闭发送流", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "关闭发送流", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "callId", description = "整个过程的唯一标识,不传则使用随机端口发流", required = true)
public void closeSendRTP(String callId) {
log.info("[第三方服务对接->关闭发送流] callId->{}", callId);

View File

@@ -8,7 +8,6 @@ import com.viewsh.module.video.framework.sip.SipConfig;
import com.viewsh.module.video.framework.config.UserSetting;
import com.viewsh.module.video.framework.config.VersionInfo;
import com.viewsh.module.video.framework.exception.ControllerException;
import com.viewsh.module.video.conf.security.JwtUtils;
import com.viewsh.module.video.gb28181.service.IDeviceChannelService;
import com.viewsh.module.video.gb28181.service.IDeviceService;
import com.viewsh.module.video.jt1078.config.JT1078Config;
@@ -97,27 +96,27 @@ public class ServerController {
@GetMapping(value = "/media_server/list")
@ResponseBody
@Operation(summary = "流媒体服务列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "流媒体服务列表", security = @SecurityRequirement(name = "Authorization"))
public List<MediaServer> getMediaServerList() {
return mediaServerService.getAll();
}
@GetMapping(value = "/media_server/online/list")
@ResponseBody
@Operation(summary = "在线流媒体服务列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "在线流媒体服务列表", security = @SecurityRequirement(name = "Authorization"))
public List<MediaServer> getOnlineMediaServerList() {
return mediaServerService.getAllOnline();
}
@GetMapping(value = "/media_server/one/{id}")
@ResponseBody
@Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "停止视频回放", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "id", description = "流媒体服务ID", required = true)
public MediaServer getMediaServer(@PathVariable String id) {
return mediaServerService.getOne(id);
}
@Operation(summary = "测试流媒体服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "测试流媒体服务", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "ip", description = "流媒体服务IP", required = true)
@Parameter(name = "port", description = "流媒体服务HTT端口", required = true)
@Parameter(name = "secret", description = "流媒体服务secret", required = true)
@@ -127,7 +126,7 @@ public class ServerController {
return mediaServerService.checkMediaServer(ip, port, secret, type);
}
@Operation(summary = "测试流媒体录像管理服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "测试流媒体录像管理服务", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "ip", description = "流媒体服务IP", required = true)
@Parameter(name = "port", description = "流媒体服务HTT端口", required = true)
@GetMapping(value = "/media_server/record/check")
@@ -139,7 +138,7 @@ public class ServerController {
}
}
@Operation(summary = "保存流媒体服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "保存流媒体服务", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "mediaServerItem", description = "流媒体信息", required = true)
@PostMapping(value = "/media_server/save")
@ResponseBody
@@ -157,7 +156,7 @@ public class ServerController {
}
}
@Operation(summary = "移除流媒体服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "移除流媒体服务", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "id", description = "流媒体ID", required = true)
@DeleteMapping(value = "/media_server/delete")
@ResponseBody
@@ -169,7 +168,7 @@ public class ServerController {
mediaServerService.delete(mediaServer);
}
@Operation(summary = "获取流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取流信息", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "app", description = "应用名", required = true)
@Parameter(name = "stream", description = "流ID", required = true)
@Parameter(name = "mediaServerId", description = "流媒体ID", required = true)
@@ -184,7 +183,7 @@ public class ServerController {
}
@Operation(summary = "关闭服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "关闭服务", security = @SecurityRequirement(name = "Authorization"))
@GetMapping(value = "/shutdown")
@ResponseBody
public void shutdown() {
@@ -192,7 +191,7 @@ public class ServerController {
System.exit(1);
}
@Operation(summary = "获取系统配置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取系统配置信息", security = @SecurityRequirement(name = "Authorization"))
@GetMapping(value = "/system/configInfo")
@ResponseBody
public SystemConfigInfo getConfigInfo() {
@@ -205,7 +204,7 @@ public class ServerController {
return systemConfigInfo;
}
@Operation(summary = "获取版本信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取版本信息", security = @SecurityRequirement(name = "Authorization"))
@GetMapping(value = "/version")
@ResponseBody
public VersionPo VersionPogetVersion() {
@@ -213,7 +212,7 @@ public class ServerController {
}
@GetMapping(value = "/config")
@Operation(summary = "获取配置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取配置信息", security = @SecurityRequirement(name = "Authorization"))
@Parameter(name = "type", description = "配置类型sip, base", required = true)
@ResponseBody
public JSONObject getVersion(String type) {
@@ -240,7 +239,7 @@ public class ServerController {
@GetMapping(value = "/system/info")
@ResponseBody
@Operation(summary = "获取系统信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取系统信息", security = @SecurityRequirement(name = "Authorization"))
public SystemAllInfo getSystemInfo() {
SystemAllInfo systemAllInfo = redisCatchStorage.getSystemInfo();
@@ -249,7 +248,7 @@ public class ServerController {
@GetMapping(value = "/media_server/load")
@ResponseBody
@Operation(summary = "获取负载信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取负载信息", security = @SecurityRequirement(name = "Authorization"))
public List<MediaServerLoad> getMediaLoad() {
List<MediaServerLoad> result = new ArrayList<>();
List<MediaServer> allOnline = mediaServerService.getAllOnline();
@@ -265,7 +264,7 @@ public class ServerController {
@GetMapping(value = "/resource/info")
@ResponseBody
@Operation(summary = "获取负载信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取负载信息", security = @SecurityRequirement(name = "Authorization"))
public ResourceInfo getResourceInfo() {
ResourceInfo result = new ResourceInfo();
ResourceBaseInfo deviceInfo = deviceService.getOverview();
@@ -282,7 +281,7 @@ public class ServerController {
@GetMapping(value = "/info")
@ResponseBody
@Operation(summary = "获取系统信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取系统信息", security = @SecurityRequirement(name = "Authorization"))
public Map<String, Map<String, String>> getInfo(HttpServletRequest request) {
Map<String, Map<String, String>> result = new LinkedHashMap<>();
Map<String, String> hardwareMap = new LinkedHashMap<>();
@@ -364,7 +363,7 @@ public class ServerController {
@GetMapping(value = "/map/config")
@ResponseBody
@Operation(summary = "获取地图配置", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取地图配置", security = @SecurityRequirement(name = "Authorization"))
public List<MapConfig> getMapConfig() {
if (mapService == null) {
return Collections.emptyList();
@@ -374,7 +373,7 @@ public class ServerController {
@GetMapping(value = "/map/model-icon/list")
@ResponseBody
@Operation(summary = "获取地图配置图标", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Operation(summary = "获取地图配置图标", security = @SecurityRequirement(name = "Authorization"))
public List<MapModelIcon> getMapModelIconList() {
if (mapService == null) {
return Collections.emptyList();