mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 22:47:49 +08:00
1078-添加录像上传
This commit is contained in:
parent
e8d832d0a5
commit
3728219177
@ -21,7 +21,7 @@ public class FtpServerConfig {
|
|||||||
private UserManager userManager;
|
private UserManager userManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FtpPlet ftpPlet;
|
private ftplet ftpPlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ftp server init
|
* ftp server init
|
||||||
|
|||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.genersoft.iot.vmp.conf.ftpServer;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置文件 user-settings 映射的配置信息
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "ftp", ignoreInvalidFields = true)
|
||||||
|
@Order(0)
|
||||||
|
public class FtpSetting {
|
||||||
|
|
||||||
|
private Boolean enable = Boolean.FALSE;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
private int port = 21;
|
||||||
|
private String username = "admin";
|
||||||
|
private String password = "admin";
|
||||||
|
|
||||||
|
public Boolean getEnable() {
|
||||||
|
return enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnable(Boolean enable) {
|
||||||
|
this.enable = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPort(int port) {
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,8 @@ package com.genersoft.iot.vmp.conf.ftpServer;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.jt1078.event.FtpUploadEvent;
|
import com.genersoft.iot.vmp.jt1078.event.FtpUploadEvent;
|
||||||
import org.apache.ftpserver.ftplet.*;
|
import org.apache.ftpserver.ftplet.*;
|
||||||
import org.apache.ftpserver.impl.DefaultFtpSession;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
@ -12,9 +13,9 @@ import java.io.IOException;
|
|||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FtpPlet extends DefaultFtplet {
|
public class ftplet extends DefaultFtplet {
|
||||||
|
|
||||||
private FtpletContext ftpletContext;
|
private final Logger logger = LoggerFactory.getLogger(ftplet.class);
|
||||||
|
|
||||||
@Value("${ftp.username}")
|
@Value("${ftp.username}")
|
||||||
private String username;
|
private String username;
|
||||||
@ -28,22 +29,26 @@ public class FtpPlet extends DefaultFtplet {
|
|||||||
return FtpletResult.DISCONNECT;
|
return FtpletResult.DISCONNECT;
|
||||||
}
|
}
|
||||||
super.beforeCommand(session, request);
|
super.beforeCommand(session, request);
|
||||||
// if (request.getCommand().equalsIgnoreCase("STOR") ) {
|
|
||||||
// FtpUploadEvent ftpUploadEvent = new FtpUploadEvent(this);
|
|
||||||
// ftpUploadEvent.setFileName(request.getArgument());
|
|
||||||
// applicationEventPublisher.publishEvent(ftpUploadEvent);
|
|
||||||
// }
|
|
||||||
return FtpletResult.DEFAULT;
|
return FtpletResult.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FtpletResult onUploadStart(FtpSession session, FtpRequest request) throws FtpException, IOException {
|
public FtpletResult onUploadEnd(FtpSession session, FtpRequest request) throws FtpException, IOException {
|
||||||
DefaultFtpSession ftpSession = (DefaultFtpSession) session;
|
FtpUploadEvent event = new FtpUploadEvent(this);
|
||||||
return super.onUploadStart(session, request);
|
event.setFileName(session.getFileSystemView().getFile(request.getArgument()).getAbsolutePath());
|
||||||
|
applicationEventPublisher.publishEvent(event);
|
||||||
|
|
||||||
|
logger.info("[文件已上传]: {}", session.getFileSystemView().getFile(request.getArgument()).getAbsolutePath());
|
||||||
|
return super.onUploadEnd(session, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FtpletResult onUploadEnd(FtpSession session, FtpRequest request) throws FtpException, IOException {
|
public FtpletResult onAppendEnd(FtpSession session, FtpRequest request) throws FtpException, IOException {
|
||||||
|
FtpUploadEvent event = new FtpUploadEvent(this);
|
||||||
|
event.setFileName(session.getFileSystemView().getFile(request.getArgument()).getAbsolutePath());
|
||||||
|
applicationEventPublisher.publishEvent(event);
|
||||||
|
|
||||||
|
logger.info("[文件已上传]: {}", session.getFileSystemView().getFile(request.getArgument()).getAbsolutePath());
|
||||||
return super.onUploadEnd(session, request);
|
return super.onUploadEnd(session, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,6 +1,8 @@
|
|||||||
package com.genersoft.iot.vmp.jt1078.controller;
|
package com.genersoft.iot.vmp.jt1078.controller;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.conf.ftpServer.FtpSetting;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.*;
|
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||||
import com.genersoft.iot.vmp.jt1078.controller.bean.*;
|
import com.genersoft.iot.vmp.jt1078.controller.bean.*;
|
||||||
@ -29,8 +31,11 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -53,6 +58,9 @@ public class JT1078Controller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
UserSetting userSetting;
|
UserSetting userSetting;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FtpSetting ftpSetting;
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@Autowired
|
@Autowired
|
||||||
private ThreadPoolTaskExecutor taskExecutor;
|
private ThreadPoolTaskExecutor taskExecutor;
|
||||||
@ -252,7 +260,7 @@ public class JT1078Controller {
|
|||||||
return WVPResult.success(recordList);
|
return WVPResult.success(recordList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Operation(summary = "1078-开始回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "1078-录像-开始回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||||
@Parameter(name = "startTime", description = "开始时间,格式: yyyy-MM-dd HH:mm:ss", required = true)
|
@Parameter(name = "startTime", description = "开始时间,格式: yyyy-MM-dd HH:mm:ss", required = true)
|
||||||
@ -321,7 +329,7 @@ public class JT1078Controller {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "1078-回放控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "1078-录像-回放控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||||
@Parameter(name = "command", description = "0:开始回放; 1:暂停回放; 2:结束回放; 3:快进回放; 4:关键帧快退回放; 5:拖动回放; 6:关键帧播放", required = true)
|
@Parameter(name = "command", description = "0:开始回放; 1:暂停回放; 2:结束回放; 3:快进回放; 4:关键帧快退回放; 5:拖动回放; 6:关键帧播放", required = true)
|
||||||
@ -338,7 +346,7 @@ public class JT1078Controller {
|
|||||||
service.playbackControl(deviceId, channelId, command, playbackSpeed,time);
|
service.playbackControl(deviceId, channelId, command, playbackSpeed,time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "1078-结束回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "1078-录像-结束回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||||
@GetMapping("/playback/stop")
|
@GetMapping("/playback/stop")
|
||||||
@ -351,6 +359,33 @@ public class JT1078Controller {
|
|||||||
service.stopPlayback(deviceId, channelId);
|
service.stopPlayback(deviceId, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "1078-录像-下载", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
|
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||||
|
@Parameter(name = "startTime", description = "开始时间,格式: yyyy-MM-dd HH:mm:ss", required = true)
|
||||||
|
@Parameter(name = "endTime", description = "结束时间,格式: yyyy-MM-dd HH:mm:ss", required = true)
|
||||||
|
@Parameter(name = "type", description = "0.音视频 1.音频 2.视频 3.视频或音视频", required = true)
|
||||||
|
@Parameter(name = "rate", description = "0.所有码流 1.主码流 2.子码流(如果此通道只传输音频,此字段置0)", required = true)
|
||||||
|
@GetMapping("/playback/download")
|
||||||
|
public void recordDownload(HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
@Parameter(required = true) String deviceId,
|
||||||
|
@Parameter(required = false) String channelId,
|
||||||
|
@Parameter(required = true) String startTime,
|
||||||
|
@Parameter(required = true) String endTime,
|
||||||
|
@Parameter(required = false) Integer type,
|
||||||
|
@Parameter(required = false) Integer rate
|
||||||
|
|
||||||
|
) throws IOException {
|
||||||
|
logger.info("[1078-录像] 下载,设备:{}, 通道: {}, 开始时间: {}, 结束时间: {}, 音视频类型: {}, 码流类型: {}, ",
|
||||||
|
deviceId, channelId, startTime, endTime, type, rate);
|
||||||
|
if (!ftpSetting.getEnable()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未启用ftp服务,无法下载录像");
|
||||||
|
}
|
||||||
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
|
service.recordDownload(deviceId, channelId, startTime, endTime, type, rate, outputStream);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "1078-分页查询部标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "1078-分页查询部标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "page", description = "当前页", required = true)
|
@Parameter(name = "page", description = "当前页", required = true)
|
||||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufUtil;
|
import io.netty.buffer.ByteBufUtil;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.util.CharsetUtil;
|
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public class J9206 extends Rs {
|
|||||||
// 服务器端口
|
// 服务器端口
|
||||||
private int port;
|
private int port;
|
||||||
// 用户名
|
// 用户名
|
||||||
private String user;
|
private String username;
|
||||||
// 密码
|
// 密码
|
||||||
private String password;
|
private String password;
|
||||||
// 文件上传路径
|
// 文件上传路径
|
||||||
@ -62,9 +61,9 @@ public class J9206 extends Rs {
|
|||||||
|
|
||||||
buffer.writeByte(serverIp.getBytes(Charset.forName("GBK")).length);
|
buffer.writeByte(serverIp.getBytes(Charset.forName("GBK")).length);
|
||||||
buffer.writeCharSequence(serverIp, Charset.forName("GBK"));
|
buffer.writeCharSequence(serverIp, Charset.forName("GBK"));
|
||||||
buffer.writeByte(port);
|
buffer.writeShort(port);
|
||||||
buffer.writeByte(user.getBytes(Charset.forName("GBK")).length);
|
buffer.writeByte(username.getBytes(Charset.forName("GBK")).length);
|
||||||
buffer.writeCharSequence(user, Charset.forName("GBK"));
|
buffer.writeCharSequence(username, Charset.forName("GBK"));
|
||||||
buffer.writeByte(password.getBytes(Charset.forName("GBK")).length);
|
buffer.writeByte(password.getBytes(Charset.forName("GBK")).length);
|
||||||
buffer.writeCharSequence(password, Charset.forName("GBK"));
|
buffer.writeCharSequence(password, Charset.forName("GBK"));
|
||||||
buffer.writeByte(path.getBytes(Charset.forName("GBK")).length);
|
buffer.writeByte(path.getBytes(Charset.forName("GBK")).length);
|
||||||
@ -77,7 +76,6 @@ public class J9206 extends Rs {
|
|||||||
buffer.writeByte(streamType);
|
buffer.writeByte(streamType);
|
||||||
buffer.writeByte(storageType);
|
buffer.writeByte(storageType);
|
||||||
buffer.writeByte(taskConditions);
|
buffer.writeByte(taskConditions);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,12 +96,12 @@ public class J9206 extends Rs {
|
|||||||
this.port = port;
|
this.port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUser() {
|
public String getUsername() {
|
||||||
return user;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(String user) {
|
public void setUsername(String username) {
|
||||||
this.user = user;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
@ -187,7 +185,7 @@ public class J9206 extends Rs {
|
|||||||
return "J9206{" +
|
return "J9206{" +
|
||||||
"serverIp='" + serverIp + '\'' +
|
"serverIp='" + serverIp + '\'' +
|
||||||
", port=" + port +
|
", port=" + port +
|
||||||
", user='" + user + '\'' +
|
", user='" + username + '\'' +
|
||||||
", password='" + password + '\'' +
|
", password='" + password + '\'' +
|
||||||
", path='" + path + '\'' +
|
", path='" + path + '\'' +
|
||||||
", channelId=" + channelId +
|
", channelId=" + channelId +
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.jt1078.bean.*;
|
|||||||
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface Ijt1078Service {
|
public interface Ijt1078Service {
|
||||||
@ -115,4 +116,6 @@ public interface Ijt1078Service {
|
|||||||
void changeStreamType(String deviceId, String channelId, Integer streamType);
|
void changeStreamType(String deviceId, String channelId, Integer streamType);
|
||||||
|
|
||||||
void playbackControl(String deviceId, String channelId, Integer command, Integer playbackSpeed, String time);
|
void playbackControl(String deviceId, String channelId, Integer command, Integer playbackSpeed, String time);
|
||||||
|
|
||||||
|
void recordDownload(String deviceId, String channelId, String startTime, String endTime, Integer type, Integer rate, ServletOutputStream outputStream);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,19 +5,19 @@ import com.genersoft.iot.vmp.common.GeneralCallback;
|
|||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
|
import com.genersoft.iot.vmp.conf.ftpServer.FtpSetting;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.*;
|
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||||
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
|
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
|
||||||
import com.genersoft.iot.vmp.jt1078.dao.JTDeviceMapper;
|
import com.genersoft.iot.vmp.jt1078.dao.JTDeviceMapper;
|
||||||
import com.genersoft.iot.vmp.jt1078.event.CallbackManager;
|
import com.genersoft.iot.vmp.jt1078.event.CallbackManager;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.event.FtpUploadEvent;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
||||||
import com.genersoft.iot.vmp.jt1078.proc.response.*;
|
import com.genersoft.iot.vmp.jt1078.proc.response.*;
|
||||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||||
import com.genersoft.iot.vmp.jt1078.util.SSRCUtil;
|
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.media.event.hook.Hook;
|
import com.genersoft.iot.vmp.media.event.hook.Hook;
|
||||||
@ -35,22 +35,19 @@ import com.genersoft.iot.vmp.utils.DateUtil;
|
|||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.apache.commons.compress.utils.IOUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.sip.SipException;
|
import java.io.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.text.ParseException;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -91,6 +88,9 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FtpSetting ftpSetting;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JTDevice getDevice(String terminalId) {
|
public JTDevice getDevice(String terminalId) {
|
||||||
@ -136,14 +136,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||||
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playKey, k -> new ArrayList<>());
|
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playKey, k -> new ArrayList<>());
|
||||||
errorCallbacks.add(callback);
|
errorCallbacks.add(callback);
|
||||||
StreamInfo streamInfo = (StreamInfo)redisTemplate.opsForValue().get(playKey);
|
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||||
if (streamInfo != null) {
|
if (streamInfo != null) {
|
||||||
String mediaServerId = streamInfo.getMediaServerId();
|
String mediaServerId = streamInfo.getMediaServerId();
|
||||||
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||||
if (mediaServer != null) {
|
if (mediaServer != null) {
|
||||||
// 查询流是否存在,不存在则删除缓存数据
|
// 查询流是否存在,不存在则删除缓存数据
|
||||||
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServer, "rtp", "rtsp", streamInfo.getStream());
|
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServer, "rtp", "rtsp", streamInfo.getStream());
|
||||||
if (mediaInfo != null && mediaInfo.getInteger("code") == 0 ) {
|
if (mediaInfo != null && mediaInfo.getInteger("code") == 0) {
|
||||||
Boolean online = mediaInfo.getBoolean("online");
|
Boolean online = mediaInfo.getBoolean("online");
|
||||||
if (online != null && online) {
|
if (online != null && online) {
|
||||||
logger.info("[1078-点播] 点播已经存在,直接返回, deviceId: {}, channelId: {}", deviceId, channelId);
|
logger.info("[1078-点播] 点播已经存在,直接返回, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||||
@ -190,7 +190,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
}, userSetting.getPlayTimeout());
|
}, userSetting.getPlayTimeout());
|
||||||
|
|
||||||
// 开启收流端口
|
// 开启收流端口
|
||||||
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServer, stream, null, false, false, 0, false, false, false,1);
|
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServer, stream, null, false, false, 0, false, false, false, 1);
|
||||||
logger.info("[1078-点播] deviceId: {}, channelId: {}, 端口: {}", deviceId, channelId, ssrcInfo.getPort());
|
logger.info("[1078-点播] deviceId: {}, channelId: {}, 端口: {}", deviceId, channelId, ssrcInfo.getPort());
|
||||||
J9101 j9101 = new J9101();
|
J9101 j9101 = new J9101();
|
||||||
j9101.setChannel(Integer.valueOf(channelId));
|
j9101.setChannel(Integer.valueOf(channelId));
|
||||||
@ -291,7 +291,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
logger.info("[1078-查询录像列表] deviceId: {}, channelId: {}, startTime: {}, endTime: {}, 结果: {}条"
|
logger.info("[1078-查询录像列表] deviceId: {}, channelId: {}, startTime: {}, endTime: {}, 结果: {}条"
|
||||||
, deviceId, channelId, startTime, endTime, JRecordItemList.size() );
|
, deviceId, channelId, startTime, endTime, JRecordItemList.size());
|
||||||
return JRecordItemList;
|
return JRecordItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,14 +305,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playbackKey, k -> new ArrayList<>());
|
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playbackKey, k -> new ArrayList<>());
|
||||||
errorCallbacks.add(callback);
|
errorCallbacks.add(callback);
|
||||||
String logInfo = String.format("deviceId:%s, channelId:%s, startTime:%s, endTime:%s", deviceId, channelId, startTime, endTime);
|
String logInfo = String.format("deviceId:%s, channelId:%s, startTime:%s, endTime:%s", deviceId, channelId, startTime, endTime);
|
||||||
StreamInfo streamInfo = (StreamInfo)redisTemplate.opsForValue().get(playbackKey);
|
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playbackKey);
|
||||||
if (streamInfo != null) {
|
if (streamInfo != null) {
|
||||||
String mediaServerId = streamInfo.getMediaServerId();
|
String mediaServerId = streamInfo.getMediaServerId();
|
||||||
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||||
if (mediaServer != null) {
|
if (mediaServer != null) {
|
||||||
// 查询流是否存在,不存在则删除缓存数据
|
// 查询流是否存在,不存在则删除缓存数据
|
||||||
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServer, "rtp", "rtsp", streamInfo.getStream());
|
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServer, "rtp", "rtsp", streamInfo.getStream());
|
||||||
if (mediaInfo != null && mediaInfo.getInteger("code") == 0 ) {
|
if (mediaInfo != null && mediaInfo.getInteger("code") == 0) {
|
||||||
Boolean online = mediaInfo.getBoolean("online");
|
Boolean online = mediaInfo.getBoolean("online");
|
||||||
if (online != null && online) {
|
if (online != null && online) {
|
||||||
logger.info("[1078-回放] 回放已经存在,直接返回, logInfo: {}", logInfo);
|
logger.info("[1078-回放] 回放已经存在,直接返回, logInfo: {}", logInfo);
|
||||||
@ -424,6 +424,67 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
playbackControl(deviceId, channelId, 2, null, String.valueOf(0));
|
playbackControl(deviceId, channelId, 2, null, String.valueOf(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, ServletOutputStream> fileUploadMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@EventListener
|
||||||
|
public void onApplicationEvent(FtpUploadEvent event) {
|
||||||
|
if (fileUploadMap.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fileUploadMap.keySet().forEach(key -> {
|
||||||
|
if (!event.getFileName().contains(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ServletOutputStream servletOutputStream = fileUploadMap.get(event.getFileName());
|
||||||
|
String filePath = "ftp" + event.getFileName();
|
||||||
|
File file = new File(filePath);
|
||||||
|
if (!file.exists()) {
|
||||||
|
logger.warn("[下载录像] 收到通知时未找到录像文件: {}", filePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileInputStream fileInputStream = new FileInputStream(file);
|
||||||
|
IOUtils.copy(fileInputStream, servletOutputStream);
|
||||||
|
fileInputStream.close();
|
||||||
|
servletOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.warn("[下载录像] 读取文件异常: {}", filePath, e);
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
servletOutputStream.close();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recordDownload(String deviceId, String channelId, String startTime, String endTime, Integer type, Integer rate, ServletOutputStream outputStream) {
|
||||||
|
String filePath = UUID.randomUUID().toString();
|
||||||
|
fileUploadMap.put(filePath, outputStream);
|
||||||
|
logger.info("[1078-录像] 下载,设备:{}, 通道: {}, 开始时间: {}, 结束时间: {},等待上传文件路径: {} ",
|
||||||
|
deviceId, channelId, startTime, endTime, filePath);
|
||||||
|
// 发送停止命令
|
||||||
|
J9206 j92026 = new J9206();
|
||||||
|
j92026.setChannelId(Integer.parseInt(channelId));
|
||||||
|
j92026.setStartTime(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(startTime));
|
||||||
|
j92026.setEndTime(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(endTime));
|
||||||
|
j92026.setServerIp(ftpSetting.getIp());
|
||||||
|
j92026.setPort(ftpSetting.getPort());
|
||||||
|
j92026.setUsername(ftpSetting.getUsername());
|
||||||
|
j92026.setPassword(ftpSetting.getPassword());
|
||||||
|
j92026.setPath(filePath);
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
j92026.setMediaType(type);
|
||||||
|
}
|
||||||
|
if (rate != null) {
|
||||||
|
j92026.setStreamType(rate);
|
||||||
|
}
|
||||||
|
jt1078Template.fileUpload(deviceId, j92026, 7200);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ptzControl(String deviceId, String channelId, String command, int speed) {
|
public void ptzControl(String deviceId, String channelId, String command, int speed) {
|
||||||
// 发送停止命令
|
// 发送停止命令
|
||||||
@ -467,7 +528,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j9306.setChannel(Integer.parseInt(channelId));
|
j9306.setChannel(Integer.parseInt(channelId));
|
||||||
if (command.equals("zoomin")) {
|
if (command.equals("zoomin")) {
|
||||||
j9306.setZoom(0);
|
j9306.setZoom(0);
|
||||||
}else {
|
} else {
|
||||||
j9306.setZoom(1);
|
j9306.setZoom(1);
|
||||||
}
|
}
|
||||||
jt1078Template.ptzZoom(deviceId, j9306, 6);
|
jt1078Template.ptzZoom(deviceId, j9306, 6);
|
||||||
@ -478,7 +539,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j9303.setChannel(Integer.parseInt(channelId));
|
j9303.setChannel(Integer.parseInt(channelId));
|
||||||
if (command.equals("irisin")) {
|
if (command.equals("irisin")) {
|
||||||
j9303.setIris(0);
|
j9303.setIris(0);
|
||||||
}else {
|
} else {
|
||||||
j9303.setIris(1);
|
j9303.setIris(1);
|
||||||
}
|
}
|
||||||
jt1078Template.ptzIris(deviceId, j9303, 6);
|
jt1078Template.ptzIris(deviceId, j9303, 6);
|
||||||
@ -489,7 +550,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j9302.setChannel(Integer.parseInt(channelId));
|
j9302.setChannel(Integer.parseInt(channelId));
|
||||||
if (command.equals("focusfar")) {
|
if (command.equals("focusfar")) {
|
||||||
j9302.setFocalDirection(0);
|
j9302.setFocalDirection(0);
|
||||||
}else {
|
} else {
|
||||||
j9302.setFocalDirection(1);
|
j9302.setFocalDirection(1);
|
||||||
}
|
}
|
||||||
jt1078Template.ptzFocal(deviceId, j9302, 6);
|
jt1078Template.ptzFocal(deviceId, j9302, 6);
|
||||||
@ -504,7 +565,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j9305.setChannel(Integer.parseInt(channelId));
|
j9305.setChannel(Integer.parseInt(channelId));
|
||||||
if (command.equalsIgnoreCase("on")) {
|
if (command.equalsIgnoreCase("on")) {
|
||||||
j9305.setOn(1);
|
j9305.setOn(1);
|
||||||
}else {
|
} else {
|
||||||
j9305.setOn(0);
|
j9305.setOn(0);
|
||||||
}
|
}
|
||||||
jt1078Template.ptzSupplementaryLight(deviceId, j9305, 6);
|
jt1078Template.ptzSupplementaryLight(deviceId, j9305, 6);
|
||||||
@ -516,7 +577,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j9304.setChannel(Integer.parseInt(channelId));
|
j9304.setChannel(Integer.parseInt(channelId));
|
||||||
if (command.equalsIgnoreCase("on")) {
|
if (command.equalsIgnoreCase("on")) {
|
||||||
j9304.setOn(1);
|
j9304.setOn(1);
|
||||||
}else {
|
} else {
|
||||||
j9304.setOn(0);
|
j9304.setOn(0);
|
||||||
}
|
}
|
||||||
jt1078Template.ptzWiper(deviceId, j9304, 6);
|
jt1078Template.ptzWiper(deviceId, j9304, 6);
|
||||||
@ -529,13 +590,13 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
}
|
}
|
||||||
if (params == null || params.length == 0) {
|
if (params == null || params.length == 0) {
|
||||||
J8104 j8104 = new J8104();
|
J8104 j8104 = new J8104();
|
||||||
return (JTDeviceConfig)jt1078Template.getDeviceConfig(deviceId, j8104, 20);
|
return (JTDeviceConfig) jt1078Template.getDeviceConfig(deviceId, j8104, 20);
|
||||||
}else {
|
} else {
|
||||||
long[] paramBytes = new long[params.length];
|
long[] paramBytes = new long[params.length];
|
||||||
for (int i = 0; i < params.length; i++) {
|
for (int i = 0; i < params.length; i++) {
|
||||||
try {
|
try {
|
||||||
Field field = JTDeviceConfig.class.getDeclaredField(params[i]);
|
Field field = JTDeviceConfig.class.getDeclaredField(params[i]);
|
||||||
if (field.isAnnotationPresent(ConfigAttribute.class) ) {
|
if (field.isAnnotationPresent(ConfigAttribute.class)) {
|
||||||
ConfigAttribute configAttribute = field.getAnnotation(ConfigAttribute.class);
|
ConfigAttribute configAttribute = field.getAnnotation(ConfigAttribute.class);
|
||||||
long id = configAttribute.id();
|
long id = configAttribute.id();
|
||||||
String description = configAttribute.description();
|
String description = configAttribute.description();
|
||||||
@ -548,7 +609,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
}
|
}
|
||||||
J8106 j8106 = new J8106();
|
J8106 j8106 = new J8106();
|
||||||
j8106.setParams(paramBytes);
|
j8106.setParams(paramBytes);
|
||||||
return (JTDeviceConfig)jt1078Template.getDeviceSpecifyConfig(deviceId, j8106, 20);
|
return (JTDeviceConfig) jt1078Template.getDeviceSpecifyConfig(deviceId, j8106, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,13 +644,13 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
@Override
|
@Override
|
||||||
public JTDeviceAttribute attribute(String deviceId) {
|
public JTDeviceAttribute attribute(String deviceId) {
|
||||||
J8107 j8107 = new J8107();
|
J8107 j8107 = new J8107();
|
||||||
return (JTDeviceAttribute)jt1078Template.deviceAttribute(deviceId, j8107, 20);
|
return (JTDeviceAttribute) jt1078Template.deviceAttribute(deviceId, j8107, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JTPositionBaseInfo queryPositionInfo(String deviceId) {
|
public JTPositionBaseInfo queryPositionInfo(String deviceId) {
|
||||||
J8201 j8201 = new J8201();
|
J8201 j8201 = new J8201();
|
||||||
return (JTPositionBaseInfo)jt1078Template.queryPositionInfo(deviceId, j8201, 20);
|
return (JTPositionBaseInfo) jt1078Template.queryPositionInfo(deviceId, j8201, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -611,7 +672,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
@Override
|
@Override
|
||||||
public int linkDetection(String deviceId) {
|
public int linkDetection(String deviceId) {
|
||||||
J8204 j8204 = new J8204();
|
J8204 j8204 = new J8204();
|
||||||
return (int)jt1078Template.linkDetection(deviceId, j8204, 6);
|
return (int) jt1078Template.linkDetection(deviceId, j8204, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -620,7 +681,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j8300.setSign(sign);
|
j8300.setSign(sign);
|
||||||
j8300.setTextType(textType);
|
j8300.setTextType(textType);
|
||||||
j8300.setContent(content);
|
j8300.setContent(content);
|
||||||
return (int)jt1078Template.textMessage(deviceId, j8300, 6);
|
return (int) jt1078Template.textMessage(deviceId, j8300, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -628,7 +689,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8400 j8400 = new J8400();
|
J8400 j8400 = new J8400();
|
||||||
j8400.setSign(sign);
|
j8400.setSign(sign);
|
||||||
j8400.setPhoneNumber(phoneNumber);
|
j8400.setPhoneNumber(phoneNumber);
|
||||||
return (int)jt1078Template.telephoneCallback(deviceId, j8400, 6);
|
return (int) jt1078Template.telephoneCallback(deviceId, j8400, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -638,16 +699,16 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
if (phoneBookContactList != null) {
|
if (phoneBookContactList != null) {
|
||||||
j8401.setPhoneBookContactList(phoneBookContactList);
|
j8401.setPhoneBookContactList(phoneBookContactList);
|
||||||
}
|
}
|
||||||
return (int)jt1078Template.setPhoneBook(deviceId, j8401, 6);
|
return (int) jt1078Template.setPhoneBook(deviceId, j8401, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JTPositionBaseInfo controlDoor(String deviceId, Boolean open) {
|
public JTPositionBaseInfo controlDoor(String deviceId, Boolean open) {
|
||||||
J8500 j8500 = new J8500();
|
J8500 j8500 = new J8500();
|
||||||
JTVehicleControl jtVehicleControl = new JTVehicleControl();
|
JTVehicleControl jtVehicleControl = new JTVehicleControl();
|
||||||
jtVehicleControl.setControlCarDoor(open?1:0);
|
jtVehicleControl.setControlCarDoor(open ? 1 : 0);
|
||||||
j8500.setVehicleControl(jtVehicleControl);
|
j8500.setVehicleControl(jtVehicleControl);
|
||||||
return (JTPositionBaseInfo)jt1078Template.vehicleControl(deviceId, j8500, 20);
|
return (JTPositionBaseInfo) jt1078Template.vehicleControl(deviceId, j8500, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -655,14 +716,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8600 j8600 = new J8600();
|
J8600 j8600 = new J8600();
|
||||||
j8600.setAttribute(attribute);
|
j8600.setAttribute(attribute);
|
||||||
j8600.setCircleAreaList(circleAreaList);
|
j8600.setCircleAreaList(circleAreaList);
|
||||||
return (int)jt1078Template.setAreaForCircle(deviceId, j8600, 20);
|
return (int) jt1078Template.setAreaForCircle(deviceId, j8600, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteAreaForCircle(String deviceId, List<Long> ids) {
|
public int deleteAreaForCircle(String deviceId, List<Long> ids) {
|
||||||
J8601 j8601 = new J8601();
|
J8601 j8601 = new J8601();
|
||||||
j8601.setIdList(ids);
|
j8601.setIdList(ids);
|
||||||
return (int)jt1078Template.deleteAreaForCircle(deviceId, j8601, 20);
|
return (int) jt1078Template.deleteAreaForCircle(deviceId, j8601, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -670,7 +731,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8608 j8608 = new J8608();
|
J8608 j8608 = new J8608();
|
||||||
j8608.setType(1);
|
j8608.setType(1);
|
||||||
j8608.setIdList(ids);
|
j8608.setIdList(ids);
|
||||||
return (List<JTAreaOrRoute>)jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -678,14 +739,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8602 j8602 = new J8602();
|
J8602 j8602 = new J8602();
|
||||||
j8602.setAttribute(attribute);
|
j8602.setAttribute(attribute);
|
||||||
j8602.setRectangleAreas(rectangleAreas);
|
j8602.setRectangleAreas(rectangleAreas);
|
||||||
return (int)jt1078Template.setAreaForRectangle(deviceId, j8602, 20);
|
return (int) jt1078Template.setAreaForRectangle(deviceId, j8602, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteAreaForRectangle(String deviceId, List<Long> ids) {
|
public int deleteAreaForRectangle(String deviceId, List<Long> ids) {
|
||||||
J8603 j8603 = new J8603();
|
J8603 j8603 = new J8603();
|
||||||
j8603.setIdList(ids);
|
j8603.setIdList(ids);
|
||||||
return (int)jt1078Template.deleteAreaForRectangle(deviceId, j8603, 20);
|
return (int) jt1078Template.deleteAreaForRectangle(deviceId, j8603, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -693,21 +754,21 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8608 j8608 = new J8608();
|
J8608 j8608 = new J8608();
|
||||||
j8608.setType(2);
|
j8608.setType(2);
|
||||||
j8608.setIdList(ids);
|
j8608.setIdList(ids);
|
||||||
return (List<JTAreaOrRoute>)jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int setAreaForPolygon(String deviceId, JTPolygonArea polygonArea) {
|
public int setAreaForPolygon(String deviceId, JTPolygonArea polygonArea) {
|
||||||
J8604 j8604 = new J8604();
|
J8604 j8604 = new J8604();
|
||||||
j8604.setPolygonArea(polygonArea);
|
j8604.setPolygonArea(polygonArea);
|
||||||
return (int)jt1078Template.setAreaForPolygon(deviceId, j8604, 20);
|
return (int) jt1078Template.setAreaForPolygon(deviceId, j8604, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteAreaForPolygon(String deviceId, List<Long> ids) {
|
public int deleteAreaForPolygon(String deviceId, List<Long> ids) {
|
||||||
J8605 j8605 = new J8605();
|
J8605 j8605 = new J8605();
|
||||||
j8605.setIdList(ids);
|
j8605.setIdList(ids);
|
||||||
return (int)jt1078Template.deleteAreaForPolygon(deviceId, j8605, 20);
|
return (int) jt1078Template.deleteAreaForPolygon(deviceId, j8605, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -715,21 +776,21 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8608 j8608 = new J8608();
|
J8608 j8608 = new J8608();
|
||||||
j8608.setType(3);
|
j8608.setType(3);
|
||||||
j8608.setIdList(ids);
|
j8608.setIdList(ids);
|
||||||
return (List<JTAreaOrRoute>)jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int setRoute(String deviceId, JTRoute route) {
|
public int setRoute(String deviceId, JTRoute route) {
|
||||||
J8606 j8606 = new J8606();
|
J8606 j8606 = new J8606();
|
||||||
j8606.setRoute(route);
|
j8606.setRoute(route);
|
||||||
return (int)jt1078Template.setRoute(deviceId, j8606, 20);
|
return (int) jt1078Template.setRoute(deviceId, j8606, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteRoute(String deviceId, List<Long> ids) {
|
public int deleteRoute(String deviceId, List<Long> ids) {
|
||||||
J8607 j8607 = new J8607();
|
J8607 j8607 = new J8607();
|
||||||
j8607.setIdList(ids);
|
j8607.setIdList(ids);
|
||||||
return (int)jt1078Template.deleteRoute(deviceId, j8607, 20);
|
return (int) jt1078Template.deleteRoute(deviceId, j8607, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -737,27 +798,27 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
J8608 j8608 = new J8608();
|
J8608 j8608 = new J8608();
|
||||||
j8608.setType(4);
|
j8608.setType(4);
|
||||||
j8608.setIdList(ids);
|
j8608.setIdList(ids);
|
||||||
return (List<JTAreaOrRoute>)jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JTDriverInformation queryDriverInformation(String deviceId) {
|
public JTDriverInformation queryDriverInformation(String deviceId) {
|
||||||
J8702 j8702 = new J8702();
|
J8702 j8702 = new J8702();
|
||||||
return (JTDriverInformation)jt1078Template.queryDriverInformation(deviceId, j8702, 20);
|
return (JTDriverInformation) jt1078Template.queryDriverInformation(deviceId, j8702, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> shooting(String deviceId, JTShootingCommand shootingCommand) {
|
public List<Long> shooting(String deviceId, JTShootingCommand shootingCommand) {
|
||||||
J8801 j8801 = new J8801();
|
J8801 j8801 = new J8801();
|
||||||
j8801.setCommand(shootingCommand);
|
j8801.setCommand(shootingCommand);
|
||||||
return (List<Long>)jt1078Template.shooting(deviceId, j8801, 300);
|
return (List<Long>) jt1078Template.shooting(deviceId, j8801, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<JTMediaDataInfo> queryMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand) {
|
public List<JTMediaDataInfo> queryMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand) {
|
||||||
J8802 j8802 = new J8802();
|
J8802 j8802 = new J8802();
|
||||||
j8802.setCommand(queryMediaDataCommand);
|
j8802.setCommand(queryMediaDataCommand);
|
||||||
return (List<JTMediaDataInfo>)jt1078Template.queryMediaData(deviceId, j8802, 300);
|
return (List<JTMediaDataInfo>) jt1078Template.queryMediaData(deviceId, j8802, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -788,7 +849,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
@Override
|
@Override
|
||||||
public JTMediaAttribute queryMediaAttribute(String deviceId) {
|
public JTMediaAttribute queryMediaAttribute(String deviceId) {
|
||||||
J9003 j9003 = new J9003();
|
J9003 j9003 = new J9003();
|
||||||
return (JTMediaAttribute)jt1078Template.queryMediaAttribute(deviceId, j9003, 300);
|
return (JTMediaAttribute) jt1078Template.queryMediaAttribute(deviceId, j9003, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -819,7 +880,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_TALK + deviceId + ":" + channelId;
|
String playKey = VideoManagerConstants.INVITE_INFO_1078_TALK + deviceId + ":" + channelId;
|
||||||
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playKey, k -> new ArrayList<>());
|
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playKey, k -> new ArrayList<>());
|
||||||
errorCallbacks.add(callback);
|
errorCallbacks.add(callback);
|
||||||
StreamInfo streamInfo = (StreamInfo)redisTemplate.opsForValue().get(playKey);
|
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||||
if (streamInfo != null) {
|
if (streamInfo != null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "对讲进行中");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "对讲进行中");
|
||||||
}
|
}
|
||||||
@ -874,7 +935,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
});
|
});
|
||||||
Hook hookForDeparture = Hook.getInstance(HookType.on_media_departure, "rtp", receiveStream, mediaServer.getId());
|
Hook hookForDeparture = Hook.getInstance(HookType.on_media_departure, "rtp", receiveStream, mediaServer.getId());
|
||||||
subscribe.addSubscribe(hookForDeparture, (hookData) -> {
|
subscribe.addSubscribe(hookForDeparture, (hookData) -> {
|
||||||
logger.info("[1078-对讲] 对讲时源流注销, app: {}. stream: {}, deviceId: {}, channelId: {}",app, stream, deviceId, channelId);
|
logger.info("[1078-对讲] 对讲时源流注销, app: {}. stream: {}, deviceId: {}, channelId: {}", app, stream, deviceId, channelId);
|
||||||
stopTalk(deviceId, channelId);
|
stopTalk(deviceId, channelId);
|
||||||
});
|
});
|
||||||
// 设置超时监听
|
// 设置超时监听
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user