Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AmosBankRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bank
AmosBankRoot
Commits
5778d12a
Commit
5778d12a
authored
Jun 10, 2020
by
xinglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
科技处告警跑马灯展示
parent
6ab4d9c7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
26 deletions
+28
-26
EquipmentListener.java
.../java/com/yeejoin/amos/bank/config/EquipmentListener.java
+26
-22
SelfSupportListener.java
...ava/com/yeejoin/amos/bank/config/SelfSupportListener.java
+0
-1
BankInfoMapper.java
...java/com/yeejoin/amos/bank/dao/mapper/BankInfoMapper.java
+1
-1
IEquipmentService.java
...java/com/yeejoin/amos/bank/service/IEquipmentService.java
+0
-1
dbTemplate_bankInfo.xml
...tart/src/main/resources/db/mapper/dbTemplate_bankInfo.xml
+1
-1
No files found.
AmosBankService/src/main/java/com/yeejoin/amos/bank/config/EquipmentListener.java
View file @
5778d12a
...
@@ -114,8 +114,8 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -114,8 +114,8 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
JSONObject
metricJson
=
JSONObject
.
parseObject
(
string
);
JSONObject
metricJson
=
JSONObject
.
parseObject
(
string
);
String
communication
=
metricJson
.
get
(
"communication"
).
toString
();
String
communication
=
metricJson
.
get
(
"communication"
).
toString
();
int
status
=
communication
.
equals
(
"正常"
)
?
0
:
1
;
int
status
=
communication
.
equals
(
"正常"
)
?
0
:
1
;
int
sourceIdStatus
=
bankInfoMapper
.
findBySourceId
(
eqpId
);
String
sourceIdStatus
=
bankInfoMapper
.
findBySourceId
(
eqpId
);
if
(
status
!=
sourceIdStatus
)
{
if
(!
ObjectUtils
.
isEmpty
(
sourceIdStatus
)
&&
status
!=
Integer
.
valueOf
(
sourceIdStatus
).
intValue
()
)
{
bankInfoMapper
.
updateBySourceId
(
status
,
eqpId
);
bankInfoMapper
.
updateBySourceId
(
status
,
eqpId
);
Map
<
String
,
Object
>
resultMap
=
bankInfoMapper
.
selectBankInfoBySourceId
(
eqpId
);
Map
<
String
,
Object
>
resultMap
=
bankInfoMapper
.
selectBankInfoBySourceId
(
eqpId
);
...
@@ -153,15 +153,12 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -153,15 +153,12 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
// 获取ip
// 获取ip
String
ipAddress
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"IP"
);
String
ipAddress
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"IP"
);
// 所属楼层
// 所属楼层
String
lou
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"所属楼层"
);
String
lou
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"所属楼层"
);
// 三维位置
// 三维位置
String
sanwei
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"三维位置"
);
String
sanwei
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"三维位置"
);
// 资源ID
// 资源ID
String
sourceId
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"设备ID"
);
String
sourceId
=
getEqpConfigMapValueByKey
(
eqpConfigMap
,
"设备ID"
);
String
eqpName
=
parseObject
.
getString
(
"eqpName"
);
String
eqpName
=
parseObject
.
getString
(
"eqpName"
);
// orgcode
// orgcode
String
orgcode
=
parseObject
.
getString
(
"orgCode"
);
String
orgcode
=
parseObject
.
getString
(
"orgCode"
);
...
@@ -172,7 +169,9 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -172,7 +169,9 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
// 告警信息
// 告警信息
String
metricKey
=
""
;
String
metricKey
=
""
;
// 默认状态为正常
// 默认状态为正常
int
statusByName
=
0
;
Object
communication
=
JSONObject
.
parseObject
(((
JSONObject
)
jsonArray
.
get
(
0
)).
getString
(
"metricJson"
)).
get
(
"communication"
);
int
statusByName
=
!
ObjectUtils
.
isEmpty
(
communication
)
&&
communication
.
equals
(
"异常"
)
?
1
:
0
;
for
(
Object
e
:
jsonArray
)
{
for
(
Object
e
:
jsonArray
)
{
JSONObject
object
=
(
JSONObject
)
e
;
JSONObject
object
=
(
JSONObject
)
e
;
String
string
=
object
.
getString
(
"metricJson"
);
String
string
=
object
.
getString
(
"metricJson"
);
...
@@ -190,18 +189,14 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -190,18 +189,14 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
System
.
out
.
println
(
"----start chuli ip equipment state : "
+
entry
);
System
.
out
.
println
(
"----start chuli ip equipment state : "
+
entry
);
String
remark
=
entry
.
getKey
().
toString
();
String
remark
=
entry
.
getKey
().
toString
();
String
statusName
=
entry
.
getValue
().
toString
();
String
statusName
=
entry
.
getValue
().
toString
();
if
(
remark
.
equals
(
"communication"
))
{
if
(
remark
.
equals
(
"communication"
))
{
// 触发风险合格不合格
statusByName
=
riskAlarm
(
eqpId
,
remark
,
statusName
);
//拓扑闪烁
//拓扑闪烁
topographyAlarm
(
sourceId
,
statusByName
);
topographyAlarm
(
sourceId
,
statusByName
);
// 触发风险合格不合格
riskAlarm
(
eqpId
,
remark
,
statusName
);
}
}
}
}
}
}
;
// 增加报警(跑马灯,首页)
// 增加报警(跑马灯,首页)
addAlarmMethod
(
eqpId
,
statusByName
,
eqpName
,
ipAddress
,
metricKey
,
orgcode
,
sanwei
,
lou
);
addAlarmMethod
(
eqpId
,
statusByName
,
eqpName
,
ipAddress
,
metricKey
,
orgcode
,
sanwei
,
lou
);
...
@@ -216,8 +211,9 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -216,8 +211,9 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
}
}
private
Integer
riskAlarm
(
Long
eqpId
,
String
remark
,
String
statusName
)
{
private
Integer
riskAlarm
(
Long
eqpId
,
String
remark
,
String
statusName
)
{
int
statusByName
=
0
;
;
int
statusByName
=
0
;
EquipmentQualityVo
queryEquipmentPoint
=
equipmentMapper
.
queryEquipmentPoint
(
eqpId
,
remark
);
EquipmentQualityVo
queryEquipmentPoint
=
equipmentMapper
.
queryEquipmentPoint
(
eqpId
,
remark
);
if
(!
ObjectUtils
.
isEmpty
(
queryEquipmentPoint
))
{
Long
equipmentsPointId
=
queryEquipmentPoint
.
getId
();
Long
equipmentsPointId
=
queryEquipmentPoint
.
getId
();
List
<
Long
>
riskFactorId
=
equipmentMapper
.
judgeEquipmentExists
(
equipmentsPointId
);
List
<
Long
>
riskFactorId
=
equipmentMapper
.
judgeEquipmentExists
(
equipmentsPointId
);
if
(
"异常"
.
equals
(
statusName
))
{
if
(
"异常"
.
equals
(
statusName
))
{
...
@@ -238,6 +234,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -238,6 +234,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
logger
.
error
(
"update rpn fail "
+
e1
.
getMessage
());
logger
.
error
(
"update rpn fail "
+
e1
.
getMessage
());
}
}
}
}
}
return
statusByName
;
return
statusByName
;
}
}
...
@@ -246,7 +243,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -246,7 +243,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
TopographyNode
node
=
equipmentMapper
.
queryNodeBySourceId
(
sourceId
);
TopographyNode
node
=
equipmentMapper
.
queryNodeBySourceId
(
sourceId
);
// 拓扑闪烁
// 拓扑闪烁
if
(
null
!=
nod
e
)
{
if
(
null
!=
node
&&
node
.
getState
()
!=
statusByNam
e
)
{
node
.
setNumber
(
statusByName
);
node
.
setNumber
(
statusByName
);
node
.
setState
(
statusByName
);
node
.
setState
(
statusByName
);
equipmentMapper
.
updateNodeState
(
node
);
equipmentMapper
.
updateNodeState
(
node
);
...
@@ -264,6 +261,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -264,6 +261,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
/**
/**
* 根据eqpConfigMap中的key获取value
* 根据eqpConfigMap中的key获取value
*
* @param eqpConfigMap
* @param eqpConfigMap
* @param key
* @param key
* @return
* @return
...
@@ -285,6 +283,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -285,6 +283,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
/**
/**
* 增加告警记录
* 增加告警记录
*
* @param eqpId
* @param eqpId
* @param metricKey
* @param metricKey
* @param statusByName
* @param statusByName
...
@@ -292,7 +291,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -292,7 +291,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
* @param ipAddress
* @param ipAddress
* @param eqpName
* @param eqpName
*/
*/
public
void
addAlarmRecord
(
Long
eqpId
,
String
metricKey
,
Integer
statusByName
,
String
orgCode1
,
String
ipAddress
,
String
eqpName
)
{
public
void
addAlarmRecord
(
Long
eqpId
,
String
metricKey
,
Integer
statusByName
,
String
orgCode1
,
String
ipAddress
,
String
eqpName
)
{
List
<
Alarm
>
curAlarmList
=
alarmService
.
findByQueryColumn
(
eqpId
+
metricKey
);
List
<
Alarm
>
curAlarmList
=
alarmService
.
findByQueryColumn
(
eqpId
+
metricKey
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
(
curAlarmList
!=
null
&&
curAlarmList
.
size
()
>
0
)
{
if
(
curAlarmList
!=
null
&&
curAlarmList
.
size
()
>
0
)
{
...
@@ -335,7 +334,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -335,7 +334,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
}
}
}
}
public
void
addAlarmMethod
(
Long
eqpId
,
Integer
statusByName
,
String
eqpName
,
String
ipAddress
,
String
metricKey
,
String
orgCode
,
String
sanwei
,
String
lou
)
throws
IOException
{
public
void
addAlarmMethod
(
Long
eqpId
,
Integer
statusByName
,
String
eqpName
,
String
ipAddress
,
String
metricKey
,
String
orgCode
,
String
sanwei
,
String
lou
)
throws
IOException
{
List
<
AlarmPoint
>
alarmPoint
=
alarmPointService
.
selectPointTypeAndPointId
(
AlarmPointTypeEnum
.
设备
.
getCode
(),
List
<
AlarmPoint
>
alarmPoint
=
alarmPointService
.
selectPointTypeAndPointId
(
AlarmPointTypeEnum
.
设备
.
getCode
(),
eqpId
);
eqpId
);
if
(
alarmPoint
!=
null
&&
alarmPoint
.
size
()
>
0
)
{
if
(
alarmPoint
!=
null
&&
alarmPoint
.
size
()
>
0
)
{
...
@@ -343,7 +342,9 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -343,7 +342,9 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
if
(
statusByName
==
0
)
{
if
(
statusByName
==
0
)
{
// 删除告警
// 删除告警
alarmPointService
.
delete
(
alarmPoint
.
get
(
0
));
alarmPointService
.
delete
(
alarmPoint
.
get
(
0
));
pushAlarmPoint
(
"alarmPoint"
,
alarmPointService
.
findAll
());
}
}
return
;
}
else
{
}
else
{
// 不存在,判断当前状态是不是合格,不合格新增,合格不做任何操作
// 不存在,判断当前状态是不是合格,不合格新增,合格不做任何操作
if
(
statusByName
!=
0
)
{
if
(
statusByName
!=
0
)
{
...
@@ -364,13 +365,16 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
...
@@ -364,13 +365,16 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
alarmPoint1
.
setPointAttrs
(
JSON
.
toJSONString
(
map
));
alarmPoint1
.
setPointAttrs
(
JSON
.
toJSONString
(
map
));
alarmPointService
.
save
(
alarmPoint1
);
alarmPointService
.
save
(
alarmPoint1
);
// 推送告警
// 推送告警
List
<
AlarmPoint
>
list
=
alarmPointService
.
findAll
();
pushAlarmPoint
(
"alarmPoint"
,
alarmPointService
.
findAll
());
WebsocketParam
param
=
new
WebsocketParam
(
"alarmPoint"
,
JSON
.
toJSONString
(
list
));
Properties
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"application.properties"
);
String
url
=
(
String
)
props
.
get
(
"params.remoteWebsocketUrl"
)
+
"/generic/sendMessage"
;
HttpUtil
.
PostJson
(
url
,
JSON
.
toJSONString
(
param
));
}
}
}
}
}
}
/**
* 发送跑马灯告警
*/
public
void
pushAlarmPoint
(
String
WS
,
Object
object
)
{
WebsocketParam
param
=
new
WebsocketParam
(
WS
,
JSON
.
toJSONString
(
object
));
client
.
sendMessage
(
param
);
}
}
}
AmosBankService/src/main/java/com/yeejoin/amos/bank/config/SelfSupportListener.java
View file @
5778d12a
...
@@ -234,7 +234,6 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
...
@@ -234,7 +234,6 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
Properties
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"application.properties"
);
Properties
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"application.properties"
);
String
url
=
(
String
)
props
.
get
(
"params.remoteWebsocketUrl"
)
+
"/generic/sendMessage"
;
String
url
=
(
String
)
props
.
get
(
"params.remoteWebsocketUrl"
)
+
"/generic/sendMessage"
;
HttpUtil
.
PostJson
(
url
,
JSON
.
toJSONString
(
param
));
HttpUtil
.
PostJson
(
url
,
JSON
.
toJSONString
(
param
));
}
}
}
}
...
...
AmosBankService/src/main/java/com/yeejoin/amos/bank/dao/mapper/BankInfoMapper.java
View file @
5778d12a
...
@@ -16,7 +16,7 @@ public interface BankInfoMapper extends BaseMapper {
...
@@ -16,7 +16,7 @@ public interface BankInfoMapper extends BaseMapper {
List
<
BankInfoDTO
>
selectBankInfoList
();
List
<
BankInfoDTO
>
selectBankInfoList
();
int
findBySourceId
(
@Param
(
"sourceId"
)
Long
sourceId
);
String
findBySourceId
(
@Param
(
"sourceId"
)
Long
sourceId
);
void
updateBySourceId
(
@Param
(
"status"
)
int
status
,
@Param
(
"sourceId"
)
Long
sourceId
);
void
updateBySourceId
(
@Param
(
"status"
)
int
status
,
@Param
(
"sourceId"
)
Long
sourceId
);
...
...
AmosBankService/src/main/java/com/yeejoin/amos/bank/service/IEquipmentService.java
View file @
5778d12a
...
@@ -40,5 +40,4 @@ public interface IEquipmentService {
...
@@ -40,5 +40,4 @@ public interface IEquipmentService {
List
<
PointParam
>
handlePatrolPointData
(
Long
factorId
)
throws
InnerInvokException
;
List
<
PointParam
>
handlePatrolPointData
(
Long
factorId
)
throws
InnerInvokException
;
Map
<
String
,
List
>
handlePointDatas
(
Long
factorId
)
throws
InnerInvokException
;
Map
<
String
,
List
>
handlePointDatas
(
Long
factorId
)
throws
InnerInvokException
;
}
}
AmosBankStart/src/main/resources/db/mapper/dbTemplate_bankInfo.xml
View file @
5778d12a
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
from b_bank_info Bi left join b_bank_equipment Be on Bi.id = Be.bank_id group by Bi.id
from b_bank_info Bi left join b_bank_equipment Be on Bi.id = Be.bank_id group by Bi.id
</select>
</select>
<select
id=
"findBySourceId"
resultType=
"
int
"
>
<select
id=
"findBySourceId"
resultType=
"
String
"
>
select status from b_bank_equipment where 1=1 and source_id = #{sourceId}
select status from b_bank_equipment where 1=1 and source_id = #{sourceId}
</select>
</select>
...
...
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