Commit b1615250 by zhangjw

新增:事件日志相关逻辑

parent 9f5e6b61
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</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('pm_event_info')">导出</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">
<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:'日志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: 'sourceName'
},
{
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
......@@ -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);
}
}
package org.jeecg.modules.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.modules.pm.entity.event.PmEventInfo;
import org.jeecg.modules.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);
}
}
package org.jeecg.modules.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 java.lang.Long id;
/**
* 唯一标识一次发生的事件
*/
@Excel(name = "唯一标识一次发生的事件", width = 15)
@ApiModelProperty(value = "唯一标识一次发生的事件")
private java.lang.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 java.lang.Integer eventState;
/**
* 0:普通事件;1:低级报警;2:中级
* 报警;3:高级报警
*/
@Excel(name = "0:普通事件;1:低级报警;2:中级 报警;3:高级报警", width = 15)
@ApiModelProperty(value = "0:普通事件;1:低级报警;2:中级 报警;3:高级报警")
private java.lang.Integer eventLevel;
/**
* 控制中心编号
*/
@Excel(name = "控制中心编号", width = 15)
@ApiModelProperty(value = "控制中心编号")
private java.lang.String unitIdx;
/**
* 事件类型
*/
@Excel(name = "事件类型", width = 15)
@ApiModelProperty(value = "事件类型")
private java.lang.Integer eventType;
/**
* 事件类型名称
*/
@Excel(name = "事件类型名称", width = 15)
@ApiModelProperty(value = "事件类型名称")
private java.lang.String eventTypeName;
/**
* 事件所属子系统类型.
* "废弃,事件整改,没有子系统属性"
*/
@Excel(name = "事件所属子系统类型: 废弃,事件整改,没有子系统属性", width = 15)
@ApiModelProperty(value = "事件所属子系统类型: 废弃,事件整改,没有子系统属性 ")
private java.lang.Integer subSysType;
/**
* 事件名称
*/
@Excel(name = "事件名称", width = 15)
@ApiModelProperty(value = "事件名称")
private java.lang.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 java.lang.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 java.lang.String stopTime;
/**
* 事件源编号
*/
@Excel(name = "事件源编号", width = 15)
@ApiModelProperty(value = "事件源编号")
private java.lang.String sourceIdx;
/**
* 事件源类型
*/
@Excel(name = "事件源类型", width = 15)
@ApiModelProperty(value = "事件源类型")
private java.lang.Integer sourceType;
/**
* 事件源名称
*/
@Excel(name = "事件源名称", width = 15)
@ApiModelProperty(value = "事件源名称")
private java.lang.String sourceName;
/**
* 事件描述信息
*/
@Excel(name = "事件描述信息", width = 15)
@ApiModelProperty(value = "事件描述信息")
private java.lang.String logTxt;
/**
* 事件源区域编号
*/
@Excel(name = "事件源区域编号", width = 15)
@ApiModelProperty(value = "事件源区域编号")
private java.lang.String regionIdx;
/**
* 事件拓展信息:
* 各个子系统根据子系统的消息结构体
* 定义解析,下文主要介绍事件中此字
* 段含义
*/
@Excel(name = "事件拓展信息:各个子系统根据子系统的消息结构体 定义解析, 下文主要介绍事件中此字 段含义", width = 15)
@ApiModelProperty(value = "事件拓展信息: 各个子系统根据子系统的消息结构体 定义解析, 下文主要介绍事件中此字 段含义")
private java.lang.String extInfo;
/**
* 事件处理结果:当 event_state 为更新时使用
*/
@Excel(name = "事件处理结果:当 event_state 为更新时使用", width = 15)
@ApiModelProperty(value = "事件处理结果:当 event_state 为更新时使用")
private java.lang.String rsltMsg;
/**
* 联动信息:目前包含客户端联动、预
* 案
*/
@Excel(name = "联动信息:目前包含客户端联动、预 案", width = 15)
@ApiModelProperty(value = "联动信息:目前包含客户端联动、预 案")
private java.lang.String trigInfo;
/**
* 上层事件类型
* VSS: 视频事件
* EPS: 入侵报警事件'
*/
@Excel(name = "VSS: 视频事件 EPS: 入侵报警事件", width = 15)
@ApiModelProperty(value = "VSS: 视频事件 EPS: 入侵报警事件")
private String eventCategory;
}
package org.jeecg.modules.pm.mapper.event;
import org.jeecg.modules.pm.entity.event.PmEventInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @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.modules.pm.mapper.event.PmEventInfoMapper">
</mapper>
\ No newline at end of file
package org.jeecg.modules.pm.mq;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.pm.entity.eps.EventDis;
import org.jeecg.modules.pm.entity.event.PmEventInfo;
import org.jeecg.modules.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;
/**
* @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);
pmEventInfoService.save(
new PmEventInfo()
.setEventCategory(PmEventInfo.VSS)
.setId(IdWorker.getId())
.setLogId(commEventLog.getLogId())
.setEventState(commEventLog.getEventState())
.setEventLevel(commEventLog.getEventLevel())
.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().toString()));
}
@JmsListener(destination = EPS_TOPIC)
public void epsProcessMessage(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);
// 扩展字段,此字段为设备上报事件内容,部分事件需要使用pb文件再次解析
System.out.println(commEventLog);
}
}
package org.jeecg.modules.pm.service.event;
import org.jeecg.modules.pm.entity.event.PmEventInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
public interface IPmEventInfoService extends IService<PmEventInfo> {
}
package org.jeecg.modules.pm.service.impl.event;
import org.jeecg.modules.pm.entity.event.PmEventInfo;
import org.jeecg.modules.pm.mapper.event.PmEventInfoMapper;
import org.jeecg.modules.pm.service.event.IPmEventInfoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date: 2022-04-01
* @Version: V1.0
*/
@Service
public class PmEventInfoServiceImpl extends ServiceImpl<PmEventInfoMapper, PmEventInfo> implements IPmEventInfoService {
}
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