[1078] 增加驾驶员信息

This commit is contained in:
lin 2025-07-17 12:56:07 +08:00
parent e730bf2d15
commit 8b17e97682
7 changed files with 143 additions and 25 deletions

View File

@ -22,7 +22,8 @@ public class JTDriverInformation {
@Schema(description = "IC卡读取结果:" + @Schema(description = "IC卡读取结果:" +
"0x00:IC卡读卡成功" + "0x00:IC卡读卡成功" +
"0x01:读卡失败 ,原因为卡片密钥认证未通过; 0x02:读卡失败 ,原因为卡片已被锁定;" + "0x01:读卡失败 ,原因为卡片密钥认证未通过;" +
"0x02:读卡失败 ,原因为卡片已被锁定;" +
"0x03:读卡失败 ,原因为卡片被拔出;" + "0x03:读卡失败 ,原因为卡片被拔出;" +
"0x04:读卡失败 ,原因为数据校验错误。" + "0x04:读卡失败 ,原因为数据校验错误。" +
"以下字段在 IC卡读取结果等于0x00 时才有效") "以下字段在 IC卡读取结果等于0x00 时才有效")
@ -56,7 +57,10 @@ public class JTDriverInformation {
} }
if (jtDriverInformation.getStatus() == 1) { if (jtDriverInformation.getStatus() == 1) {
jtDriverInformation.setResult((int)buf.readUnsignedByte()); int result = (int)buf.readUnsignedByte();
jtDriverInformation.setResult(result);
if (result == 0) {
// IC卡读卡成功
int nameLength = buf.readUnsignedByte(); int nameLength = buf.readUnsignedByte();
jtDriverInformation.setName(buf.readCharSequence(nameLength, Charset.forName("GBK")).toString().trim()); jtDriverInformation.setName(buf.readCharSequence(nameLength, Charset.forName("GBK")).toString().trim());
jtDriverInformation.setCertificateCode(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim()); jtDriverInformation.setCertificateCode(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim());
@ -75,6 +79,7 @@ public class JTDriverInformation {
jtDriverInformation.setDriverIdNumber(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim()); jtDriverInformation.setDriverIdNumber(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim());
} }
} }
}
return jtDriverInformation; return jtDriverInformation;
} }

View File

@ -45,7 +45,7 @@ public class Jt808Decoder extends ByteToMessageDecoder {
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
in.retain(); in.retain();
Session session = ctx.channel().attr(Session.KEY).get(); Session session = ctx.channel().attr(Session.KEY).get();
log.debug("> {} hex: 7e{}7e", session, ByteBufUtil.hexDump(in)); log.info("> {} hex: 7e{}7e", session, ByteBufUtil.hexDump(in));
try { try {
// 按照部标定义执行校验和转义 // 按照部标定义执行校验和转义
ByteBuf buf = unEscapeAndCheck(in); ByteBuf buf = unEscapeAndCheck(in);
@ -77,6 +77,8 @@ public class Jt808Decoder extends ByteToMessageDecoder {
Re handler = CodecFactory.getHandler(header.getMsgId()); Re handler = CodecFactory.getHandler(header.getMsgId());
if (handler == null) { if (handler == null) {
log.error("get msgId is null {}", header.getMsgId()); log.error("get msgId is null {}", header.getMsgId());
in.skipBytes(in.readableBytes());
buf.release();
return; return;
} }

View File

@ -36,6 +36,7 @@ public class J0704 extends Re {
int dateLength = buf.readUnsignedShort(); int dateLength = buf.readUnsignedShort();
ByteBuf byteBuf = buf.readBytes(dateLength); ByteBuf byteBuf = buf.readBytes(dateLength);
JTPositionBaseInfo positionInfo = JTPositionBaseInfo.decode(byteBuf); JTPositionBaseInfo positionInfo = JTPositionBaseInfo.decode(byteBuf);
byteBuf.release();
positionBaseInfoList.add(positionInfo); positionBaseInfoList.add(positionInfo);
} }
log.info("[JT-定位数据批量上传]: 共{}条", positionBaseInfoList.size()); log.info("[JT-定位数据批量上传]: 共{}条", positionBaseInfoList.size());

View File

@ -273,5 +273,14 @@ export function telephoneCallback({ phoneNumber, sign, destPhoneNumber }) {
} }
}) })
} }
export function queryDriverInfo(phoneNumber) {
return request({
method: 'get',
url: '/api/jt1078/driver-information',
params: {
phoneNumber: phoneNumber
}
})
}

View File

@ -5,7 +5,7 @@ import {
play, ptz, queryAttribute, play, ptz, queryAttribute,
queryChannels, queryConfig, queryChannels, queryConfig,
queryDeviceById, queryDeviceById,
queryDevices, queryPosition, queryRecordList, sendTextMessage, setConfig, startPlayback, queryDevices, queryDriverInfo, queryPosition, queryRecordList, sendTextMessage, setConfig, startPlayback,
stopPlay, stopPlayback, telephoneCallback, update, stopPlay, stopPlayback, telephoneCallback, update,
updateChannel, wiper updateChannel, wiper
} from '@/api/jtDevice' } from '@/api/jtDevice'
@ -260,6 +260,16 @@ const actions = {
reject(error) reject(error)
}) })
}) })
},
queryDriverInfo({ commit }, phoneNumber) {
return new Promise((resolve, reject) => {
queryDriverInfo(phoneNumber).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
} }
} }

