mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 22:47:49 +08:00
通用通道支持预置位调用,删除, 增加
This commit is contained in:
parent
19b873ba5c
commit
9614584219
@ -184,7 +184,6 @@ public class ChannelFrontEndController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "聚焦控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "聚焦控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
@Parameter(name = "command", description = "控制指令,允许值: near, far, stop", required = true)
|
@Parameter(name = "command", description = "控制指令,允许值: near, far, stop", required = true)
|
||||||
@Parameter(name = "speed", description = "聚焦速度(0-100)", required = true)
|
@Parameter(name = "speed", description = "聚焦速度(0-100)", required = true)
|
||||||
@ -237,7 +236,6 @@ public class ChannelFrontEndController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "查询预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
@GetMapping("/preset/query")
|
@GetMapping("/preset/query")
|
||||||
public DeferredResult<WVPResult<List<Preset>>> queryPreset(Integer channelId) {
|
public DeferredResult<WVPResult<List<Preset>>> queryPreset(Integer channelId) {
|
||||||
@ -298,7 +296,6 @@ public class ChannelFrontEndController {
|
|||||||
@Parameter(name = "presetName", description = "预置位名称", required = true)
|
@Parameter(name = "presetName", description = "预置位名称", required = true)
|
||||||
@GetMapping("/preset/add")
|
@GetMapping("/preset/add")
|
||||||
public DeferredResult<WVPResult<String>> addPreset(Integer channelId, Integer presetId, String presetName) {
|
public DeferredResult<WVPResult<String>> addPreset(Integer channelId, Integer presetId, String presetName) {
|
||||||
|
|
||||||
FrontEndControlCodeForPreset controlCode = new FrontEndControlCodeForPreset();
|
FrontEndControlCodeForPreset controlCode = new FrontEndControlCodeForPreset();
|
||||||
controlCode.setCode(1);
|
controlCode.setCode(1);
|
||||||
controlCode.setPresetId(presetId);
|
controlCode.setPresetId(presetId);
|
||||||
@ -308,7 +305,6 @@ public class ChannelFrontEndController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "预置位指令-调用预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "预置位指令-调用预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
@Parameter(name = "presetId", description = "预置位编号(1-100)", required = true)
|
@Parameter(name = "presetId", description = "预置位编号(1-100)", required = true)
|
||||||
@GetMapping("/preset/call")
|
@GetMapping("/preset/call")
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPTZService;
|
import com.genersoft.iot.vmp.gb28181.service.IPTZService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePTZService;
|
import com.genersoft.iot.vmp.gb28181.service.ISourcePTZService;
|
||||||
@ -20,26 +19,6 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPTZService ptzService;
|
private IPTZService ptzService;
|
||||||
|
|
||||||
public void frontEndCommand(CommonGBChannel channel, Integer cmdCode, Integer parameter1, Integer parameter2, Integer combindCode2){
|
|
||||||
|
|
||||||
if (parameter1 == null || parameter1 < 0 || parameter1 > 100) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter1 为 0-255的数字");
|
|
||||||
}
|
|
||||||
// 返回转换为国标定义的范围
|
|
||||||
parameter1 = (int)(parameter1/100D* 255);
|
|
||||||
if (parameter2 == null || parameter2 < 0 || parameter2 > 100) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "parameter2 为 0-255的数字");
|
|
||||||
}
|
|
||||||
// 返回转换为国标定义的范围
|
|
||||||
parameter2 = (int)(parameter2/100D* 255);
|
|
||||||
if (combindCode2 == null || combindCode2 < 0 || combindCode2 > 100) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "combindCode2 为 0-15的数字");
|
|
||||||
}
|
|
||||||
combindCode2 = (int)(combindCode2/100D* 16);
|
|
||||||
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, combindCode2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
public void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||||
try {
|
try {
|
||||||
@ -70,11 +49,11 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
cmdCode = cmdCode | 1 << 4;
|
cmdCode = cmdCode | 1 << 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panSpeed = frontEndControlCode.getPanSpeed();
|
panSpeed = (int)(frontEndControlCode.getPanSpeed()/100D* 255);
|
||||||
titleSpeed = frontEndControlCode.getTiltSpeed();
|
titleSpeed = (int)(frontEndControlCode.getTiltSpeed()/100D* 255);;
|
||||||
zoomSpeed = frontEndControlCode.getZoomSpeed();
|
zoomSpeed = (int)(frontEndControlCode.getZoomSpeed()/100D* 16);
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, panSpeed, titleSpeed, zoomSpeed);
|
ptzService.frontEndCommand(channel, cmdCode, panSpeed, titleSpeed, zoomSpeed);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[云台控制失败] ", e);
|
log.error("[云台控制失败] ", e);
|
||||||
@ -102,9 +81,8 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
if (frontEndControlCode.getPresetId() != null) {
|
if (frontEndControlCode.getPresetId() != null) {
|
||||||
parameter2 = frontEndControlCode.getPresetId();
|
parameter2 = frontEndControlCode.getPresetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[预置位控制失败] ", e);
|
log.error("[预置位控制失败] ", e);
|
||||||
@ -147,7 +125,7 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
irisSpeed = frontEndControlCode.getIrisSpeed();
|
irisSpeed = frontEndControlCode.getIrisSpeed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, focusSpeed, irisSpeed, parameter3);
|
ptzService.frontEndCommand(channel, cmdCode, focusSpeed, irisSpeed, parameter3);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[云台控制失败] ", e);
|
log.error("[云台控制失败] ", e);
|
||||||
@ -187,7 +165,7 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[巡航控制失败] ", e);
|
log.error("[巡航控制失败] ", e);
|
||||||
@ -226,7 +204,7 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[巡航控制失败] ", e);
|
log.error("[巡航控制失败] ", e);
|
||||||
@ -255,7 +233,7 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[辅助开关失败] ", e);
|
log.error("[辅助开关失败] ", e);
|
||||||
@ -282,7 +260,7 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
|
||||||
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.error("[雨刷开关失败] ", e);
|
log.error("[雨刷开关失败] ", e);
|
||||||
|
|||||||
@ -402,13 +402,14 @@ export function stopCruise({ channelId, cruiseId }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addPreset({ channelId, presetId }) {
|
export function addPreset({ channelId, presetId, presetName }) {
|
||||||
return request({
|
return request({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: '/api/common/channel/front-end/preset/add',
|
url: '/api/common/channel/front-end/preset/add',
|
||||||
params: {
|
params: {
|
||||||
channelId: channelId,
|
channelId: channelId,
|
||||||
presetId: presetId
|
presetId: presetId,
|
||||||
|
presetName: presetName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPresetList: function() {
|
getPresetList: function() {
|
||||||
this.$store.dispatch('commonChanel/queryPreset', [this.channelId])
|
this.$store.dispatch('commonChanel/queryPreset', this.channelId)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.presetList = data
|
this.presetList = data
|
||||||
// 防止出现表格错位
|
// 防止出现表格错位
|
||||||
@ -73,7 +73,11 @@ export default {
|
|||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
})
|
})
|
||||||
this.$store.dispatch('commonChanel/addPreset', [this.channelId, this.ptzPresetId])
|
this.$store.dispatch('commonChanel/addPreset', {
|
||||||
|
channelId: this.channelId,
|
||||||
|
presetId: this.ptzPresetId,
|
||||||
|
presetName: this.ptzPresetId
|
||||||
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.inputVisible = false
|
this.inputVisible = false
|
||||||
@ -99,7 +103,10 @@ export default {
|
|||||||
},
|
},
|
||||||
gotoPreset: function(preset) {
|
gotoPreset: function(preset) {
|
||||||
console.log(preset)
|
console.log(preset)
|
||||||
this.$store.dispatch('commonChanel/callPreset', [this.channelId, preset.presetId])
|
this.$store.dispatch('commonChanel/callPreset', {
|
||||||
|
channelId: this.channelId,
|
||||||
|
presetId: preset.presetId
|
||||||
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
@ -128,7 +135,10 @@ export default {
|
|||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
})
|
})
|
||||||
this.$store.dispatch('commonChanel/deletePreset', [this.channelId, preset.presetId])
|
this.$store.dispatch('commonChanel/deletePreset', {
|
||||||
|
channelId: this.channelId,
|
||||||
|
presetId: preset.presetId
|
||||||
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getPresetList()
|
this.getPresetList()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user