Commit b0bb8e07 by chenjunxiong

Merge remote-tracking branch 'origin/master'

parents 28bd039d 96d7b661
<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 :md="8" :sm="24">
<a-form-item label="事件类别">
<a-select v-model="queryParam.eventCategory" placeholder="请选择" default-value="VSS">
<a-select-option value="VSS">VSS</a-select-option>
<a-select-option value="EPS">EPS</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery">查询</a-button>
</a-col>
</span>
<!-- <div class="table-operator">-->
<!--&lt;!&ndash; <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>&ndash;&gt;-->
<!--&lt;!&ndash; <a-button type="primary" icon="download" @click="handleExportXls('pm_event_info')">导出</a-button>&ndash;&gt;-->
<!--&lt;!&ndash; <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">&ndash;&gt;-->
<!--&lt;!&ndash;&lt;!&ndash; <a-button type="primary" icon="import">导入</a-button>&ndash;&gt;&ndash;&gt;-->
<!--&lt;!&ndash; </a-upload>&ndash;&gt;-->
<!-- &lt;!&ndash; 高级查询区域 &ndash;&gt;-->
<!--&lt;!&ndash; <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>&ndash;&gt;-->
<!--&lt;!&ndash; <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>&ndash;&gt;-->
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<!-- &lt;!&ndash; <a-dropdown v-if="selectedRowKeys.length > 0">&ndash;&gt;-->
<!--&lt;!&ndash; <a-menu slot="overlay">&ndash;&gt;-->
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!--&lt;!&ndash; </a-menu>&ndash;&gt;-->
<!--&lt;!&ndash; <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>&ndash;&gt;-->
<!--&lt;!&ndash; </a-dropdown>&ndash;&gt;-->
<!-- </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">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt=""
style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<!-- <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>-->
<pm-event-info-modal ref="modalForm" @ok="modalFormOk"></pm-event-info-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import PmEventInfoModal from './modules/PmEventInfoModal'
export default {
name: 'PmEventInfoList',
mixins: [JeecgListMixin, mixinDevice],
components: {
PmEventInfoModal
},
data() {
return {
description: 'pm_event_info管理页面',
// 表头
columns: [
// {
// title: '#',
// dataIndex: '',
// key:'rowIndex',
// width:60,
// align:"center",
// customRender:function (t,r,index) {
// return parseInt(index)+1;
// }
// },
{
title: '类别',
align: "center",
dataIndex: 'eventCategory'
},
{
title: '源名称',
align: "center",
dataIndex: 'sourceName'
},
{
title: '日志ID',
align: "center",
dataIndex: 'logId'
},
{
title: '状态',
align: "center",
dataIndex: 'eventState'
},
{
title: '等级',
align: "center",
dataIndex: 'eventLevel'
},
{
title: '控制中心编号',
align: "center",
dataIndex: 'unitIdx'
},
{
title: '类型',
align: "center",
dataIndex: 'eventType'
},
{
title: '类型名称',
align: "center",
dataIndex: 'eventTypeName'
},
// {
// title:'事件所属子系统类型."废弃,事件整改,没有子系统属性"',
// align:"center",
// dataIndex: 'subSysType'
// },
{
title: '名称',
align: "center",
dataIndex: 'eventName'
},
{
title: '开始时间',
align: "center",
dataIndex: 'startTime',
customRender: function (text) {
return !text ? "" : (text.length > 10 ? text.substr(0, 20) : text)
}
},
{
title: '结束时间',
align: "center",
dataIndex: 'stopTime',
customRender: function (text) {
return !text ? "" : (text.length > 10 ? text.substr(0, 20) : text)
}
},
{
title: '源编号',
align: "center",
dataIndex: 'sourceIdx'
},
{
title: '源类型',
align: "center",
dataIndex: 'sourceType'
},
{
title: '描述信息',
align: "center",
dataIndex: 'logTxt'
},
{
title: '区域编号',
align: "center",
dataIndex: 'regionIdx'
},
// {
// title:'事件拓展信息:各个子系统根据子系统的消息结构体定义解析,下文主要介绍事件中此字段含义',
// align:"center",
// dataIndex: 'extInfo'
// },
// {
// title:'事件处理结果:当 event_state 为更新时使用',
// align:"center",
// dataIndex: 'rsltMsg'
// },
// {
// title:'联动信息:目前包含客户端联动、预案',
// align:"center",
// dataIndex: 'trigInfo'
// },
// {
// title: '操作',
// dataIndex: 'action',
// align:"center",
// fixed:"right",
// width:147,
// scopedSlots: { customRender: 'action' }
// }
],
url: {
list: "/pm/pmEventInfo/list",
delete: "/pm/pmEventInfo/delete",
deleteBatch: "/pm/pmEventInfo/deleteBatch",
exportXlsUrl: "/pm/pmEventInfo/exportXls",
importExcelUrl: "pm/pmEventInfo/importExcel",
},
dictOptions: {},
superFieldList: [],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig() {
},
getSuperFieldList() {
let fieldList = [];
fieldList.push({type: 'string', value: 'logId', text: '唯一标识一次发生的事件'})
fieldList.push({type: 'string', value: 'eventCategory', text: '事件类别'})
fieldList.push({
type: 'int',
value: 'eventState',
text: '0:瞬时事件,保存;1:事件开始,保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用,CMS 不用;4:事件更新,联动结果更新'
})
fieldList.push({type: 'int', value: 'eventLevel', text: '0:普通事件;1:低级报警;2:中级报警;3:高级报警'})
fieldList.push({type: 'string', value: 'unitIdx', text: '控制中心编号'})
fieldList.push({type: 'int', value: 'eventType', text: '事件类型'})
fieldList.push({type: 'string', value: 'eventTypeName', text: '事件类型名称'})
fieldList.push({type: 'int', value: 'subSysType', text: '事件所属子系统类型."废弃,事件整改,没有子系统属性"'})
fieldList.push({type: 'string', value: 'eventName', text: '事件名称'})
fieldList.push({type: 'string', value: 'startTime', text: '事件开始时间'})
fieldList.push({type: 'string', value: 'stopTime', text: '事件结束时间'})
fieldList.push({type: 'string', value: 'sourceIdx', text: '事件源编号'})
fieldList.push({type: 'int', value: 'sourceType', text: '事件源类型'})
fieldList.push({type: 'string', value: 'sourceName', text: '事件源名称'})
fieldList.push({type: 'string', value: 'logTxt', text: '事件描述信息'})
fieldList.push({type: 'string', value: 'regionIdx', text: '事件源区域编号'})
fieldList.push({type: 'string', value: 'extInfo', text: '事件拓展信息:各个子系统根据子系统的消息结构体定义解析,下文主要介绍事件中此字段含义'})
fieldList.push({type: 'string', value: 'rsltMsg', text: '事件处理结果:当 event_state 为更新时使用'})
fieldList.push({type: 'string', value: 'trigInfo', text: '联动信息:目前包含客户端联动、预案'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
\ No newline at end of file
<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="事件类别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eventCategory">
<a-input v-model="model.eventCategory" placeholder="事件类别" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="唯一标识一次发生的事件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="logId">
<a-input v-model="model.logId" placeholder="请输入唯一标识一次发生的事件" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="0:瞬时事件,保存;1:事件开始,
保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用,
CMS 不用;4:事件更新,联动结果更
新" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eventState">
<a-input-number v-model="model.eventState" placeholder="请输入0:瞬时事件,保存;1:事件开始,
保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用,
CMS 不用;4:事件更新,联动结果更
新" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="0:普通事件;1:低级报警;2:中级
报警;3:高级报警" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eventLevel">
<a-input-number v-model="model.eventLevel" placeholder="请输入0:普通事件;1:低级报警;2:中级
报警;3:高级报警" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="控制中心编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unitIdx">
<a-input v-model="model.unitIdx" placeholder="请输入控制中心编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eventType">
<a-input-number v-model="model.eventType" placeholder="请输入事件类型" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eventTypeName">
<a-input v-model="model.eventTypeName" placeholder="请输入事件类型名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件所属子系统类型.废弃,事件整改,没有子系统属性" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subSysType">
<a-input-number v-model="model.subSysType" placeholder="请输入事件所属子系统类型.废弃,事件整改,没有子系统属性" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eventName">
<a-input v-model="model.eventName" placeholder="请输入事件名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startTime">
<j-date placeholder="请选择事件开始时间" v-model="model.startTime" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stopTime">
<j-date placeholder="请选择事件结束时间" v-model="model.stopTime" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件源编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sourceIdx">
<a-input v-model="model.sourceIdx" placeholder="请输入事件源编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件源类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sourceType">
<a-input-number v-model="model.sourceType" placeholder="请输入事件源类型" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件源名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sourceName">
<a-input v-model="model.sourceName" placeholder="请输入事件源名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件描述信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="logTxt">
<a-textarea v-model="model.logTxt" rows="4" placeholder="请输入事件描述信息" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件源区域编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="regionIdx">
<a-input v-model="model.regionIdx" placeholder="请输入事件源区域编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件拓展信息:
各个子系统根据子系统的消息结构体
定义解析,下文主要介绍事件中此字
段含义" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="extInfo">
<a-textarea v-model="model.extInfo" rows="4" placeholder="请输入事件拓展信息:
各个子系统根据子系统的消息结构体
定义解析,下文主要介绍事件中此字
段含义" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="事件处理结果:当 event_state 为更新时使用" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rsltMsg">
<a-textarea v-model="model.rsltMsg" rows="4" placeholder="请输入事件处理结果:当 event_state 为更新时使用" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="联动信息:目前包含客户端联动、预
案" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="trigInfo">
<a-textarea v-model="model.trigInfo" rows="4" placeholder="请输入联动信息:目前包含客户端联动、预
案" />
</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: 'PmEventInfoForm',
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: "/pm/pmEventInfo/add",
edit: "/pm/pmEventInfo/edit",
queryById: "/pm/pmEventInfo/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>
\ No newline at end of file
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<pm-event-info-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></pm-event-info-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 PmEventInfoForm from './PmEventInfoForm'
export default {
name: 'PmEventInfoModal',
components: {
PmEventInfoForm
},
// 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>
\ No newline at end of file
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<pm-event-info-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></pm-event-info-form>
</j-modal>
</template>
<script>
import PmEventInfoForm from './PmEventInfoForm'
export default {
name: 'PmEventInfoModal',
components: {
PmEventInfoForm
},
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>
\ No newline at end of file
......@@ -18,11 +18,11 @@ import net.sf.jsqlparser.expression.LongValue;
/**
* 单数据源配置(jeecg.datasource.open = false时生效)
* @Author zhoujf
*
* @Author zhoujf
*/
@Configuration
@MapperScan(value={"org.jeecg.modules.**.mapper*"})
@MapperScan(value = {"org.jeecg.modules.**.mapper*", "org.jeecg.pm.mapper"})
public class MybatisPlusSaasConfig {
/**
* tenant_id 字段名
......@@ -50,20 +50,20 @@ public class MybatisPlusSaasConfig {
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
@Override
public Expression getTenantId() {
String tenant_id = oConvertUtils.getString(TenantContext.getTenant(),"0");
String tenant_id = oConvertUtils.getString(TenantContext.getTenant(), "0");
return new LongValue(tenant_id);
}
@Override
public String getTenantIdColumn(){
public String getTenantIdColumn() {
return TENANT_FIELD_NAME;
}
// 返回 true 表示不走租户逻辑
@Override
public boolean ignoreTable(String tableName) {
for(String temp: tenantTable){
if(temp.equalsIgnoreCase(tableName)){
for (String temp : tenantTable) {
if (temp.equalsIgnoreCase(tableName)) {
return false;
}
}
......
......@@ -26,6 +26,16 @@
<artifactId>jeecg-boot-module-hikvision</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
<!--引入微服务启动依赖 starter
<dependency>
<groupId>org.jeecgframework.boot</groupId>
......@@ -35,18 +45,7 @@
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-job</artifactId>
</dependency>-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</dependency>
</dependencies>
<build>
......
package org.jeecg.modules.pm.config;
import com.google.protobuf.InvalidProtocolBufferException;
import org.jeecg.modules.pm.entity.eps.EventDis;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.annotation.JmsListener;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
/**
* <p>
*
* </p>
*
* @author 陈俊雄
* @since 2022/3/29
*/
@Configuration
public class HikvisionMQ {
@JmsListener(destination = "openapi.vss.topic")
public void processMessage(BytesMessage bytesMessage) throws JMSException, InvalidProtocolBufferException {
final byte[] bytes = new byte[(int) bytesMessage.getBodyLength()];
bytesMessage.readBytes(bytes);
final EventDis.CommEventLog commEventLog = EventDis.CommEventLog.parseFrom(bytes);
System.out.println(commEventLog);
}
}
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jeecg-boot-parent</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-boot-module-property</artifactId>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>com.chanjx</groupId>
<artifactId>chanjx-utils</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-module-hikvision</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
</dependencies>
<!-- <build>-->
<!-- <extensions>-->
<!-- <extension>-->
<!-- <groupId>kr.motd.maven</groupId>-->
<!-- <artifactId>os-maven-plugin</artifactId>-->
<!-- <version>1.6.2</version>-->
<!-- </extension>-->
<!-- </extensions>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.xolstice.maven.plugins</groupId>-->
<!-- <artifactId>protobuf-maven-plugin</artifactId>-->
<!-- <version>0.6.1</version>-->
<!-- <configuration>-->
<!-- <protocArtifact>com.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}</protocArtifact>-->
<!-- <pluginId>grpc-java</pluginId>-->
<!-- <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.32.1:exe:${os.detected.classifier}</pluginArtifact>-->
<!-- <protoSourceRoot>src/main/proto</protoSourceRoot>-->
<!-- <outputDirectory>src/main/java</outputDirectory>-->
<!-- <clearOutputDirectory>false</clearOutputDirectory>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>compile</goal>-->
<!-- <goal>compile-custom</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>
package org.jeecg.pm.controller.event;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
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.pm.entity.event.PmEventInfo;
import org.jeecg.pm.service.event.IPmEventInfoService;
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: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
@Api(tags = "pm_event_info")
@RestController
@RequestMapping("/pm/pmEventInfo")
@Slf4j
public class PmEventInfoController extends JeecgController<PmEventInfo, IPmEventInfoService> {
@Autowired
private IPmEventInfoService pmEventInfoService;
/**
* 分页列表查询
*
* @param pmEventInfo
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "pm_event_info-分页列表查询")
@ApiOperation(value = "pm_event_info-分页列表查询", notes = "pm_event_info-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<PmEventInfo>> queryPageList(PmEventInfo pmEventInfo,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
IPage<PmEventInfo> pageList = pmEventInfoService.page(new Page<PmEventInfo>(pageNo, pageSize), new QueryWrapper<PmEventInfo>().lambda().orderByDesc(PmEventInfo::getStartTime));
return Result.OK(pageList);
}
/**
* 添加
*
* @param pmEventInfo
* @return
*/
@AutoLog(value = "pm_event_info-添加")
@ApiOperation(value = "pm_event_info-添加", notes = "pm_event_info-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody PmEventInfo pmEventInfo) {
pmEventInfo.setId(IdWorker.getId());
pmEventInfoService.save(pmEventInfo);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param pmEventInfo
* @return
*/
@AutoLog(value = "pm_event_info-编辑")
@ApiOperation(value = "pm_event_info-编辑", notes = "pm_event_info-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody PmEventInfo pmEventInfo) {
pmEventInfoService.updateById(pmEventInfo);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "pm_event_info-通过id删除")
@ApiOperation(value = "pm_event_info-通过id删除", notes = "pm_event_info-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
pmEventInfoService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "pm_event_info-批量删除")
@ApiOperation(value = "pm_event_info-批量删除", notes = "pm_event_info-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.pmEventInfoService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "pm_event_info-通过id查询")
@ApiOperation(value = "pm_event_info-通过id查询", notes = "pm_event_info-通过id查询")
@GetMapping(value = "/queryById")
public Result<PmEventInfo> queryById(@RequestParam(name = "id", required = true) String id) {
PmEventInfo pmEventInfo = pmEventInfoService.getById(id);
if (pmEventInfo == null) {
return Result.error("未找到对应数据", null);
}
return Result.OK(pmEventInfo);
}
/**
* 导出excel
*
* @param request
* @param pmEventInfo
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, PmEventInfo pmEventInfo) {
return super.exportXls(request, pmEventInfo, PmEventInfo.class, "pm_event_info");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, PmEventInfo.class);
}
}
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: comm.proto
package org.jeecg.modules.pm.entity.eps;
package org.jeecg.pm.entity.eps;
public final class Comm {
private Comm() {}
......
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: event_dis.proto
package org.jeecg.modules.pm.entity.eps;
package org.jeecg.pm.entity.eps;
public final class EventDis {
private EventDis() {}
......
package org.jeecg.pm.entity.event;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
@Data
@TableName("pm_event_info")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "pm_event_info对象", description = "pm_event_info")
public class PmEventInfo implements Serializable {
/**
* 视频事件
*/
public static final String VSS = "VSS";
/**
* 入侵报警事件
*/
public static final String EPS = "EPS";
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private Long id;
/**
* 唯一标识一次发生的事件
*/
@Excel(name = "唯一标识一次发生的事件", width = 15)
@ApiModelProperty(value = "唯一标识一次发生的事件")
private String logId;
/**
* 0:瞬时事件,保存;1:事件开始,
* 保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用,
* CMS 不用;4:事件更新,联动结果更
* 新
*/
@Excel(name = "0:瞬时事件,保存;1:事件开始, 保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用, CMS 不用;4:事件更新,联动结果更 新", width = 15)
@ApiModelProperty(value = "0:瞬时事件,保存;1:事件开始, 保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用, CMS 不用;4:事件更新,联动结果更 新")
private String eventState;
/**
* 0:普通事件;1:低级报警;2:中级
* 报警;3:高级报警
*/
@Excel(name = "0:普通事件;1:低级报警;2:中级 报警;3:高级报警", width = 15)
@ApiModelProperty(value = "0:普通事件;1:低级报警;2:中级 报警;3:高级报警")
private String eventLevel;
/**
* 控制中心编号
*/
@Excel(name = "控制中心编号", width = 15)
@ApiModelProperty(value = "控制中心编号")
private String unitIdx;
/**
* 事件类型
*/
@Excel(name = "事件类型", width = 15)
@ApiModelProperty(value = "事件类型")
private Integer eventType;
/**
* 事件类型名称
*/
@Excel(name = "事件类型名称", width = 15)
@ApiModelProperty(value = "事件类型名称")
private String eventTypeName;
/**
* 事件所属子系统类型.
* "废弃,事件整改,没有子系统属性"
*/
@Excel(name = "事件所属子系统类型: 废弃,事件整改,没有子系统属性", width = 15)
@ApiModelProperty(value = "事件所属子系统类型: 废弃,事件整改,没有子系统属性 ")
private Integer subSysType;
/**
* 事件名称
*/
@Excel(name = "事件名称", width = 15)
@ApiModelProperty(value = "事件名称")
private String eventName;
/**
* 事件开始时间
*/
@Excel(name = "事件开始时间", width = 15, format = "yyyy-MM-dd")
// @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "事件开始时间")
private String startTime;
/**
* 事件结束时间
*/
@Excel(name = "事件结束时间", width = 15, format = "yyyy-MM-dd")
// @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "事件结束时间")
private String stopTime;
/**
* 事件源编号
*/
@Excel(name = "事件源编号", width = 15)
@ApiModelProperty(value = "事件源编号")
private String sourceIdx;
/**
* 事件源类型
*/
@Excel(name = "事件源类型", width = 15)
@ApiModelProperty(value = "事件源类型")
private Integer sourceType;
/**
* 事件源名称
*/
@Excel(name = "事件源名称", width = 15)
@ApiModelProperty(value = "事件源名称")
private String sourceName;
/**
* 事件描述信息
*/
@Excel(name = "事件描述信息", width = 15)
@ApiModelProperty(value = "事件描述信息")
private String logTxt;
/**
* 事件源区域编号
*/
@Excel(name = "事件源区域编号", width = 15)
@ApiModelProperty(value = "事件源区域编号")
private String regionIdx;
/**
* 事件拓展信息:
* 各个子系统根据子系统的消息结构体
* 定义解析,下文主要介绍事件中此字
* 段含义
*/
@Excel(name = "事件拓展信息:各个子系统根据子系统的消息结构体 定义解析, 下文主要介绍事件中此字 段含义", width = 15)
@ApiModelProperty(value = "事件拓展信息: 各个子系统根据子系统的消息结构体 定义解析, 下文主要介绍事件中此字 段含义")
private String extInfo;
/**
* 事件处理结果:当 event_state 为更新时使用
*/
@Excel(name = "事件处理结果:当 event_state 为更新时使用", width = 15)
@ApiModelProperty(value = "事件处理结果:当 event_state 为更新时使用")
private String rsltMsg;
/**
* 联动信息:目前包含客户端联动、预
* 案
*/
@Excel(name = "联动信息:目前包含客户端联动、预 案", width = 15)
@ApiModelProperty(value = "联动信息:目前包含客户端联动、预 案")
private String trigInfo;
/**
* 上层事件类型
* VSS: 视频事件
* EPS: 入侵报警事件'
*/
@Excel(name = "VSS: 视频事件 EPS: 入侵报警事件", width = 15)
@ApiModelProperty(value = "VSS: 视频事件 EPS: 入侵报警事件")
private String eventCategory;
}
package org.jeecg.pm.entity.event.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author: JJww
* @Date:2022/4/6
*/
@Getter
@AllArgsConstructor
public enum EventLevel {
/**
* 普通事件
*/
ORDINARY(0, "普通事件"),
/**
* 低级报警
*/
LOW_LEVEL(1, "低级报警"),
/**
* 中级报警
*/
INTERMEDIATE(2, "中级报警"),
/**
* 高级报警
*/
SENIOR(3, "高级报警"),
UNKNOWN(9, "未知类型");
/**
* 状态码
*/
private final Integer level;
/**
* 状态说明
*/
private final String remark;
}
package org.jeecg.pm.entity.event.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author: JJww
* @Date:2022/4/6
*/
@Getter
@AllArgsConstructor
public enum EventState {
INSTANTANEOUS(0, "瞬时"),
START(1, "开始"),
STOP(2, "结束"),
PULSE(3, "脉冲"),
UPDATE(4, "更新"),
UNKNOWN(9, "未知类型");
/**
* 状态码
*/
private final Integer state;
/**
* 状态说明
*/
private final String remark;
}
package org.jeecg.pm.mapper.event;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.pm.entity.event.PmEventInfo;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
public interface PmEventInfoMapper extends BaseMapper<PmEventInfo> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.pm.mapper.event.PmEventInfoMapper">
</mapper>
\ No newline at end of file
package org.jeecg.pm.mq;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.pm.entity.eps.EventDis;
import org.jeecg.pm.entity.event.PmEventInfo;
import org.jeecg.pm.entity.event.enums.EventLevel;
import org.jeecg.pm.entity.event.enums.EventState;
import org.jeecg.pm.service.event.IPmEventInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;
import javax.jms.BytesMessage;
import java.util.Arrays;
/**
* @author: JJww
* @Date:2022/3/23
*/
@Slf4j
@Component
public class EventMessageListener {
/**
* 视频事件
*/
private final static String VSS_TOPIC = "openapi.vss.topic";
/**
* 报警事件
*/
private final static String EPS_TOPIC = "openapi.eps.topic";
@Autowired
private IPmEventInfoService pmEventInfoService;
@JmsListener(destination = VSS_TOPIC)
public void vssProcessMessage(BytesMessage bytesMessage) throws Exception {
final byte[] bytes = new byte[(int) bytesMessage.getBodyLength()];
bytesMessage.readBytes(bytes);
// 壳文件字段,EventDis类为event_dis.proto文件解析而来,CommEventLog类为事件壳文件类
final EventDis.CommEventLog commEventLog = EventDis.CommEventLog.parseFrom(bytes);
final PmEventInfo pmEventInfo = this.recode(commEventLog);
pmEventInfo.setEventCategory(PmEventInfo.VSS);
pmEventInfoService.saveEvent(pmEventInfo);
log.info("VSS_TOPIC:{}", pmEventInfo);
}
@JmsListener(destination = EPS_TOPIC)
public void epsProcessMessage(BytesMessage bytesMessage) throws Exception {
final byte[] bytes = new byte[(int) bytesMessage.getBodyLength()];
bytesMessage.readBytes(bytes);
final EventDis.CommEventLog commEventLog = EventDis.CommEventLog.parseFrom(bytes);
final PmEventInfo pmEventInfo = this.recode(commEventLog);
pmEventInfo.setEventCategory(PmEventInfo.EPS);
pmEventInfoService.saveEvent(pmEventInfo);
log.info("EPS_TOPIC:{}", pmEventInfo);
}
public PmEventInfo recode(EventDis.CommEventLog commEventLog) {
final EventLevel eventLevel = Arrays.asList(EventLevel.values()).stream().filter(level -> level.getLevel().equals(commEventLog.getEventLevel())).findFirst().orElse(EventLevel.UNKNOWN);
final EventState eventState = Arrays.asList(EventState.values()).stream().filter(state -> state.getState().equals(commEventLog.getEventState())).findFirst().orElse(EventState.UNKNOWN);
return new PmEventInfo()
.setLogId(commEventLog.getLogId())
.setEventState(eventState.getRemark())
.setEventLevel(eventLevel.getRemark())
.setUnitIdx(commEventLog.getUnitIdx())
.setEventType(commEventLog.getEventType())
.setEventTypeName(commEventLog.getEventTypeName())
.setSubSysType(commEventLog.getSubSysType())
.setEventName(commEventLog.getEventName())
.setStartTime(commEventLog.getStartTime())
.setStopTime(commEventLog.getStopTime())
.setSourceIdx(commEventLog.getSourceIdx())
.setSourceType(commEventLog.getSourceType())
.setSourceName(commEventLog.getSourceName())
.setLogTxt(commEventLog.getLogTxt())
.setRegionIdx(commEventLog.getRegionIdx())
.setExtInfo(commEventLog.getExtInfo().toStringUtf8());
}
}
package org.jeecg.pm.service.event;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.pm.entity.eps.EventDis;
import org.jeecg.pm.entity.event.PmEventInfo;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
public interface IPmEventInfoService extends IService<PmEventInfo> {
/**
* 保存事件
* @param pmEventInfo
*/
void saveEvent(PmEventInfo pmEventInfo);
}
package org.jeecg.pm.service.impl.event;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.pm.entity.event.PmEventInfo;
import org.jeecg.pm.mapper.event.PmEventInfoMapper;
import org.jeecg.pm.service.event.IPmEventInfoService;
import org.springframework.stereotype.Service;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
@Slf4j
@Service
public class PmEventInfoServiceImpl extends ServiceImpl<PmEventInfoMapper, PmEventInfo> implements IPmEventInfoService {
@Override
public void saveEvent(PmEventInfo pmEventInfo) {
final PmEventInfo eventInfo = baseMapper.selectOne(new QueryWrapper<PmEventInfo>().lambda().eq(PmEventInfo::getLogId, pmEventInfo.getLogId()));//事件唯一ID
if (eventInfo == null) {
pmEventInfo.setId(IdWorker.getId());
baseMapper.insert(pmEventInfo);
return;
}
eventInfo.setEventLevel(pmEventInfo.getEventLevel()).setEventState(pmEventInfo.getEventState()).setStopTime(pmEventInfo.getStopTime());
baseMapper.updateById(eventInfo);
}
}
package org.jeecg.pm.jeecgbootmoduleproperty;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class JeecgBootModulePropertyApplicationTests {
@Test
void contextLoads() {
}
}
......@@ -69,6 +69,13 @@
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-module-property</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -57,6 +57,7 @@
<module>jeecg-boot-module-demo</module>
<module>jeecg-boot-module-system</module>
<module>jeecg-boot-module-hikvision</module>
<module>jeecg-boot-module-property</module>
<!--需要微服务,请打开
<module>jeecg-boot-starter</module>
<module>jeecg-cloud-module</module>-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment