[1078] 增加文本下发
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 文本信息标志
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "文本信息标志")
|
||||
public class JTTextSign {
|
||||
|
||||
@@ -14,6 +16,9 @@ public class JTTextSign {
|
||||
@Schema(description = "1终端显示器显示")
|
||||
private boolean terminalDisplay;
|
||||
|
||||
@Schema(description = "1广告屏显示")
|
||||
private boolean adScreen;
|
||||
|
||||
@Schema(description = "1终端 TTS 播读")
|
||||
private boolean tts;
|
||||
|
||||
@@ -29,41 +34,12 @@ public class JTTextSign {
|
||||
if (tts) {
|
||||
byteSign |= (0x1 << 3);
|
||||
}
|
||||
if (adScreen) {
|
||||
byteSign |= (0x1 << 4);
|
||||
}
|
||||
if (source) {
|
||||
byteSign |= (0x1 << 5);
|
||||
}
|
||||
return byteSign;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isTerminalDisplay() {
|
||||
return terminalDisplay;
|
||||
}
|
||||
|
||||
public void setTerminalDisplay(boolean terminalDisplay) {
|
||||
this.terminalDisplay = terminalDisplay;
|
||||
}
|
||||
|
||||
public boolean isTts() {
|
||||
return tts;
|
||||
}
|
||||
|
||||
public void setTts(boolean tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public boolean isSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(boolean source) {
|
||||
this.source = source;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.info("> {} hex: 7e{}7e", session, ByteBufUtil.hexDump(in));
|
||||
log.debug("> {} hex: 7e{}7e", session, ByteBufUtil.hexDump(in));
|
||||
try {
|
||||
// 按照部标定义执行校验和转义
|
||||
ByteBuf buf = unEscapeAndCheck(in);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Jt808Encoder extends MessageToByteEncoder<Rs> {
|
||||
List<ByteBuf> encodeList = Jt808EncoderCmd.encode(msg, session, session.nextSerialNo());
|
||||
if(encodeList!=null && !encodeList.isEmpty()){
|
||||
for (ByteBuf byteBuf : encodeList) {
|
||||
log.info("< {} hex:{}", session, ByteBufUtil.hexDump(byteBuf));
|
||||
log.debug("< {} hex:{}", session, ByteBufUtil.hexDump(byteBuf));
|
||||
out.writeBytes(byteBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTTextSign;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* 文本信息下发
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@MsgId(id = "8300")
|
||||
public class J8300 extends Rs {
|
||||
|
||||
@@ -36,28 +40,4 @@ public class J8300 extends Rs {
|
||||
buffer.writeCharSequence(content, Charset.forName("GBK"));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public JTTextSign getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(JTTextSign sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public int getTextType() {
|
||||
return textType;
|
||||
}
|
||||
|
||||
public void setTextType(int textType) {
|
||||
this.textType = textType;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
@Override
|
||||
public int linkDetection(String phoneNumber) {
|
||||
J8204 j8204 = new J8204();
|
||||
return (int) jt1078Template.linkDetection(phoneNumber, j8204, 6);
|
||||
Object result = jt1078Template.linkDetection(phoneNumber, j8204, 6);
|
||||
if (result == null) {
|
||||
return 1;
|
||||
}else {
|
||||
return (int) result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -255,5 +255,12 @@ export function queryPosition(phoneNumber) {
|
||||
}
|
||||
})
|
||||
}
|
||||
export function sendTextMessage(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/jt1078/text-msg`,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
play, ptz, queryAttribute,
|
||||
queryChannels, queryConfig,
|
||||
queryDeviceById,
|
||||
queryDevices, queryPosition, queryRecordList, setConfig, startPlayback,
|
||||
queryDevices, queryPosition, queryRecordList, sendTextMessage, setConfig, startPlayback,
|
||||
stopPlay, stopPlayback, update,
|
||||
updateChannel, wiper
|
||||
} from '@/api/jtDevice'
|
||||
@@ -240,6 +240,16 @@ const actions = {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
sendTextMessage({ commit }, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
sendTextMessage(data).then(response => {
|
||||
const { data } = response
|
||||
resolve(data)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
118
web/src/views/jtDevice/dialog/testMsg.vue
Executable file
118
web/src/views/jtDevice/dialog/testMsg.vue
Executable file
@@ -0,0 +1,118 @@
|
||||
<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>
|
||||
<el-form >
|
||||
<el-divider content-position="center">标志</el-divider>
|
||||
<el-form-item label="类型">
|
||||
<el-radio-group v-model="form.sign.type">
|
||||
<el-radio :label="1">紧急</el-radio>
|
||||
<el-radio :label="2">服务</el-radio>
|
||||
<el-radio :label="3">通知</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="终端显示器显示">
|
||||
<el-checkbox v-model="form.sign.terminalDisplay"></el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="终端TTS播读">
|
||||
<el-checkbox v-model="form.sign.tts"></el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="广告屏显示">
|
||||
<el-checkbox v-model="form.sign.adScreen"></el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="信息类型">
|
||||
<el-radio-group v-model="form.sign.source">
|
||||
<el-radio :label="false">中心导航信息</el-radio>
|
||||
<el-radio :label="true">CAN故障码信息</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-divider content-position="center">属性</el-divider>
|
||||
<el-form-item label="文本类型">
|
||||
<el-radio-group v-model="form.textType">
|
||||
<el-radio :label="1">通知</el-radio>
|
||||
<el-radio :label="2">服务</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="消息内容">
|
||||
<el-input type="textarea" v-model="form.content" maxlength="1024" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="text-align: right">
|
||||
<el-button type="primary" @click="onSubmit">下发</el-button>
|
||||
<el-button @click="close" >取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import elDragDialog from '@/directive/el-drag-dialog'
|
||||
|
||||
export default {
|
||||
name: 'ConfigInfo',
|
||||
directives: { elDragDialog },
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
showDialog: false,
|
||||
form: {
|
||||
phoneNumber: null,
|
||||
sign: {
|
||||
type: 3, // 1紧急,2服务,3通知
|
||||
terminalDisplay: true, // 1终端显示器显示
|
||||
tts: true, // 从选区创建新的临时文件
|
||||
adScreen: true, // 广告屏显示
|
||||
source: false // false: 中心导航信息 true CAN故障码信息
|
||||
},
|
||||
textType: 1, // 文本类型,1 = 通知 ,2 = 服务
|
||||
content: '' // 消息内容,最长为1024字节
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
created() {},
|
||||
methods: {
|
||||
openDialog: function(data) {
|
||||
|
||||
this.showDialog = true
|
||||
this.form = {
|
||||
phoneNumber: null,
|
||||
sign: {
|
||||
type: 3, // 1紧急,2服务,3通知
|
||||
terminalDisplay: true, // 1终端显示器显示
|
||||
tts: true, // 从选区创建新的临时文件
|
||||
adScreen: true, // 广告屏显示
|
||||
source: false // false: 中心导航信息 true CAN故障码信息
|
||||
},
|
||||
textType: 1, // 文本类型,1 = 通知 ,2 = 服务
|
||||
content: '' // 消息内容,最长为1024字节
|
||||
}
|
||||
this.form.phoneNumber = data.phoneNumber
|
||||
},
|
||||
close: function() {
|
||||
this.showDialog = false
|
||||
},
|
||||
onSubmit: function() {
|
||||
this.$store.dispatch('jtDevice/sendTextMessage', this.form)
|
||||
.then(data => {
|
||||
this.$message.success({
|
||||
showClose: true,
|
||||
message: '发送成功'
|
||||
})
|
||||
// this.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -112,7 +112,7 @@
|
||||
<el-dropdown-item command="position" v-bind:disabled="!scope.row.status" >
|
||||
位置信息</el-dropdown-item>
|
||||
<el-dropdown-item command="textMsg" v-bind:disabled="!scope.row.status" >
|
||||
文本信息</el-dropdown-item>
|
||||
文本下发</el-dropdown-item>
|
||||
<el-dropdown-item command="telephoneCallback" v-bind:disabled="!scope.row.status" >
|
||||
电话回拨</el-dropdown-item>
|
||||
<el-dropdown-item command="setPhoneBook" v-bind:disabled="!scope.row.status" >
|
||||
@@ -148,6 +148,7 @@
|
||||
<configInfo ref="configInfo" />
|
||||
<attribute ref="attribute" />
|
||||
<position ref="position" />
|
||||
<testMsg ref="testMsg" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -156,11 +157,12 @@ import deviceEdit from './edit.vue'
|
||||
import configInfo from '../dialog/configInfo.vue'
|
||||
import attribute from './dialog/attribute.vue'
|
||||
import position from './dialog/position.vue'
|
||||
import testMsg from './dialog/testMsg.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
deviceEdit, configInfo, attribute, position
|
||||
deviceEdit, configInfo, attribute, position, testMsg
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -267,6 +269,8 @@ export default {
|
||||
this.linkDetection(itemData)
|
||||
} else if (command === 'position') {
|
||||
this.queryPosition(itemData)
|
||||
} else if (command === 'textMsg') {
|
||||
this.sendTextMsg(itemData)
|
||||
} else {
|
||||
this.$message.info('尚不支持')
|
||||
}
|
||||
@@ -290,6 +294,9 @@ export default {
|
||||
this.$refs.position.openDialog(data)
|
||||
})
|
||||
},
|
||||
sendTextMsg: function(itemData) {
|
||||
this.$refs.testMsg.openDialog(itemData)
|
||||
},
|
||||
linkDetection: function(itemData) {
|
||||
this.$store.dispatch('jtDevice/linkDetection', itemData.phoneNumber)
|
||||
.then((data) => {
|
||||
|
||||
Reference in New Issue
Block a user