[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卡读取结果:" +
"0x00:IC卡读卡成功" +
"0x01:读卡失败 ,原因为卡片密钥认证未通过; 0x02:读卡失败 ,原因为卡片已被锁定;" +
"0x01:读卡失败 ,原因为卡片密钥认证未通过;" +
"0x02:读卡失败 ,原因为卡片已被锁定;" +
"0x03:读卡失败 ,原因为卡片被拔出;" +
"0x04:读卡失败 ,原因为数据校验错误。" +
"以下字段在 IC卡读取结果等于0x00 时才有效")
@ -56,23 +57,27 @@ public class JTDriverInformation {
}
if (jtDriverInformation.getStatus() == 1) {
jtDriverInformation.setResult((int)buf.readUnsignedByte());
int nameLength = buf.readUnsignedByte();
jtDriverInformation.setName(buf.readCharSequence(nameLength, Charset.forName("GBK")).toString().trim());
jtDriverInformation.setCertificateCode(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim());
int certificateIssuanceMechanismNameLength = buf.readUnsignedByte();
jtDriverInformation.setCertificateIssuanceMechanismName(buf.readCharSequence(
certificateIssuanceMechanismNameLength, Charset.forName("GBK")).toString().trim());
byte[] bytesForExpire = new byte[4];
buf.readBytes(bytesForExpire);
String bytesForExpireStr = BCDUtil.transform(bytesForExpire);
try {
jtDriverInformation.setExpire(DateUtil.jt1078dateToyyyy_MM_dd(bytesForExpireStr));
}catch (Exception e) {
log.error("[JT-驾驶员身份信息] 解码时无法格式化时间: {}", bytesForExpireStr);
}
if (is2019) {
jtDriverInformation.setDriverIdNumber(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim());
int result = (int)buf.readUnsignedByte();
jtDriverInformation.setResult(result);
if (result == 0) {
// IC卡读卡成功
int nameLength = buf.readUnsignedByte();
jtDriverInformation.setName(buf.readCharSequence(nameLength, Charset.forName("GBK")).toString().trim());
jtDriverInformation.setCertificateCode(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim());
int certificateIssuanceMechanismNameLength = buf.readUnsignedByte();
jtDriverInformation.setCertificateIssuanceMechanismName(buf.readCharSequence(
certificateIssuanceMechanismNameLength, Charset.forName("GBK")).toString().trim());
byte[] bytesForExpire = new byte[4];
buf.readBytes(bytesForExpire);
String bytesForExpireStr = BCDUtil.transform(bytesForExpire);
try {
jtDriverInformation.setExpire(DateUtil.jt1078dateToyyyy_MM_dd(bytesForExpireStr));
}catch (Exception e) {
log.error("[JT-驾驶员身份信息] 解码时无法格式化时间: {}", bytesForExpireStr);
}
if (is2019) {
jtDriverInformation.setDriverIdNumber(buf.readCharSequence(20, Charset.forName("GBK")).toString().trim());
}
}
}
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 {
in.retain();
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 {
// 按照部标定义执行校验和转义
ByteBuf buf = unEscapeAndCheck(in);
@ -77,6 +77,8 @@ public class Jt808Decoder extends ByteToMessageDecoder {
Re handler = CodecFactory.getHandler(header.getMsgId());
if (handler == null) {
log.error("get msgId is null {}", header.getMsgId());
in.skipBytes(in.readableBytes());
buf.release();
return;
}

View File

@ -36,6 +36,7 @@ public class J0704 extends Re {
int dateLength = buf.readUnsignedShort();
ByteBuf byteBuf = buf.readBytes(dateLength);
JTPositionBaseInfo positionInfo = JTPositionBaseInfo.decode(byteBuf);
byteBuf.release();
positionBaseInfoList.add(positionInfo);
}
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,
queryChannels, queryConfig,
queryDeviceById,
queryDevices, queryPosition, queryRecordList, sendTextMessage, setConfig, startPlayback,
queryDevices, queryDriverInfo, queryPosition, queryRecordList, sendTextMessage, setConfig, startPlayback,
stopPlay, stopPlayback, telephoneCallback, update,
updateChannel, wiper
} from '@/api/jtDevice'
@ -260,6 +260,16 @@ const actions = {
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 command="setPhoneBook" v-bind:disabled="!scope.row.status" >
设置电话本</el-dropdown-item>
<el-dropdown-item command="tempPositionTracking" v-bind:disabled="!scope.row.status" >
临时跟踪</el-dropdown-item>
<el-dropdown-item command="driverInfo" v-bind:disabled="!scope.row.status" >
驾驶员信息</el-dropdown-item>
<el-dropdown-item command="reset" v-bind:disabled="!scope.row.status" >
终端复位</el-dropdown-item>
<el-dropdown-item command="factoryReset" v-bind:disabled="!scope.row.status" >
恢复出厂</el-dropdown-item>
<el-dropdown-item command="door" v-bind:disabled="!scope.row.status" >
车门控制</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>
</el-dropdown-menu>
@ -150,6 +148,7 @@
<position ref="position" />
<textMsg ref="textMsg" />
<telephoneCallback ref="telephoneCallback" />
<driverInfo ref="driverInfo" />
</div>
</template>
@ -160,11 +159,12 @@ import attribute from './dialog/attribute.vue'
import position from './dialog/position.vue'
import textMsg from './dialog/textMsg.vue'
import telephoneCallback from './dialog/telephoneCallback.vue'
import driverInfo from './dialog/driverInfo.vue'
export default {
name: 'App',
components: {
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo
},
data() {
return {
@ -275,6 +275,8 @@ export default {
this.sendTextMsg(itemData)
} else if (command === 'telephoneCallback') {
this.telephoneCallback(itemData)
} else if (command === 'driverInfo') {
this.queryDriverInfo(itemData)
} else {
this.$message.info('尚不支持')
}
@ -304,6 +306,12 @@ export default {
telephoneCallback: function(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) {
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
.then((data) => {