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
a7e9c41a
Commit
a7e9c41a
authored
Jun 10, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'm33' into 'master'
M33 See merge request
!19
parents
cd38a6d8
87a136de
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
23 deletions
+98
-23
Maven__com_auth0_java_jwt_3_8_2.xml
.idea/libraries/Maven__com_auth0_java_jwt_3_8_2.xml
+13
-0
Maven__commons_codec_commons_codec_1_15.xml
.idea/libraries/Maven__commons_codec_commons_codec_1_15.xml
+13
-0
Maven__org_apache_commons_commons_collections4_4_1.xml
...es/Maven__org_apache_commons_commons_collections4_4_1.xml
+13
-0
Maven__org_apache_poi_poi_3_17.xml
.idea/libraries/Maven__org_apache_poi_poi_3_17.xml
+13
-0
OperateSAMStatusResponseEventHandler.java
...g/license/event/OperateSAMStatusResponseEventHandler.java
+16
-0
ForwardConnectionListener.java
...ot/sixiang/license/forward/ForwardConnectionListener.java
+14
-16
OperateConnectionListener.java
...ot/sixiang/license/operate/OperateConnectionListener.java
+16
-7
No files found.
.idea/libraries/Maven__com_auth0_java_jwt_3_8_2.xml
0 → 100644
View file @
a7e9c41a
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.auth0:java-jwt:3.8.2"
>
<CLASSES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/com/auth0/java-jwt/3.8.2/java-jwt-3.8.2.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://C:/tools/Spring/mvn_repository/com/auth0/java-jwt/3.8.2/java-jwt-3.8.2-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/com/auth0/java-jwt/3.8.2/java-jwt-3.8.2-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__commons_codec_commons_codec_1_15.xml
0 → 100644
View file @
a7e9c41a
<component
name=
"libraryTable"
>
<library
name=
"Maven: commons-codec:commons-codec:1.15"
>
<CLASSES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://C:/tools/Spring/mvn_repository/commons-codec/commons-codec/1.15/commons-codec-1.15-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/commons-codec/commons-codec/1.15/commons-codec-1.15-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__org_apache_commons_commons_collections4_4_1.xml
0 → 100644
View file @
a7e9c41a
<component
name=
"libraryTable"
>
<library
name=
"Maven: org.apache.commons:commons-collections4:4.1"
>
<CLASSES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://C:/tools/Spring/mvn_repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__org_apache_poi_poi_3_17.xml
0 → 100644
View file @
a7e9c41a
<component
name=
"libraryTable"
>
<library
name=
"Maven: org.apache.poi:poi:3.17"
>
<CLASSES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/org/apache/poi/poi/3.17/poi-3.17.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://C:/tools/Spring/mvn_repository/org/apache/poi/poi/3.17/poi-3.17-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://C:/tools/Spring/mvn_repository/org/apache/poi/poi/3.17/poi-3.17-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
license/src/main/java/iot/sixiang/license/event/OperateSAMStatusResponseEventHandler.java
View file @
a7e9c41a
...
...
@@ -5,6 +5,7 @@ import iot.sixiang.license.device.DeviceProtocol;
import
iot.sixiang.license.model.SamInfo
;
import
iot.sixiang.license.model.SamMonitor
;
import
iot.sixiang.license.operate.OperateManager
;
import
iot.sixiang.license.service.AlarmService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
...
...
@@ -22,6 +23,9 @@ public class OperateSAMStatusResponseEventHandler {
@Autowired
public
OperateManager
operateManager
;
@Autowired
private
AlarmService
alarmService
;
public
OperateSAMStatusResponseEventHandler
()
{
}
...
...
@@ -36,6 +40,12 @@ public class OperateSAMStatusResponseEventHandler {
for
(
SamInfo
samInfo
:
samInfoList
)
{
if
(
samInfo
.
getStatus
()
==
0
||
samInfo
.
getStatus
()
==
1
||
samInfo
.
getStatus
()
==
2
||
samInfo
.
getStatus
()
==
4
)
{
onlineCount
++;
}
else
{
int
index
=
samInfo
.
getIndex
();
int
typeId
=
2
;
String
title
=
"SAM故障"
;
String
content
=
"index为"
+
index
+
"的SAM发生故障"
;
alarmService
.
addAlarm
(
typeId
,
title
,
content
);
}
}
SamMonitor
samMonitor
=
new
SamMonitor
();
...
...
@@ -43,5 +53,11 @@ public class OperateSAMStatusResponseEventHandler {
samMonitor
.
setOnlineCount
(
onlineCount
);
samMonitor
.
setSamCount
(
samCount
);
operateManager
.
putSamMonitorMap
(
serverIp
,
samMonitor
);
if
(
onlineCount
/
samCount
>
0.7
)
{
int
typeId
=
3
;
String
title
=
"SAM不足"
;
String
content
=
"当前在线客户端已超过70%"
;
alarmService
.
addAlarm
(
typeId
,
title
,
content
);
}
}
}
license/src/main/java/iot/sixiang/license/forward/ForwardConnectionListener.java
View file @
a7e9c41a
package
iot
.
sixiang
.
license
.
forward
;
import
io.netty.channel.ChannelFuture
;
import
io.netty.channel.EventLoop
;
import
io.netty.channel.socket.SocketChannel
;
import
iot.sixiang.license.device.DeviceProtocol
;
import
iot.sixiang.license.event.DeviceClientBeForcedOfflineEvent
;
...
...
@@ -9,32 +8,31 @@ import iot.sixiang.license.event.DeviceClientLicenseEvent;
import
iot.sixiang.license.event.EventPublisher
;
import
iot.sixiang.license.event.ForwardClientConnectEvent
;
import
iot.sixiang.license.net.BaseConnectionListener
;
import
iot.sixiang.license.service.AlarmService
;
import
iot.sixiang.license.util.SpringUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.
stereotype.Component
;
import
org.springframework.
beans.factory.annotation.Autowired
;
import
java.
util.concurrent.TimeUnit
;
import
java.
net.InetSocketAddress
;
@Slf4j
public
class
ForwardConnectionListener
extends
BaseConnectionListener
{
@Autowired
private
AlarmService
alarmService
;
@Override
public
void
operationComplete
(
ChannelFuture
channelFuture
)
throws
Exception
{
if
(!
channelFuture
.
isSuccess
())
{
// final EventLoop loop = channelFuture.channel().eventLoop();
// loop.schedule(new Runnable() {
// @Override
// public void run() {
// log.debug("ForwardConnectionListener ...operationComplete");
// log.info("forward client connect fail ..." + appId);
//// ForwardManager forwardManager = SpringUtil.getBean(ForwardManager.class);
//// log.debug("channelActive.forwardManager:" + forwardManager);
//
//// log.warn("The client is not connected and starts to reconnect..." + forwardManager);
//// forwardManager.startTcpClient(appId);
// }
// }, 10L, TimeUnit.SECONDS);
//TODO 中转失败进行告警
InetSocketAddress
socketAddress
=
(
InetSocketAddress
)
channelFuture
.
channel
().
remoteAddress
();
String
remoteIp
=
socketAddress
.
getHostString
();
String
remotePort
=
String
.
valueOf
(
socketAddress
.
getPort
());
int
typeId
=
1
;
String
title
=
"中转失败"
;
String
content
=
"中转到服务器:"
+
remoteIp
+
":"
+
remotePort
+
"失败"
;
alarmService
.
addAlarm
(
typeId
,
title
,
content
);
//TODO forward client连接失败,则强制踢掉设备客户端
DeviceClientBeForcedOfflineEvent
deviceClientBeForcedOfflineEvent
=
new
DeviceClientBeForcedOfflineEvent
();
...
...
license/src/main/java/iot/sixiang/license/operate/OperateConnectionListener.java
View file @
a7e9c41a
...
...
@@ -3,27 +3,36 @@ package iot.sixiang.license.operate;
import
io.netty.channel.ChannelFuture
;
import
io.netty.channel.socket.SocketChannel
;
import
iot.sixiang.license.device.DeviceProtocol
;
import
iot.sixiang.license.event.*
;
import
iot.sixiang.license.event.EventPublisher
;
import
iot.sixiang.license.event.OperateSAMStatusRequestEvent
;
import
iot.sixiang.license.net.BaseConnectionListener
;
import
iot.sixiang.license.service.AlarmService
;
import
iot.sixiang.license.util.SpringUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.net.InetSocketAddress
;
@Slf4j
public
class
OperateConnectionListener
extends
BaseConnectionListener
{
@Autowired
private
AlarmService
alarmService
;
@Override
public
void
operationComplete
(
ChannelFuture
channelFuture
)
throws
Exception
{
if
(!
channelFuture
.
isSuccess
())
{
//TODO 失败进行告警
InetSocketAddress
socketAddress
=
(
InetSocketAddress
)
channelFuture
.
channel
().
remoteAddress
();
String
remoteIp
=
socketAddress
.
getHostString
();
String
remotePort
=
String
.
valueOf
(
socketAddress
.
getPort
());
int
typeId
=
1
;
String
title
=
"连接服器失败"
;
String
content
=
"连接服务器:"
+
remoteIp
+
":"
+
remotePort
+
"失败"
;
alarmService
.
addAlarm
(
typeId
,
title
,
content
);
}
else
{
//TODO 查询SAM状态
OperateSAMStatusRequestEvent
operateSAMStatusQueryEvent
=
new
OperateSAMStatusRequestEvent
();
short
stx
=
21930
;
int
len
=
2
;
byte
cmd
=
0x5f
;
...
...
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