Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
9d4a4b3e
Commit
9d4a4b3e
authored
Apr 27, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加告警日志信息
parent
5204032c
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
731 additions
and
338 deletions
+731
-338
device-manager/db/add.sql
device-manager/db/add.sql
+2
-0
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
...ase/framework/listener/CustomerKeyExpirationListener.java
+5
-5
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceAlarmInfoEntity.java
...ortals/xhx/module/device/model/DeviceAlarmInfoEntity.java
+17
-156
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceAlarmInfoQuery.java
...mortals/xhx/module/device/model/DeviceAlarmInfoQuery.java
+479
-109
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceAlarmInfoController.java
...tals/xhx/module/device/web/DeviceAlarmInfoController.java
+12
-7
device-manager/src/main/resources/sqlmap/module/device/DeviceAlarmInfoMapper.xml
.../resources/sqlmap/module/device/DeviceAlarmInfoMapper.xml
+216
-61
doc/设备管理系统.doc
doc/设备管理系统.doc
+0
-0
doc/设备管理系统.docx
doc/设备管理系统.docx
+0
-0
No files found.
device-manager/db/add.sql
View file @
9d4a4b3e
...
...
@@ -28,3 +28,5 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `productCode` varchar (64) default ''
ALTER
TABLE
mortals_xhx_device
ADD
COLUMN
`hallId`
bigint
(
20
)
COMMENT
'大厅Id'
AFTER
skinName
;
ALTER
TABLE
mortals_xhx_device
ADD
COLUMN
`hallName`
varchar
(
256
)
default
''
COMMENT
'大厅名称'
AFTER
hallId
;
ALTER
TABLE
mortals_xhx_device_alarm_info
ADD
COLUMN
`deviceCode`
varchar
(
256
)
default
''
COMMENT
'设备编码'
AFTER
alarmDevice
;
ALTER
TABLE
mortals_xhx_device_alarm_info
ADD
COLUMN
`deviceName`
varchar
(
256
)
default
''
COMMENT
'设备名称'
AFTER
deviceCode
;
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
View file @
9d4a4b3e
package
com.mortals.xhx.base.framework.listener
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.util.UuidUtil
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.RespData
;
...
...
@@ -87,7 +85,9 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmInfoEntity
.
initAttrValue
();
alarmInfoEntity
.
setAlarmDevice
(
deviceEntity
.
getId
());
alarmInfoEntity
.
setSiteId
(
deviceEntity
.
getSiteId
());
alarmInfoEntity
.
setAlarmContent
(
String
.
format
(
"设备告警:%s设备:%s已离线,请注意检查!"
,
productEntity
.
getProductName
(),
deviceEntity
.
getDeviceName
()+
":"
+
deviceEntity
.
getDeviceName
()
));
alarmInfoEntity
.
setDeviceName
(
deviceEntity
.
getDeviceName
());
alarmInfoEntity
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
alarmInfoEntity
.
setAlarmContent
(
String
.
format
(
"设备告警:%s设备:%s已离线,请注意检查!"
,
productEntity
.
getProductName
(),
deviceEntity
.
getDeviceName
()
+
":"
+
deviceEntity
.
getDeviceName
()));
alarmInfoEntity
.
setAlarmType
(
AlarmTypeEnum
.
离线
.
getValue
());
alarmInfoEntity
.
setAlarmLevel
(
AlarmLevelEnum
.
一般
.
getValue
());
alarmInfoEntity
.
setAlarmStatus
(
AlarmStatusEnum
.
未清除
.
getValue
());
...
...
@@ -118,8 +118,8 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmSmsSendEntity
.
setMobile
(
deviceAlarmInfoEntity
.
getReceivePersonnelTelephone
());
alarmSmsSendEntity
.
setReceiver
(
deviceAlarmInfoEntity
.
getAlarmReceivePersonnel
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"1"
,
productEntity
.
getProductName
());
map
.
put
(
"2"
,
deviceEntity
.
getDeviceName
()+
":"
+
deviceEntity
.
getDeviceName
());
map
.
put
(
"1"
,
productEntity
.
getProductName
());
map
.
put
(
"2"
,
deviceEntity
.
getDeviceName
()
+
":"
+
deviceEntity
.
getDeviceName
());
alarmSmsSendEntity
.
setSendMess
(
JSON
.
toJSONString
(
map
));
alarmSmsSendEntity
.
setSendStatus
(
SendStatusEnum
.
未发送
.
getValue
());
alarmSmsSendService
.
save
(
alarmSmsSendEntity
,
null
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceAlarmInfoEntity.java
View file @
9d4a4b3e
package
com.mortals.xhx.module.device.model
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.ArrayList
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.device.model.vo.DeviceAlarmInfoVo
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 设备告警日志实体对象
*
* @author zxfei
* @date 202
2-08-22
* @date 202
3-04-27
*/
@Data
public
class
DeviceAlarmInfoEntity
extends
DeviceAlarmInfoVo
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -25,10 +22,6 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
* 告警设备Id
*/
private
Long
alarmDevice
;
/**
* 站点Id,来源基础服务平台
*/
private
Long
siteId
;
/**
* 告警类型,(0.离线)
*/
...
...
@@ -53,140 +46,18 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
* 告警详细内容
*/
private
String
alarmContent
;
public
DeviceAlarmInfoEntity
(){}
/**
* 获取 告警时间
* @return Date
*/
public
Date
getAlarmTime
(){
return
alarmTime
;
}
/**
* 设置 告警时间
* @param alarmTime
*/
public
void
setAlarmTime
(
Date
alarmTime
){
this
.
alarmTime
=
alarmTime
;
}
/**
* 获取 告警设备Id
* @return Long
*/
public
Long
getAlarmDevice
(){
return
alarmDevice
;
}
/**
* 设置 告警设备Id
* @param alarmDevice
*/
public
void
setAlarmDevice
(
Long
alarmDevice
){
this
.
alarmDevice
=
alarmDevice
;
}
/**
* 获取 站点Id,来源基础服务平台
* @return Long
*/
public
Long
getSiteId
(){
return
siteId
;
}
/**
* 设置 站点Id,来源基础服务平台
* @param siteId
*/
public
void
setSiteId
(
Long
siteId
){
this
.
siteId
=
siteId
;
}
/**
* 获取 告警类型,(0.离线)
* @return Integer
*/
public
Integer
getAlarmType
(){
return
alarmType
;
}
/**
* 设置 告警类型,(0.离线)
* @param alarmType
*/
public
void
setAlarmType
(
Integer
alarmType
){
this
.
alarmType
=
alarmType
;
}
/**
* 获取 告警级别(0.危险,1.次要,2.一般)
* @return Integer
*/
public
Integer
getAlarmLevel
(){
return
alarmLevel
;
}
/**
* 设置 告警级别(0.危险,1.次要,2.一般)
* @param alarmLevel
*/
public
void
setAlarmLevel
(
Integer
alarmLevel
){
this
.
alarmLevel
=
alarmLevel
;
}
/**
* 获取 接收人员[设备管理的责任人]
* @return String
*/
public
String
getAlarmReceivePersonnel
(){
return
alarmReceivePersonnel
;
}
/**
* 设置 接收人员[设备管理的责任人]
* @param alarmReceivePersonnel
*/
public
void
setAlarmReceivePersonnel
(
String
alarmReceivePersonnel
){
this
.
alarmReceivePersonnel
=
alarmReceivePersonnel
;
}
/**
* 获取 接收人员电话
* @return String
*/
public
String
getReceivePersonnelTelephone
(){
return
receivePersonnelTelephone
;
}
/**
* 设置 接收人员电话
* @param receivePersonnelTelephone
*/
public
void
setReceivePersonnelTelephone
(
String
receivePersonnelTelephone
){
this
.
receivePersonnelTelephone
=
receivePersonnelTelephone
;
}
/**
* 获取 告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)
* @return Integer
*/
public
Integer
getAlarmStatus
(){
return
alarmStatus
;
}
/**
* 设置 告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)
* @param alarmStatus
* 站点Id,来源基础服务平台
*/
public
void
setAlarmStatus
(
Integer
alarmStatus
){
this
.
alarmStatus
=
alarmStatus
;
}
private
Long
siteId
;
/**
* 获取 告警详细内容
* @return String
* 设备编码
*/
public
String
getAlarmContent
(){
return
alarmContent
;
}
private
String
deviceCode
;
/**
* 设置 告警详细内容
* @param alarmContent
* 设备名称
*/
public
void
setAlarmContent
(
String
alarmContent
){
this
.
alarmContent
=
alarmContent
;
}
private
String
deviceName
;
@Override
public
int
hashCode
()
{
return
this
.
getId
().
hashCode
();
...
...
@@ -203,28 +74,12 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
return
false
;
}
public
String
toString
(){
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
",alarmTime:"
).
append
(
getAlarmTime
());
sb
.
append
(
",alarmDevice:"
).
append
(
getAlarmDevice
());
sb
.
append
(
",siteId:"
).
append
(
getSiteId
());
sb
.
append
(
",alarmType:"
).
append
(
getAlarmType
());
sb
.
append
(
",alarmLevel:"
).
append
(
getAlarmLevel
());
sb
.
append
(
",alarmReceivePersonnel:"
).
append
(
getAlarmReceivePersonnel
());
sb
.
append
(
",receivePersonnelTelephone:"
).
append
(
getReceivePersonnelTelephone
());
sb
.
append
(
",alarmStatus:"
).
append
(
getAlarmStatus
());
sb
.
append
(
",alarmContent:"
).
append
(
getAlarmContent
());
return
sb
.
toString
();
}
public
void
initAttrValue
(){
this
.
alarmTime
=
null
;
this
.
alarmDevice
=
null
;
this
.
siteId
=
null
;
this
.
alarmType
=
null
;
this
.
alarmLevel
=
null
;
...
...
@@ -236,5 +91,11 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
this
.
alarmStatus
=
0
;
this
.
alarmContent
=
""
;
this
.
siteId
=
null
;
this
.
deviceCode
=
""
;
this
.
deviceName
=
""
;
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceAlarmInfoQuery.java
View file @
9d4a4b3e
This diff is collapsed.
Click to expand it.
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceAlarmInfoController.java
View file @
9d4a4b3e
...
...
@@ -2,17 +2,14 @@ package com.mortals.xhx.module.device.web;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.code.DeviceStatusEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.module.device.model.DeviceAlarmInfoEntity
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceQuery
;
import
com.mortals.xhx.module.device.service.DeviceAlarmInfoService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -48,14 +45,22 @@ public class DeviceAlarmInfoController extends BaseCRUDJsonBodyMappingController
super
.
init
(
model
,
context
);
}
@Override
protected
void
doListBefore
(
DeviceAlarmInfoEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
query
.
setOrderField
(
"createTime"
);
query
.
setOrderKind
(
OrderCol
.
DESCENDING
);
super
.
doListBefore
(
query
,
model
,
context
);
}
@Override
protected
int
doListAfter
(
DeviceAlarmInfoEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
List
<
DeviceAlarmInfoEntity
>
alarmInfoEntityList
=
this
.
service
.
find
(
query
,
context
);
Map
<
Integer
,
Long
>
collect
=
alarmInfoEntityList
.
stream
().
collect
(
Collectors
.
groupingBy
(
DeviceAlarmInfoEntity:
:
getAlarmLevel
,
Collectors
.
counting
()));
model
.
put
(
"totalCount"
,
alarmInfoEntityList
.
size
());
model
.
put
(
"dangerCount"
,
collect
.
getOrDefault
(
0
,
0L
));
model
.
put
(
"subCount"
,
collect
.
getOrDefault
(
1
,
0L
));
model
.
put
(
"normalCount"
,
collect
.
getOrDefault
(
2
,
0L
));
model
.
put
(
"dangerCount"
,
collect
.
getOrDefault
(
0
,
0L
));
model
.
put
(
"subCount"
,
collect
.
getOrDefault
(
1
,
0L
));
model
.
put
(
"normalCount"
,
collect
.
getOrDefault
(
2
,
0L
));
return
super
.
doListAfter
(
query
,
model
,
context
);
}
...
...
device-manager/src/main/resources/sqlmap/module/device/DeviceAlarmInfoMapper.xml
View file @
9d4a4b3e
This diff is collapsed.
Click to expand it.
doc/设备管理系统.doc
deleted
100644 → 0
View file @
5204032c
File deleted
doc/设备管理系统.docx
View file @
9d4a4b3e
No preview for this file type
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