文本转语音

zhc4dev
zhc077 2 years ago
parent e9ad7fa255
commit ae5d5108c1
  1. 13
      ant-design-vue-jeecg/package.json
  2. 141
      ant-design-vue-jeecg/src/App.vue
  3. 272
      ant-design-vue-jeecg/src/views/message/ZySpeechMessageList.vue
  4. 114
      ant-design-vue-jeecg/src/views/message/modules/ZySpeechMessageForm.vue
  5. 60
      ant-design-vue-jeecg/src/views/message/modules/ZySpeechMessageModal.vue
  6. 84
      ant-design-vue-jeecg/src/views/message/modules/ZySpeechMessageModal__Style#Drawer.vue
  7. 32
      ant-design-vue-jeecg/src/views/speak/Speak-tts.vue
  8. 151
      ant-design-vue-jeecg/src/views/system/UserAnnouncementList.vue
  9. 156
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/controller/ZySpeechMessageController.java
  10. 92
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/ZySpeechMessage.java
  11. 15
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/mapper/ZySpeechMessageMapper.java
  12. 15
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/service/IZySpeechMessageService.java
  13. 18
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/service/impl/ZySpeechMessageServiceImpl.java

@ -28,14 +28,17 @@
"echarts": "^5.3.0",
"element-ui": "^2.15.6",
"enquire.js": "^2.1.6",
"html2canvas": "~1.0.0-rc.4",
"jquery": "^3.6.0",
"js-cookie": "^2.2.0",
"jspdf": "^2.5.1",
"lodash.get": "^4.4.2",
"lodash.pick": "^4.4.0",
"md5": "^2.2.1",
"nprogress": "^0.2.0",
"qiankun": "^2.5.1",
"qs": "^6.10.3",
"speak-tts": "^2.0.8",
"tinymce": "5.4.1",
"viser-vue": "^2.4.8",
"vue": "^2.6.10",
@ -53,9 +56,7 @@
"vxe-table": "2.9.13",
"vxe-table-plugin-antd": "1.8.10",
"xe-utils": "2.4.8",
"xss": "^1.0.13",
"html2canvas": "~1.0.0-rc.4",
"jspdf": "^2.5.1"
"xss": "^1.0.13"
},
"devDependencies": {
"@babel/polyfill": "^7.2.5",
@ -68,11 +69,11 @@
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.1.0",
"html-webpack-plugin": "^4.2.0",
"html2canvas": "~1.0.0-rc.4",
"jspdf": "^2.5.1",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"vue-template-compiler": "^2.6.10",
"html2canvas": "~1.0.0-rc.4",
"jspdf": "^2.5.1"
"vue-template-compiler": "^2.6.10"
},
"eslintConfig": {
"root": true,

@ -6,16 +6,32 @@
</a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device'
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device'
import Speech from "speak-tts";
import {getAction, putAction} from "@api/manage";
export default {
data () {
export default {
data() {
return {
speech: null,
locale: zhCN,
// id
messageIds: [],
// ID
timer: null,
//
millisec: 30000,
url: {
list: "/org.jeecg.modules.message/zySpeechMessage/list",
edit: "/org.jeecg.modules.message/zySpeechMessage/edit",
},
/* 数据源 */
dataSource: [],
}
},
created () {
created() {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> App is init")
let that = this
enquireScreen(deviceType => {
// tablet
@ -27,18 +43,125 @@
else if (deviceType === 1) {
that.$store.commit('TOGGLE_DEVICE', 'mobile')
that.$store.dispatch('setSidebar', false)
}
else {
} else {
that.$store.commit('TOGGLE_DEVICE', 'desktop')
that.$store.dispatch('setSidebar', true)
}
})
},
mounted() {
this.speechInit();
this.openTimer()
},
methods: {
speechInit() {
this.speech = new Speech();
if (this.speech.hasBrowserSupport()) { // returns a boolean
console.log("this browser,supported TTS")
} else {
console.log("sorry,this browser,not supported TTS!!!")
}
// this.speech.setLanguage('zh-CN');
this.speech.init({
'volume': 1,
// 'lang': 'en-GB',
'lang': 'zh-CN',
'rate': 1,
'pitch': 1,
'voice':'Google UK English Male',
'splitSentences': true,
}).then((data) => {
console.log('语音播报初始化完成...,配置参数:',data)
}).catch(e => {
console.error("An error occured while init : ", e)
})
},
//
MySpeak(obj) {
console.log("MySpeak()接受到的消息:" + JSON.stringify(obj))
this.speech.speak({text: obj['message']}).then(() => {
// console.log("MySpeak()...")
})
console.log("MySpeak()播报完成...")
// this.updateMessageStatus(obj['id']);
},
speak() {
this.speech.speak({text: "欢迎关注小编"}).then(() => {
console.log("播报完成")
})
},
getMessageList() {
let parma = {
"status": '0',
}
getAction(this.url.list, parma).then((res) => {
if (res.success) {
console.log("文字转语音消息列表>:" + JSON.stringify(res.result.records));
this.dataSource = res.result.records;
this.dataSource.forEach(obj => {
if (obj['status'] === '0') {
// this.speak();
this.MySpeak(obj);
// console.log("MySpeak()...");
// this.speech.speak(obj['message']).then(() => {
// this.speak();
}
})
} else {
this.$message.warning(res.message)
}
}).finally(() => {
// this.loading = false
// this.loadData();
})
},
updateMessageStatus(id) {
console.log("删除已播报消息:" + id);
let parma = {
"id": id,
"status": '1',
}
putAction(this.url.edit, parma).then((res) => {
if (res.success) {
this.dataSource.pop().id;
console.log(id + ">>>>>>>()之后:" + JSON.stringify(this.dataSource))
} else {
this.$message.warning(res.message)
}
})
},
openTimer() {
this.closeTimer()
console.log("timer初始化完成:" + new Date().toLocaleString())
//
this.timer = setInterval(() => {
// debugger
if (this.dataSource.length === 0) {
console.log("timer is exec,the current time:" + new Date().toLocaleString())
this.getMessageList();
} else {
console.log("hole down")
}
}, this.millisec)
},
/** 关闭定时器 */
closeTimer() {
if (this.timer) clearInterval(this.timer)
},
}
}
</script>
<style>
#app {
#app {
height: 100%;
}
}
</style>

@ -0,0 +1,272 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="消息">
<a-input placeholder="请输入消息" v-model="queryParam.message"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="是否已播报">
<j-dict-select-tag type="list" v-model="queryParam.status" dictCode="sfjj"
placeholder="请选择状态"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工单ID">
<a-input placeholder="请输入工单ID" v-model="queryParam.workorderId"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="订单商品ID">
<a-input placeholder="请输入订单商品ID" v-model="queryParam.ordergoodsId"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="生产计划工序ID">
<a-input placeholder="请输入生产计划工序ID" v-model="queryParam.zyplanprocessId"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<!-- <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!-- </a>-->
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<a-button type="primary" icon="download" @click="handleExportXls('生产消息播报')">导出</a-button>
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
<!-- <a-button type="primary" icon="import">导入</a-button>-->
<!-- </a-upload>-->
<!-- 高级查询区域 -->
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!-- </a-menu>-->
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
<!-- </a-dropdown>-->
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<!-- <a @click="handleEdit(record)">编辑</a>-->
<!-- <a-divider type="vertical" />-->
<!-- <a-dropdown>-->
<!-- <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item>-->
<!-- <a @click="handleDetail(record)">详情</a>-->
<!-- </a-menu-item>-->
<!-- <a-menu-item>-->
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
<!-- </a-menu-item>-->
<!-- </a-menu>-->
<!-- </a-dropdown>-->
</span>
</a-table>
</div>
<zy-speech-message-modal ref="modalForm" @ok="modalFormOk"></zy-speech-message-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import ZySpeechMessageModal from './modules/ZySpeechMessageModal'
import Speech from 'speak-tts'
import {getAction} from "@api/manage";
export default {
name: 'ZySpeechMessageList',
mixins: [JeecgListMixin, mixinDevice],
components: {
ZySpeechMessageModal
},
data() {
return {
description: '消息播报管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '消息',
align: "center",
dataIndex: 'message'
},
{
title: '播报状态',
align: "center",
dataIndex: 'status_dictText'
},
{
title: '工单ID',
align: "center",
dataIndex: 'workorderId'
},
{
title: '订单商品ID',
align: "center",
dataIndex: 'ordergoodsId'
},
{
title: '生产计划工序ID',
align: "center",
dataIndex: 'zyplanprocessId'
},
{
title: '操作',
dataIndex: 'action',
align: "center",
fixed: "right",
width: 147,
scopedSlots: {customRender: 'action'}
}
],
url: {
list: "/org.jeecg.modules.message/zySpeechMessage/list",
getMessageList: "/org.jeecg.modules.message/zySpeechMessage/getMessageList",
delete: "/org.jeecg.modules.message/zySpeechMessage/delete",
deleteBatch: "/org.jeecg.modules.message/zySpeechMessage/deleteBatch",
exportXlsUrl: "/org.jeecg.modules.message/zySpeechMessage/exportXls",
importExcelUrl: "org.jeecg.modules.message/zySpeechMessage/importExcel",
},
dictOptions: {},
superFieldList: [],
//
messageList: [],
// ID
timer: null,
//
millisec: 30000,
}
},
created() {
// this.getMessageList();
// this.getSuperFieldList();
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
// mounted() {
// this.speechInit();
// this.openTimer()
// },
methods: {
speechInit() {
this.speech = new Speech();
this.speech.setLanguage('zh-CN');
this.speech.init().then(() => {
console.log('语音播报初始化完成...')
// this.MySpeak();
})
},
//
MySpeak(message) {
console.log("MySpeak()接受到的消息:" + message)
this.speech.speak({text: message}).then(() => {
// alert("MySpeak()...");
console.log("MySpeak()播报完成...")
})
},
async getMessageList() {
let parma = {
"status": '0',
}
let messageIds = [];
getAction(this.url.list, parma).then((res) => {
if (res.success) {
console.log("文字转语音消息列表>:" + JSON.stringify(res.result));
res.result.records.forEach(obj => {
// this.MySpeak(obj['message']);
// messageIds.push(obj['id']);
this.speech.speak({text: obj['message']}).then(() => {
// alert("MySpeak()...");
console.log("MySpeak()播报完成...")
})
})
} else {
this.$message.warning(res.message)
}
}).finally(() => {
// this.loading = false
// this.loadData();
})
},
openTimer() {
this.closeTimer()
this.timer = setInterval(() => {
// if (this.$route.path === this.path) {
// this.loadData()
// }
this.getMessageList();
console.log("the time is running,the current time:" + new Date().toLocaleString())
}, this.millisec)
},
/** 关闭定时器 */
closeTimer() {
if (this.timer) clearInterval(this.timer)
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

@ -0,0 +1,114 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="工单id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workorderId">
<a-input v-model="model.workorderId" placeholder="请输入工单id" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="生产计划工序id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zyplanprocessId">
<a-input v-model="model.zyplanprocessId" placeholder="请输入生产计划工序id" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="播报状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<a-input v-model="model.status" placeholder="请输入播报状态" ></a-input>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'ZySpeechMessageForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/org.jeecg.modules.message/zySpeechMessage/add",
edit: "/org.jeecg.modules.message/zySpeechMessage/edit",
queryById: "/org.jeecg.modules.message/zySpeechMessage/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<zy-speech-message-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></zy-speech-message-form>
</j-modal>
</template>
<script>
import ZySpeechMessageForm from './ZySpeechMessageForm'
export default {
name: 'ZySpeechMessageModal',
components: {
ZySpeechMessageForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<zy-speech-message-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></zy-speech-message-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import ZySpeechMessageForm from './ZySpeechMessageForm'
export default {
name: 'ZySpeechMessageModal',
components: {
ZySpeechMessageForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

@ -0,0 +1,32 @@
<template>
<el-button type="success" @click="speakTtsSpeech">speak-tts语音播报</el-button>
</template>
<script>
import Speech from "speak-tts"; // es6
export default {
name: "SpeechDemo",
data() {
return {
speech: null,
};
},
mounted() {
this.speechInit();
},
methods: {
speakTtsSpeech() {
this.speech.speak({ text: "公众号:霸道的程序猿" }).then(() => {
console.log("读取成功");
});
},
speechInit() {
this.speech = new Speech();
this.speech.setLanguage("zh-CN");
this.speech.init().then(() => {});
},
},
};
</script>
<style scoped>
</style>

@ -16,7 +16,7 @@
</a-form-item>
</a-col>
<a-col :span="8" >
<a-col :span="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
@ -51,28 +51,30 @@
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction,putAction } from '@/api/manage'
import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import DynamicNotice from '@/components/tools/DynamicNotice'
import {filterObj} from '@/utils/util'
import {getAction, putAction} from '@/api/manage'
import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import DynamicNotice from '@/components/tools/DynamicNotice'
import Speech from 'speak-tts'
export default {
export default {
name: "UserAnnouncementList",
mixins: [JeecgListMixin],
components: {
DynamicNotice,
ShowAnnouncement
},
data () {
data() {
return {
description: '系统通告表管理页面',
queryParam: {},
columns: [{
title: '标题',
align:"center",
align: "center",
dataIndex: 'titile'
},{
}, {
title: '消息类型',
align: "center",
dataIndex: 'msgCategory',
@ -85,89 +87,92 @@
return text;
}
}
},{
}, {
title: '发布人',
align:"center",
align: "center",
dataIndex: 'sender'
},{
}, {
title: '发布时间',
align:"center",
align: "center",
dataIndex: 'sendTime'
},{
}, {
title: '优先级',
align:"center",
align: "center",
dataIndex: 'priority',
customRender:function (text) {
if(text=='L'){
customRender: function (text) {
if (text == 'L') {
return "低";
}else if(text=="M"){
} else if (text == "M") {
return "中";
}else if(text=="H"){
} else if (text == "H") {
return "高";
} else {
return text;
}
}
},{
}, {
title: '阅读状态',
align:"center",
align: "center",
dataIndex: 'readFlag',
customRender:function (text) {
if(text=='0'){
customRender: function (text) {
if (text == '0') {
return "未读";
}else if(text=="1"){
} else if (text == "1") {
return "已读";
} else {
return text;
}
}
},{
}, {
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
align: "center",
scopedSlots: {customRender: 'action'},
}],
url: {
list: "/sys/sysAnnouncementSend/getMyAnnouncementSend",
editCementSend:"sys/sysAnnouncementSend/editByAnntIdAndUserId",
readAllMsg:"sys/sysAnnouncementSend/readAll",
editCementSend: "sys/sysAnnouncementSend/editByAnntIdAndUserId",
readAllMsg: "sys/sysAnnouncementSend/readAll",
},
loading:false,
openPath:'',
formData:''
loading: false,
openPath: '',
formData: ''
}
},
mounted() {
this.speechInit();
},
methods: {
handleDetail: function(record){
handleDetail: function (record) {
this.$refs.sysAnnouncementModal.detail(record);
this.$refs.sysAnnouncementModal.title="查看";
this.$refs.sysAnnouncementModal.title = "查看";
},
showAnnouncement(record){
putAction(this.url.editCementSend,{anntId:record.anntId}).then((res)=>{
if(res.success){
showAnnouncement(record) {
putAction(this.url.editCementSend, {anntId: record.anntId}).then((res) => {
if (res.success) {
this.loadData();
this.syncHeadNotic(record.anntId)
}
});
if(record.openType==='component'){
if (record.openType === 'component') {
this.openPath = record.openPage;
this.formData = {id:record.busId};
this.formData = {id: record.busId};
this.$refs.showDynamNotice.detail();
}else{
} else {
this.$refs.ShowAnnouncement.detail(record);
}
},
syncHeadNotic(anntId){
getAction("sys/annountCement/syncNotic",{anntId:anntId})
syncHeadNotic(anntId) {
getAction("sys/annountCement/syncNotic", {anntId: anntId})
},
readAll(){
readAll() {
var that = this;
that.$confirm({
title:"确认操作",
content:"是否全部标注已读?",
onOk: function(){
putAction(that.url.readAllMsg).then((res)=>{
if(res.success){
title: "确认操作",
content: "是否全部标注已读?",
onOk: function () {
putAction(that.url.readAllMsg).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData();
that.syncHeadNotic();
@ -176,17 +181,51 @@
}
});
},
speechInit() {
this.speech = new Speech();
this.speech.setLanguage('zh-CN');
this.speech.init().then(() => {
console.log('语音播报初始化完成...')
this.MySpeak();
})
},
//
MySpeak() {
this.speech.speak({text: "测试javascript语音合成"}).then(() => {
// alert("MySpeak()...");
console.log("MySpeak()播报完成...")
})
}
}
}
</script>
<style scoped>
.ant-card-body .table-operator{
.ant-card-body .table-operator {
margin-bottom: 18px;
}
.anty-row-operator button{margin: 0 5px}
.ant-btn-danger{background-color: #ffffff}z
}
.anty-row-operator button {
margin: 0 5px
}
.ant-btn-danger {
background-color: #ffffff
}
z
.ant-modal-cust-warp {
height: 100%
}
.ant-modal-cust-warp .ant-modal-body {
height: calc(100% - 110px) !important;
overflow-y: auto
}
.ant-modal-cust-warp{height: 100%}
.ant-modal-cust-warp .ant-modal-body{height:calc(100% - 110px) !important;overflow-y: auto}
.ant-modal-cust-warp .ant-modal-content{height:90% !important;overflow-y: hidden}
.ant-modal-cust-warp .ant-modal-content {
height: 90% !important;
overflow-y: hidden
}
</style>

@ -0,0 +1,156 @@
package org.jeecg.modules.message.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.message.entity.ZySpeechMessage;
import org.jeecg.modules.message.service.IZySpeechMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
* @Description: 生产消息播报
* @Author: jeecg-boot
* @Date: 2023-04-21
* @Version: V1.0
*/
@Api(tags = "生产消息播报")
@RestController
@RequestMapping("/org.jeecg.modules.message/zySpeechMessage")
@Slf4j
public class ZySpeechMessageController extends JeecgController<ZySpeechMessage, IZySpeechMessageService> {
@Autowired
private IZySpeechMessageService zySpeechMessageService;
/**
* 分页列表查询
*
* @param zySpeechMessage
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "生产消息播报-分页列表查询")
@ApiOperation(value = "生产消息播报-分页列表查询", notes = "生产消息播报-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(ZySpeechMessage zySpeechMessage,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZySpeechMessage> queryWrapper = QueryGenerator.initQueryWrapper(zySpeechMessage, req.getParameterMap());
Page<ZySpeechMessage> page = new Page<ZySpeechMessage>(pageNo, pageSize);
IPage<ZySpeechMessage> pageList = zySpeechMessageService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param zySpeechMessage
* @return
*/
@AutoLog(value = "生产消息播报-添加")
@ApiOperation(value = "生产消息播报-添加", notes = "生产消息播报-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ZySpeechMessage zySpeechMessage) {
zySpeechMessageService.save(zySpeechMessage);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zySpeechMessage
* @return
*/
@AutoLog(value = "生产消息播报-编辑")
@ApiOperation(value = "生产消息播报-编辑", notes = "生产消息播报-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZySpeechMessage zySpeechMessage) {
zySpeechMessageService.updateById(zySpeechMessage);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "生产消息播报-通过id删除")
@ApiOperation(value = "生产消息播报-通过id删除", notes = "生产消息播报-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
zySpeechMessageService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "生产消息播报-批量删除")
@ApiOperation(value = "生产消息播报-批量删除", notes = "生产消息播报-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.zySpeechMessageService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "生产消息播报-通过id查询")
@ApiOperation(value = "生产消息播报-通过id查询", notes = "生产消息播报-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
ZySpeechMessage zySpeechMessage = zySpeechMessageService.getById(id);
if (zySpeechMessage == null) {
return Result.error("未找到对应数据");
}
return Result.OK(zySpeechMessage);
}
/**
* 导出excel
*
* @param request
* @param zySpeechMessage
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ZySpeechMessage zySpeechMessage) {
return super.exportXls(request, zySpeechMessage, ZySpeechMessage.class, "生产消息播报");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ZySpeechMessage.class);
}
}

@ -0,0 +1,92 @@
package org.jeecg.modules.message.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 生产消息播报
* @Author: jeecg-boot
* @Date: 2023-04-21
* @Version: V1.0
*/
@Data
@TableName("zy_speech_message")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "zy_speech_message对象", description = "生产消息播报")
public class ZySpeechMessage implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**
* 订单商品id
*/
@Excel(name = "订单商品id", width = 15)
@ApiModelProperty(value = "订单商品id")
private String ordergoodsId;
/**
* 工单id
*/
@Excel(name = "工单id", width = 15)
@ApiModelProperty(value = "工单id")
private String workorderId;
/**
* 生产计划工序id
*/
@Excel(name = "生产计划工序id", width = 15)
@ApiModelProperty(value = "生产计划工序id")
private String zyplanprocessId;
/**
* 播报状态
*/
@Excel(name = "播报状态", width = 15)
@ApiModelProperty(value = "是否加急")
@Dict(dicCode = "sfjj")
private String status;
@Excel(name = "消息", width = 15)
@ApiModelProperty(value = "消息")
private String message;
}

@ -0,0 +1,15 @@
package org.jeecg.modules.message.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.message.entity.ZySpeechMessage;
/**
* @Description: 生产消息播报
* @Author: jeecg-boot
* @Date: 2023-04-21
* @Version: V1.0
*/
public interface ZySpeechMessageMapper extends BaseMapper<ZySpeechMessage> {
}

@ -0,0 +1,15 @@
package org.jeecg.modules.message.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.message.entity.ZySpeechMessage;
/**
* @Description: 生产消息播报
* @Author: jeecg-boot
* @Date: 2023-04-21
* @Version: V1.0
*/
public interface IZySpeechMessageService extends IService<ZySpeechMessage> {
}

@ -0,0 +1,18 @@
package org.jeecg.modules.message.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.message.entity.ZySpeechMessage;
import org.jeecg.modules.message.mapper.ZySpeechMessageMapper;
import org.jeecg.modules.message.service.IZySpeechMessageService;
import org.springframework.stereotype.Service;
/**
* @Description: 生产消息播报
* @Author: jeecg-boot
* @Date: 2023-04-21
* @Version: V1.0
*/
@Service
public class ZySpeechMessageServiceImpl extends ServiceImpl<ZySpeechMessageMapper, ZySpeechMessage> implements IZySpeechMessageService {
}
Loading…
Cancel
Save