diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelFrontEndController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelFrontEndController.java index 8c9674d9b..1d7e460fc 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelFrontEndController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelFrontEndController.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; @@ -599,6 +600,42 @@ public class ChannelFrontEndController { return result; } + @Operation(summary = "看守位设置", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "channelId", description = "通道ID", required = true) + @Parameter(name = "enabled", description = "是否开启看守位", required = true) + @Parameter(name = "resetTime", description = "自动归位时间间隔(秒)") + @Parameter(name = "presetIndex", description = "调用预置位编号") + @GetMapping("/home_position") + public DeferredResult> homePosition(Integer channelId, Boolean enabled, + @RequestParam(required = false) Integer resetTime, + @RequestParam(required = false) Integer presetIndex){ + + if (log.isDebugEnabled()) { + log.debug("[通用通道]看守位设置 API调用,channelId:{} ,enabled:{} ,resetTime:{} ,presetIndex:{}", channelId, enabled, resetTime, presetIndex); + } + + CommonGBChannel channel = channelService.getOne(channelId); + Assert.notNull(channel, "通道不存在"); + + DeferredResult> result = new DeferredResult<>(); + + result.onTimeout(()->{ + WVPResult wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时"); + result.setResult(wvpResult); + }); + + ErrorCallback callback = (code, msg, data) -> { + WVPResult wvpResult = new WVPResult<>(); + wvpResult.setCode(code); + wvpResult.setMsg(msg); + wvpResult.setData(data); + result.setResult(wvpResult); + }; + + channelControlService.homePosition(channel, enabled, resetTime, presetIndex, callback); + return result; + } + @Operation(summary = "拉框放大", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "channelId", description = "通道ID", required = true) @Parameter(name = "length", description = "播放窗口长度像素值", required = true) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelControlService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelControlService.java index 89e7187e7..d7f5a1ffc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelControlService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelControlService.java @@ -17,4 +17,6 @@ public interface IGbChannelControlService { void auxiliary(CommonGBChannel channel, FrontEndControlCodeForAuxiliary frontEndControlCode, ErrorCallback callback); void queryPreset(CommonGBChannel channel, ErrorCallback> callback); void dragZoom(CommonGBChannel channel, FrontEndControlCodeForDragZoom frontEndControlCode, ErrorCallback callback); + + void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPTZService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPTZService.java index 69adb7388..902d6abb0 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPTZService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPTZService.java @@ -22,4 +22,5 @@ public interface IPTZService { void dragZoomOut(CommonGBChannel channel, int length, int width, int midPointX, int midPointY, int lengthX, int lengthY); + void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePTZService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePTZService.java index f62dc19c4..8f05b9e60 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePTZService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePTZService.java @@ -27,4 +27,6 @@ public interface ISourcePTZService { void queryPreset(CommonGBChannel channel, ErrorCallback> callback); void dragZoom(CommonGBChannel channel, FrontEndControlCodeForDragZoom frontEndControlCode, ErrorCallback callback); + + void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelControlServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelControlServiceImpl.java index ade5e83f1..f7dd4c1e3 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelControlServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelControlServiceImpl.java @@ -138,4 +138,16 @@ public class GbChannelControlServiceImpl implements IGbChannelControlService { } sourcePTZService.dragZoom(channel, frontEndControlCode, callback); } + + @Override + public void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback) { + log.info("[通用通道] 看守位设置, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId()); + Integer dataType = channel.getDataType(); + ISourcePTZService sourcePTZService = sourcePTZServiceMap.get(ChannelDataType.PTZ_SERVICE + dataType); + if (sourcePTZService == null) { + log.error("[通用通道] 类型: {} 不支持看守位设置", dataType); + throw new PlayException(Response.BUSY_HERE, "channel not support"); + } + sourcePTZService.homePosition(channel, enabled, resetTime, presetIndex, callback); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PTZServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PTZServiceImpl.java index 1d4a9fbcf..093db0dcc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PTZServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PTZServiceImpl.java @@ -119,6 +119,23 @@ public class PTZServiceImpl implements IPTZService { deviceService.dragZoomOut(device, deviceChannel.getDeviceId(), length, width, midPointX, midPointY, lengthX, lengthY); } + @Override + public void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback) { + if (channel.getDataType() != ChannelDataType.GB28181) { + log.warn("[INFO 消息] 只有国标通道支持看守位,通道ID:{}", channel.getGbId()); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "不支持"); + } + Device device = deviceService.getDevice(channel.getDataDeviceId()); + if (device == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备"); + } + DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId()); + if (deviceChannel == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道"); + } + deviceService.homePosition(device, deviceChannel.getDeviceId(), enabled, resetTime, presetIndex, callback); + } + @Override public void queryPresetList(CommonGBChannel channel, ErrorCallback> callback) { if (channel.getDataType() != ChannelDataType.GB28181) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePTZServiceForGbImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePTZServiceForGbImpl.java index b86a29f12..b4c8c9958 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePTZServiceForGbImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePTZServiceForGbImpl.java @@ -349,6 +349,11 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService { ptzService.queryPresetList(channel, callback); } + @Override + public void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback) { + ptzService.homePosition(channel, enabled, resetTime, presetIndex, callback); + } + @Override public void dragZoom(CommonGBChannel channel, FrontEndControlCodeForDragZoom controlCode, ErrorCallback callback) { if (controlCode.getCode() == 1) { diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePTZServiceForJTImpl.java b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePTZServiceForJTImpl.java index 657058282..81ba99b42 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePTZServiceForJTImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePTZServiceForJTImpl.java @@ -156,6 +156,11 @@ public class SourcePTZServiceForJTImpl implements ISourcePTZService { callback.run(ErrorCode.ERROR486.getCode(), ErrorCode.ERROR486.getMsg(), null); } + @Override + public void homePosition(CommonGBChannel channel, Boolean enabled, Integer resetTime, Integer presetIndex, ErrorCallback callback) { + callback.run(ErrorCode.ERROR486.getCode(), ErrorCode.ERROR486.getMsg(), null); + } + @Override public void dragZoom(CommonGBChannel channel, FrontEndControlCodeForDragZoom frontEndControlCode, ErrorCallback callback) { callback.run(ErrorCode.ERROR486.getCode(), ErrorCode.ERROR486.getMsg(), null); diff --git a/web/src/api/commonChannel.js b/web/src/api/commonChannel.js index 58d41305f..dd1cad4df 100644 --- a/web/src/api/commonChannel.js +++ b/web/src/api/commonChannel.js @@ -691,6 +691,14 @@ export function drawThin(data) { data: data }) } +export function homePosition(params) { + return request({ + method: 'get', + url: '/api/common/channel/front-end/home_position', + params + }) +} + export function test() { return request({ method: 'get', diff --git a/web/src/store/modules/commonChanel.js b/web/src/store/modules/commonChanel.js index 4684c3cc9..dd333fbe5 100644 --- a/web/src/store/modules/commonChanel.js +++ b/web/src/store/modules/commonChanel.js @@ -50,7 +50,8 @@ import { resumePlayback, seekPlayback, speedPlayback, getAllForMap, test, saveLevel, resetLevel, clearThin, thinProgress, drawThin, saveThin, dragZoomIn, dragZoomOut, - talkStart, talkStop, broadcastStart, broadcastStop + talkStart, talkStop, broadcastStart, broadcastStop, + homePosition } from '@/api/commonChannel' const actions = { @@ -695,6 +696,17 @@ const actions = { }) }, + homePosition({ commit }, params) { + return new Promise((resolve, reject) => { + homePosition(params).then(response => { + const { data } = response + resolve(data) + }).catch(error => { + reject(error) + }) + }) + }, + test({ commit }) { return new Promise((resolve, reject) => { test().then(response => { diff --git a/web/src/styles/iconfont.scss b/web/src/styles/iconfont.scss index 9ab351464..5110bf1b4 100644 --- a/web/src/styles/iconfont.scss +++ b/web/src/styles/iconfont.scss @@ -1,6 +1,6 @@ @font-face { font-family: "iconfont"; /* Project id 1291092 */ - src: url('iconfont.woff2?t=1780559263294') format('woff2'); + src: url('iconfont.woff2?t=1782216793622') format('woff2'); } .iconfont { @@ -11,6 +11,58 @@ -moz-osx-font-smoothing: grayscale; } +.icon-yuzhidian:before { + content: "\e808"; +} + +.icon-xunhuan:before { + content: "\e809"; +} + +.icon-kanshouwei:before { + content: "\e80a"; +} + +.icon-yushua:before { + content: "\e80b"; +} + +.icon-mubiaogenzong1:before { + content: "\e80c"; +} + +.icon-fangkuang:before { + content: "\e807"; +} + +.icon-jingxiang:before { + content: "\e806"; +} + +.icon-zuoyoujingxiang:before { + content: "\ea5d"; +} + +.icon-shangxiajingxiang:before { + content: "\ea5e"; +} + +.icon-a-18_baojingluxiang:before { + content: "\e805"; +} + +.icon-mubiaogenzong:before { + content: "\e804"; +} + +.icon-yuntaijiaodu:before { + content: "\e803"; +} + +.icon-tubiao_yuntaikongzhi:before { + content: "\e802"; +} + .icon-dingshirenwuguanli:before { content: "\e800"; } diff --git a/web/src/styles/iconfont.woff2 b/web/src/styles/iconfont.woff2 index 84acc732e..3798c805f 100644 Binary files a/web/src/styles/iconfont.woff2 and b/web/src/styles/iconfont.woff2 differ diff --git a/web/src/views/channel/common/ptzGuardConfig.vue b/web/src/views/channel/common/ptzGuardConfig.vue new file mode 100644 index 000000000..e6c007e51 --- /dev/null +++ b/web/src/views/channel/common/ptzGuardConfig.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/web/src/views/channel/ptzConfig.vue b/web/src/views/channel/ptzConfig.vue index 30897ddf4..0384f8151 100644 --- a/web/src/views/channel/ptzConfig.vue +++ b/web/src/views/channel/ptzConfig.vue @@ -5,19 +5,23 @@
- + 预置点 - + 巡航组 - + 线性扫描 + + + 看守位 + - + 辅助开关 @@ -31,6 +35,7 @@ +
@@ -43,10 +48,11 @@ import ptzPresetConfig from './common/ptzPresetConfig.vue' import ptzCruiseConfig from './common/ptzCruiseConfig.vue' import ptzScanConfig from './common/ptzScanConfig.vue' import ptzSwitchConfig from './common/ptzSwitchConfig.vue' +import ptzGuardConfig from './common/ptzGuardConfig.vue' export default { name: 'ChPtzConfig', - components: { playerPtzPanel, ptzPresetConfig, ptzCruiseConfig, ptzScanConfig, ptzSwitchConfig }, + components: { playerPtzPanel, ptzPresetConfig, ptzCruiseConfig, ptzScanConfig, ptzSwitchConfig, ptzGuardConfig }, props: { channelId: { type: String, default: null } }, diff --git a/web/src/views/device/channel/ptzConfig.vue b/web/src/views/device/channel/ptzConfig.vue index 0a6b564ca..3d422418d 100644 --- a/web/src/views/device/channel/ptzConfig.vue +++ b/web/src/views/device/channel/ptzConfig.vue @@ -5,23 +5,23 @@
- + 预置点 - + 巡航组 - + 线性扫描 - + 看守位 - + 辅助开关