mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 05:57:49 +08:00
[1078] 通用通道录像回放支持
This commit is contained in:
parent
0a19ce4f34
commit
d7f5e7d771
@ -290,7 +290,7 @@ public class JT1078Controller {
|
|||||||
@Parameter(required = false) Integer playbackSpeed
|
@Parameter(required = false) Integer playbackSpeed
|
||||||
|
|
||||||
) {
|
) {
|
||||||
jt1078PlayService.playbackControl(phoneNumber, channelId, command, playbackSpeed,time);
|
jt1078PlayService.playbackControl(phoneNumber, channelId, command, playbackSpeed, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "JT-录像-结束回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "JT-录像-结束回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
|||||||
@ -7,61 +7,124 @@ import com.genersoft.iot.vmp.gb28181.bean.CommonRecordInfo;
|
|||||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlaybackService;
|
import com.genersoft.iot.vmp.gb28181.service.ISourcePlaybackService;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTChannel;
|
import com.genersoft.iot.vmp.jt1078.bean.JTChannel;
|
||||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.dao.JTChannelMapper;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.dao.JTTerminalMapper;
|
||||||
|
import com.genersoft.iot.vmp.jt1078.proc.request.J1205;
|
||||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078PlayService;
|
import com.genersoft.iot.vmp.jt1078.service.Ijt1078PlayService;
|
||||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||||
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service(ChannelDataType.PLAYBACK_SERVICE + ChannelDataType.JT_1078)
|
@Service(ChannelDataType.PLAYBACK_SERVICE + ChannelDataType.JT_1078)
|
||||||
public class SourcePlaybackServiceForJTImpl implements ISourcePlaybackService {
|
public class SourcePlaybackServiceForJTImpl implements ISourcePlaybackService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JTTerminalMapper jtDeviceMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JTChannelMapper jtChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JT1078Template jt1078Template;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Ijt1078PlayService playService;
|
private Ijt1078PlayService playService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback) {
|
public void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback) {
|
||||||
|
JTChannel jtChannel = jtChannelMapper.selectChannelById(channel.getDataDeviceId());
|
||||||
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
JTDevice device = jtDeviceMapper.getDeviceById(jtChannel.getDataDeviceId());
|
||||||
|
Assert.notNull(device, "设备不存在");
|
||||||
|
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
||||||
|
|
||||||
|
playService.playback(device.getPhoneNumber(), jtChannel.getChannelId(), DateUtil.timestampMsTo_yyyy_MM_dd_HH_mm_ss(startTime),
|
||||||
|
DateUtil.timestampMsTo_yyyy_MM_dd_HH_mm_ss(stopTime), 0, 0, 0, 0, result -> {
|
||||||
|
callback.run(result.getCode(), result.getMsg(), result.getData());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopPlayback(CommonGBChannel channel, String stream) {
|
public void stopPlayback(CommonGBChannel channel, String stream) {
|
||||||
|
JTChannel jtChannel = jtChannelMapper.selectChannelById(channel.getDataDeviceId());
|
||||||
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
JTDevice device = jtDeviceMapper.getDeviceById(jtChannel.getDataDeviceId());
|
||||||
|
Assert.notNull(device, "设备不存在");
|
||||||
|
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
||||||
|
|
||||||
|
playService.stopPlayback(device.getPhoneNumber(), jtChannel.getChannelId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playbackPause(CommonGBChannel channel, String stream) {
|
public void playbackPause(CommonGBChannel channel, String stream) {
|
||||||
|
JTChannel jtChannel = jtChannelMapper.selectChannelById(channel.getDataDeviceId());
|
||||||
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
JTDevice device = jtDeviceMapper.getDeviceById(jtChannel.getDataDeviceId());
|
||||||
|
Assert.notNull(device, "设备不存在");
|
||||||
|
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
||||||
|
|
||||||
|
playService.playbackControl(device.getPhoneNumber(), jtChannel.getChannelId(), 1, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playbackResume(CommonGBChannel channel, String stream) {
|
public void playbackResume(CommonGBChannel channel, String stream) {
|
||||||
|
JTChannel jtChannel = jtChannelMapper.selectChannelById(channel.getDataDeviceId());
|
||||||
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
JTDevice device = jtDeviceMapper.getDeviceById(jtChannel.getDataDeviceId());
|
||||||
|
Assert.notNull(device, "设备不存在");
|
||||||
|
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
||||||
|
|
||||||
|
playService.playbackControl(device.getPhoneNumber(), jtChannel.getChannelId(), 0, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playbackSeek(CommonGBChannel channel, String stream, long seekTime) {
|
public void playbackSeek(CommonGBChannel channel, String stream, long seekTime) {
|
||||||
|
// 因为seek是增量,比如15s处, 1078是具体的时间点,比如2025-10-10 23:21:12 这个一个绝对时间点。无法转换,故此处不做支持
|
||||||
|
log.warn("[JT-通用通道] 回放seek, 尚不支持");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playbackSpeed(CommonGBChannel channel, String stream, Double speed) {
|
public void playbackSpeed(CommonGBChannel channel, String stream, Double speed) {
|
||||||
|
JTChannel jtChannel = jtChannelMapper.selectChannelById(channel.getDataDeviceId());
|
||||||
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
JTDevice device = jtDeviceMapper.getDeviceById(jtChannel.getDataDeviceId());
|
||||||
|
Assert.notNull(device, "设备不存在");
|
||||||
|
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
||||||
|
|
||||||
|
playService.playbackControl(device.getPhoneNumber(), jtChannel.getChannelId(), 0, (int)Math.floor(speed), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void queryRecord(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<List<CommonRecordInfo>> callback) {
|
public void queryRecord(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<List<CommonRecordInfo>> callback) {
|
||||||
JTChannel jtChannel = jt1078Service.getChannelByDbId(channelId);
|
JTChannel jtChannel = jtChannelMapper.selectChannelById(channel.getDataDeviceId());
|
||||||
Assert.notNull(channel, "通道不存在");
|
Assert.notNull(channel, "通道不存在");
|
||||||
JTDevice device = jt1078Service.getDeviceById(channel.getTerminalDbId());
|
JTDevice device = jtDeviceMapper.getDeviceById(jtChannel.getDataDeviceId());
|
||||||
Assert.notNull(device, "设备不存在");
|
Assert.notNull(device, "设备不存在");
|
||||||
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
jt1078Template.checkTerminalStatus(device.getPhoneNumber());
|
||||||
playService.getRecordList()
|
List<J1205.JRecordItem> recordList = playService.getRecordList(device.getPhoneNumber(), jtChannel.getChannelId(), startTime, endTime);
|
||||||
|
if (recordList.isEmpty()) {
|
||||||
|
callback.run(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg(), null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CommonRecordInfo> recordInfoList = new ArrayList<>();
|
||||||
|
for (J1205.JRecordItem jRecordItem : recordList) {
|
||||||
|
CommonRecordInfo commonRecordInfo = new CommonRecordInfo();
|
||||||
|
commonRecordInfo.setStartTime(jRecordItem.getStartTime());
|
||||||
|
commonRecordInfo.setEndTime(jRecordItem.getEndTime());
|
||||||
|
recordInfoList.add(commonRecordInfo);
|
||||||
|
}
|
||||||
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), recordInfoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user