Commit b1615250 by zhangjw

新增:事件日志相关逻辑

parent 9f5e6b61
<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 @@ ...@@ -26,6 +26,16 @@
<artifactId>jeecg-boot-module-hikvision</artifactId> <artifactId>jeecg-boot-module-hikvision</artifactId>
</dependency> </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 <!--引入微服务启动依赖 starter
<dependency> <dependency>
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
...@@ -35,18 +45,7 @@ ...@@ -35,18 +45,7 @@
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-job</artifactId> <artifactId>jeecg-boot-starter-job</artifactId>
</dependency>--> </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> </dependencies>
<build> <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