From 8b17e976828543028a775fa17dfb3cf0b78b0e74 Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Thu, 17 Jul 2025 12:56:07 +0800 Subject: [PATCH] =?UTF-8?q?[1078]=20=E5=A2=9E=E5=8A=A0=E9=A9=BE=E9=A9=B6?= =?UTF-8?q?=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/jt1078/bean/JTDriverInformation.java | 41 +++++---- .../vmp/jt1078/codec/decode/Jt808Decoder.java | 4 +- .../iot/vmp/jt1078/proc/request/J0704.java | 1 + web/src/api/jtDevice.js | 9 ++ web/src/store/modules/jtDevice.js | 12 ++- web/src/views/jtDevice/dialog/driverInfo.vue | 83 +++++++++++++++++++ web/src/views/jtDevice/list.vue | 18 ++-- 7 files changed, 143 insertions(+), 25 deletions(-) create mode 100755 web/src/views/jtDevice/dialog/driverInfo.vue diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDriverInformation.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDriverInformation.java index 20f8e68fa..3309e40b1 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDriverInformation.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTDriverInformation.java @@ -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; diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/codec/decode/Jt808Decoder.java b/src/main/java/com/genersoft/iot/vmp/jt1078/codec/decode/Jt808Decoder.java index c8d3f1a23..d531add76 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/codec/decode/Jt808Decoder.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/codec/decode/Jt808Decoder.java @@ -45,7 +45,7 @@ public class Jt808Decoder extends ByteToMessageDecoder { protected void decode(ChannelHandlerContext ctx, ByteBuf in, List 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; } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0704.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0704.java index fe697882d..87679bdc2 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0704.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0704.java @@ -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()); diff --git a/web/src/api/jtDevice.js b/web/src/api/jtDevice.js index ea325fcc9..db8be1b11 100644 --- a/web/src/api/jtDevice.js +++ b/web/src/api/jtDevice.js @@ -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 + } + }) +} diff --git a/web/src/store/modules/jtDevice.js b/web/src/store/modules/jtDevice.js index 1b9ad5c4d..4e14d28d0 100644 --- a/web/src/store/modules/jtDevice.js +++ b/web/src/store/modules/jtDevice.js @@ -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) + }) + }) } } diff --git a/web/src/views/jtDevice/dialog/driverInfo.vue b/web/src/views/jtDevice/dialog/driverInfo.vue new file mode 100755 index 000000000..2ac18855a --- /dev/null +++ b/web/src/views/jtDevice/dialog/driverInfo.vue @@ -0,0 +1,83 @@ + + + diff --git a/web/src/views/jtDevice/list.vue b/web/src/views/jtDevice/list.vue index 96cee0c3c..e9db9e7cd 100755 --- a/web/src/views/jtDevice/list.vue +++ b/web/src/views/jtDevice/list.vue @@ -117,16 +117,14 @@ 电话回拨 设置电话本 - - 临时跟踪 + + 驾驶员信息 终端复位 恢复出厂 车门控制 - - 驾驶员信息 音视频属性 @@ -150,6 +148,7 @@ + @@ -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) => {