1078-添加通道信息
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* JT 通道
|
||||
*/
|
||||
@Schema(description = "jt808通道")
|
||||
public class JTChannel {
|
||||
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设备的数据库ID
|
||||
*/
|
||||
@Schema(description = "设备的数据库ID")
|
||||
private int deviceId;
|
||||
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(int deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JTChannel{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", deviceId=" + deviceId +
|
||||
", createTime='" + createTime + '\'' +
|
||||
", updateTime='" + updateTime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -47,10 +47,10 @@ public class JTDevice {
|
||||
private String deviceModel;
|
||||
|
||||
/**
|
||||
* 终端ID
|
||||
* 终端手机号
|
||||
*/
|
||||
@Schema(description = "终端ID")
|
||||
private String terminalId;
|
||||
@Schema(description = "终端手机号")
|
||||
private Integer phoneNumber;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
@@ -154,12 +154,12 @@ public class JTDevice {
|
||||
this.deviceModel = deviceModel;
|
||||
}
|
||||
|
||||
public String getTerminalId() {
|
||||
return terminalId;
|
||||
public Integer getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setTerminalId(String terminalId) {
|
||||
this.terminalId = terminalId;
|
||||
public void setPhoneNumber(Integer phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
@@ -243,7 +243,7 @@ public class JTDevice {
|
||||
", 市县域文字描述='" + cityText + '\'' +
|
||||
", 制造商ID='" + makerId + '\'' +
|
||||
", 终端型号='" + deviceModel + '\'' +
|
||||
", 终端ID='" + terminalId + '\'' +
|
||||
", 终端手机号='" + phoneNumber + '\'' +
|
||||
", 设备ID='" + deviceId + '\'' +
|
||||
", 车牌颜色=" + plateColor +
|
||||
", 车牌='" + plateNo + '\'' +
|
||||
|
||||
@@ -53,10 +53,10 @@ public class Jt808Decoder extends ByteToMessageDecoder {
|
||||
|
||||
header.setVersion(buf.readUnsignedByte());
|
||||
String devId = ByteBufUtil.hexDump(buf.readSlice(10));
|
||||
header.setTerminalId(devId.replaceFirst("^0*", ""));
|
||||
header.setTerminalPhoneNumber(devId.replaceFirst("^0*", ""));
|
||||
|
||||
} else {
|
||||
header.setTerminalId(ByteBufUtil.hexDump(buf.readSlice(6)).replaceFirst("^0*", ""));
|
||||
header.setTerminalPhoneNumber(ByteBufUtil.hexDump(buf.readSlice(6)).replaceFirst("^0*", ""));
|
||||
}
|
||||
header.setSn(buf.readUnsignedShort());
|
||||
if (isSubpackage) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.genersoft.iot.vmp.jt1078.codec.decode;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -25,7 +24,7 @@ public enum MultiPacketManager {
|
||||
* 增加待合并的分包,如果分包接受完毕会返回完整的数据包
|
||||
*/
|
||||
public ByteBuf add(MultiPacket packet) {
|
||||
String key = packet.getHeader().getMsgId() + "/" + packet.getHeader().getTerminalId();
|
||||
String key = packet.getHeader().getMsgId() + "/" + packet.getHeader().getTerminalPhoneNumber();
|
||||
logger.debug("分包消息: \n{}", packet);
|
||||
List<MultiPacket> multiPackets = packetMap.computeIfAbsent(key, k -> new ArrayList<>(packet.getCount()));
|
||||
multiPackets.add(packet);
|
||||
|
||||
@@ -94,12 +94,12 @@ public class Jt808EncoderCmd extends MessageToByteEncoder<Cmd> {
|
||||
byteBuf.writeByte(header.getVersion());
|
||||
|
||||
// 终端手机号
|
||||
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getTerminalId(), 20)));
|
||||
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getTerminalPhoneNumber(), 20)));
|
||||
} else {
|
||||
// 消息体属性
|
||||
byteBuf.writeShort(encode.readableBytes());
|
||||
|
||||
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getTerminalId(), 12)));
|
||||
byteBuf.writeBytes(ByteBufUtil.decodeHexDump(Bin.strHexPaddingLeft(header.getTerminalPhoneNumber(), 12)));
|
||||
}
|
||||
|
||||
// 消息体流水号
|
||||
|
||||
@@ -51,7 +51,7 @@ import java.util.Map;
|
||||
|
||||
@ConditionalOnProperty(value = "jt1078.enable", havingValue = "true")
|
||||
@RestController
|
||||
@Tag(name = "部标设备")
|
||||
@Tag(name = "部标设备控制")
|
||||
@RequestMapping("/api/jt1078")
|
||||
public class JT1078Controller {
|
||||
|
||||
@@ -71,12 +71,12 @@ public class JT1078Controller {
|
||||
private ThreadPoolTaskExecutor taskExecutor;
|
||||
|
||||
@Operation(summary = "1078-开始点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "type", description = "类型:0:音视频,1:视频,3:音频", required = true)
|
||||
@GetMapping("/live/start")
|
||||
public DeferredResult<WVPResult<StreamContent>> startLive(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId,
|
||||
@Parameter(required = false) Integer type) {
|
||||
if (type == null || (type != 0 && type != 1 && type != 3)) {
|
||||
@@ -84,16 +84,16 @@ public class JT1078Controller {
|
||||
}
|
||||
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
|
||||
result.onTimeout(()->{
|
||||
logger.info("[1078-点播等待超时] deviceId:{}, channelId:{}, ", deviceId, channelId);
|
||||
logger.info("[1078-点播等待超时] phoneNumber:{}, channelId:{}, ", phoneNumber, channelId);
|
||||
// 释放rtpserver
|
||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg("超时");
|
||||
result.setResult(wvpResult);
|
||||
service.stopPlay(deviceId, channelId);
|
||||
service.stopPlay(phoneNumber, channelId);
|
||||
});
|
||||
|
||||
service.play(deviceId, channelId, type, (code, msg, streamInfo) -> {
|
||||
service.play(phoneNumber, channelId, type, (code, msg, streamInfo) -> {
|
||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
@@ -127,17 +127,17 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-结束点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@GetMapping("/live/stop")
|
||||
public void stopLive(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId) {
|
||||
service.stopPlay(deviceId, channelId);
|
||||
service.stopPlay(phoneNumber, channelId);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-语音对讲", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "app", description = "推流应用名", required = true)
|
||||
@Parameter(name = "stream", description = "推流ID", required = true)
|
||||
@@ -145,7 +145,7 @@ public class JT1078Controller {
|
||||
@Parameter(name = "onlySend", description = "是否只发送", required = false)
|
||||
@GetMapping("/talk/start")
|
||||
public DeferredResult<WVPResult<StreamContent>> startTalk(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId,
|
||||
@Parameter(required = true) String app,
|
||||
@Parameter(required = true) String stream,
|
||||
@@ -157,16 +157,16 @@ public class JT1078Controller {
|
||||
}
|
||||
String finalChannelId = channelId;
|
||||
result.onTimeout(()->{
|
||||
logger.info("[1078-语音对讲超时] deviceId:{}, channelId:{}, ", deviceId, finalChannelId);
|
||||
logger.info("[1078-语音对讲超时] phoneNumber:{}, channelId:{}, ", phoneNumber, finalChannelId);
|
||||
// 释放rtpserver
|
||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg("超时");
|
||||
result.setResult(wvpResult);
|
||||
service.stopPlay(deviceId, finalChannelId);
|
||||
service.stopPlay(phoneNumber, finalChannelId);
|
||||
});
|
||||
|
||||
service.startTalk(deviceId, channelId, app, stream, mediaServerId, onlySend, (code, msg, streamInfo) -> {
|
||||
service.startTalk(phoneNumber, channelId, app, stream, mediaServerId, onlySend, (code, msg, streamInfo) -> {
|
||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
@@ -200,57 +200,57 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-结束对讲", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@GetMapping("/talk/stop")
|
||||
public void stopTalk(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId) {
|
||||
service.stopTalk(deviceId, channelId);
|
||||
service.stopTalk(phoneNumber, channelId);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "1078-暂停点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@GetMapping("/live/pause")
|
||||
public void pauseLive(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId) {
|
||||
service.pausePlay(deviceId, channelId);
|
||||
service.pausePlay(phoneNumber, channelId);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-继续点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@GetMapping("/live/continue")
|
||||
public void continueLive(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId) {
|
||||
|
||||
service.continueLivePlay(deviceId, channelId);
|
||||
service.continueLivePlay(phoneNumber, channelId);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-切换码流类型", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "streamType", description = "0:主码流; 1:子码流", required = true)
|
||||
@GetMapping("/live/switch")
|
||||
public void changeStreamType(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId,
|
||||
@Parameter(required = true) Integer streamType) {
|
||||
service.changeStreamType(deviceId, channelId, streamType);
|
||||
service.changeStreamType(phoneNumber, channelId, streamType);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-录像-查询资源列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", 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)
|
||||
@GetMapping("/record/list")
|
||||
public WVPResult<List<J1205.JRecordItem>> playbackList(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = false) String channelId,
|
||||
@Parameter(required = true) String startTime,
|
||||
@Parameter(required = true) String endTime
|
||||
@@ -258,7 +258,7 @@ public class JT1078Controller {
|
||||
if (ObjectUtils.isEmpty(channelId)) {
|
||||
channelId = "1";
|
||||
}
|
||||
List<J1205.JRecordItem> recordList = service.getRecordList(deviceId, channelId, startTime, endTime);
|
||||
List<J1205.JRecordItem> recordList = service.getRecordList(phoneNumber, channelId, startTime, endTime);
|
||||
if (recordList == null) {
|
||||
return WVPResult.fail(ErrorCode.ERROR100);
|
||||
}else {
|
||||
@@ -266,7 +266,7 @@ public class JT1078Controller {
|
||||
}
|
||||
}
|
||||
@Operation(summary = "1078-录像-开始回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", 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)
|
||||
@@ -276,7 +276,7 @@ public class JT1078Controller {
|
||||
@Parameter(name = "playbackSpeed", description = "0.无效 1.1倍 2.2倍 3.4倍 4.8倍 5.16倍 (回放控制为1和2时,此字段内容有效,否则置0)", required = true)
|
||||
@GetMapping("/playback/start")
|
||||
public DeferredResult<WVPResult<StreamContent>> recordLive(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = false) String channelId,
|
||||
@Parameter(required = true) String startTime,
|
||||
@Parameter(required = true) String endTime,
|
||||
@@ -292,16 +292,16 @@ public class JT1078Controller {
|
||||
}
|
||||
String finalChannelId = channelId;
|
||||
result.onTimeout(()->{
|
||||
logger.info("[1078-回放-等待超时] deviceId:{}, channelId:{}, ", deviceId, finalChannelId);
|
||||
logger.info("[1078-回放-等待超时] phoneNumber:{}, channelId:{}, ", phoneNumber, finalChannelId);
|
||||
// 释放rtpserver
|
||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg("回放超时");
|
||||
result.setResult(wvpResult);
|
||||
service.stopPlay(deviceId, finalChannelId);
|
||||
service.stopPlay(phoneNumber, finalChannelId);
|
||||
});
|
||||
|
||||
service.playback(deviceId, channelId, startTime, endTime,type, rate, playbackType, playbackSpeed, (code, msg, streamInfo) -> {
|
||||
service.playback(phoneNumber, channelId, startTime, endTime,type, rate, playbackType, playbackSpeed, (code, msg, streamInfo) -> {
|
||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||
if (code == InviteErrorCode.SUCCESS.getCode()) {
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
@@ -335,37 +335,37 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-录像-回放控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "command", description = "0:开始回放; 1:暂停回放; 2:结束回放; 3:快进回放; 4:关键帧快退回放; 5:拖动回放; 6:关键帧播放", required = true)
|
||||
@Parameter(name = "playbackSpeed", description = "0.无效 1.1倍 2.2倍 3.4倍 4.8倍 5.16倍 (回放控制为1和2时,此字段内容有效,否则置0)", required = true)
|
||||
@Parameter(name = "time", description = "拖动回放位置(时间)", required = true)
|
||||
@GetMapping("/playback/control")
|
||||
public void recordControl(@Parameter(required = true) String deviceId,
|
||||
public void recordControl(@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = true) String channelId,
|
||||
@Parameter(required = false) Integer command,
|
||||
@Parameter(required = false) String time,
|
||||
@Parameter(required = false) Integer playbackSpeed
|
||||
|
||||
) {
|
||||
service.playbackControl(deviceId, channelId, command, playbackSpeed,time);
|
||||
service.playbackControl(phoneNumber, channelId, command, playbackSpeed,time);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-录像-结束回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@GetMapping("/playback/stop")
|
||||
public void stopPlayback(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = false) String channelId) {
|
||||
if (ObjectUtils.isEmpty(channelId)) {
|
||||
channelId = "1";
|
||||
}
|
||||
service.stopPlayback(deviceId, channelId);
|
||||
service.stopPlayback(phoneNumber, channelId);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-录像-下载", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", 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)
|
||||
@@ -374,7 +374,7 @@ public class JT1078Controller {
|
||||
@GetMapping("/playback/download")
|
||||
public DeferredResult<Void> recordDownload(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = false) String channelId,
|
||||
@Parameter(required = true) String startTime,
|
||||
@Parameter(required = true) String endTime,
|
||||
@@ -383,16 +383,16 @@ public class JT1078Controller {
|
||||
|
||||
) throws IOException {
|
||||
logger.info("[1078-录像] 下载,设备:{}, 通道: {}, 开始时间: {}, 结束时间: {}, 音视频类型: {}, 码流类型: {}, ",
|
||||
deviceId, channelId, startTime, endTime, type, rate);
|
||||
phoneNumber, channelId, startTime, endTime, type, rate);
|
||||
if (!ftpSetting.getEnable()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未启用ftp服务,无法下载录像");
|
||||
}
|
||||
DeferredResult<Void> result = new DeferredResult<>();
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(deviceId + "_" + channelId + ".mp4", "UTF-8"));
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(phoneNumber + "_" + channelId + ".mp4", "UTF-8"));
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
service.recordDownload(deviceId, channelId, startTime, endTime, type, rate, (code, msg, data) -> {
|
||||
service.recordDownload(phoneNumber, channelId, startTime, endTime, type, rate, (code, msg, data) -> {
|
||||
String filePath = "ftp" + data;
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
@@ -418,105 +418,66 @@ public class JT1078Controller {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "1078-分页查询部标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@GetMapping("/device/list")
|
||||
public PageInfo<JTDevice> getDevices(int page, int count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online) {
|
||||
return service.getDeviceList(page, count, query, online);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "device", description = "设备", required = true)
|
||||
@PostMapping("/device/update")
|
||||
public void updateDevice(JTDevice device){
|
||||
assert device.getId() > 0;
|
||||
assert device.getDeviceId() != null;
|
||||
service.updateDevice(device);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "1078-新增设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "device", description = "设备", required = true)
|
||||
@PostMapping("/device/add")
|
||||
public void addDevice(JTDevice device){
|
||||
assert device.getDeviceId() != null;
|
||||
service.addDevice(device);
|
||||
}
|
||||
@Operation(summary = "删除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备ID", required = true)
|
||||
@DeleteMapping("/device/delete")
|
||||
public void addDevice(String deviceId){
|
||||
assert deviceId != null;
|
||||
service.deleteDeviceByDeviceId(deviceId);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-云台控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, zoomin, zoomout, irisin, irisout, focusnear, focusfar, stop", required = true)
|
||||
@Parameter(name = "speed", description = "速度(0-255), command,值 left, right, up, down时有效", required = true)
|
||||
@PostMapping("/ptz")
|
||||
public void ptz(String deviceId, String channelId, String command, int speed){
|
||||
public void ptz(String phoneNumber, String channelId, String command, int speed){
|
||||
|
||||
if (ObjectUtils.isEmpty(channelId)) {
|
||||
channelId = "1";
|
||||
}
|
||||
logger.info("[1078-云台控制] deviceId:{}, channelId:{}, command: {}, speed: {}", deviceId, channelId, command, speed);
|
||||
service.ptzControl(deviceId, channelId, command, speed);
|
||||
logger.info("[1078-云台控制] phoneNumber:{}, channelId:{}, command: {}, speed: {}", phoneNumber, channelId, command, speed);
|
||||
service.ptzControl(phoneNumber, channelId, command, speed);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-补光灯开关", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: on off", required = true)
|
||||
@PostMapping("/fill-light")
|
||||
public void fillLight(String deviceId, String channelId, String command){
|
||||
public void fillLight(String phoneNumber, String channelId, String command){
|
||||
|
||||
if (ObjectUtils.isEmpty(channelId)) {
|
||||
channelId = "1";
|
||||
}
|
||||
logger.info("[1078-补光灯开关] deviceId:{}, channelId:{}, command: {}", deviceId, channelId, command);
|
||||
service.supplementaryLight(deviceId, channelId, command);
|
||||
logger.info("[1078-补光灯开关] phoneNumber:{}, channelId:{}, command: {}", phoneNumber, channelId, command);
|
||||
service.supplementaryLight(phoneNumber, channelId, command);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-雨刷开关", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: on off", required = true)
|
||||
@PostMapping("/wiper")
|
||||
public void wiper(String deviceId, String channelId, String command){
|
||||
public void wiper(String phoneNumber, String channelId, String command){
|
||||
|
||||
if (ObjectUtils.isEmpty(channelId)) {
|
||||
channelId = "1";
|
||||
}
|
||||
logger.info("[1078-雨刷开关] deviceId:{}, channelId:{}, command: {}", deviceId, channelId, command);
|
||||
service.wiper(deviceId, channelId, command);
|
||||
logger.info("[1078-雨刷开关] phoneNumber:{}, channelId:{}, command: {}", phoneNumber, channelId, command);
|
||||
service.wiper(phoneNumber, channelId, command);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@GetMapping("/config")
|
||||
public JTDeviceConfig config(String deviceId, String[] params){
|
||||
public JTDeviceConfig config(String phoneNumber, String[] params){
|
||||
|
||||
logger.info("[1078-查询终端参数] deviceId:{}", deviceId);
|
||||
return service.queryConfig(deviceId, params, null);
|
||||
logger.info("[1078-查询终端参数] phoneNumber:{}", phoneNumber);
|
||||
return service.queryConfig(phoneNumber, params, null);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-设置终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "config", description = "终端参数", required = true)
|
||||
@PostMapping("/set-config")
|
||||
public void setConfig(@RequestBody SetConfigParam config){
|
||||
|
||||
logger.info("[1078-设置终端参数] 参数: {}", config.toString());
|
||||
service.setConfig(config.getDeviceId(), config.getConfig());
|
||||
service.setConfig(config.getPhoneNumber(), config.getConfig());
|
||||
}
|
||||
|
||||
@Operation(summary = "终端控制-连接", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@@ -525,74 +486,74 @@ public class JT1078Controller {
|
||||
public void connectionControl(@RequestBody ConnectionControlParam control){
|
||||
|
||||
logger.info("[1078-终端控制] 参数: {}", control.toString());
|
||||
service.connectionControl(control.getDeviceId(), control.getControl());
|
||||
service.connectionControl(control.getPhoneNumber(), control.getControl());
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-终端控制-复位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@PostMapping("/control/reset")
|
||||
public void resetControl(String deviceId){
|
||||
public void resetControl(String phoneNumber){
|
||||
|
||||
logger.info("[1078-复位] deviceId: {}", deviceId);
|
||||
service.resetControl(deviceId);
|
||||
logger.info("[1078-复位] phoneNumber: {}", phoneNumber);
|
||||
service.resetControl(phoneNumber);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-终端控制-恢复出厂设置", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@PostMapping("/control/factory-reset")
|
||||
public void factoryResetControl(String deviceId){
|
||||
public void factoryResetControl(String phoneNumber){
|
||||
|
||||
logger.info("[1078-恢复出厂设置] deviceId: {}", deviceId);
|
||||
service.factoryResetControl(deviceId);
|
||||
logger.info("[1078-恢复出厂设置] phoneNumber: {}", phoneNumber);
|
||||
service.factoryResetControl(phoneNumber);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询终端属性", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/attribute")
|
||||
public JTDeviceAttribute attribute(String deviceId){
|
||||
public JTDeviceAttribute attribute(String phoneNumber){
|
||||
|
||||
logger.info("[1078-查询终端属性] deviceId: {}", deviceId);
|
||||
return service.attribute(deviceId);
|
||||
logger.info("[1078-查询终端属性] phoneNumber: {}", phoneNumber);
|
||||
return service.attribute(phoneNumber);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询位置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/position-info")
|
||||
public JTPositionBaseInfo queryPositionInfo(String deviceId){
|
||||
public JTPositionBaseInfo queryPositionInfo(String phoneNumber){
|
||||
|
||||
logger.info("[1078-查询位置信息] deviceId: {}", deviceId);
|
||||
return service.queryPositionInfo(deviceId);
|
||||
logger.info("[1078-查询位置信息] phoneNumber: {}", phoneNumber);
|
||||
return service.queryPositionInfo(phoneNumber);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-临时位置跟踪控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "timeInterval", description = "时间间隔,单位为秒,时间间隔为0 时停止跟踪,停止跟踪无需带后继字段", required = true)
|
||||
@Parameter(name = "validityPeriod", description = "位置跟踪有效期, 单位为秒,终端在接收到位置跟踪控制消息后,在有效期截止时间之前依据消息中的时间间隔发送位置汇报", required = true)
|
||||
@GetMapping("/control/temp-position-tracking")
|
||||
public void tempPositionTrackingControl(String deviceId, Integer timeInterval, Long validityPeriod){
|
||||
public void tempPositionTrackingControl(String phoneNumber, Integer timeInterval, Long validityPeriod){
|
||||
|
||||
logger.info("[1078-临时位置跟踪控制] deviceId: {}, 时间间隔 {}秒, 位置跟踪有效期 {}秒", deviceId, timeInterval, validityPeriod);
|
||||
service.tempPositionTrackingControl(deviceId, timeInterval, validityPeriod);
|
||||
logger.info("[1078-临时位置跟踪控制] phoneNumber: {}, 时间间隔 {}秒, 位置跟踪有效期 {}秒", phoneNumber, timeInterval, validityPeriod);
|
||||
service.tempPositionTrackingControl(phoneNumber, timeInterval, validityPeriod);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-人工确认报警消息", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "timeInterval", description = "时间间隔,单位为秒,时间间隔为0 时停止跟踪,停止跟踪无需带后继字段", required = true)
|
||||
@Parameter(name = "validityPeriod", description = "位置跟踪有效期, 单位为秒,终端在接收到位置跟踪控制消息后,在有效期截止时间之前依据消息中的时间间隔发送位置汇报", required = true)
|
||||
@PostMapping("/confirmation-alarm-message")
|
||||
public void confirmationAlarmMessage(@RequestBody ConfirmationAlarmMessageParam param){
|
||||
|
||||
logger.info("[1078-人工确认报警消息] 参数: {}", param);
|
||||
service.confirmationAlarmMessage(param.getDeviceId(), param.getAlarmPackageNo(), param.getAlarmMessageType());
|
||||
service.confirmationAlarmMessage(param.getPhoneNumber(), param.getAlarmPackageNo(), param.getAlarmMessageType());
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-链路检测", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/link-detection")
|
||||
public WVPResult<Integer> linkDetection(String deviceId){
|
||||
public WVPResult<Integer> linkDetection(String phoneNumber){
|
||||
|
||||
logger.info("[1078-链路检测] deviceId: {}", deviceId);
|
||||
int result = service.linkDetection(deviceId);
|
||||
logger.info("[1078-链路检测] phoneNumber: {}", phoneNumber);
|
||||
int result = service.linkDetection(phoneNumber);
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -608,7 +569,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> textMessage(@RequestBody TextMessageParam textMessageParam){
|
||||
|
||||
logger.info("[1078-文本信息下发] textMessageParam: {}", textMessageParam);
|
||||
int result = service.textMessage(textMessageParam.getDeviceId(), textMessageParam.getSign(), textMessageParam.getTextType(), textMessageParam.getContent());
|
||||
int result = service.textMessage(textMessageParam.getPhoneNumber(), textMessageParam.getSign(), textMessageParam.getTextType(), textMessageParam.getContent());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -619,14 +580,14 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-电话回拨", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "sign", description = "标志: 0:普通通话,1:监听", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "电话号码", required = true)
|
||||
@Parameter(name = "destPhoneNumber", description = "回拨电话号码", required = true)
|
||||
@GetMapping("/telephone-callback")
|
||||
public WVPResult<Integer> telephoneCallback(String deviceId, Integer sign, String phoneNumber){
|
||||
public WVPResult<Integer> telephoneCallback(String phoneNumber, Integer sign, String destPhoneNumber){
|
||||
|
||||
logger.info("[1078-电话回拨] deviceId: {}, sign: {}, phoneNumber: {},", deviceId, sign, phoneNumber);
|
||||
int result = service.telephoneCallback(deviceId, sign, phoneNumber);
|
||||
logger.info("[1078-电话回拨] phoneNumber: {}, sign: {}, phoneNumber: {},", phoneNumber, sign, phoneNumber);
|
||||
int result = service.telephoneCallback(phoneNumber, sign, destPhoneNumber);
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -642,7 +603,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> setPhoneBook(@RequestBody SetPhoneBookParam setPhoneBookParam){
|
||||
|
||||
logger.info("[1078-设置电话本] setPhoneBookParam: {}", setPhoneBookParam);
|
||||
int result = service.setPhoneBook(setPhoneBookParam.getDeviceId(), setPhoneBookParam.getType(), setPhoneBookParam.getPhoneBookContactList());
|
||||
int result = service.setPhoneBook(setPhoneBookParam.getPhoneNumber(), setPhoneBookParam.getType(), setPhoneBookParam.getPhoneBookContactList());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -653,13 +614,13 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-车门控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "open", description = "开启车门", required = true)
|
||||
@GetMapping("/control/door")
|
||||
public WVPResult<Integer> controlDoor(String deviceId, Boolean open){
|
||||
public WVPResult<Integer> controlDoor(String phoneNumber, Boolean open){
|
||||
|
||||
logger.info("[1078-车门控制] deviceId: {}, open: {},", deviceId, open);
|
||||
JTPositionBaseInfo positionBaseInfo = service.controlDoor(deviceId, open);
|
||||
logger.info("[1078-车门控制] phoneNumber: {}, open: {},", phoneNumber, open);
|
||||
JTPositionBaseInfo positionBaseInfo = service.controlDoor(phoneNumber, open);
|
||||
|
||||
if (open == !positionBaseInfo.getStatus().isDoorLocking()) {
|
||||
return WVPResult.success(null);
|
||||
@@ -674,7 +635,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> updateAreaForCircle(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-更新圆形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForCircle(0, areaParam.getDeviceId(), areaParam.getCircleAreaList());
|
||||
int result = service.setAreaForCircle(0, areaParam.getPhoneNumber(), areaParam.getCircleAreaList());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -690,7 +651,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> addAreaForCircle(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-追加圆形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForCircle(1, areaParam.getDeviceId(), areaParam.getCircleAreaList());
|
||||
int result = service.setAreaForCircle(1, areaParam.getPhoneNumber(), areaParam.getCircleAreaList());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -706,7 +667,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> editAreaForCircle(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-修改圆形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForCircle(2, areaParam.getDeviceId(), areaParam.getCircleAreaList());
|
||||
int result = service.setAreaForCircle(2, areaParam.getPhoneNumber(), areaParam.getCircleAreaList());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -717,13 +678,13 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-删除圆形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "ids", description = "待删除圆形区域的id,例如1,2,3", required = true)
|
||||
@GetMapping("/area/circle/delete")
|
||||
public WVPResult<Integer> deleteAreaForCircle(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<Integer> deleteAreaForCircle(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-删除圆形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||
int result = service.deleteAreaForCircle(deviceId, ids);
|
||||
logger.info("[1078-删除圆形区域] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
int result = service.deleteAreaForCircle(phoneNumber, ids);
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -734,12 +695,12 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询圆形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/area/circle/query")
|
||||
public WVPResult<List<JTAreaOrRoute>> queryAreaForCircle(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<List<JTAreaOrRoute>> queryAreaForCircle(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-查询圆形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||
List<JTAreaOrRoute> result = service.queryAreaForCircle(deviceId, ids);
|
||||
logger.info("[1078-查询圆形区域] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
List<JTAreaOrRoute> result = service.queryAreaForCircle(phoneNumber, ids);
|
||||
if (result != null) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -754,7 +715,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> updateAreaForRectangle(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-更新矩形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForRectangle(0, areaParam.getDeviceId(), areaParam.getRectangleAreas());
|
||||
int result = service.setAreaForRectangle(0, areaParam.getPhoneNumber(), areaParam.getRectangleAreas());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -770,7 +731,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> addAreaForRectangle(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-追加矩形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForRectangle(1, areaParam.getDeviceId(), areaParam.getRectangleAreas());
|
||||
int result = service.setAreaForRectangle(1, areaParam.getPhoneNumber(), areaParam.getRectangleAreas());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -786,7 +747,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> editAreaForRectangle(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-修改矩形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForRectangle(2, areaParam.getDeviceId(), areaParam.getRectangleAreas());
|
||||
int result = service.setAreaForRectangle(2, areaParam.getPhoneNumber(), areaParam.getRectangleAreas());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -797,13 +758,13 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-删除矩形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "ids", description = "待删除圆形区域的id,例如1,2,3", required = true)
|
||||
@GetMapping("/area/rectangle/delete")
|
||||
public WVPResult<Integer> deleteAreaForRectangle(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<Integer> deleteAreaForRectangle(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-删除矩形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||
int result = service.deleteAreaForRectangle(deviceId, ids);
|
||||
logger.info("[1078-删除矩形区域] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
int result = service.deleteAreaForRectangle(phoneNumber, ids);
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -814,12 +775,12 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询矩形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/area/rectangle/query")
|
||||
public WVPResult<List<JTAreaOrRoute>> queryAreaForRectangle(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<List<JTAreaOrRoute>> queryAreaForRectangle(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-查询矩形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||
List<JTAreaOrRoute> result = service.queryAreaForRectangle(deviceId, ids);
|
||||
logger.info("[1078-查询矩形区域] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
List<JTAreaOrRoute> result = service.queryAreaForRectangle(phoneNumber, ids);
|
||||
if (result != null) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -833,7 +794,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> setAreaForPolygon(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-设置多边形区域] areaParam: {},", areaParam);
|
||||
int result = service.setAreaForPolygon(areaParam.getDeviceId(), areaParam.getPolygonArea());
|
||||
int result = service.setAreaForPolygon(areaParam.getPhoneNumber(), areaParam.getPolygonArea());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -844,13 +805,13 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-删除多边形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "ids", description = "待删除圆形区域的id,例如1,2,3", required = true)
|
||||
@GetMapping("/area/polygon/delete")
|
||||
public WVPResult<Integer> deleteAreaForPolygon(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<Integer> deleteAreaForPolygon(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-删除多边形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||
int result = service.deleteAreaForPolygon(deviceId, ids);
|
||||
logger.info("[1078-删除多边形区域] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
int result = service.deleteAreaForPolygon(phoneNumber, ids);
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -861,12 +822,12 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询多边形区域", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/area/polygon/query")
|
||||
public WVPResult<List<JTAreaOrRoute>> queryAreaForPolygon(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<List<JTAreaOrRoute>> queryAreaForPolygon(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-查询多边形区域] deviceId: {}, ids:{}", deviceId, ids);
|
||||
List<JTAreaOrRoute> result = service.queryAreaForPolygon(deviceId, ids);
|
||||
logger.info("[1078-查询多边形区域] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
List<JTAreaOrRoute> result = service.queryAreaForPolygon(phoneNumber, ids);
|
||||
if (result != null) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -880,7 +841,7 @@ public class JT1078Controller {
|
||||
public WVPResult<Integer> setRoute(@RequestBody SetAreaParam areaParam){
|
||||
|
||||
logger.info("[1078-设置路线] areaParam: {},", areaParam);
|
||||
int result = service.setRoute(areaParam.getDeviceId(), areaParam.getRoute());
|
||||
int result = service.setRoute(areaParam.getPhoneNumber(), areaParam.getRoute());
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -891,13 +852,13 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-删除路线", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "ids", description = "待删除圆形区域的id,例如1,2,3", required = true)
|
||||
@GetMapping("/route/delete")
|
||||
public WVPResult<Integer> deleteRoute(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<Integer> deleteRoute(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-删除路线] deviceId: {}, ids:{}", deviceId, ids);
|
||||
int result = service.deleteRoute(deviceId, ids);
|
||||
logger.info("[1078-删除路线] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
int result = service.deleteRoute(phoneNumber, ids);
|
||||
if (result == 0) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -908,12 +869,12 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询路线", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/route/query")
|
||||
public WVPResult<List<JTAreaOrRoute>> queryRoute(String deviceId, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
public WVPResult<List<JTAreaOrRoute>> queryRoute(String phoneNumber, @RequestParam(value = "ids", required = false) List<Long> ids){
|
||||
|
||||
logger.info("[1078-查询路线] deviceId: {}, ids:{}", deviceId, ids);
|
||||
List<JTAreaOrRoute> result = service.queryRoute(deviceId, ids);
|
||||
logger.info("[1078-查询路线] phoneNumber: {}, ids:{}", phoneNumber, ids);
|
||||
List<JTAreaOrRoute> result = service.queryRoute(phoneNumber, ids);
|
||||
if (result != null) {
|
||||
return WVPResult.success(result);
|
||||
}else {
|
||||
@@ -924,12 +885,12 @@ public class JT1078Controller {
|
||||
// TODO 待实现 行驶记录数据采集命令 行驶记录数据上传 行驶记录参数下传命令 电子运单上报 CAN总线数据上传
|
||||
|
||||
@Operation(summary = "1078-上报驾驶员身份信息请求", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@GetMapping("/driver-information")
|
||||
public WVPResult<JTDriverInformation> queryDriverInformation(String deviceId){
|
||||
public WVPResult<JTDriverInformation> queryDriverInformation(String phoneNumber){
|
||||
|
||||
logger.info("[1078-上报驾驶员身份信息请求] deviceId: {}", deviceId);
|
||||
JTDriverInformation jtDriverInformation = service.queryDriverInformation(deviceId);
|
||||
logger.info("[1078-上报驾驶员身份信息请求] phoneNumber: {}", phoneNumber);
|
||||
JTDriverInformation jtDriverInformation = service.queryDriverInformation(phoneNumber);
|
||||
if (jtDriverInformation != null) {
|
||||
return WVPResult.success(jtDriverInformation);
|
||||
}else {
|
||||
@@ -938,12 +899,12 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-摄像头立即拍摄命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@PostMapping("/shooting")
|
||||
public WVPResult<List<Long>> shooting(@RequestBody ShootingParam param){
|
||||
|
||||
logger.info("[1078-摄像头立即拍摄命令] param: {}", param );
|
||||
List<Long> ids = service.shooting(param.getDeviceId(), param.getShootingCommand());
|
||||
List<Long> ids = service.shooting(param.getPhoneNumber(), param.getShootingCommand());
|
||||
if (ids != null) {
|
||||
return WVPResult.success(ids);
|
||||
}else {
|
||||
@@ -957,7 +918,7 @@ public class JT1078Controller {
|
||||
public WVPResult<List<JTMediaDataInfo>> queryMediaData(@RequestBody QueryMediaDataParam param){
|
||||
|
||||
logger.info("[1078-存储多媒体数据检索] param: {}", param );
|
||||
List<JTMediaDataInfo> ids = service.queryMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
List<JTMediaDataInfo> ids = service.queryMediaData(param.getPhoneNumber(), param.getQueryMediaDataCommand());
|
||||
if (ids != null) {
|
||||
return WVPResult.success(ids);
|
||||
}else {
|
||||
@@ -988,7 +949,7 @@ public class JT1078Controller {
|
||||
mediaDataInfo.setId(param.getMediaId());
|
||||
ids.add(mediaDataInfo);
|
||||
}else {
|
||||
ids = service.queryMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
ids = service.queryMediaData(param.getPhoneNumber(), param.getQueryMediaDataCommand());
|
||||
}
|
||||
if (ids.isEmpty()) {
|
||||
deferredResult.setResult(WVPResult.fail(ErrorCode.ERROR100));
|
||||
@@ -1022,9 +983,9 @@ public class JT1078Controller {
|
||||
}
|
||||
taskExecutor.execute(()->{
|
||||
if (param.getMediaId() != null) {
|
||||
service.uploadMediaDataForSingle(param.getDeviceId(), param.getMediaId(), param.getDelete());
|
||||
service.uploadMediaDataForSingle(param.getPhoneNumber(), param.getMediaId(), param.getDelete());
|
||||
}else {
|
||||
service.uploadMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
service.uploadMediaData(param.getPhoneNumber(), param.getQueryMediaDataCommand());
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1032,13 +993,13 @@ public class JT1078Controller {
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-开始录音", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "time", description = "录音时间,单位为秒(s) ,0 表示一直录音", required = false)
|
||||
@Parameter(name = "save", description = "0:实时上传;1:保存", required = false)
|
||||
@Parameter(name = "samplingRate", description = "音频采样率, 0:8K;1:11K;2:23K;3:32K", required = false)
|
||||
@GetMapping("/record/start")
|
||||
public void startRecord(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = false) Integer time,
|
||||
@Parameter(required = false) Integer save,
|
||||
@Parameter(required = false) Integer samplingRate
|
||||
@@ -1052,17 +1013,17 @@ public class JT1078Controller {
|
||||
if (ObjectUtils.isEmpty(samplingRate)) {
|
||||
samplingRate = 0;
|
||||
}
|
||||
service.record(deviceId, 1, time, save, samplingRate);
|
||||
service.record(phoneNumber, 1, time, save, samplingRate);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-停止录音", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "time", description = "录音时间,单位为秒(s) ,0 表示一直录音", required = false)
|
||||
@Parameter(name = "save", description = "0:实时上传;1:保存", required = false)
|
||||
@Parameter(name = "samplingRate", description = "音频采样率, 0:8K;1:11K;2:23K;3:32K", required = false)
|
||||
@GetMapping("/record/stop")
|
||||
public void stopRecord(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId,
|
||||
@Parameter(required = true) String phoneNumber,
|
||||
@Parameter(required = false) Integer time,
|
||||
@Parameter(required = false) Integer save,
|
||||
@Parameter(required = false) Integer samplingRate
|
||||
@@ -1076,16 +1037,16 @@ public class JT1078Controller {
|
||||
if (ObjectUtils.isEmpty(samplingRate)) {
|
||||
samplingRate = 0;
|
||||
}
|
||||
service.record(deviceId, 0, time, save, samplingRate);
|
||||
service.record(phoneNumber, 0, time, save, samplingRate);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-查询终端音视频属性", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@GetMapping("/media/attribute")
|
||||
public JTMediaAttribute queryMediaAttribute(HttpServletRequest request,
|
||||
@Parameter(required = true) String deviceId
|
||||
@Parameter(required = true) String phoneNumber
|
||||
) {
|
||||
return service.queryMediaAttribute(deviceId);
|
||||
return service.queryMediaAttribute(phoneNumber);
|
||||
}
|
||||
|
||||
// TODO 视频报警上报
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.genersoft.iot.vmp.jt1078.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ConditionalOnProperty(value = "jt1078.enable", havingValue = "true")
|
||||
@RestController
|
||||
@Tag(name = "部标设备管理")
|
||||
@RequestMapping("/api/jt1078/device")
|
||||
public class JT1078DeviceController {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(JT1078DeviceController.class);
|
||||
|
||||
@Resource
|
||||
Ijt1078Service service;
|
||||
|
||||
@Autowired
|
||||
UserSetting userSetting;
|
||||
|
||||
@Operation(summary = "1078-分页查询部标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@Parameter(name = "count", description = "每页查询数量", required = true)
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@GetMapping("/list")
|
||||
public PageInfo<JTDevice> getDevices(int page, int count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online) {
|
||||
return service.getDeviceList(page, count, query, online);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "device", description = "设备", required = true)
|
||||
@PostMapping("/update")
|
||||
public void updateDevice(JTDevice device){
|
||||
assert device.getId() > 0;
|
||||
assert device.getPhoneNumber() != null;
|
||||
service.updateDevice(device);
|
||||
}
|
||||
|
||||
@Operation(summary = "1078-新增设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "device", description = "设备", required = true)
|
||||
@PostMapping("/add")
|
||||
public void addDevice(JTDevice device){
|
||||
assert device.getPhoneNumber() != null;
|
||||
service.addDevice(device);
|
||||
}
|
||||
@Operation(summary = "删除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@DeleteMapping("/delete")
|
||||
public void addDevice(Integer phoneNumber){
|
||||
assert phoneNumber != null;
|
||||
service.deleteDeviceByPhoneNumber(phoneNumber);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "1078-查询部标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@GetMapping("/channel/list")
|
||||
public List<JTChannel> getChannels(@RequestParam(required = true) Integer phoneNumber,
|
||||
@RequestParam(required = false) String query) {
|
||||
assert phoneNumber != null;
|
||||
return service.getChannelList(phoneNumber, query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConfig;
|
||||
|
||||
public class SetConfigParam {
|
||||
|
||||
private String deviceId;
|
||||
private String phoneNumber;
|
||||
private JTDeviceConfig config;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public JTDeviceConfig getConfig() {
|
||||
@@ -26,7 +26,7 @@ public class SetConfigParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SetConfigParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"phoneNumber='" + phoneNumber + '\'' +
|
||||
", config=" + config +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -10,18 +10,18 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class ConfirmationAlarmMessageParam {
|
||||
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
private String phoneNumber;
|
||||
@Schema(description = "报警消息流水号")
|
||||
private int alarmPackageNo;
|
||||
@Schema(description = "人工确认报警类型")
|
||||
private JTConfirmationAlarmMessageType alarmMessageType;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String PhoneNumber) {
|
||||
this.phoneNumber = PhoneNumber;
|
||||
}
|
||||
|
||||
public JTConfirmationAlarmMessageType getAlarmMessageType() {
|
||||
@@ -43,7 +43,7 @@ public class ConfirmationAlarmMessageParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ConfirmationAlarmMessageParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"PhoneNumber='" + phoneNumber + '\'' +
|
||||
", alarmPackageNo=" + alarmPackageNo +
|
||||
", alarmMessageType=" + alarmMessageType +
|
||||
'}';
|
||||
|
||||
@@ -4,15 +4,15 @@ import com.genersoft.iot.vmp.jt1078.bean.JTDeviceConnectionControl;
|
||||
|
||||
public class ConnectionControlParam {
|
||||
|
||||
private String deviceId;
|
||||
private String phoneNumber;
|
||||
private JTDeviceConnectionControl control;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public JTDeviceConnectionControl getControl() {
|
||||
@@ -26,7 +26,7 @@ public class ConnectionControlParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ConnectionControlParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"deviceId='" + phoneNumber + '\'' +
|
||||
", control=" + control +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class QueryMediaDataParam {
|
||||
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "多媒体 ID, 单条存储多媒体数据检索上传时有效")
|
||||
private Long mediaId;
|
||||
@@ -19,12 +19,12 @@ public class QueryMediaDataParam {
|
||||
@Schema(description = "存储多媒体数据参数")
|
||||
private JTQueryMediaDataCommand queryMediaDataCommand;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public JTQueryMediaDataCommand getQueryMediaDataCommand() {
|
||||
@@ -54,7 +54,7 @@ public class QueryMediaDataParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueryMediaDataParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"设备手机号='" + phoneNumber + '\'' +
|
||||
", mediaId=" + mediaId +
|
||||
", queryMediaDataCommand=" + queryMediaDataCommand +
|
||||
'}';
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
public class SetAreaParam {
|
||||
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "圆形区域项")
|
||||
private List<JTCircleArea> circleAreaList;
|
||||
@@ -24,12 +24,12 @@ public class SetAreaParam {
|
||||
private JTRoute route;
|
||||
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public List<JTCircleArea> getCircleAreaList() {
|
||||
@@ -67,7 +67,7 @@ public class SetAreaParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SetAreaParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"设备手机号='" + phoneNumber + '\'' +
|
||||
", circleAreaList=" + circleAreaList +
|
||||
", rectangleAreas=" + rectangleAreas +
|
||||
", polygonArea=" + polygonArea +
|
||||
|
||||
@@ -9,8 +9,8 @@ import java.util.List;
|
||||
@Schema(description = "设置电话本")
|
||||
public class SetPhoneBookParam {
|
||||
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
@Schema(description = "设备手机号")
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "设置类型:\n" +
|
||||
"0: 删除终端上所有存储的联系人,\n" +
|
||||
@@ -22,12 +22,12 @@ public class SetPhoneBookParam {
|
||||
@Schema(description = "联系人")
|
||||
private List<JTPhoneBookContact> phoneBookContactList;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
@@ -49,7 +49,7 @@ public class SetPhoneBookParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SetPhoneBookParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"设备手机号='" + phoneNumber + '\'' +
|
||||
", type=" + type +
|
||||
", phoneBookContactList=" + phoneBookContactList +
|
||||
'}';
|
||||
|
||||
@@ -6,17 +6,17 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class ShootingParam {
|
||||
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "拍摄命令参数")
|
||||
private JTShootingCommand shootingCommand;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public JTShootingCommand getShootingCommand() {
|
||||
@@ -30,7 +30,7 @@ public class ShootingParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ShootingParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"设备手机号='" + phoneNumber + '\'' +
|
||||
", shootingCommand=" + shootingCommand +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@Schema(description = "人工确认报警消息参数")
|
||||
public class TextMessageParam {
|
||||
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
@Schema(description = "设备手机号")
|
||||
private String phoneNumber;
|
||||
@Schema(description = "标志")
|
||||
private JTTextSign sign;
|
||||
@Schema(description = "文本类型,1 = 通知 ,2 = 服务")
|
||||
@@ -18,12 +18,12 @@ public class TextMessageParam {
|
||||
@Schema(description = "消息内容,最长为1024字节")
|
||||
private String content;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public int getTextType() {
|
||||
@@ -53,7 +53,7 @@ public class TextMessageParam {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TextMessageParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
"phoneNumber='" + phoneNumber + '\'' +
|
||||
", sign=" + sign +
|
||||
", textType=" + textType +
|
||||
", content='" + content + '\'' +
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.genersoft.iot.vmp.jt1078.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTChannel;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface JTChannelMapper {
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * " +
|
||||
"from " +
|
||||
"wvp_jt_channel jc " +
|
||||
"WHERE " +
|
||||
"device_id = #{deviceId}" +
|
||||
" <if test='query != null'> AND " +
|
||||
"jc.name LIKE concat('%',#{query},'%') " +
|
||||
"</if> " +
|
||||
"ORDER BY jc.update_time " +
|
||||
" </script>"})
|
||||
List<JTChannel> getAll(@Param("deviceId") int deviceId, @Param("query") String query);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_jt_device " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
"<if test=\"deviceId != null\">, device_id=#{deviceId}</if>" +
|
||||
"<if test=\"provinceId != null\">, province_id=#{provinceId}</if>" +
|
||||
"<if test=\"provinceText != null\">, province_text=#{provinceText}</if>" +
|
||||
"<if test=\"cityId != null\">, city_id=#{cityId}</if>" +
|
||||
"<if test=\"cityText != null\">, city_text=#{cityText}</if>" +
|
||||
"<if test=\"makerId != null\">, maker_id=#{makerId}</if>" +
|
||||
"<if test=\"deviceModel != null\">, device_model=#{deviceModel}</if>" +
|
||||
"<if test=\"plateColor != null\">, plate_color=#{plateColor}</if>" +
|
||||
"<if test=\"plateNo != null\">, plate_no=#{plateNo}</if>" +
|
||||
"<if test=\"authenticationCode != null\">, authentication_code=#{authenticationCode}</if>" +
|
||||
"<if test=\"longitude != null\">, longitude=#{longitude}</if>" +
|
||||
"<if test=\"latitude != null\">, latitude=#{latitude}</if>" +
|
||||
"<if test=\"status != null\">, status=#{status}</if>" +
|
||||
"WHERE terminal_id=#{terminalId}"+
|
||||
" </script>"})
|
||||
void updateDevice(JTDevice device);
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * " +
|
||||
"from " +
|
||||
"wvp_jt_device jd " +
|
||||
"WHERE " +
|
||||
"1=1" +
|
||||
" <if test='query != null'> AND (" +
|
||||
"jd.terminal_id LIKE concat('%',#{query},'%') " +
|
||||
"jd.province_id LIKE concat('%',#{query},'%') " +
|
||||
"OR jd.city_id LIKE concat('%',#{query},'%') " +
|
||||
"OR jd.maker_id LIKE concat('%',#{query},'%') " +
|
||||
"OR jd.device_model LIKE concat('%',#{query},'%') " +
|
||||
"OR jd.device_id LIKE concat('%',#{query},'%') " +
|
||||
"OR jd.plate_no LIKE concat('%',#{query},'%')" +
|
||||
")</if> " +
|
||||
" <if test='online == true' > AND jd.status= true</if>" +
|
||||
" <if test='online == false' > AND jd.status= false</if>" +
|
||||
"ORDER BY jd.update_time " +
|
||||
" </script>"})
|
||||
List<JTDevice> getDeviceList(@Param("query") String query, @Param("online") Boolean online);
|
||||
|
||||
@Insert("INSERT INTO wvp_jt_device (" +
|
||||
"terminal_id,"+
|
||||
"province_id,"+
|
||||
"province_text,"+
|
||||
"city_id,"+
|
||||
"city_text,"+
|
||||
"maker_id,"+
|
||||
"device_id,"+
|
||||
"device_model,"+
|
||||
"plate_color,"+
|
||||
"plate_no,"+
|
||||
"authentication_code,"+
|
||||
"longitude,"+
|
||||
"latitude,"+
|
||||
"create_time,"+
|
||||
"update_time"+
|
||||
") VALUES (" +
|
||||
"#{terminalId}," +
|
||||
"#{provinceId}," +
|
||||
"#{provinceText}," +
|
||||
"#{cityId}," +
|
||||
"#{cityText}," +
|
||||
"#{makerId}," +
|
||||
"#{deviceId}," +
|
||||
"#{deviceModel}," +
|
||||
"#{plateColor}," +
|
||||
"#{plateNo}," +
|
||||
"#{authenticationCode}," +
|
||||
"#{longitude}," +
|
||||
"#{latitude}," +
|
||||
"#{createTime}," +
|
||||
"#{updateTime}" +
|
||||
")")
|
||||
void addDevice(JTDevice device);
|
||||
|
||||
@Delete("delete from wvp_jt_device where terminal_id = #{terminalId}")
|
||||
void deleteDeviceByTerminalId(@Param("terminalId") String terminalId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_jt_device " +
|
||||
"SET status=#{connected} " +
|
||||
"WHERE terminal_id=#{terminalId}"+
|
||||
" </script>"})
|
||||
void updateDeviceStatus(@Param("connected") boolean connected, @Param("terminalId") String terminalId);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
public interface JTDeviceMapper {
|
||||
|
||||
@Select("SELECT * FROM wvp_jt_device where terminal_id=#{terminalId}")
|
||||
JTDevice getDevice(@Param("terminalId") String terminalId);
|
||||
JTDevice getDevice(@Param("terminalId") Integer terminalId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_jt_device " +
|
||||
@@ -87,12 +87,12 @@ public interface JTDeviceMapper {
|
||||
void addDevice(JTDevice device);
|
||||
|
||||
@Delete("delete from wvp_jt_device where terminal_id = #{terminalId}")
|
||||
void deleteDeviceByTerminalId(@Param("terminalId") String terminalId);
|
||||
void deleteDeviceByTerminalId(@Param("terminalId") Integer terminalId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_jt_device " +
|
||||
"SET status=#{connected} " +
|
||||
"WHERE terminal_id=#{terminalId}"+
|
||||
" </script>"})
|
||||
void updateDeviceStatus(@Param("connected") boolean connected, @Param("terminalId") String terminalId);
|
||||
void updateDeviceStatus(@Param("connected") boolean connected, @Param("terminalId") Integer terminalId);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Header {
|
||||
Integer msgPro;
|
||||
|
||||
// 终端手机号
|
||||
String terminalId;
|
||||
String terminalPhoneNumber;
|
||||
|
||||
// 消息体流水号
|
||||
Integer sn;
|
||||
@@ -41,12 +41,12 @@ public class Header {
|
||||
this.msgPro = msgPro;
|
||||
}
|
||||
|
||||
public String getTerminalId() {
|
||||
return terminalId;
|
||||
public String getTerminalPhoneNumber() {
|
||||
return terminalPhoneNumber;
|
||||
}
|
||||
|
||||
public void setTerminalId(String terminalId) {
|
||||
this.terminalId = terminalId;
|
||||
public void setTerminalPhoneNumber(String terminalPhoneNumber) {
|
||||
this.terminalPhoneNumber = terminalPhoneNumber;
|
||||
}
|
||||
|
||||
public Integer getSn() {
|
||||
@@ -79,7 +79,7 @@ public class Header {
|
||||
return "Header{" +
|
||||
"消息ID='" + msgId + '\'' +
|
||||
", 消息体属性=" + msgPro +
|
||||
", 终端手机号='" + terminalId + '\'' +
|
||||
", 终端手机号='" + terminalPhoneNumber + '\'' +
|
||||
", 消息体流水号=" + sn +
|
||||
", 协议版本号=" + version +
|
||||
'}';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
@@ -37,7 +36,7 @@ public class J0001 extends Re {
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0001", (long) respNo, result);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0001", (long) respNo, result);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
@@ -29,13 +28,13 @@ public class J0003 extends Re {
|
||||
respNo = buf.readUnsignedShort();
|
||||
respId = ByteBufUtil.hexDump(buf.readSlice(2));
|
||||
result = buf.readUnsignedByte();
|
||||
log.info("[JT-注销] 设备: {}", header.getTerminalId());
|
||||
log.info("[JT-注销] 设备: {}", header.getTerminalPhoneNumber());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0001", (long) respNo, result);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0001", (long) respNo, result);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
import com.genersoft.iot.vmp.common.CivilCodePo;
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||
import com.genersoft.iot.vmp.jt1078.codec.netty.Jt808Handler;
|
||||
import com.genersoft.iot.vmp.jt1078.event.RegisterEvent;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.J8100;
|
||||
@@ -86,7 +85,7 @@ public class J0100 extends Re {
|
||||
J8100 j8100 = new J8100();
|
||||
j8100.setRespNo(header.getSn());
|
||||
// 从数据库判断这个设备是否合法
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalId());
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalPhoneNumber());
|
||||
if (deviceInDb != null) {
|
||||
j8100.setResult(J8100.SUCCESS);
|
||||
String authenticationCode = UUID.randomUUID().toString();
|
||||
@@ -113,7 +112,7 @@ public class J0100 extends Re {
|
||||
service.updateDevice(deviceInDb);
|
||||
log.info("[JT-注册成功] 设备: {}", deviceInDb);
|
||||
}else {
|
||||
log.info("[JT-注册失败] 未授权设备: {}", header.getTerminalId());
|
||||
log.info("[JT-注册失败] 未授权设备: {}", header.getTerminalPhoneNumber());
|
||||
j8100.setResult(J8100.FAIL);
|
||||
// 断开连接,清理资源
|
||||
if (session.isRegistered()) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@@ -38,7 +37,7 @@ public class J0102 extends Re {
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
JTDevice device = service.getDevice(header.getTerminalId());
|
||||
JTDevice device = service.getDevice(header.getTerminalPhoneNumber());
|
||||
J8001 j8001 = new J8001();
|
||||
j8001.setRespNo(header.getSn());
|
||||
j8001.setRespId(header.getMsgId());
|
||||
|
||||
@@ -164,7 +164,7 @@ public class J0104 extends Re {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0104", (long) respNo, deviceConfig);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0104", (long) respNo, deviceConfig);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class J0107 extends Re {
|
||||
deviceAttribute.setGnssAttribute(JTGnssAttribute.getInstance(buf.readUnsignedByte()));
|
||||
deviceAttribute.setCommunicationModuleAttribute(JTCommunicationModuleAttribute.getInstance(buf.readUnsignedByte()));
|
||||
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0107", null, deviceAttribute);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0107", null, deviceAttribute);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,11 @@ import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 位置信息汇报
|
||||
*
|
||||
@@ -94,7 +89,7 @@ public class J0200 extends Re {
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalId());
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalPhoneNumber());
|
||||
J8001 j8001 = new J8001();
|
||||
j8001.setRespNo(header.getSn());
|
||||
j8001.setRespId(header.getMsgId());
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,13 +33,13 @@ public class J0201 extends Re {
|
||||
|
||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||
log.info("[JT-位置信息查询应答]: {}", positionInfo.toString());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0201", (long) respNo, positionInfo);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0201", (long) respNo, positionInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalId());
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalPhoneNumber());
|
||||
J8001 j8001 = new J8001();
|
||||
j8001.setRespNo(header.getSn());
|
||||
j8001.setRespId(header.getMsgId());
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -29,13 +28,13 @@ public class J0500 extends Re {
|
||||
int respNo = buf.readUnsignedShort();
|
||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||
log.info("[JT-车辆控制应答]: {}", positionInfo.toString());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0500", (long) respNo, positionInfo);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0500", (long) respNo, positionInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalId());
|
||||
JTDevice deviceInDb = service.getDevice(header.getTerminalPhoneNumber());
|
||||
J8001 j8001 = new J8001();
|
||||
j8001.setRespNo(header.getSn());
|
||||
j8001.setRespId(header.getMsgId());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class J0608 extends Re {
|
||||
log.info("[JT-查询区域或线路数据应答]: 类型: {}, 数量: {}", type, dataLength);
|
||||
List<JTAreaOrRoute> areaOrRoutes = new ArrayList<>();
|
||||
if (dataLength == 0) {
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0608", null, areaOrRoutes);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0608", null, areaOrRoutes);
|
||||
return null;
|
||||
}
|
||||
switch (type) {
|
||||
@@ -46,7 +46,7 @@ public class J0608 extends Re {
|
||||
JTCircleArea jtCircleArea = JTCircleArea.decode(buf);
|
||||
jtCircleAreas.add(jtCircleArea);
|
||||
}
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0608", null, jtCircleAreas);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0608", null, jtCircleAreas);
|
||||
break;
|
||||
case 2:
|
||||
buf.readUnsignedByte();
|
||||
@@ -58,7 +58,7 @@ public class J0608 extends Re {
|
||||
JTRectangleArea jtRectangleArea = JTRectangleArea.decode(buf);
|
||||
jtRectangleAreas.add(jtRectangleArea);
|
||||
}
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0608", null, jtRectangleAreas);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0608", null, jtRectangleAreas);
|
||||
break;
|
||||
case 3:
|
||||
// 查询多 边形区域数据
|
||||
@@ -68,7 +68,7 @@ public class J0608 extends Re {
|
||||
JTPolygonArea jtRectangleArea = JTPolygonArea.decode(buf);
|
||||
jtPolygonAreas.add(jtRectangleArea);
|
||||
}
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0608", null, jtPolygonAreas);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0608", null, jtPolygonAreas);
|
||||
break;
|
||||
case 4:
|
||||
// 查询线路数据
|
||||
@@ -78,7 +78,7 @@ public class J0608 extends Re {
|
||||
JTRoute jtRoute = JTRoute.decode(buf);
|
||||
jtRoutes.add(jtRoute);
|
||||
}
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0608", null, jtRoutes);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0608", null, jtRoutes);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTDriverInformation;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTPositionBaseInfo;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
@@ -29,7 +27,7 @@ public class J0702 extends Re {
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
driverInformation = JTDriverInformation.decode(buf);
|
||||
log.info("[JT-驾驶员身份信息采集上报]: {}", driverInformation.toString());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0702", null, driverInformation);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0702", null, driverInformation);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -71,7 +70,7 @@ public class J0801 extends Re {
|
||||
log.info("[JT-多媒体数据上传] 写入文件失败", e);
|
||||
}
|
||||
log.info("[JT-多媒体数据上传]: {}", mediaEventInfo);
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0801", null, mediaEventInfo);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0801", null, mediaEventInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTMediaDataInfo;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTMediaEventInfo;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTPositionBaseInfo;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
|
||||
@@ -15,8 +13,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,7 +34,7 @@ public class J0802 extends Re {
|
||||
int length = buf.readUnsignedShort();
|
||||
if (length == 0) {
|
||||
log.info("[JT-存储多媒体数据检索应答]: {}", length);
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0802", (long) respNo, new ArrayList<>());
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0802", (long) respNo, new ArrayList<>());
|
||||
return null;
|
||||
}
|
||||
mediaDataInfoList = new ArrayList<>(length);
|
||||
@@ -46,7 +42,7 @@ public class J0802 extends Re {
|
||||
mediaDataInfoList.add(JTMediaDataInfo.decode(buf));
|
||||
}
|
||||
log.info("[JT-存储多媒体数据检索应答]: {}", mediaDataInfoList.size());
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0802", (long) respNo, mediaDataInfoList);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0802", (long) respNo, mediaDataInfoList);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.genersoft.iot.vmp.jt1078.session.Session;
|
||||
import com.genersoft.iot.vmp.jt1078.session.SessionManager;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -40,13 +39,13 @@ public class J0805 extends Re {
|
||||
ids.add(buf.readUnsignedInt());
|
||||
}
|
||||
}
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0805", null, ids);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0805", null, ids);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "0001", (long) respNo, result);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "0001", (long) respNo, result);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class J1003 extends Re {
|
||||
@Override
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
mediaAttribute = JTMediaAttribute.decode(buf);
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "1003", null, mediaAttribute);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "1003", null, mediaAttribute);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.request;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.Header;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
|
||||
@@ -50,7 +49,7 @@ public class J1205 extends Re {
|
||||
|
||||
@Override
|
||||
protected Rs handler(Header header, Session session, Ijt1078Service service) {
|
||||
SessionManager.INSTANCE.response(header.getTerminalId(), "1205", (long) respNo, recordList);
|
||||
SessionManager.INSTANCE.response(header.getTerminalPhoneNumber(), "1205", (long) respNo, recordList);
|
||||
J8001 j8001 = new J8001();
|
||||
j8001.setRespNo(header.getSn());
|
||||
j8001.setRespId(header.getMsgId());
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class Re {
|
||||
|
||||
public Rs decode(ByteBuf buf, Header header, Session session, Ijt1078Service service) {
|
||||
if (session != null && !StringUtils.hasLength(session.getDevId())) {
|
||||
session.register(header.getTerminalId(), (int) header.getVersion(), header);
|
||||
session.register(header.getTerminalPhoneNumber(), (int) header.getVersion(), header);
|
||||
}
|
||||
Rs rs = decode0(buf, header, session);
|
||||
Rs rsHand = handler(header, session, service);
|
||||
|
||||
@@ -6,11 +6,10 @@ import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import java.util.List;
|
||||
|
||||
public interface Ijt1078Service {
|
||||
JTDevice getDevice(String terminalId);
|
||||
JTDevice getDevice(Integer terminalId);
|
||||
|
||||
void updateDevice(JTDevice deviceInDb);
|
||||
|
||||
@@ -18,104 +17,106 @@ public interface Ijt1078Service {
|
||||
|
||||
void addDevice(JTDevice device);
|
||||
|
||||
void deleteDeviceByDeviceId(String deviceId);
|
||||
void deleteDeviceByPhoneNumber(Integer phoneNumber);
|
||||
|
||||
void updateDeviceStatus(boolean connected, String terminalId);
|
||||
void updateDeviceStatus(boolean connected, Integer terminalId);
|
||||
|
||||
void play(String deviceId, String channelId, int type, GeneralCallback<StreamInfo> callback);
|
||||
void play(String phoneNumber, String channelId, int type, GeneralCallback<StreamInfo> callback);
|
||||
|
||||
void playback(String deviceId, String channelId, String startTime, String endTime, Integer type,
|
||||
void playback(String phoneNumber, String channelId, String startTime, String endTime, Integer type,
|
||||
Integer rate, Integer playbackType, Integer playbackSpeed, GeneralCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(String deviceId, String channelId);
|
||||
void stopPlay(String phoneNumber, String channelId);
|
||||
|
||||
void pausePlay(String deviceId, String channelId);
|
||||
void pausePlay(String phoneNumber, String channelId);
|
||||
|
||||
void continueLivePlay(String deviceId, String channelId);
|
||||
void continueLivePlay(String phoneNumber, String channelId);
|
||||
|
||||
List<J1205.JRecordItem> getRecordList(String deviceId, String channelId, String startTime, String endTime);
|
||||
List<J1205.JRecordItem> getRecordList(String phoneNumber, String channelId, String startTime, String endTime);
|
||||
|
||||
void stopPlayback(String deviceId, String channelId);
|
||||
void stopPlayback(String phoneNumber, String channelId);
|
||||
|
||||
void ptzControl(String deviceId, String channelId, String command, int speed);
|
||||
void ptzControl(String phoneNumber, String channelId, String command, int speed);
|
||||
|
||||
void supplementaryLight(String deviceId, String channelId, String command);
|
||||
void supplementaryLight(String phoneNumber, String channelId, String command);
|
||||
|
||||
void wiper(String deviceId, String channelId, String command);
|
||||
void wiper(String phoneNumber, String channelId, String command);
|
||||
|
||||
JTDeviceConfig queryConfig(String deviceId, String[] params, GeneralCallback<StreamInfo> callback);
|
||||
JTDeviceConfig queryConfig(String phoneNumber, String[] params, GeneralCallback<StreamInfo> callback);
|
||||
|
||||
void setConfig(String deviceId, JTDeviceConfig config);
|
||||
void setConfig(String phoneNumber, JTDeviceConfig config);
|
||||
|
||||
void connectionControl(String deviceId, JTDeviceConnectionControl control);
|
||||
void connectionControl(String phoneNumber, JTDeviceConnectionControl control);
|
||||
|
||||
void resetControl(String deviceId);
|
||||
void resetControl(String phoneNumber);
|
||||
|
||||
void factoryResetControl(String deviceId);
|
||||
void factoryResetControl(String phoneNumber);
|
||||
|
||||
JTDeviceAttribute attribute(String deviceId);
|
||||
JTDeviceAttribute attribute(String phoneNumber);
|
||||
|
||||
JTPositionBaseInfo queryPositionInfo(String deviceId);
|
||||
JTPositionBaseInfo queryPositionInfo(String phoneNumber);
|
||||
|
||||
void tempPositionTrackingControl(String deviceId, Integer timeInterval, Long validityPeriod);
|
||||
void tempPositionTrackingControl(String phoneNumber, Integer timeInterval, Long validityPeriod);
|
||||
|
||||
void confirmationAlarmMessage(String deviceId, int alarmPackageNo, JTConfirmationAlarmMessageType alarmMessageType);
|
||||
void confirmationAlarmMessage(String phoneNumber, int alarmPackageNo, JTConfirmationAlarmMessageType alarmMessageType);
|
||||
|
||||
int linkDetection(String deviceId);
|
||||
int linkDetection(String phoneNumber);
|
||||
|
||||
int textMessage(String deviceId,JTTextSign sign, int textType, String content);
|
||||
int textMessage(String phoneNumber,JTTextSign sign, int textType, String content);
|
||||
|
||||
int telephoneCallback(String deviceId, Integer sign, String phoneNumber);
|
||||
int telephoneCallback(String phoneNumber, Integer sign, String destPhoneNumber);
|
||||
|
||||
int setPhoneBook(String deviceId, int type, List<JTPhoneBookContact> phoneBookContactList);
|
||||
int setPhoneBook(String phoneNumber, int type, List<JTPhoneBookContact> phoneBookContactList);
|
||||
|
||||
JTPositionBaseInfo controlDoor(String deviceId, Boolean open);
|
||||
JTPositionBaseInfo controlDoor(String phoneNumber, Boolean open);
|
||||
|
||||
int setAreaForCircle(int attribute, String deviceId, List<JTCircleArea> circleAreaList);
|
||||
int setAreaForCircle(int attribute, String phoneNumber, List<JTCircleArea> circleAreaList);
|
||||
|
||||
int deleteAreaForCircle(String deviceId, List<Long> ids);
|
||||
int deleteAreaForCircle(String phoneNumber, List<Long> ids);
|
||||
|
||||
List<JTAreaOrRoute> queryAreaForCircle(String deviceId, List<Long> ids);
|
||||
List<JTAreaOrRoute> queryAreaForCircle(String phoneNumber, List<Long> ids);
|
||||
|
||||
int setAreaForRectangle(int i, String deviceId, List<JTRectangleArea> rectangleAreas);
|
||||
int setAreaForRectangle(int i, String phoneNumber, List<JTRectangleArea> rectangleAreas);
|
||||
|
||||
int deleteAreaForRectangle(String deviceId, List<Long> ids);
|
||||
int deleteAreaForRectangle(String phoneNumber, List<Long> ids);
|
||||
|
||||
List<JTAreaOrRoute> queryAreaForRectangle(String deviceId, List<Long> ids);
|
||||
List<JTAreaOrRoute> queryAreaForRectangle(String phoneNumber, List<Long> ids);
|
||||
|
||||
int setAreaForPolygon(String deviceId, JTPolygonArea polygonArea);
|
||||
int setAreaForPolygon(String phoneNumber, JTPolygonArea polygonArea);
|
||||
|
||||
int deleteAreaForPolygon(String deviceId, List<Long> ids);
|
||||
int deleteAreaForPolygon(String phoneNumber, List<Long> ids);
|
||||
|
||||
List<JTAreaOrRoute> queryAreaForPolygon(String deviceId, List<Long> ids);
|
||||
List<JTAreaOrRoute> queryAreaForPolygon(String phoneNumber, List<Long> ids);
|
||||
|
||||
int setRoute(String deviceId, JTRoute route);
|
||||
int setRoute(String phoneNumber, JTRoute route);
|
||||
|
||||
int deleteRoute(String deviceId, List<Long> ids);
|
||||
int deleteRoute(String phoneNumber, List<Long> ids);
|
||||
|
||||
List<JTAreaOrRoute> queryRoute(String deviceId, List<Long> ids);
|
||||
List<JTAreaOrRoute> queryRoute(String phoneNumber, List<Long> ids);
|
||||
|
||||
JTDriverInformation queryDriverInformation(String deviceId);
|
||||
JTDriverInformation queryDriverInformation(String phoneNumber);
|
||||
|
||||
List<Long> shooting(String deviceId, JTShootingCommand shootingCommand);
|
||||
List<Long> shooting(String phoneNumber, JTShootingCommand shootingCommand);
|
||||
|
||||
List<JTMediaDataInfo> queryMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||
List<JTMediaDataInfo> queryMediaData(String phoneNumber, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||
|
||||
void uploadMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||
void uploadMediaData(String phoneNumber, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||
|
||||
void record(String deviceId, int command, Integer time, Integer save, Integer samplingRate);
|
||||
void record(String phoneNumber, int command, Integer time, Integer save, Integer samplingRate);
|
||||
|
||||
void uploadMediaDataForSingle(String deviceId, Long mediaId, Integer delete);
|
||||
void uploadMediaDataForSingle(String phoneNumber, Long mediaId, Integer delete);
|
||||
|
||||
JTMediaAttribute queryMediaAttribute(String deviceId);
|
||||
JTMediaAttribute queryMediaAttribute(String phoneNumber);
|
||||
|
||||
void startTalk(String deviceId, String channelId, String app, String stream, String mediaServerId, Boolean onlySend, GeneralCallback<StreamInfo> callback);
|
||||
void startTalk(String phoneNumber, String channelId, String app, String stream, String mediaServerId, Boolean onlySend, GeneralCallback<StreamInfo> callback);
|
||||
|
||||
void stopTalk(String deviceId, String channelId);
|
||||
void stopTalk(String phoneNumber, String channelId);
|
||||
|
||||
void changeStreamType(String deviceId, String channelId, Integer streamType);
|
||||
void changeStreamType(String phoneNumber, String channelId, Integer streamType);
|
||||
|
||||
void playbackControl(String deviceId, String channelId, Integer command, Integer playbackSpeed, String time);
|
||||
void playbackControl(String phoneNumber, String channelId, Integer command, Integer playbackSpeed, String time);
|
||||
|
||||
void recordDownload(String deviceId, String channelId, String startTime, String endTime, Integer type, Integer rate, GeneralCallback<String> fileCallback);
|
||||
void recordDownload(String phoneNumber, String channelId, String startTime, String endTime, Integer type, Integer rate, GeneralCallback<String> fileCallback);
|
||||
|
||||
List<JTChannel> getChannelList(int phoneNumber, String query);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
|
||||
import com.genersoft.iot.vmp.jt1078.dao.JTChannelMapper;
|
||||
import com.genersoft.iot.vmp.jt1078.dao.JTDeviceMapper;
|
||||
import com.genersoft.iot.vmp.jt1078.event.CallbackManager;
|
||||
import com.genersoft.iot.vmp.jt1078.event.FtpUploadEvent;
|
||||
@@ -59,6 +60,9 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
@Autowired
|
||||
private JTDeviceMapper jtDeviceMapper;
|
||||
|
||||
@Autowired
|
||||
private JTChannelMapper jtChannelMapper;
|
||||
|
||||
@Autowired
|
||||
private JT1078Template jt1078Template;
|
||||
|
||||
@@ -94,7 +98,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
|
||||
|
||||
@Override
|
||||
public JTDevice getDevice(String terminalId) {
|
||||
public JTDevice getDevice(Integer terminalId) {
|
||||
return jtDeviceMapper.getDevice(terminalId);
|
||||
}
|
||||
|
||||
@@ -119,22 +123,22 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceByDeviceId(String deviceId) {
|
||||
jtDeviceMapper.deleteDeviceByTerminalId(deviceId);
|
||||
public void deleteDeviceByPhoneNumber(Integer phoneNumber) {
|
||||
jtDeviceMapper.deleteDeviceByTerminalId(phoneNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceStatus(boolean connected, String terminalId) {
|
||||
public void updateDeviceStatus(boolean connected, Integer terminalId) {
|
||||
jtDeviceMapper.updateDeviceStatus(connected, terminalId);
|
||||
}
|
||||
|
||||
private final Map<String, List<GeneralCallback<StreamInfo>>> inviteErrorCallbackMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void play(String deviceId, String channelId, int type, GeneralCallback<StreamInfo> callback) {
|
||||
public void play(String phoneNumber, String channelId, int type, GeneralCallback<StreamInfo> callback) {
|
||||
|
||||
// 检查流是否已经存在,存在则返回
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + phoneNumber + ":" + channelId;
|
||||
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playKey, k -> new ArrayList<>());
|
||||
errorCallbacks.add(callback);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
@@ -147,7 +151,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
if (mediaInfo != null && mediaInfo.getInteger("code") == 0) {
|
||||
Boolean online = mediaInfo.getBoolean("online");
|
||||
if (online != null && online) {
|
||||
logger.info("[1078-点播] 点播已经存在,直接返回, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-点播] 点播已经存在,直接返回, phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
|
||||
}
|
||||
@@ -158,7 +162,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
// 清理数据
|
||||
redisTemplate.delete(playKey);
|
||||
}
|
||||
String stream = deviceId + "_" + channelId;
|
||||
String stream = phoneNumber + "_" + channelId;
|
||||
MediaServer mediaServer = mediaServerService.getMediaServerForMinimumLoad(null);
|
||||
if (mediaServer == null) {
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
@@ -170,9 +174,9 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
Hook hook = Hook.getInstance(HookType.on_media_arrival, "rtp", stream, mediaServer.getId());
|
||||
subscribe.addSubscribe(hook, (hookData) -> {
|
||||
dynamicTask.stop(playKey);
|
||||
logger.info("[1078-点播] 点播成功, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-点播] 点播成功, phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
// TODO 发送9105 实时音视频传输状态通知, 通知丢包率
|
||||
StreamInfo info = onPublishHandler(mediaServer, hookData, deviceId, channelId);
|
||||
StreamInfo info = onPublishHandler(mediaServer, hookData, phoneNumber, channelId);
|
||||
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), info);
|
||||
@@ -182,7 +186,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
});
|
||||
// 设置超时监听
|
||||
dynamicTask.startDelay(playKey, () -> {
|
||||
logger.info("[1078-点播] 超时, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-点播] 超时, phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getMsg(), null);
|
||||
@@ -192,7 +196,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
|
||||
// 开启收流端口
|
||||
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-点播] phoneNumber: {}, channelId: {}, 端口: {}", phoneNumber, channelId, ssrcInfo.getPort());
|
||||
J9101 j9101 = new J9101();
|
||||
j9101.setChannel(Integer.valueOf(channelId));
|
||||
j9101.setIp(mediaServer.getSdpIp());
|
||||
@@ -200,21 +204,21 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9101.setTcpPort(ssrcInfo.getPort());
|
||||
j9101.setUdpPort(ssrcInfo.getPort());
|
||||
j9101.setType(type);
|
||||
Object s = jt1078Template.startLive(deviceId, j9101, 6);
|
||||
Object s = jt1078Template.startLive(phoneNumber, j9101, 6);
|
||||
System.out.println("ssss=== " + s);
|
||||
|
||||
}
|
||||
|
||||
public StreamInfo onPublishHandler(MediaServer mediaServerItem, HookData hookData, String deviceId, String channelId) {
|
||||
public StreamInfo onPublishHandler(MediaServer mediaServerItem, HookData hookData, String phoneNumber, String channelId) {
|
||||
StreamInfo streamInfo = mediaServerService.getStreamInfoByAppAndStream(mediaServerItem, "rtp", hookData.getStream(), hookData.getMediaInfo(), null);
|
||||
streamInfo.setDeviceID(deviceId);
|
||||
streamInfo.setDeviceID(phoneNumber);
|
||||
streamInfo.setChannelId(channelId);
|
||||
return streamInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(String deviceId, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||
public void stopPlay(String phoneNumber, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + phoneNumber + ":" + channelId;
|
||||
dynamicTask.stop(playKey);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
// 发送停止命令
|
||||
@@ -223,8 +227,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9102.setCommand(0);
|
||||
j9102.setCloseType(0);
|
||||
j9102.setStreamType(1);
|
||||
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||
logger.info("[1078-停止点播] deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
jt1078Template.stopLive(phoneNumber, j9102, 6);
|
||||
logger.info("[1078-停止点播] phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
// 删除缓存数据
|
||||
if (streamInfo != null) {
|
||||
// 关闭rtpServer
|
||||
@@ -240,45 +244,45 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pausePlay(String deviceId, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||
public void pausePlay(String phoneNumber, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + phoneNumber + ":" + channelId;
|
||||
dynamicTask.stop(playKey);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
if (streamInfo == null) {
|
||||
logger.info("[1078-暂停点播] 未找到点播信息 deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-暂停点播] 未找到点播信息 phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
}
|
||||
logger.info("[1078-暂停点播] deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-暂停点播] phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
// 发送暂停命令
|
||||
J9102 j9102 = new J9102();
|
||||
j9102.setChannel(Integer.valueOf(channelId));
|
||||
j9102.setCommand(2);
|
||||
j9102.setCloseType(0);
|
||||
j9102.setStreamType(1);
|
||||
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||
jt1078Template.stopLive(phoneNumber, j9102, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void continueLivePlay(String deviceId, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||
public void continueLivePlay(String phoneNumber, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + phoneNumber + ":" + channelId;
|
||||
dynamicTask.stop(playKey);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
if (streamInfo == null) {
|
||||
logger.info("[1078-继续点播] 未找到点播信息 deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-继续点播] 未找到点播信息 phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
}
|
||||
logger.info("[1078-继续点播] deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-继续点播] phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
// 发送暂停命令
|
||||
J9102 j9102 = new J9102();
|
||||
j9102.setChannel(Integer.valueOf(channelId));
|
||||
j9102.setCommand(2);
|
||||
j9102.setCloseType(0);
|
||||
j9102.setStreamType(1);
|
||||
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||
jt1078Template.stopLive(phoneNumber, j9102, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<J1205.JRecordItem> getRecordList(String deviceId, String channelId, String startTime, String endTime) {
|
||||
logger.info("[1078-查询录像列表] deviceId: {}, channelId: {}, startTime: {}, endTime: {}"
|
||||
, deviceId, channelId, startTime, endTime);
|
||||
public List<J1205.JRecordItem> getRecordList(String phoneNumber, String channelId, String startTime, String endTime) {
|
||||
logger.info("[1078-查询录像列表] phoneNumber: {}, channelId: {}, startTime: {}, endTime: {}"
|
||||
, phoneNumber, channelId, startTime, endTime);
|
||||
// 发送请求录像列表命令
|
||||
J9205 j9205 = new J9205();
|
||||
j9205.setChannelId(Integer.parseInt(channelId));
|
||||
@@ -287,25 +291,25 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9205.setMediaType(0);
|
||||
j9205.setStreamType(0);
|
||||
j9205.setStorageType(0);
|
||||
List<J1205.JRecordItem> JRecordItemList = (List<J1205.JRecordItem>) jt1078Template.queryBackTime(deviceId, j9205, 20);
|
||||
List<J1205.JRecordItem> JRecordItemList = (List<J1205.JRecordItem>) jt1078Template.queryBackTime(phoneNumber, j9205, 20);
|
||||
if (JRecordItemList == null || JRecordItemList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
logger.info("[1078-查询录像列表] deviceId: {}, channelId: {}, startTime: {}, endTime: {}, 结果: {}条"
|
||||
, deviceId, channelId, startTime, endTime, JRecordItemList.size());
|
||||
logger.info("[1078-查询录像列表] phoneNumber: {}, channelId: {}, startTime: {}, endTime: {}, 结果: {}条"
|
||||
, phoneNumber, channelId, startTime, endTime, JRecordItemList.size());
|
||||
return JRecordItemList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playback(String deviceId, String channelId, String startTime, String endTime, Integer type,
|
||||
public void playback(String phoneNumber, String channelId, String startTime, String endTime, Integer type,
|
||||
Integer rate, Integer playbackType, Integer playbackSpeed, GeneralCallback<StreamInfo> callback) {
|
||||
logger.info("[1078-回放] 回放,设备:{}, 通道: {}, 开始时间: {}, 结束时间: {}, 音视频类型: {}, 码流类型: {}, " +
|
||||
"回放方式: {}, 快进或快退倍数: {}", deviceId, channelId, startTime, endTime, type, rate, playbackType, playbackSpeed);
|
||||
"回放方式: {}, 快进或快退倍数: {}", phoneNumber, channelId, startTime, endTime, type, rate, playbackType, playbackSpeed);
|
||||
// 检查流是否已经存在,存在则返回
|
||||
String playbackKey = VideoManagerConstants.INVITE_INFO_1078_PLAYBACK + deviceId + ":" + channelId;
|
||||
String playbackKey = VideoManagerConstants.INVITE_INFO_1078_PLAYBACK + phoneNumber + ":" + channelId;
|
||||
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playbackKey, k -> new ArrayList<>());
|
||||
errorCallbacks.add(callback);
|
||||
String logInfo = String.format("deviceId:%s, channelId:%s, startTime:%s, endTime:%s", deviceId, channelId, startTime, endTime);
|
||||
String logInfo = String.format("phoneNumber:%s, channelId:%s, startTime:%s, endTime:%s", phoneNumber, channelId, startTime, endTime);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playbackKey);
|
||||
if (streamInfo != null) {
|
||||
String mediaServerId = streamInfo.getMediaServerId();
|
||||
@@ -329,7 +333,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
String startTimeParam = DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(startTime);
|
||||
String endTimeParam = DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(endTime);
|
||||
String stream = deviceId + "_" + channelId + "_" + startTimeParam + "_" + endTimeParam;
|
||||
String stream = phoneNumber + "_" + channelId + "_" + startTimeParam + "_" + endTimeParam;
|
||||
MediaServer mediaServer = mediaServerService.getMediaServerForMinimumLoad(null);
|
||||
if (mediaServer == null) {
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
@@ -342,7 +346,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
subscribe.addSubscribe(hookSubscribe, (hookData) -> {
|
||||
dynamicTask.stop(playbackKey);
|
||||
logger.info("[1078-回放] 回放成功, logInfo: {}", logInfo);
|
||||
StreamInfo info = onPublishHandler(mediaServer, hookData, deviceId, channelId);
|
||||
StreamInfo info = onPublishHandler(mediaServer, hookData, phoneNumber, channelId);
|
||||
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), info);
|
||||
@@ -381,15 +385,15 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9201.setType(type);
|
||||
j9201.setStartTime(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(startTime));
|
||||
j9201.setEndTime(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(endTime));
|
||||
jt1078Template.startBackLive(deviceId, j9201, 20);
|
||||
jt1078Template.startBackLive(phoneNumber, j9201, 20);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playbackControl(String deviceId, String channelId, Integer command, Integer playbackSpeed, String time) {
|
||||
logger.info("[1078-回放控制] deviceId: {}, channelId: {}, command: {}, playbackSpeed: {}, time: {}",
|
||||
deviceId, channelId, command, playbackSpeed, time);
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAYBACK + deviceId + ":" + channelId;
|
||||
public void playbackControl(String phoneNumber, String channelId, Integer command, Integer playbackSpeed, String time) {
|
||||
logger.info("[1078-回放控制] phoneNumber: {}, channelId: {}, command: {}, playbackSpeed: {}, time: {}",
|
||||
phoneNumber, channelId, command, playbackSpeed, time);
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAYBACK + phoneNumber + ":" + channelId;
|
||||
dynamicTask.stop(playKey);
|
||||
if (command == 2) {
|
||||
// 结束回放
|
||||
@@ -417,12 +421,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
if (!ObjectUtils.isEmpty(time)) {
|
||||
j9202.setPlaybackTime(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(time));
|
||||
}
|
||||
jt1078Template.controlBackLive(deviceId, j9202, 6);
|
||||
jt1078Template.controlBackLive(phoneNumber, j9202, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlayback(String deviceId, String channelId) {
|
||||
playbackControl(deviceId, channelId, 2, null, String.valueOf(0));
|
||||
public void stopPlayback(String phoneNumber, String channelId) {
|
||||
playbackControl(phoneNumber, channelId, 2, null, String.valueOf(0));
|
||||
}
|
||||
|
||||
private Map<String, GeneralCallback<String>> fileUploadMap = new ConcurrentHashMap<>();
|
||||
@@ -445,14 +449,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordDownload(String deviceId, String channelId, String startTime, String endTime, Integer type, Integer rate, GeneralCallback<String> fileCallback) {
|
||||
public void recordDownload(String phoneNumber, String channelId, String startTime, String endTime, Integer type, Integer rate, GeneralCallback<String> fileCallback) {
|
||||
String filePath = UUID.randomUUID().toString();
|
||||
fileUploadMap.put(filePath, fileCallback);
|
||||
dynamicTask.startDelay(filePath, ()->{
|
||||
fileUploadMap.remove(filePath);
|
||||
}, 2*60*60*1000);
|
||||
logger.info("[1078-录像] 下载,设备:{}, 通道: {}, 开始时间: {}, 结束时间: {},等待上传文件路径: {} ",
|
||||
deviceId, channelId, startTime, endTime, filePath);
|
||||
phoneNumber, channelId, startTime, endTime, filePath);
|
||||
// 发送停止命令
|
||||
J9206 j92026 = new J9206();
|
||||
j92026.setChannelId(Integer.parseInt(channelId));
|
||||
@@ -470,11 +474,11 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
if (rate != null) {
|
||||
j92026.setStreamType(rate);
|
||||
}
|
||||
jt1078Template.fileUpload(deviceId, j92026, 7200);
|
||||
jt1078Template.fileUpload(phoneNumber, j92026, 7200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ptzControl(String deviceId, String channelId, String command, int speed) {
|
||||
public void ptzControl(String phoneNumber, String channelId, String command, int speed) {
|
||||
// 发送停止命令
|
||||
|
||||
switch (command) {
|
||||
@@ -507,7 +511,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9301.setSpeed(0);
|
||||
break;
|
||||
}
|
||||
jt1078Template.ptzRotate(deviceId, j9301, 6);
|
||||
jt1078Template.ptzRotate(phoneNumber, j9301, 6);
|
||||
break;
|
||||
|
||||
case "zoomin":
|
||||
@@ -519,7 +523,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
} else {
|
||||
j9306.setZoom(1);
|
||||
}
|
||||
jt1078Template.ptzZoom(deviceId, j9306, 6);
|
||||
jt1078Template.ptzZoom(phoneNumber, j9306, 6);
|
||||
break;
|
||||
case "irisin":
|
||||
case "irisout":
|
||||
@@ -530,7 +534,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
} else {
|
||||
j9303.setIris(1);
|
||||
}
|
||||
jt1078Template.ptzIris(deviceId, j9303, 6);
|
||||
jt1078Template.ptzIris(phoneNumber, j9303, 6);
|
||||
break;
|
||||
case "focusnear":
|
||||
case "focusfar":
|
||||
@@ -541,14 +545,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
} else {
|
||||
j9302.setFocalDirection(1);
|
||||
}
|
||||
jt1078Template.ptzFocal(deviceId, j9302, 6);
|
||||
jt1078Template.ptzFocal(phoneNumber, j9302, 6);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void supplementaryLight(String deviceId, String channelId, String command) {
|
||||
public void supplementaryLight(String phoneNumber, String channelId, String command) {
|
||||
J9305 j9305 = new J9305();
|
||||
j9305.setChannel(Integer.parseInt(channelId));
|
||||
if (command.equalsIgnoreCase("on")) {
|
||||
@@ -556,11 +560,11 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
} else {
|
||||
j9305.setOn(0);
|
||||
}
|
||||
jt1078Template.ptzSupplementaryLight(deviceId, j9305, 6);
|
||||
jt1078Template.ptzSupplementaryLight(phoneNumber, j9305, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiper(String deviceId, String channelId, String command) {
|
||||
public void wiper(String phoneNumber, String channelId, String command) {
|
||||
J9304 j9304 = new J9304();
|
||||
j9304.setChannel(Integer.parseInt(channelId));
|
||||
if (command.equalsIgnoreCase("on")) {
|
||||
@@ -568,17 +572,17 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
} else {
|
||||
j9304.setOn(0);
|
||||
}
|
||||
jt1078Template.ptzWiper(deviceId, j9304, 6);
|
||||
jt1078Template.ptzWiper(phoneNumber, j9304, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JTDeviceConfig queryConfig(String deviceId, String[] params, GeneralCallback<StreamInfo> callback) {
|
||||
if (deviceId == null) {
|
||||
public JTDeviceConfig queryConfig(String phoneNumber, String[] params, GeneralCallback<StreamInfo> callback) {
|
||||
if (phoneNumber == null) {
|
||||
return null;
|
||||
}
|
||||
if (params == null || params.length == 0) {
|
||||
J8104 j8104 = new J8104();
|
||||
return (JTDeviceConfig) jt1078Template.getDeviceConfig(deviceId, j8104, 20);
|
||||
return (JTDeviceConfig) jt1078Template.getDeviceConfig(phoneNumber, j8104, 20);
|
||||
} else {
|
||||
long[] paramBytes = new long[params.length];
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
@@ -597,247 +601,247 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
J8106 j8106 = new J8106();
|
||||
j8106.setParams(paramBytes);
|
||||
return (JTDeviceConfig) jt1078Template.getDeviceSpecifyConfig(deviceId, j8106, 20);
|
||||
return (JTDeviceConfig) jt1078Template.getDeviceSpecifyConfig(phoneNumber, j8106, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(String deviceId, JTDeviceConfig config) {
|
||||
public void setConfig(String phoneNumber, JTDeviceConfig config) {
|
||||
J8103 j8103 = new J8103();
|
||||
j8103.setConfig(config);
|
||||
jt1078Template.setDeviceSpecifyConfig(deviceId, j8103, 6);
|
||||
jt1078Template.setDeviceSpecifyConfig(phoneNumber, j8103, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionControl(String deviceId, JTDeviceConnectionControl control) {
|
||||
public void connectionControl(String phoneNumber, JTDeviceConnectionControl control) {
|
||||
J8105 j8105 = new J8105();
|
||||
j8105.setConnectionControl(control);
|
||||
jt1078Template.deviceControl(deviceId, j8105, 6);
|
||||
jt1078Template.deviceControl(phoneNumber, j8105, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetControl(String deviceId) {
|
||||
public void resetControl(String phoneNumber) {
|
||||
J8105 j8105 = new J8105();
|
||||
j8105.setReset(true);
|
||||
jt1078Template.deviceControl(deviceId, j8105, 6);
|
||||
jt1078Template.deviceControl(phoneNumber, j8105, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void factoryResetControl(String deviceId) {
|
||||
public void factoryResetControl(String phoneNumber) {
|
||||
J8105 j8105 = new J8105();
|
||||
j8105.setFactoryReset(true);
|
||||
jt1078Template.deviceControl(deviceId, j8105, 6);
|
||||
jt1078Template.deviceControl(phoneNumber, j8105, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JTDeviceAttribute attribute(String deviceId) {
|
||||
public JTDeviceAttribute attribute(String phoneNumber) {
|
||||
J8107 j8107 = new J8107();
|
||||
return (JTDeviceAttribute) jt1078Template.deviceAttribute(deviceId, j8107, 20);
|
||||
return (JTDeviceAttribute) jt1078Template.deviceAttribute(phoneNumber, j8107, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JTPositionBaseInfo queryPositionInfo(String deviceId) {
|
||||
public JTPositionBaseInfo queryPositionInfo(String phoneNumber) {
|
||||
J8201 j8201 = new J8201();
|
||||
return (JTPositionBaseInfo) jt1078Template.queryPositionInfo(deviceId, j8201, 20);
|
||||
return (JTPositionBaseInfo) jt1078Template.queryPositionInfo(phoneNumber, j8201, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tempPositionTrackingControl(String deviceId, Integer timeInterval, Long validityPeriod) {
|
||||
public void tempPositionTrackingControl(String phoneNumber, Integer timeInterval, Long validityPeriod) {
|
||||
J8202 j8202 = new J8202();
|
||||
j8202.setTimeInterval(timeInterval);
|
||||
j8202.setValidityPeriod(validityPeriod);
|
||||
jt1078Template.tempPositionTrackingControl(deviceId, j8202, 20);
|
||||
jt1078Template.tempPositionTrackingControl(phoneNumber, j8202, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmationAlarmMessage(String deviceId, int alarmPackageNo, JTConfirmationAlarmMessageType alarmMessageType) {
|
||||
public void confirmationAlarmMessage(String phoneNumber, int alarmPackageNo, JTConfirmationAlarmMessageType alarmMessageType) {
|
||||
J8203 j8203 = new J8203();
|
||||
j8203.setAlarmMessageType(alarmMessageType);
|
||||
j8203.setAlarmPackageNo(alarmPackageNo);
|
||||
jt1078Template.confirmationAlarmMessage(deviceId, j8203, 6);
|
||||
jt1078Template.confirmationAlarmMessage(phoneNumber, j8203, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int linkDetection(String deviceId) {
|
||||
public int linkDetection(String phoneNumber) {
|
||||
J8204 j8204 = new J8204();
|
||||
return (int) jt1078Template.linkDetection(deviceId, j8204, 6);
|
||||
return (int) jt1078Template.linkDetection(phoneNumber, j8204, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int textMessage(String deviceId, JTTextSign sign, int textType, String content) {
|
||||
public int textMessage(String phoneNumber, JTTextSign sign, int textType, String content) {
|
||||
J8300 j8300 = new J8300();
|
||||
j8300.setSign(sign);
|
||||
j8300.setTextType(textType);
|
||||
j8300.setContent(content);
|
||||
return (int) jt1078Template.textMessage(deviceId, j8300, 6);
|
||||
return (int) jt1078Template.textMessage(phoneNumber, j8300, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int telephoneCallback(String deviceId, Integer sign, String phoneNumber) {
|
||||
public int telephoneCallback(String phoneNumber, Integer sign, String destPhoneNumber) {
|
||||
J8400 j8400 = new J8400();
|
||||
j8400.setSign(sign);
|
||||
j8400.setPhoneNumber(phoneNumber);
|
||||
return (int) jt1078Template.telephoneCallback(deviceId, j8400, 6);
|
||||
j8400.setPhoneNumber(destPhoneNumber);
|
||||
return (int) jt1078Template.telephoneCallback(phoneNumber, j8400, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setPhoneBook(String deviceId, int type, List<JTPhoneBookContact> phoneBookContactList) {
|
||||
public int setPhoneBook(String phoneNumber, int type, List<JTPhoneBookContact> phoneBookContactList) {
|
||||
J8401 j8401 = new J8401();
|
||||
j8401.setType(type);
|
||||
if (phoneBookContactList != null) {
|
||||
j8401.setPhoneBookContactList(phoneBookContactList);
|
||||
}
|
||||
return (int) jt1078Template.setPhoneBook(deviceId, j8401, 6);
|
||||
return (int) jt1078Template.setPhoneBook(phoneNumber, j8401, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JTPositionBaseInfo controlDoor(String deviceId, Boolean open) {
|
||||
public JTPositionBaseInfo controlDoor(String phoneNumber, Boolean open) {
|
||||
J8500 j8500 = new J8500();
|
||||
JTVehicleControl jtVehicleControl = new JTVehicleControl();
|
||||
jtVehicleControl.setControlCarDoor(open ? 1 : 0);
|
||||
j8500.setVehicleControl(jtVehicleControl);
|
||||
return (JTPositionBaseInfo) jt1078Template.vehicleControl(deviceId, j8500, 20);
|
||||
return (JTPositionBaseInfo) jt1078Template.vehicleControl(phoneNumber, j8500, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setAreaForCircle(int attribute, String deviceId, List<JTCircleArea> circleAreaList) {
|
||||
public int setAreaForCircle(int attribute, String phoneNumber, List<JTCircleArea> circleAreaList) {
|
||||
J8600 j8600 = new J8600();
|
||||
j8600.setAttribute(attribute);
|
||||
j8600.setCircleAreaList(circleAreaList);
|
||||
return (int) jt1078Template.setAreaForCircle(deviceId, j8600, 20);
|
||||
return (int) jt1078Template.setAreaForCircle(phoneNumber, j8600, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAreaForCircle(String deviceId, List<Long> ids) {
|
||||
public int deleteAreaForCircle(String phoneNumber, List<Long> ids) {
|
||||
J8601 j8601 = new J8601();
|
||||
j8601.setIdList(ids);
|
||||
return (int) jt1078Template.deleteAreaForCircle(deviceId, j8601, 20);
|
||||
return (int) jt1078Template.deleteAreaForCircle(phoneNumber, j8601, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JTAreaOrRoute> queryAreaForCircle(String deviceId, List<Long> ids) {
|
||||
public List<JTAreaOrRoute> queryAreaForCircle(String phoneNumber, List<Long> ids) {
|
||||
J8608 j8608 = new J8608();
|
||||
j8608.setType(1);
|
||||
j8608.setIdList(ids);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(phoneNumber, j8608, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setAreaForRectangle(int attribute, String deviceId, List<JTRectangleArea> rectangleAreas) {
|
||||
public int setAreaForRectangle(int attribute, String phoneNumber, List<JTRectangleArea> rectangleAreas) {
|
||||
J8602 j8602 = new J8602();
|
||||
j8602.setAttribute(attribute);
|
||||
j8602.setRectangleAreas(rectangleAreas);
|
||||
return (int) jt1078Template.setAreaForRectangle(deviceId, j8602, 20);
|
||||
return (int) jt1078Template.setAreaForRectangle(phoneNumber, j8602, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAreaForRectangle(String deviceId, List<Long> ids) {
|
||||
public int deleteAreaForRectangle(String phoneNumber, List<Long> ids) {
|
||||
J8603 j8603 = new J8603();
|
||||
j8603.setIdList(ids);
|
||||
return (int) jt1078Template.deleteAreaForRectangle(deviceId, j8603, 20);
|
||||
return (int) jt1078Template.deleteAreaForRectangle(phoneNumber, j8603, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JTAreaOrRoute> queryAreaForRectangle(String deviceId, List<Long> ids) {
|
||||
public List<JTAreaOrRoute> queryAreaForRectangle(String phoneNumber, List<Long> ids) {
|
||||
J8608 j8608 = new J8608();
|
||||
j8608.setType(2);
|
||||
j8608.setIdList(ids);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(phoneNumber, j8608, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setAreaForPolygon(String deviceId, JTPolygonArea polygonArea) {
|
||||
public int setAreaForPolygon(String phoneNumber, JTPolygonArea polygonArea) {
|
||||
J8604 j8604 = new J8604();
|
||||
j8604.setPolygonArea(polygonArea);
|
||||
return (int) jt1078Template.setAreaForPolygon(deviceId, j8604, 20);
|
||||
return (int) jt1078Template.setAreaForPolygon(phoneNumber, j8604, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAreaForPolygon(String deviceId, List<Long> ids) {
|
||||
public int deleteAreaForPolygon(String phoneNumber, List<Long> ids) {
|
||||
J8605 j8605 = new J8605();
|
||||
j8605.setIdList(ids);
|
||||
return (int) jt1078Template.deleteAreaForPolygon(deviceId, j8605, 20);
|
||||
return (int) jt1078Template.deleteAreaForPolygon(phoneNumber, j8605, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JTAreaOrRoute> queryAreaForPolygon(String deviceId, List<Long> ids) {
|
||||
public List<JTAreaOrRoute> queryAreaForPolygon(String phoneNumber, List<Long> ids) {
|
||||
J8608 j8608 = new J8608();
|
||||
j8608.setType(3);
|
||||
j8608.setIdList(ids);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(phoneNumber, j8608, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setRoute(String deviceId, JTRoute route) {
|
||||
public int setRoute(String phoneNumber, JTRoute route) {
|
||||
J8606 j8606 = new J8606();
|
||||
j8606.setRoute(route);
|
||||
return (int) jt1078Template.setRoute(deviceId, j8606, 20);
|
||||
return (int) jt1078Template.setRoute(phoneNumber, j8606, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRoute(String deviceId, List<Long> ids) {
|
||||
public int deleteRoute(String phoneNumber, List<Long> ids) {
|
||||
J8607 j8607 = new J8607();
|
||||
j8607.setIdList(ids);
|
||||
return (int) jt1078Template.deleteRoute(deviceId, j8607, 20);
|
||||
return (int) jt1078Template.deleteRoute(phoneNumber, j8607, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JTAreaOrRoute> queryRoute(String deviceId, List<Long> ids) {
|
||||
public List<JTAreaOrRoute> queryRoute(String phoneNumber, List<Long> ids) {
|
||||
J8608 j8608 = new J8608();
|
||||
j8608.setType(4);
|
||||
j8608.setIdList(ids);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(deviceId, j8608, 20);
|
||||
return (List<JTAreaOrRoute>) jt1078Template.queryAreaOrRoute(phoneNumber, j8608, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JTDriverInformation queryDriverInformation(String deviceId) {
|
||||
public JTDriverInformation queryDriverInformation(String phoneNumber) {
|
||||
J8702 j8702 = new J8702();
|
||||
return (JTDriverInformation) jt1078Template.queryDriverInformation(deviceId, j8702, 20);
|
||||
return (JTDriverInformation) jt1078Template.queryDriverInformation(phoneNumber, j8702, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> shooting(String deviceId, JTShootingCommand shootingCommand) {
|
||||
public List<Long> shooting(String phoneNumber, JTShootingCommand shootingCommand) {
|
||||
J8801 j8801 = new J8801();
|
||||
j8801.setCommand(shootingCommand);
|
||||
return (List<Long>) jt1078Template.shooting(deviceId, j8801, 300);
|
||||
return (List<Long>) jt1078Template.shooting(phoneNumber, j8801, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JTMediaDataInfo> queryMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand) {
|
||||
public List<JTMediaDataInfo> queryMediaData(String phoneNumber, JTQueryMediaDataCommand queryMediaDataCommand) {
|
||||
J8802 j8802 = new J8802();
|
||||
j8802.setCommand(queryMediaDataCommand);
|
||||
return (List<JTMediaDataInfo>) jt1078Template.queryMediaData(deviceId, j8802, 300);
|
||||
return (List<JTMediaDataInfo>) jt1078Template.queryMediaData(phoneNumber, j8802, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand) {
|
||||
public void uploadMediaData(String phoneNumber, JTQueryMediaDataCommand queryMediaDataCommand) {
|
||||
J8803 j8803 = new J8803();
|
||||
j8803.setCommand(queryMediaDataCommand);
|
||||
jt1078Template.uploadMediaData(deviceId, j8803, 10);
|
||||
jt1078Template.uploadMediaData(phoneNumber, j8803, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void record(String deviceId, int command, Integer time, Integer save, Integer samplingRate) {
|
||||
public void record(String phoneNumber, int command, Integer time, Integer save, Integer samplingRate) {
|
||||
J8804 j8804 = new J8804();
|
||||
j8804.setCommond(command);
|
||||
j8804.setDuration(time);
|
||||
j8804.setSave(save);
|
||||
j8804.setSamplingRate(samplingRate);
|
||||
jt1078Template.record(deviceId, j8804, 10);
|
||||
jt1078Template.record(phoneNumber, j8804, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadMediaDataForSingle(String deviceId, Long mediaId, Integer delete) {
|
||||
public void uploadMediaDataForSingle(String phoneNumber, Long mediaId, Integer delete) {
|
||||
J8805 j8805 = new J8805();
|
||||
j8805.setMediaId(mediaId);
|
||||
j8805.setDelete(delete);
|
||||
jt1078Template.uploadMediaDataForSingle(deviceId, j8805, 10);
|
||||
jt1078Template.uploadMediaDataForSingle(phoneNumber, j8805, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JTMediaAttribute queryMediaAttribute(String deviceId) {
|
||||
public JTMediaAttribute queryMediaAttribute(String phoneNumber) {
|
||||
J9003 j9003 = new J9003();
|
||||
return (JTMediaAttribute) jt1078Template.queryMediaAttribute(deviceId, j9003, 300);
|
||||
return (JTMediaAttribute) jt1078Template.queryMediaAttribute(phoneNumber, j9003, 300);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -862,10 +866,10 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTalk(String deviceId, String channelId, String app, String stream, String mediaServerId, Boolean onlySend,
|
||||
public void startTalk(String phoneNumber, String channelId, String app, String stream, String mediaServerId, Boolean onlySend,
|
||||
GeneralCallback<StreamInfo> callback) {
|
||||
// 检查流是否已经存在,存在则返回
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_TALK + deviceId + ":" + channelId;
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_TALK + phoneNumber + ":" + channelId;
|
||||
List<GeneralCallback<StreamInfo>> errorCallbacks = inviteErrorCallbackMap.computeIfAbsent(playKey, k -> new ArrayList<>());
|
||||
errorCallbacks.add(callback);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
@@ -873,7 +877,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "对讲进行中");
|
||||
}
|
||||
|
||||
String receiveStream = "1078" + "_" + deviceId + "_" + channelId;
|
||||
String receiveStream = "1078" + "_" + phoneNumber + "_" + channelId;
|
||||
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||
if (mediaServer == null) {
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
@@ -887,12 +891,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), app + "/" + stream + "流不存在");
|
||||
}
|
||||
// 开启收流端口, zlm发送1078的rtp流需要将ssrc字段设置为 imei_channel格式
|
||||
String ssrc = deviceId + "_" + channelId;
|
||||
String ssrc = phoneNumber + "_" + channelId;
|
||||
SendRtpItem sendRtpItem = new SendRtpItem();
|
||||
sendRtpItem.setMediaServerId(mediaServerId);
|
||||
sendRtpItem.setPort(0);
|
||||
sendRtpItem.setSsrc(ssrc);
|
||||
sendRtpItem.setDeviceId(deviceId);
|
||||
sendRtpItem.setDeviceId(phoneNumber);
|
||||
sendRtpItem.setChannelId(channelId);
|
||||
sendRtpItem.setRtcp(false);
|
||||
sendRtpItem.setApp(app);
|
||||
@@ -904,14 +908,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
if (onlySend == null || !onlySend) {
|
||||
sendRtpItem.setReceiveStream(receiveStream);
|
||||
}
|
||||
sendRtpItem.setPlatformId(deviceId);
|
||||
sendRtpItem.setPlatformId(phoneNumber);
|
||||
if (onlySend == null || !onlySend) {
|
||||
// 设置hook监听
|
||||
Hook hook = Hook.getInstance(HookType.on_media_arrival, "rtp", receiveStream, mediaServer.getId());
|
||||
subscribe.addSubscribe(hook, (hookData) -> {
|
||||
dynamicTask.stop(playKey);
|
||||
logger.info("[1078-对讲] 对讲成功, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
StreamInfo info = onPublishHandler(mediaServer, hookData, deviceId, channelId);
|
||||
logger.info("[1078-对讲] 对讲成功, phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
StreamInfo info = onPublishHandler(mediaServer, hookData, phoneNumber, channelId);
|
||||
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), info);
|
||||
@@ -923,12 +927,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
});
|
||||
Hook hookForDeparture = Hook.getInstance(HookType.on_media_departure, "rtp", receiveStream, mediaServer.getId());
|
||||
subscribe.addSubscribe(hookForDeparture, (hookData) -> {
|
||||
logger.info("[1078-对讲] 对讲时源流注销, app: {}. stream: {}, deviceId: {}, channelId: {}", app, stream, deviceId, channelId);
|
||||
stopTalk(deviceId, channelId);
|
||||
logger.info("[1078-对讲] 对讲时源流注销, app: {}. stream: {}, phoneNumber: {}, channelId: {}", app, stream, phoneNumber, channelId);
|
||||
stopTalk(phoneNumber, channelId);
|
||||
});
|
||||
// 设置超时监听
|
||||
dynamicTask.startDelay(playKey, () -> {
|
||||
logger.info("[1078-对讲] 超时, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-对讲] 超时, phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getMsg(), null);
|
||||
@@ -939,8 +943,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
|
||||
Integer localPort = mediaServerService.startSendRtpPassive(mediaServer, sendRtpItem, 15000);
|
||||
|
||||
logger.info("[1078-对讲] deviceId: {}, channelId: {}, 收发端口: {}, app: {}, stream: {}",
|
||||
deviceId, channelId, localPort, app, stream);
|
||||
logger.info("[1078-对讲] phoneNumber: {}, channelId: {}, 收发端口: {}, app: {}, stream: {}",
|
||||
phoneNumber, channelId, localPort, app, stream);
|
||||
J9101 j9101 = new J9101();
|
||||
j9101.setChannel(Integer.valueOf(channelId));
|
||||
j9101.setIp(mediaServer.getSdpIp());
|
||||
@@ -948,9 +952,9 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9101.setTcpPort(localPort);
|
||||
j9101.setUdpPort(localPort);
|
||||
j9101.setType(2);
|
||||
jt1078Template.startLive(deviceId, j9101, 6);
|
||||
jt1078Template.startLive(phoneNumber, j9101, 6);
|
||||
if (onlySend != null && onlySend) {
|
||||
logger.info("[1078-对讲] 对讲成功, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
logger.info("[1078-对讲] 对讲成功, phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||
errorCallback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), null);
|
||||
}
|
||||
@@ -960,8 +964,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopTalk(String deviceId, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_TALK + deviceId + ":" + channelId;
|
||||
public void stopTalk(String phoneNumber, String channelId) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_TALK + phoneNumber + ":" + channelId;
|
||||
dynamicTask.stop(playKey);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
// 发送停止命令
|
||||
@@ -970,8 +974,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j9102.setCommand(4);
|
||||
j9102.setCloseType(0);
|
||||
j9102.setStreamType(1);
|
||||
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||
logger.info("[1078-停止对讲] deviceId: {}, channelId: {}", deviceId, channelId);
|
||||
jt1078Template.stopLive(phoneNumber, j9102, 6);
|
||||
logger.info("[1078-停止对讲] phoneNumber: {}, channelId: {}", phoneNumber, channelId);
|
||||
// 删除缓存数据
|
||||
if (streamInfo != null) {
|
||||
redisTemplate.delete(playKey);
|
||||
@@ -988,20 +992,25 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeStreamType(String deviceId, String channelId, Integer streamType) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + deviceId + ":" + channelId;
|
||||
public void changeStreamType(String phoneNumber, String channelId, Integer streamType) {
|
||||
String playKey = VideoManagerConstants.INVITE_INFO_1078_PLAY + phoneNumber + ":" + channelId;
|
||||
dynamicTask.stop(playKey);
|
||||
StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey);
|
||||
if (streamInfo == null) {
|
||||
logger.info("[1078-切换码流类型] 未找到点播信息 deviceId: {}, channelId: {}, streamType: {}", deviceId, channelId, streamType);
|
||||
logger.info("[1078-切换码流类型] 未找到点播信息 phoneNumber: {}, channelId: {}, streamType: {}", phoneNumber, channelId, streamType);
|
||||
}
|
||||
logger.info("[1078-切换码流类型] deviceId: {}, channelId: {}, streamType: {}", deviceId, channelId, streamType);
|
||||
logger.info("[1078-切换码流类型] phoneNumber: {}, channelId: {}, streamType: {}", phoneNumber, channelId, streamType);
|
||||
// 发送暂停命令
|
||||
J9102 j9102 = new J9102();
|
||||
j9102.setChannel(Integer.valueOf(channelId));
|
||||
j9102.setCommand(1);
|
||||
j9102.setCloseType(0);
|
||||
j9102.setStreamType(streamType);
|
||||
jt1078Template.stopLive(deviceId, j9102, 6);
|
||||
jt1078Template.stopLive(phoneNumber, j9102, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JTChannel> getChannelList(int deviceId, String query) {
|
||||
return jtChannelMapper.getAll(deviceId, query);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user