Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
signal
traffic-signal-platform
Commits
e91e52c8
Commit
e91e52c8
authored
May 05, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 信号机告警优化
parent
3777bf1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
53 deletions
+62
-53
CommonEventWarnTask.java
...src/main/java/net/wanji/web/task/CommonEventWarnTask.java
+61
-52
WebSocketServer.java
...rc/main/java/net/wanji/web/websocket/WebSocketServer.java
+1
-1
No files found.
signal-control-service/src/main/java/net/wanji/web/task/CommonEventWarnTask.java
View file @
e91e52c8
...
...
@@ -82,46 +82,51 @@ public class CommonEventWarnTask {
* @return
*/
private
JsonViewObject
getSignalWarnData
()
{
List
<
CommonEventAlarmOutVo
>
results
=
new
ArrayList
<>();
JsonViewObject
jsonViewObject
=
utcFeignClients
.
runningStatusAlarm
();
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCode
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"信号机告警UTC服务调用异常!"
);
}
JsonViewObject
jsonViewObject
=
null
;
try
{
List
<
CommonEventAlarmOutVo
>
results
=
new
ArrayList
<>();
jsonViewObject
=
utcFeignClients
.
runningStatusAlarm
();
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCode
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"信号机告警UTC服务调用异常!"
);
}
LocalDateTime
now
=
LocalDateTime
.
now
();
String
formatNow
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
now
);
List
<
Map
<
String
,
Object
>>
content
=
(
List
<
Map
<
String
,
Object
>>)
jsonViewObject
.
getContent
();
content
.
forEach
(
map
->
{
Map
<
String
,
Object
>
result
=
map
;
String
signalId
=
(
String
)
result
.
get
(
"signalId"
);
String
crossId
=
(
String
)
result
.
get
(
"crossId"
);
Integer
currentStatus
=
(
Integer
)
result
.
get
(
"status"
);
Integer
currentFaultType
=
(
Integer
)
result
.
get
(
"faultType"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
String
formatNow
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
now
);
List
<
Map
<
String
,
Object
>>
content
=
(
List
<
Map
<
String
,
Object
>>)
jsonViewObject
.
getContent
();
content
.
forEach
(
map
->
{
Map
<
String
,
Object
>
result
=
map
;
String
signalId
=
(
String
)
result
.
get
(
"signalId"
);
String
crossId
=
(
String
)
result
.
get
(
"crossId"
);
Integer
currentStatus
=
(
Integer
)
result
.
get
(
"status"
);
Integer
currentFaultType
=
(
Integer
)
result
.
get
(
"faultType"
);
String
coordinate
=
""
;
String
crossName
=
""
;
TDeviceStatusInfo
tDeviceStatusInfo1
=
new
TDeviceStatusInfo
();
if
(
StringUtils
.
isNotEmpty
(
crossId
))
{
CrossInfoPO
tBaseCrossInfo
=
situationDetectionService
.
selectCrossInfoById
(
crossId
);
if
(
Objects
.
nonNull
(
tBaseCrossInfo
))
{
coordinate
=
tBaseCrossInfo
.
getLocation
();
String
coordinate
=
""
;
String
crossName
=
""
;
TDeviceStatusInfo
tDeviceStatusInfo1
=
new
TDeviceStatusInfo
();
if
(
StringUtils
.
isNotEmpty
(
crossId
))
{
CrossInfoPO
tBaseCrossInfo
=
situationDetectionService
.
selectCrossInfoById
(
crossId
);
if
(
Objects
.
nonNull
(
tBaseCrossInfo
))
{
coordinate
=
tBaseCrossInfo
.
getLocation
();
}
QueryWrapper
<
TDeviceStatusInfo
>
queryWrapper
=
new
QueryWrapper
<>();
TDeviceStatusInfo
tDeviceStatusInfo
=
tDeviceStatusMapper
.
selectOne
(
queryWrapper
.
eq
(
"code"
,
crossId
));
if
(
Objects
.
nonNull
(
tDeviceStatusInfo
))
{
tDeviceStatusInfo1
=
tDeviceStatusInfo
;
crossName
=
tDeviceStatusInfo
.
getName
();
}
}
QueryWrapper
<
TDeviceStatusInfo
>
queryWrapper
=
new
QueryWrapper
<>();
TDeviceStatusInfo
tDeviceStatusInfo
=
tDeviceStatusMapper
.
selectOne
(
queryWrapper
.
eq
(
"code"
,
crossId
));
if
(
Objects
.
nonNull
(
tDeviceStatusInfo
))
{
tDeviceStatusInfo1
=
tDeviceStatusInfo
;
crossName
=
tDeviceStatusInfo
.
getName
();
}
}
buildSignalWarnData
(
results
,
formatNow
,
signalId
,
currentStatus
,
currentFaultType
,
coordinate
,
crossName
,
tDeviceStatusInfo1
);
});
// 无告警数据
if
(
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
buildSignalWarnData
(
results
,
formatNow
,
signalId
,
currentStatus
,
currentFaultType
,
coordinate
,
crossName
,
tDeviceStatusInfo1
);
});
// 无告警数据
if
(
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
}
jsonViewObject
.
setTimestamp
(
now
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
());
jsonViewObject
.
setContent
(
results
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取信号机告警数据失败"
,
e
);
}
jsonViewObject
.
setTimestamp
(
now
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
());
jsonViewObject
.
setContent
(
results
);
return
jsonViewObject
;
}
...
...
@@ -138,24 +143,28 @@ public class CommonEventWarnTask {
* @param tDeviceStatusInfo1
*/
private
static
void
buildSignalWarnData
(
List
<
CommonEventAlarmOutVo
>
results
,
String
formatNow
,
String
signalId
,
Integer
currentStatus
,
Integer
currentFaultType
,
String
coordinate
,
String
crossName
,
TDeviceStatusInfo
tDeviceStatusInfo1
)
{
if
(
SignalStatusTask
.
isExucuteUpdate
(
currentStatus
,
currentFaultType
,
tDeviceStatusInfo1
))
{
CommonEventAlarmOutVo
commonEventAlarmOutVo
=
new
CommonEventAlarmOutVo
();
commonEventAlarmOutVo
.
setEventType
(
3
);
commonEventAlarmOutVo
.
setEventId
(
signalId
);
commonEventAlarmOutVo
.
setEventName
(
crossName
);
if
(
currentStatus
==
0
)
{
commonEventAlarmOutVo
.
setStatus
(
"11"
);
commonEventAlarmOutVo
.
setEventDesc
(
crossName
.
concat
(
"信号机离线"
));
}
else
if
(
currentStatus
==
1
){
commonEventAlarmOutVo
.
setStatus
(
String
.
valueOf
(
0
));
commonEventAlarmOutVo
.
setEventDesc
(
crossName
.
concat
(
"信号机上线"
));
}
else
{
commonEventAlarmOutVo
.
setStatus
(
String
.
valueOf
(
currentFaultType
));
commonEventAlarmOutVo
.
setEventDesc
(
crossName
.
concat
(
"信号机故障"
));
try
{
if
(
SignalStatusTask
.
isExucuteUpdate
(
currentStatus
,
currentFaultType
,
tDeviceStatusInfo1
))
{
CommonEventAlarmOutVo
commonEventAlarmOutVo
=
new
CommonEventAlarmOutVo
();
commonEventAlarmOutVo
.
setEventType
(
3
);
commonEventAlarmOutVo
.
setEventId
(
signalId
);
commonEventAlarmOutVo
.
setEventName
(
crossName
);
if
(
currentStatus
==
0
)
{
commonEventAlarmOutVo
.
setStatus
(
"11"
);
commonEventAlarmOutVo
.
setEventDesc
(
crossName
.
concat
(
"信号机离线"
));
}
else
if
(
currentStatus
==
1
){
commonEventAlarmOutVo
.
setStatus
(
String
.
valueOf
(
0
));
commonEventAlarmOutVo
.
setEventDesc
(
crossName
.
concat
(
"信号机上线"
));
}
else
{
commonEventAlarmOutVo
.
setStatus
(
String
.
valueOf
(
currentFaultType
));
commonEventAlarmOutVo
.
setEventDesc
(
crossName
.
concat
(
"信号机故障"
));
}
commonEventAlarmOutVo
.
setStartTime
(
formatNow
);
commonEventAlarmOutVo
.
setCoordinate
(
coordinate
);
results
.
add
(
commonEventAlarmOutVo
);
}
commonEventAlarmOutVo
.
setStartTime
(
formatNow
);
commonEventAlarmOutVo
.
setCoordinate
(
coordinate
);
results
.
add
(
commonEventAlarmOutVo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"构建信号机告警数据失败"
,
e
);
}
}
}
signal-control-service/src/main/java/net/wanji/web/websocket/WebSocketServer.java
View file @
e91e52c8
...
...
@@ -130,7 +130,7 @@ public class WebSocketServer {
*/
@OnError
public
void
onError
(
Session
session
,
Throwable
error
)
{
log
.
error
(
"主题:{},socket:{},连接异常,异常信息:{}"
,
topic
,
userId
,
error
);
log
.
error
(
"主题:{},socket:{},连接异常,异常信息:{}"
,
topic
,
userId
,
error
.
getMessage
()
);
}
/**
...
...
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