通用通道支持巡航组

This commit is contained in:
lin 2025-07-31 20:54:08 +08:00
parent 9614584219
commit 8ec950d515
8 changed files with 205 additions and 67 deletions

View File

@ -14,7 +14,7 @@ public class FrontEndControlCodeForTour implements IFrontEndControlCode {
}
/**
* 巡航指令 1为加入巡航点 2为删除一个巡航点 3为设置巡航速度 4为设置巡航停留时间 5为开始巡航 6为开始巡航
* 巡航指令 1为加入巡航点 2为删除一个巡航点 3为设置巡航速度 4为设置巡航停留时间 5为开始巡航 6为停止巡航
*/
@Getter
@Setter

View File

@ -385,12 +385,14 @@ public class ChannelFrontEndController {
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "tourId", description = "巡航组号(0-100)", required = true)
@Parameter(name = "speed", description = "巡航速度(1-4095)", required = true)
@Parameter(name = "presetId", description = "预置位编号", required = true)
@GetMapping("/tour/speed")
public DeferredResult<WVPResult<String>> setCruiseSpeed(Integer channelId, Integer tourId, Integer speed) {
public DeferredResult<WVPResult<String>> setCruiseSpeed(Integer channelId, Integer tourId, Integer speed, Integer presetId) {
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
controlCode.setCode(3);
controlCode.setTourSpeed(speed);
controlCode.setTourId(tourId);
controlCode.setPresetId(presetId);
return tourControl(channelId, controlCode);
}
@ -398,12 +400,14 @@ public class ChannelFrontEndController {
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "tourId", description = "巡航组号", required = true)
@Parameter(name = "time", description = "巡航停留时间(1-4095)", required = true)
@Parameter(name = "presetId", description = "预置位编号", required = true)
@GetMapping("/tour/time")
public DeferredResult<WVPResult<String>> setCruiseTime(Integer channelId, Integer tourId, Integer time) {
public DeferredResult<WVPResult<String>> setCruiseTime(Integer channelId, Integer tourId, Integer time, Integer presetId) {
FrontEndControlCodeForTour controlCode = new FrontEndControlCodeForTour();
controlCode.setCode(4);
controlCode.setTourTime(time);
controlCode.setTourId(tourId);
controlCode.setPresetId(presetId);
return tourControl(channelId, controlCode);
}

View File

@ -49,6 +49,18 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
cmdCode = cmdCode | 1 << 4;
}
}
if (frontEndControlCode.getPanSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
if (frontEndControlCode.getTiltSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
if (frontEndControlCode.getZoomSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
panSpeed = (int)(frontEndControlCode.getPanSpeed()/100D* 255);
titleSpeed = (int)(frontEndControlCode.getTiltSpeed()/100D* 255);;
zoomSpeed = (int)(frontEndControlCode.getZoomSpeed()/100D* 16);
@ -78,9 +90,11 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
cmdCode = 0x83;
}
}
if (frontEndControlCode.getPresetId() != null) {
parameter2 = frontEndControlCode.getPresetId();
if (frontEndControlCode.getPresetId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter2 = frontEndControlCode.getPresetId();
}
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
@ -118,12 +132,16 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
}
}
if (frontEndControlCode.getFocusSpeed() != null) {
focusSpeed = frontEndControlCode.getFocusSpeed();
if (frontEndControlCode.getFocusSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
if (frontEndControlCode.getIrisSpeed() != null) {
irisSpeed = frontEndControlCode.getIrisSpeed();
if (frontEndControlCode.getIrisSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
focusSpeed = frontEndControlCode.getFocusSpeed();
irisSpeed = frontEndControlCode.getIrisSpeed();
}
ptzService.frontEndCommand(channel, cmdCode, focusSpeed, irisSpeed, parameter3);
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
@ -144,25 +162,55 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
if (frontEndControlCode.getCode() != null) {
if (frontEndControlCode.getCode() == 1) {
cmdCode = 0x84;
if (frontEndControlCode.getPresetId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter2 = frontEndControlCode.getPresetId();
} else if (frontEndControlCode.getCode() == 2) {
cmdCode = 0x85;
if (frontEndControlCode.getPresetId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter2 = frontEndControlCode.getPresetId();
}else if (frontEndControlCode.getCode() == 3) {
cmdCode = 0x86;
if (frontEndControlCode.getPresetId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter2 = frontEndControlCode.getPresetId();
if (frontEndControlCode.getTourSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter3 = frontEndControlCode.getTourSpeed();
}else if (frontEndControlCode.getCode() == 4) {
cmdCode = 0x87;
if (frontEndControlCode.getPresetId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter2 = frontEndControlCode.getPresetId();
if (frontEndControlCode.getTourTime() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter3 = frontEndControlCode.getTourTime();
}else if (frontEndControlCode.getCode() == 5) {
cmdCode = 0x88;
}else if (frontEndControlCode.getCode() == 6) {
}else {
log.error("[巡航控制失败] 未知的指令 {}", frontEndControlCode.getCode());
callback.run(ErrorCode.ERROR100.getCode(), "未知的指令", null);
}
if (frontEndControlCode.getTourId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getTourId();
}
if (frontEndControlCode.getPresetId() != null) {
parameter2 = frontEndControlCode.getPresetId();
}
}
ptzService.frontEndCommand(channel, cmdCode, parameter1, parameter2, parameter3);
@ -184,17 +232,37 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
if (frontEndControlCode.getCode() != null) {
if (frontEndControlCode.getCode() == 1) {
cmdCode = 0x89;
if (frontEndControlCode.getScanId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getScanId();
} else if (frontEndControlCode.getCode() == 2) {
cmdCode = 0x89;
if (frontEndControlCode.getScanId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getScanId();
parameter2 = 1;
}else if (frontEndControlCode.getCode() == 3) {
cmdCode = 0x89;
if (frontEndControlCode.getScanId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getScanId();
parameter2 = 2;
}else if (frontEndControlCode.getCode() == 4) {
cmdCode = 0x8A;
if (frontEndControlCode.getScanId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
if (frontEndControlCode.getScanSpeed() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getScanId();
parameter2 = frontEndControlCode.getScanSpeed();
}else if (frontEndControlCode.getCode() == 5) {
@ -223,9 +291,17 @@ public class SourcePTZServiceForGbImpl implements ISourcePTZService {
if (frontEndControlCode.getCode() != null) {
if (frontEndControlCode.getCode() == 1) {
cmdCode = 0x8C;
if (frontEndControlCode.getAuxiliaryId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getAuxiliaryId();
} else if (frontEndControlCode.getCode() == 2) {
cmdCode = 0x8D;
if (frontEndControlCode.getAuxiliaryId() == null) {
callback.run(ErrorCode.ERROR100.getCode(), "参数异常", null);
return;
}
parameter1 = frontEndControlCode.getAuxiliaryId();
}else {
log.error("[辅助开关失败] 未知的指令 {}", frontEndControlCode.getCode());

View File

@ -332,72 +332,74 @@ export function queryPreset(channelId) {
})
}
export function addPointForCruise({ channelId, cruiseId, presetId }) {
export function addPointForCruise({ channelId, tourId, presetId }) {
return request({
method: 'get',
url: '/api/common/channel/front-end/cruise/point/add',
url: '/api/common/channel/front-end/tour/point/add',
params: {
channelId: channelId,
cruiseId: cruiseId,
tourId: tourId,
presetId: presetId
}
})
}
export function deletePointForCruise({ channelId, cruiseId, presetId }) {
export function deletePointForCruise({ channelId, tourId, presetId }) {
return request({
method: 'get',
url: '/api/common/channel/front-end/cruise/point/delete',
url: '/api/common/channel/front-end/tour/point/delete',
params: {
channelId: channelId,
cruiseId: cruiseId,
tourId: tourId,
presetId: presetId
}
})
}
export function setCruiseSpeed({ channelId, cruiseId, cruiseSpeed }) {
export function setCruiseSpeed({ channelId, tourId, presetId , speed }) {
return request({
method: 'get',
url: '/api/common/channel/front-end/cruise/speed',
url: '/api/common/channel/front-end/tour/speed',
params: {
channelId: channelId,
cruiseId: cruiseId,
speed: cruiseSpeed
tourId: tourId,
presetId: presetId,
speed: speed
}
})
}
export function setCruiseTime({ channelId, cruiseId, cruiseTime }) {
export function setCruiseTime({ channelId, tourId, presetId, time }) {
return request({
method: 'get',
url: '/api/common/channel/front-end/cruise/time',
url: '/api/common/channel/front-end/tour/time',
params: {
channelId: channelId,
cruiseId: cruiseId,
time: cruiseTime
tourId: tourId,
presetId: presetId,
time: time
}
})
}
export function startCruise({ channelId, cruiseId }) {
export function startCruise({ channelId, tourId }) {
return request({
method: 'get',
url: '/api/common/channel/front-end/cruise/start',
url: '/api/common/channel/front-end/tour/start',
params: {
channelId: channelId,
cruiseId: cruiseId
tourId: tourId
}
})
}
export function stopCruise({ channelId, cruiseId }) {
export function stopCruise({ channelId, tourId }) {
return request({
method: 'get',
url: '/api/common/channel/front-end/cruise/stop',
url: '/api/common/channel/front-end/tour/stop',
params: {
channelId: channelId,
cruiseId: cruiseId
tourId: tourId
}
})
}

View File

@ -3,7 +3,7 @@
<div style="display: grid; grid-template-columns: 80px auto; line-height: 28px">
<span>巡航组号: </span>
<el-input
v-model="cruiseId"
v-model="tourId"
min="1"
max="255"
placeholder="巡航组号"
@ -93,7 +93,7 @@ export default {
props: ['channelId'],
data() {
return {
cruiseId: 1,
tourId: 1,
presetList: [],
allPresetList: [],
selectPreset: '',
@ -110,7 +110,7 @@ export default {
},
methods: {
getPresetList: function() {
this.$store.dispatch('commonChanel/queryPreset', [this.channelId])
this.$store.dispatch('commonChanel/queryPreset', this.channelId)
.then((data) => {
this.allPresetList = data
})
@ -124,7 +124,11 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/addPointForCruise',
[this.channelId, this.cruiseId, this.selectPreset.presetId])
{
channelId: this.channelId,
tourId: this.tourId,
presetId: this.selectPreset.presetId
})
.then((data) => {
this.presetList.push(this.selectPreset)
}).catch((error) => {
@ -152,7 +156,11 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/deletePointForCruise',
[this.channelId, this.cruiseId, preset.presetId])
{
channelId: this.channelId,
tourId: this.tourId,
presetId: preset.presetId
})
.then((data) => {
this.presetList.splice(index, 1)
}).catch((error) => {
@ -180,7 +188,11 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/deletePointForCruise',
[this.channelId, this.cruiseId, 0])
{
channelId: this.channelId,
tourId: this.tourId,
presetId: 0
})
.then((data) => {
this.presetList = []
}).catch((error) => {
@ -195,6 +207,14 @@ export default {
})
},
setCruiseSpeed: function() {
if (this.presetList.length === 0) {
this.$message({
showClose: true,
message: '请添加巡航点',
type: 'warning'
})
return
}
const loading = this.$loading({
lock: true,
fullscreen: true,
@ -203,7 +223,12 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/setCruiseSpeed',
[this.channelId, this.cruiseId, this.cruiseSpeed])
{
channelId: this.channelId,
tourId: this.tourId,
presetId: this.presetList.at(-1).presetId,
speed: this.cruiseSpeed
})
.then((data) => {
this.$message({
showClose: true,
@ -227,6 +252,14 @@ export default {
this.setSpeedVisible = false
},
setCruiseTime: function() {
if (this.presetList.length === 0) {
this.$message({
showClose: true,
message: '请添加巡航点',
type: 'warning'
})
return
}
const loading = this.$loading({
lock: true,
fullscreen: true,
@ -235,7 +268,12 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/setCruiseTime',
[this.channelId, this.cruiseId, this.cruiseTime])
{
channelId: this.channelId,
tourId: this.tourId,
time: this.cruiseTime,
presetId: this.presetList.at(-1).presetId
})
.then((data) => {
this.$message({
showClose: true,
@ -267,7 +305,10 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/startCruise',
[this.channelId, this.cruiseId])
{
channelId: this.channelId,
tourId: this.tourId
})
.then((data) => {
this.$message({
showClose: true,
@ -295,7 +336,10 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/stopCruise',
[this.channelId, this.cruiseId])
{
channelId: this.channelId,
tourId: this.tourId
})
.then((data) => {
this.$message({
showClose: true,
@ -317,12 +361,3 @@ export default {
}
}
</script>
<style>
.channel-form {
display: grid;
background-color: #FFFFFF;
padding: 1rem 2rem 0 2rem;
grid-template-columns: 1fr 1fr 1fr;
gap: 1rem;
}
</style>

View File

@ -65,7 +65,12 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/setSpeedForScan', [this.channelId, this.scanId, this.speed])
this.$store.dispatch('commonChanel/setSpeedForScan',
{
channelId: this.channelId,
scanId: this.scanId,
speed: this.speed
})
.then(data => {
this.$message({
showClose: true,
@ -97,7 +102,11 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/setLeftForScan', [this.channelId, this.scanId])
this.$store.dispatch('commonChanel/setLeftForScan',
{
channelId: this.channelId,
scanId: this.scanId
})
.then(data => {
this.$message({
showClose: true,
@ -125,7 +134,11 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/setRightForScan', [this.channelId, this.scanId])
this.$store.dispatch('commonChanel/setRightForScan',
{
channelId: this.channelId,
scanId: this.scanId
})
.then(data => {
this.$message({
showClose: true,
@ -153,7 +166,11 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/startScan', [this.channelId, this.scanId])
this.$store.dispatch('commonChanel/startScan',
{
channelId: this.channelId,
scanId: this.scanId
})
.then(data => {
this.$message({
showClose: true,
@ -179,7 +196,11 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/stopScan', [this.channelId, this.scanId])
this.$store.dispatch('commonChanel/stopScan',
{
channelId: this.channelId,
scanId: this.scanId
})
.then(data => {
this.$message({
showClose: true,

View File

@ -43,7 +43,12 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/auxiliary', [this.channelId, command, this.switchId])
this.$store.dispatch('commonChanel/auxiliary',
{
channelId: this.channelId,
command: command,
switchId: this.switchId
})
.then(data => {
this.$message({
showClose: true,
@ -64,13 +69,4 @@ export default {
}
}
</script>
<style>
.channel-form {
display: grid;
background-color: #FFFFFF;
padding: 1rem 2rem 0 2rem;
grid-template-columns: 1fr 1fr 1fr;
gap: 1rem;
}
</style>

View File

@ -25,7 +25,11 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('commonChanel/wiper', [this.channelId, command])
this.$store.dispatch('commonChanel/wiper',
{
channelId: this.channelId,
command: command
})
.then(data => {
this.$message({
showClose: true,