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
4a60f7d1
Commit
4a60f7d1
authored
Apr 10, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 信号服务优化
parent
be18693d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
SystemServiceStatusTask.java
...main/java/net/wanji/web/task/SystemServiceStatusTask.java
+22
-22
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/SystemServiceStatusTask.java
View file @
4a60f7d1
...
@@ -10,13 +10,11 @@ import net.wanji.web.common.util.date.DateStyle;
...
@@ -10,13 +10,11 @@ import net.wanji.web.common.util.date.DateStyle;
import
net.wanji.web.websocket.WebSocketServer
;
import
net.wanji.web.websocket.WebSocketServer
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -37,7 +35,8 @@ public class SystemServiceStatusTask {
...
@@ -37,7 +35,8 @@ public class SystemServiceStatusTask {
@Scheduled
(
fixedRate
=
1
*
60
*
1000
)
@Scheduled
(
fixedRate
=
1
*
60
*
1000
)
public
void
telnetStatus
()
throws
Exception
{
public
void
telnetStatus
()
throws
Exception
{
Set
<
WebSocketServer
>
webSocketSet
=
WebSocketServer
.
getWebSocketSet
(
Constant
.
WEBSOCKET_TOPIC_SYS_SERVICE_STATUS
);
if
(!
CollectionUtils
.
isEmpty
(
webSocketSet
))
{
for
(
SystemServiceStatusDTO
dto
:
sysList
)
{
for
(
SystemServiceStatusDTO
dto
:
sysList
)
{
String
ip
=
dto
.
getIp
();
String
ip
=
dto
.
getIp
();
int
port
=
dto
.
getPort
();
int
port
=
dto
.
getPort
();
...
@@ -56,7 +55,8 @@ public class SystemServiceStatusTask {
...
@@ -56,7 +55,8 @@ public class SystemServiceStatusTask {
}
}
}
}
List
<
SystemServiceStatusDTO
>
sort
=
sysList
.
stream
().
sorted
(
Comparator
.
comparing
(
SystemServiceStatusDTO:
:
getStartDate
)).
collect
(
Collectors
.
toList
());
List
<
SystemServiceStatusDTO
>
sort
=
sysList
.
stream
().
sorted
(
Comparator
.
comparing
(
SystemServiceStatusDTO:
:
getStartDate
)).
collect
(
Collectors
.
toList
());
WebSocketServer
.
sendInfo2All
(
JSON
.
toJSONString
(
sort
),
Constant
.
WEBSOCKET_TOPIC_SYS_SERVICE_STATUS
);
WebSocketServer
.
sendTopicInfo2All
(
JSON
.
toJSONString
(
sort
),
Constant
.
WEBSOCKET_TOPIC_SYS_SERVICE_STATUS
);
}
}
}
}
}
signal-control-service/src/main/java/net/wanji/web/websocket/WebSocketServer.java
View file @
4a60f7d1
...
@@ -170,7 +170,7 @@ public class WebSocketServer {
...
@@ -170,7 +170,7 @@ public class WebSocketServer {
* @param topic
* @param topic
* @throws IOException
* @throws IOException
*/
*/
public
static
void
sendInfo2All
(
String
message
,
String
topic
)
throws
IOException
{
public
static
void
send
Topic
Info2All
(
String
message
,
String
topic
)
throws
IOException
{
if
(
StringUtils
.
isNotBlank
(
topic
)
&&
webSocketMap
.
containsKey
(
topic
))
{
if
(
StringUtils
.
isNotBlank
(
topic
)
&&
webSocketMap
.
containsKey
(
topic
))
{
try
{
try
{
Set
<
WebSocketServer
>
socketSets
=
webSocketMap
.
get
(
topic
);
Set
<
WebSocketServer
>
socketSets
=
webSocketMap
.
get
(
topic
);
...
...
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