Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
3a86c88d
Commit
3a86c88d
authored
Jun 10, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计总的在线数量和sam数量
parent
3857c8b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
2 deletions
+43
-2
SamMapController.java
...java/iot/sixiang/license/controller/SamMapController.java
+39
-0
OperateSAMStatusResponseEventHandler.java
...g/license/event/OperateSAMStatusResponseEventHandler.java
+0
-2
OperateManager.java
...main/java/iot/sixiang/license/operate/OperateManager.java
+4
-0
No files found.
license/src/main/java/iot/sixiang/license/controller/SamMapController.java
0 → 100644
View file @
3a86c88d
package
iot
.
sixiang
.
license
.
controller
;
import
iot.sixiang.license.model.SamMonitor
;
import
iot.sixiang.license.operate.OperateManager
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by m33 on 2022/6/10 16:43
*/
@Slf4j
@RestController
@RequestMapping
(
"/iot_license/sam"
)
public
class
SamMapController
{
@Autowired
public
OperateManager
operateManager
;
@GetMapping
(
"count"
)
public
Map
<
String
,
Integer
>
getSamTotalCount
()
{
Map
<
String
,
SamMonitor
>
samMonitorMap
=
operateManager
.
getSamMonitorMap
();
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
int
totalSamCount
=
0
;
int
totalOnlineCount
=
0
;
for
(
SamMonitor
samMonitor:
samMonitorMap
.
values
())
{
totalSamCount
+=
samMonitor
.
getSamCount
();
totalOnlineCount
+=
samMonitor
.
getOnlineCount
();
}
map
.
put
(
"totalSamCount"
,
totalSamCount
);
map
.
put
(
"totalOnlineCount"
,
totalOnlineCount
);
return
map
;
}
}
license/src/main/java/iot/sixiang/license/event/OperateSAMStatusResponseEventHandler.java
View file @
3a86c88d
...
...
@@ -43,7 +43,5 @@ public class OperateSAMStatusResponseEventHandler {
samMonitor
.
setOnlineCount
(
onlineCount
);
samMonitor
.
setSamCount
(
samCount
);
operateManager
.
putSamMonitorMap
(
serverIp
,
samMonitor
);
int
allSamCount
=
0
;
int
allOnlineCount
=
0
;
}
}
license/src/main/java/iot/sixiang/license/operate/OperateManager.java
View file @
3a86c88d
...
...
@@ -26,6 +26,10 @@ public class OperateManager {
samMonitorMap
=
new
HashMap
<>();
}
public
synchronized
Map
<
String
,
SamMonitor
>
getSamMonitorMap
()
{
return
samMonitorMap
;
}
public
synchronized
void
putSamMonitorMap
(
String
serverIp
,
SamMonitor
samMonitor
)
{
samMonitorMap
.
put
(
serverIp
,
samMonitor
);
}
...
...
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