Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
property-management
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
property-management
Commits
96d7b661
Commit
96d7b661
authored
Apr 06, 2022
by
zhangjw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善保存事件日志逻辑
parent
4b5d07ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
140 additions
and
24 deletions
+140
-24
ant-design-vue-jeecg/src/views/pm/event-center/PmEventInfoList.vue
+0
-0
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/entity/event/PmEventInfo.java
+2
-2
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/entity/event/enums/EventLevel.java
+47
-0
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/entity/event/enums/EventState.java
+36
-0
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/mq/EventMessageListener.java
+29
-21
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/service/event/IPmEventInfoService.java
+8
-0
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/service/impl/event/PmEventInfoServiceImpl.java
+18
-1
No files found.
ant-design-vue-jeecg/src/views/pm/event-center/PmEventInfoList.vue
View file @
96d7b661
This diff is collapsed.
Click to expand it.
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/entity/event/PmEventInfo.java
View file @
96d7b661
...
...
@@ -59,14 +59,14 @@ public class PmEventInfo implements Serializable {
*/
@Excel
(
name
=
"0:瞬时事件,保存;1:事件开始, 保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用, CMS 不用;4:事件更新,联动结果更 新"
,
width
=
15
)
@ApiModelProperty
(
value
=
"0:瞬时事件,保存;1:事件开始, 保存;2:事件结束,更新结束时间; 3:事件脉冲,客户端和服务器使用, CMS 不用;4:事件更新,联动结果更 新"
)
private
Integer
eventState
;
private
String
eventState
;
/**
* 0:普通事件;1:低级报警;2:中级
* 报警;3:高级报警
*/
@Excel
(
name
=
"0:普通事件;1:低级报警;2:中级 报警;3:高级报警"
,
width
=
15
)
@ApiModelProperty
(
value
=
"0:普通事件;1:低级报警;2:中级 报警;3:高级报警"
)
private
Integer
eventLevel
;
private
String
eventLevel
;
/**
* 控制中心编号
*/
...
...
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/entity/event/enums/EventLevel.java
0 → 100644
View file @
96d7b661
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
;
}
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/entity/event/enums/EventState.java
0 → 100644
View file @
96d7b661
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
;
}
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/mq/EventMessageListener.java
View file @
96d7b661
package
org
.
jeecg
.
pm
.
mq
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
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
...
...
@@ -40,12 +42,32 @@ public class EventMessageListener {
bytesMessage
.
readBytes
(
bytes
);
// 壳文件字段,EventDis类为event_dis.proto文件解析而来,CommEventLog类为事件壳文件类
final
EventDis
.
CommEventLog
commEventLog
=
EventDis
.
CommEventLog
.
parseFrom
(
bytes
);
PmEventInfo
pmEventInfo
=
new
PmEventInfo
()
.
setEventCategory
(
PmEventInfo
.
VSS
)
.
setId
(
IdWorker
.
getId
())
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
(
commEventLog
.
getEventState
())
.
setEventLevel
(
commEventLog
.
getEventLevel
())
.
setEventState
(
eventState
.
getRemark
())
.
setEventLevel
(
eventLevel
.
getRemark
())
.
setUnitIdx
(
commEventLog
.
getUnitIdx
())
.
setEventType
(
commEventLog
.
getEventType
())
.
setEventTypeName
(
commEventLog
.
getEventTypeName
())
...
...
@@ -58,20 +80,6 @@ public class EventMessageListener {
.
setSourceName
(
commEventLog
.
getSourceName
())
.
setLogTxt
(
commEventLog
.
getLogTxt
())
.
setRegionIdx
(
commEventLog
.
getRegionIdx
())
.
setExtInfo
(
commEventLog
.
getExtInfo
().
toString
());
log
.
info
(
pmEventInfo
.
toString
());
pmEventInfoService
.
save
(
pmEventInfo
);
.
setExtInfo
(
commEventLog
.
getExtInfo
().
toStringUtf8
());
}
@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
);
}
}
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/service/event/IPmEventInfoService.java
View file @
96d7b661
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
;
/**
...
...
@@ -11,4 +12,11 @@ import org.jeecg.pm.entity.event.PmEventInfo;
*/
public
interface
IPmEventInfoService
extends
IService
<
PmEventInfo
>
{
/**
* 保存事件
* @param pmEventInfo
*/
void
saveEvent
(
PmEventInfo
pmEventInfo
);
}
jeecg-boot-parent/jeecg-boot-module-property/src/main/java/org/jeecg/pm/service/impl/event/PmEventInfoServiceImpl.java
View file @
96d7b661
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
;
...
...
@@ -10,10 +13,24 @@ import org.springframework.stereotype.Service;
/**
* @Description: pm_event_info
* @Author: jeecg-boot
* @Date:
2022-04-01
* @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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment