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
47e4f2343b
commit
ebd95250c0
@ -3,9 +3,11 @@ package com.genersoft.iot.vmp.jt1078.bean;
|
|||||||
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Schema(description = "位置基本信息")
|
@Schema(description = "位置基本信息")
|
||||||
public class JTPositionBaseInfo {
|
public class JTPositionBaseInfo {
|
||||||
|
|
||||||
@ -65,6 +67,10 @@ public class JTPositionBaseInfo {
|
|||||||
|
|
||||||
public static JTPositionBaseInfo decode(ByteBuf buf) {
|
public static JTPositionBaseInfo decode(ByteBuf buf) {
|
||||||
JTPositionBaseInfo positionInfo = new JTPositionBaseInfo();
|
JTPositionBaseInfo positionInfo = new JTPositionBaseInfo();
|
||||||
|
if (buf.readableBytes() < 17) {
|
||||||
|
log.error("[位置基本信息] 解码失败,长度不足: {}", buf.readableBytes());
|
||||||
|
return positionInfo;
|
||||||
|
}
|
||||||
positionInfo.setAlarmSign(new JTAlarmSign(buf.readInt()));
|
positionInfo.setAlarmSign(new JTAlarmSign(buf.readInt()));
|
||||||
|
|
||||||
positionInfo.setStatus(new JTStatus(buf.readInt()));
|
positionInfo.setStatus(new JTStatus(buf.readInt()));
|
||||||
|
|||||||
@ -570,11 +570,13 @@ public class JT1078Controller {
|
|||||||
|
|
||||||
log.info("[JT-车门控制] phoneNumber: {}, open: {},", phoneNumber, open);
|
log.info("[JT-车门控制] phoneNumber: {}, open: {},", phoneNumber, open);
|
||||||
JTPositionBaseInfo positionBaseInfo = service.controlDoor(phoneNumber, open);
|
JTPositionBaseInfo positionBaseInfo = service.controlDoor(phoneNumber, open);
|
||||||
|
if (positionBaseInfo == null || positionBaseInfo.getStatus() == null) {
|
||||||
|
return WVPResult.fail(ErrorCode.ERROR100.getCode(), "控制失败");
|
||||||
|
}
|
||||||
if (open == !positionBaseInfo.getStatus().isDoorLocking()) {
|
if (open == !positionBaseInfo.getStatus().isDoorLocking()) {
|
||||||
return WVPResult.success(null);
|
return WVPResult.success(null);
|
||||||
}else {
|
}else {
|
||||||
return WVPResult.fail(ErrorCode.ERROR100);
|
return WVPResult.fail(ErrorCode.ERROR100.getCode(), "控制失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,6 @@ public class J0500 extends Re {
|
|||||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||||
int respNo = buf.readUnsignedShort();
|
int respNo = buf.readUnsignedShort();
|
||||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||||
log.info("[JT-车辆控制应答]: {}", positionInfo.toString());
|
|
||||||
SessionManager.INSTANCE.response(header.getPhoneNumber(), "0500", (long) respNo, positionInfo);
|
SessionManager.INSTANCE.response(header.getPhoneNumber(), "0500", (long) respNo, positionInfo);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,5 +307,15 @@ export function connection(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function controlDoor({ phoneNumber, open}) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/jt1078/control/door',
|
||||||
|
params: {
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
open: open
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
add,
|
add,
|
||||||
addChannel, connection, controlPlayback, deleteDevice, factoryReset,
|
addChannel, connection, controlDoor, controlPlayback, deleteDevice, factoryReset,
|
||||||
fillLight, getRecordTempUrl, linkDetection,
|
fillLight, getRecordTempUrl, linkDetection,
|
||||||
play, ptz, queryAttribute,
|
play, ptz, queryAttribute,
|
||||||
queryChannels, queryConfig,
|
queryChannels, queryConfig,
|
||||||
@ -300,6 +300,16 @@ const actions = {
|
|||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
controlDoor({ commit }, param) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
controlDoor(param).then(response => {
|
||||||
|
const { data } = response
|
||||||
|
resolve(data)
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
62
web/src/views/jtDevice/dialog/controlDoor.vue
Executable file
62
web/src/views/jtDevice/dialog/controlDoor.vue
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<div id="configInfo">
|
||||||
|
<el-dialog
|
||||||
|
v-el-drag-dialog
|
||||||
|
title="车门控制"
|
||||||
|
width="=80%"
|
||||||
|
top="2rem"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="showDialog"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
@close="close()"
|
||||||
|
>
|
||||||
|
<div style="padding: 0 20px 0 10px">
|
||||||
|
<el-form >
|
||||||
|
<el-form-item style="text-align: center">
|
||||||
|
<el-button @click="controlDoor(true)">开车门</el-button>
|
||||||
|
<el-button @click="controlDoor(false)" >关车门</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import elDragDialog from '@/directive/el-drag-dialog'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ConnectionServer',
|
||||||
|
directives: { elDragDialog },
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showDialog: false,
|
||||||
|
phoneNumber: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {},
|
||||||
|
methods: {
|
||||||
|
openDialog: function(data) {
|
||||||
|
this.showDialog = true
|
||||||
|
this.phoneNumber = data
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
this.showDialog = false
|
||||||
|
},
|
||||||
|
controlDoor: function(open) {
|
||||||
|
this.$store.dispatch('jtDevice/controlDoor', {
|
||||||
|
phoneNumber: this.phoneNumber,
|
||||||
|
open: open
|
||||||
|
}).then(data => {
|
||||||
|
this.$message.success({
|
||||||
|
showClose: true,
|
||||||
|
message: '发送成功'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -152,6 +152,7 @@
|
|||||||
<telephoneCallback ref="telephoneCallback" />
|
<telephoneCallback ref="telephoneCallback" />
|
||||||
<driverInfo ref="driverInfo" />
|
<driverInfo ref="driverInfo" />
|
||||||
<connectionServer ref="connectionServer" />
|
<connectionServer ref="connectionServer" />
|
||||||
|
<controlDoor ref="controlDoor" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -164,11 +165,12 @@ import textMsg from './dialog/textMsg.vue'
|
|||||||
import telephoneCallback from './dialog/telephoneCallback.vue'
|
import telephoneCallback from './dialog/telephoneCallback.vue'
|
||||||
import driverInfo from './dialog/driverInfo.vue'
|
import driverInfo from './dialog/driverInfo.vue'
|
||||||
import connectionServer from './dialog/connectionServer.vue'
|
import connectionServer from './dialog/connectionServer.vue'
|
||||||
|
import controlDoor from './dialog/controlDoor.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer
|
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer, controlDoor
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -283,6 +285,8 @@ export default {
|
|||||||
this.factoryReset(itemData)
|
this.factoryReset(itemData)
|
||||||
} else if (command === 'reset') {
|
} else if (command === 'reset') {
|
||||||
this.reset(itemData)
|
this.reset(itemData)
|
||||||
|
} else if (command === 'door') {
|
||||||
|
this.controlDoor(itemData)
|
||||||
} else if (command === 'connection') {
|
} else if (command === 'connection') {
|
||||||
this.connection(itemData)
|
this.connection(itemData)
|
||||||
} else {
|
} else {
|
||||||
@ -359,6 +363,9 @@ export default {
|
|||||||
connection: function(itemData) {
|
connection: function(itemData) {
|
||||||
this.$refs.connectionServer.openDialog(itemData.phoneNumber)
|
this.$refs.connectionServer.openDialog(itemData.phoneNumber)
|
||||||
},
|
},
|
||||||
|
controlDoor: function(itemData) {
|
||||||
|
this.$refs.controlDoor.openDialog(itemData.phoneNumber)
|
||||||
|
},
|
||||||
linkDetection: function(itemData) {
|
linkDetection: function(itemData) {
|
||||||
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
|
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user