[1078] 增加车辆控制
This commit is contained in:
@@ -3,9 +3,11 @@ package com.genersoft.iot.vmp.jt1078.bean;
|
||||
import com.genersoft.iot.vmp.jt1078.util.BCDUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@Slf4j
|
||||
@Schema(description = "位置基本信息")
|
||||
public class JTPositionBaseInfo {
|
||||
|
||||
@@ -65,6 +67,10 @@ public class JTPositionBaseInfo {
|
||||
|
||||
public static JTPositionBaseInfo decode(ByteBuf buf) {
|
||||
JTPositionBaseInfo positionInfo = new JTPositionBaseInfo();
|
||||
if (buf.readableBytes() < 17) {
|
||||
log.error("[位置基本信息] 解码失败,长度不足: {}", buf.readableBytes());
|
||||
return positionInfo;
|
||||
}
|
||||
positionInfo.setAlarmSign(new JTAlarmSign(buf.readInt()));
|
||||
|
||||
positionInfo.setStatus(new JTStatus(buf.readInt()));
|
||||
|
||||
@@ -570,11 +570,13 @@ public class JT1078Controller {
|
||||
|
||||
log.info("[JT-车门控制] phoneNumber: {}, open: {},", 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()) {
|
||||
return WVPResult.success(null);
|
||||
}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) {
|
||||
int respNo = buf.readUnsignedShort();
|
||||
positionInfo = JTPositionBaseInfo.decode(buf);
|
||||
log.info("[JT-车辆控制应答]: {}", positionInfo.toString());
|
||||
SessionManager.INSTANCE.response(header.getPhoneNumber(), "0500", (long) respNo, positionInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -307,5 +307,15 @@ export function connection(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 {
|
||||
add,
|
||||
addChannel, connection, controlPlayback, deleteDevice, factoryReset,
|
||||
addChannel, connection, controlDoor, controlPlayback, deleteDevice, factoryReset,
|
||||
fillLight, getRecordTempUrl, linkDetection,
|
||||
play, ptz, queryAttribute,
|
||||
queryChannels, queryConfig,
|
||||
@@ -300,6 +300,16 @@ const actions = {
|
||||
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" />
|
||||
<driverInfo ref="driverInfo" />
|
||||
<connectionServer ref="connectionServer" />
|
||||
<controlDoor ref="controlDoor" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -164,11 +165,12 @@ import textMsg from './dialog/textMsg.vue'
|
||||
import telephoneCallback from './dialog/telephoneCallback.vue'
|
||||
import driverInfo from './dialog/driverInfo.vue'
|
||||
import connectionServer from './dialog/connectionServer.vue'
|
||||
import controlDoor from './dialog/controlDoor.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer
|
||||
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer, controlDoor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -283,6 +285,8 @@ export default {
|
||||
this.factoryReset(itemData)
|
||||
} else if (command === 'reset') {
|
||||
this.reset(itemData)
|
||||
} else if (command === 'door') {
|
||||
this.controlDoor(itemData)
|
||||
} else if (command === 'connection') {
|
||||
this.connection(itemData)
|
||||
} else {
|
||||
@@ -359,6 +363,9 @@ export default {
|
||||
connection: function(itemData) {
|
||||
this.$refs.connectionServer.openDialog(itemData.phoneNumber)
|
||||
},
|
||||
controlDoor: function(itemData) {
|
||||
this.$refs.controlDoor.openDialog(itemData.phoneNumber)
|
||||
},
|
||||
linkDetection: function(itemData) {
|
||||
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
|
||||
.then((data) => {
|
||||
|
||||
Reference in New Issue
Block a user