通用通道支持预置位调用,删除, 增加
This commit is contained in:
@@ -184,7 +184,6 @@ public class ChannelFrontEndController {
|
||||
}
|
||||
|
||||
@Operation(summary = "聚焦控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "command", description = "控制指令,允许值: near, far, stop", required = true)
|
||||
@Parameter(name = "speed", description = "聚焦速度(0-100)", required = true)
|
||||
@@ -237,7 +236,6 @@ public class ChannelFrontEndController {
|
||||
}
|
||||
|
||||
@Operation(summary = "查询预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@GetMapping("/preset/query")
|
||||
public DeferredResult<WVPResult<List<Preset>>> queryPreset(Integer channelId) {
|
||||
@@ -298,7 +296,6 @@ public class ChannelFrontEndController {
|
||||
@Parameter(name = "presetName", description = "预置位名称", required = true)
|
||||
@GetMapping("/preset/add")
|
||||
public DeferredResult<WVPResult<String>> addPreset(Integer channelId, Integer presetId, String presetName) {
|
||||
|
||||
FrontEndControlCodeForPreset controlCode = new FrontEndControlCodeForPreset();
|
||||
controlCode.setCode(1);
|
||||
controlCode.setPresetId(presetId);
|
||||
@@ -308,7 +305,6 @@ public class ChannelFrontEndController {
|
||||
}
|
||||
|
||||
@Operation(summary = "预置位指令-调用预置位", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@Parameter(name = "presetId", description = "预置位编号(1-100)", required = true)
|
||||
@GetMapping("/preset/call")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
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.service.IPTZService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePTZService;
|
||||
@@ -20,26 +19,6 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
||||
@Autowired
|
||||
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
|
||||
public void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
|
||||
try {
|
||||
@@ -70,11 +49,11 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
||||
cmdCode = cmdCode | 1 << 4;
|
||||
}
|
||||
}
|
||||
panSpeed = frontEndControlCode.getPanSpeed();
|
||||
titleSpeed = frontEndControlCode.getTiltSpeed();
|
||||
zoomSpeed = frontEndControlCode.getZoomSpeed();
|
||||
panSpeed = (int)(frontEndControlCode.getPanSpeed()/100D* 255);
|
||||
titleSpeed = (int)(frontEndControlCode.getTiltSpeed()/100D* 255);;
|
||||
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);
|
||||
}catch (Exception e) {
|
||||
log.error("[云台控制失败] ", e);
|
||||
@@ -102,9 +81,8 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
||||
if (frontEndControlCode.getPresetId() != null) {
|
||||
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);
|
||||
}catch (Exception e) {
|
||||
log.error("[预置位控制失败] ", e);
|
||||
@@ -147,7 +125,7 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
|
||||
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);
|
||||
}catch (Exception 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);
|
||||
}catch (Exception 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);
|
||||
}catch (Exception 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);
|
||||
}catch (Exception 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);
|
||||
}catch (Exception 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({
|
||||
method: 'get',
|
||||
url: '/api/common/channel/front-end/preset/add',
|
||||
params: {
|
||||
channelId: channelId,
|
||||
presetId: presetId
|
||||
presetId: presetId,
|
||||
presetName: presetName
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getPresetList: function() {
|
||||
this.$store.dispatch('commonChanel/queryPreset', [this.channelId])
|
||||
this.$store.dispatch('commonChanel/queryPreset', this.channelId)
|
||||
.then(data => {
|
||||
this.presetList = data
|
||||
// 防止出现表格错位
|
||||
@@ -73,7 +73,11 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
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 => {
|
||||
setTimeout(() => {
|
||||
this.inputVisible = false
|
||||
@@ -99,7 +103,10 @@ export default {
|
||||
},
|
||||
gotoPreset: function(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 => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
@@ -128,7 +135,10 @@ export default {
|
||||
spinner: 'el-icon-loading',
|
||||
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 => {
|
||||
setTimeout(() => {
|
||||
this.getPresetList()
|
||||
|
||||
Reference in New Issue
Block a user