View File

@ -0,0 +1,83 @@
<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 id="shared">
<el-descriptions :column="2" v-if="driverInfo" style="margin-bottom: 1rem;">
<el-descriptions-item label="状态">{{ getStatus(driverInfo.status) }}</el-descriptions-item>
<el-descriptions-item label="时间">{{ driverInfo.time }}</el-descriptions-item>
<el-descriptions-item label="IC卡读取结果">{{ getICInfo(driverInfo.result) }}</el-descriptions-item>
<el-descriptions-item label="驾驶员姓名">{{ driverInfo.name }}</el-descriptions-item>
<el-descriptions-item label="从业资格证编码">{{ driverInfo.certificateCode }}</el-descriptions-item>
<el-descriptions-item label="发证机构名称">{{ driverInfo.certificateIssuanceMechanismName }}</el-descriptions-item>
<el-descriptions-item label="证件有效期">{{ driverInfo.expire }}</el-descriptions-item>
<el-descriptions-item label="驾驶员身份证号">{{ driverInfo.driverIdNumber }}</el-descriptions-item>
</el-descriptions>
</div>
</el-dialog>
</div>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
export default {
name: 'ConfigInfo',
directives: { elDragDialog },
props: {},
data() {
return {
showDialog: false,
driverInfo: null
}
},
computed: {},
created() {},
methods: {
openDialog: function(data) {
this.showDialog = true
this.driverInfo = data
},
close: function() {
this.showDialog = false
},
getStatus: function(status) {
switch (status) {
case 1:
return 'IC卡插入'
case 2:
return 'IC卡拔出'
default:
return '未知'
}
},
getICInfo: function(result) {
switch (result) {
case 0:
return 'IC卡读卡成功'
case 1:
return '读卡失败:卡片密钥认证未通过'
case 2:
return '读卡失败:卡片已被锁定'
case 3:
return '读卡失败:卡片被拔出'
case 4:
return '读卡失败:数据校验错误'
default:
return '未知失败原因'
}
}
}
}
</script>

View File

@ -117,16 +117,14 @@
电话回拨</el-dropdown-item> 电话回拨</el-dropdown-item>
<el-dropdown-item command="setPhoneBook" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="setPhoneBook" v-bind:disabled="!scope.row.status" >
设置电话本</el-dropdown-item> 设置电话本</el-dropdown-item>
<el-dropdown-item command="tempPositionTracking" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="driverInfo" v-bind:disabled="!scope.row.status" >
临时跟踪</el-dropdown-item> 驾驶员信息</el-dropdown-item>
<el-dropdown-item command="reset" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="reset" v-bind:disabled="!scope.row.status" >
终端复位</el-dropdown-item> 终端复位</el-dropdown-item>
<el-dropdown-item command="factoryReset" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="factoryReset" v-bind:disabled="!scope.row.status" >
恢复出厂</el-dropdown-item> 恢复出厂</el-dropdown-item>
<el-dropdown-item command="door" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="door" v-bind:disabled="!scope.row.status" >
车门控制</el-dropdown-item> 车门控制</el-dropdown-item>
<el-dropdown-item command="driverInfo" v-bind:disabled="!scope.row.status" >
驾驶员信息</el-dropdown-item>
<el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status" > <el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status" >
音视频属性</el-dropdown-item> 音视频属性</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
@ -150,6 +148,7 @@
<position ref="position" /> <position ref="position" />
<textMsg ref="textMsg" /> <textMsg ref="textMsg" />
<telephoneCallback ref="telephoneCallback" /> <telephoneCallback ref="telephoneCallback" />
<driverInfo ref="driverInfo" />
</div> </div>
</template> </template>
@ -160,11 +159,12 @@ import attribute from './dialog/attribute.vue'
import position from './dialog/position.vue' import position from './dialog/position.vue'
import textMsg from './dialog/textMsg.vue' import textMsg from './dialog/textMsg.vue'
import telephoneCallback from './dialog/telephoneCallback.vue' import telephoneCallback from './dialog/telephoneCallback.vue'
import driverInfo from './dialog/driverInfo.vue'
export default { export default {
name: 'App', name: 'App',
components: { components: {
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo
}, },
data() { data() {
return { return {
@ -275,6 +275,8 @@ export default {
this.sendTextMsg(itemData) this.sendTextMsg(itemData)
} else if (command === 'telephoneCallback') { } else if (command === 'telephoneCallback') {
this.telephoneCallback(itemData) this.telephoneCallback(itemData)
} else if (command === 'driverInfo') {
this.queryDriverInfo(itemData)
} else { } else {
this.$message.info('尚不支持') this.$message.info('尚不支持')
} }
@ -304,6 +306,12 @@ export default {
telephoneCallback: function(itemData) { telephoneCallback: function(itemData) {
this.$refs.telephoneCallback.openDialog(itemData) this.$refs.telephoneCallback.openDialog(itemData)
}, },
queryDriverInfo: function(itemData) {
this.$store.dispatch('jtDevice/queryDriverInfo', itemData.phoneNumber)
.then(data => {
this.$refs.driverInfo.openDialog(data)
})
},
linkDetection: function(itemData) { linkDetection: function(itemData) {
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber) this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
.then((data) => { .then((data) => {