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
0493c149
Commit
0493c149
authored
Dec 08, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
239c324e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
20 deletions
+21
-20
Constant.java
...se/src/main/java/iot/sixiang/license/consts/Constant.java
+2
-1
DeviceChannelInitializer.java
.../iot/sixiang/license/device/DeviceChannelInitializer.java
+2
-2
DeviceManager.java
...c/main/java/iot/sixiang/license/device/DeviceManager.java
+2
-2
DeviceServerHandler.java
.../java/iot/sixiang/license/device/DeviceServerHandler.java
+3
-3
ForwardChannelInitializer.java
...ot/sixiang/license/forward/ForwardChannelInitializer.java
+2
-2
ForwardManager.java
...main/java/iot/sixiang/license/forward/ForwardManager.java
+6
-6
OperateChannelInitializer.java
...ot/sixiang/license/operate/OperateChannelInitializer.java
+2
-2
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+2
-2
No files found.
license/src/main/java/iot/sixiang/license/consts/Const
s
.java
→
license/src/main/java/iot/sixiang/license/consts/Const
ant
.java
View file @
0493c149
package
iot
.
sixiang
.
license
.
consts
;
package
iot
.
sixiang
.
license
.
consts
;
public
class
Const
s
{
public
class
Const
ant
{
public
static
final
int
CMD_LICENSE
=
1
;
// 授权消息的cmd,十进制
public
static
final
int
CMD_LICENSE
=
1
;
// 授权消息的cmd,十进制
public
static
final
int
CMD_UPLOAD_ERROR
=
2
;
// 错误消息上报
public
static
final
int
EXECUTOR_THREAD_NUM
=
30
;
public
static
final
int
EXECUTOR_THREAD_NUM
=
30
;
public
static
final
int
FORWARD_THREAD_NUM
=
30
;
public
static
final
int
FORWARD_THREAD_NUM
=
30
;
public
static
final
int
OPERATE_THREAD_NUM
=
5
;
public
static
final
int
OPERATE_THREAD_NUM
=
5
;
...
...
license/src/main/java/iot/sixiang/license/device/DeviceChannelInitializer.java
View file @
0493c149
...
@@ -4,7 +4,7 @@ import io.netty.channel.socket.SocketChannel;
...
@@ -4,7 +4,7 @@ import io.netty.channel.socket.SocketChannel;
import
io.netty.handler.timeout.IdleStateHandler
;
import
io.netty.handler.timeout.IdleStateHandler
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
import
io.netty.util.concurrent.EventExecutorGroup
;
import
io.netty.util.concurrent.EventExecutorGroup
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
iot.sixiang.license.net.BaseChannelInitializer
;
import
iot.sixiang.license.net.BaseChannelInitializer
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
public
class
DeviceChannelInitializer
extends
BaseChannelInitializer
{
public
class
DeviceChannelInitializer
extends
BaseChannelInitializer
{
private
DeviceServerHandler
handler
;
private
DeviceServerHandler
handler
;
static
final
EventExecutorGroup
workGroup
=
new
DefaultEventExecutorGroup
(
Const
s
.
EXECUTOR_THREAD_NUM
);
static
final
EventExecutorGroup
workGroup
=
new
DefaultEventExecutorGroup
(
Const
ant
.
EXECUTOR_THREAD_NUM
);
public
DeviceChannelInitializer
(
DeviceServerHandler
handler
)
{
public
DeviceChannelInitializer
(
DeviceServerHandler
handler
)
{
this
.
handler
=
handler
;
this
.
handler
=
handler
;
...
...
license/src/main/java/iot/sixiang/license/device/DeviceManager.java
View file @
0493c149
package
iot
.
sixiang
.
license
.
device
;
package
iot
.
sixiang
.
license
.
device
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.SessionContext
;
import
iot.sixiang.license.model.SessionContext
;
import
iot.sixiang.license.model.vo.DeviceDetailVo
;
import
iot.sixiang.license.model.vo.DeviceDetailVo
;
...
@@ -142,7 +142,7 @@ public class DeviceManager {
...
@@ -142,7 +142,7 @@ public class DeviceManager {
if
(
targetSession
.
getChannelId
().
equals
(
channelId
))
{
if
(
targetSession
.
getChannelId
().
equals
(
channelId
))
{
targetSession
.
setAuthStatus
(
false
);
targetSession
.
setAuthStatus
(
false
);
targetSession
.
setStatus
(
Const
s
.
DEVICE_STATE_OFFLINE
);
targetSession
.
setStatus
(
Const
ant
.
DEVICE_STATE_OFFLINE
);
targetSession
.
setOffline
(
CommonUtil
.
getSystemTime
());
targetSession
.
setOffline
(
CommonUtil
.
getSystemTime
());
return
true
;
return
true
;
}
}
...
...
license/src/main/java/iot/sixiang/license/device/DeviceServerHandler.java
View file @
0493c149
...
@@ -7,7 +7,7 @@ import io.netty.channel.ChannelHandlerContext;
...
@@ -7,7 +7,7 @@ import io.netty.channel.ChannelHandlerContext;
import
io.netty.channel.SimpleChannelInboundHandler
;
import
io.netty.channel.SimpleChannelInboundHandler
;
import
io.netty.channel.socket.SocketChannel
;
import
io.netty.channel.socket.SocketChannel
;
import
iot.sixiang.license.auth.AuthManager
;
import
iot.sixiang.license.auth.AuthManager
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
iot.sixiang.license.event.CreateForwardClientEvent
;
import
iot.sixiang.license.event.CreateForwardClientEvent
;
import
iot.sixiang.license.event.DeviceClientInactiveEvent
;
import
iot.sixiang.license.event.DeviceClientInactiveEvent
;
import
iot.sixiang.license.event.EventPublisher
;
import
iot.sixiang.license.event.EventPublisher
;
...
@@ -55,7 +55,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
...
@@ -55,7 +55,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
int
cmdInt
=
cmd
&
0xFF
;
int
cmdInt
=
cmd
&
0xFF
;
boolean
auth
=
false
;
boolean
auth
=
false
;
if
(
cmdInt
==
Const
s
.
CMD_LICENSE
)
{
if
(
cmdInt
==
Const
ant
.
CMD_LICENSE
)
{
auth
=
handlerCheckAuth
(
channel
,
remoteIp
,
remotePort
,
protocol
);
auth
=
handlerCheckAuth
(
channel
,
remoteIp
,
remotePort
,
protocol
);
}
else
{
}
else
{
auth
=
handlerCheckAuthStatus
(
channel
,
remoteIp
,
remotePort
,
protocol
);
auth
=
handlerCheckAuthStatus
(
channel
,
remoteIp
,
remotePort
,
protocol
);
...
@@ -147,7 +147,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
...
@@ -147,7 +147,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
session
.
setChannelId
(
channelId
);
session
.
setChannelId
(
channelId
);
session
.
setClientChannel
(
channel
);
session
.
setClientChannel
(
channel
);
session
.
setAuthStatus
(
true
);
session
.
setAuthStatus
(
true
);
session
.
setStatus
(
Const
s
.
DEVICE_STATE_ONLINE
);
session
.
setStatus
(
Const
ant
.
DEVICE_STATE_ONLINE
);
session
.
setOnline
(
CommonUtil
.
getSystemTime
());
session
.
setOnline
(
CommonUtil
.
getSystemTime
());
DeviceManager
deviceManager
=
SpringUtil
.
getBean
(
DeviceManager
.
class
);
DeviceManager
deviceManager
=
SpringUtil
.
getBean
(
DeviceManager
.
class
);
...
...
license/src/main/java/iot/sixiang/license/forward/ForwardChannelInitializer.java
View file @
0493c149
...
@@ -3,13 +3,13 @@ package iot.sixiang.license.forward;
...
@@ -3,13 +3,13 @@ package iot.sixiang.license.forward;
import
io.netty.channel.socket.SocketChannel
;
import
io.netty.channel.socket.SocketChannel
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
import
io.netty.util.concurrent.EventExecutorGroup
;
import
io.netty.util.concurrent.EventExecutorGroup
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
iot.sixiang.license.net.BaseChannelInitializer
;
import
iot.sixiang.license.net.BaseChannelInitializer
;
public
class
ForwardChannelInitializer
extends
BaseChannelInitializer
{
public
class
ForwardChannelInitializer
extends
BaseChannelInitializer
{
private
ForwardClientHandler
handler
;
private
ForwardClientHandler
handler
;
static
final
EventExecutorGroup
workGroup
=
new
DefaultEventExecutorGroup
(
Const
s
.
FORWARD_THREAD_NUM
);
static
final
EventExecutorGroup
workGroup
=
new
DefaultEventExecutorGroup
(
Const
ant
.
FORWARD_THREAD_NUM
);
public
ForwardChannelInitializer
(
ForwardClientHandler
handler
)
{
public
ForwardChannelInitializer
(
ForwardClientHandler
handler
)
{
this
.
handler
=
handler
;
this
.
handler
=
handler
;
...
...
license/src/main/java/iot/sixiang/license/forward/ForwardManager.java
View file @
0493c149
package
iot
.
sixiang
.
license
.
forward
;
package
iot
.
sixiang
.
license
.
forward
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
iot.sixiang.license.model.SessionContext
;
import
iot.sixiang.license.model.SessionContext
;
import
iot.sixiang.license.model.vo.ServerStatusVo
;
import
iot.sixiang.license.model.vo.ServerStatusVo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -67,11 +67,11 @@ public class ForwardManager {
...
@@ -67,11 +67,11 @@ public class ForwardManager {
public
ServerStatusVo
getServerStatus
()
{
public
ServerStatusVo
getServerStatus
()
{
ServerStatusVo
vo
=
new
ServerStatusVo
();
ServerStatusVo
vo
=
new
ServerStatusVo
();
int
size
=
sessionContexts
.
size
();
int
size
=
sessionContexts
.
size
();
int
statue
=
Const
s
.
SERVICE_DX_STATUS_FLUENT
;
int
statue
=
Const
ant
.
SERVICE_DX_STATUS_FLUENT
;
if
(
size
>=
Const
s
.
SERVICE_DX_THRESHOLD_NORMAL
)
{
if
(
size
>=
Const
ant
.
SERVICE_DX_THRESHOLD_NORMAL
)
{
statue
=
Const
s
.
SERVICE_DX_STATUS_NORMAL
;
statue
=
Const
ant
.
SERVICE_DX_STATUS_NORMAL
;
}
else
if
(
size
>
Const
s
.
SERVICE_DX_THRESHOLD_BUSY
)
{
}
else
if
(
size
>
Const
ant
.
SERVICE_DX_THRESHOLD_BUSY
)
{
statue
=
Const
s
.
SERVICE_DX_STATUS_BUSY
;
statue
=
Const
ant
.
SERVICE_DX_STATUS_BUSY
;
}
}
vo
.
setCount
(
size
);
vo
.
setCount
(
size
);
vo
.
setStatus
(
statue
);
vo
.
setStatus
(
statue
);
...
...
license/src/main/java/iot/sixiang/license/operate/OperateChannelInitializer.java
View file @
0493c149
...
@@ -3,14 +3,14 @@ package iot.sixiang.license.operate;
...
@@ -3,14 +3,14 @@ package iot.sixiang.license.operate;
import
io.netty.channel.socket.SocketChannel
;
import
io.netty.channel.socket.SocketChannel
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
import
io.netty.util.concurrent.EventExecutorGroup
;
import
io.netty.util.concurrent.EventExecutorGroup
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
iot.sixiang.license.net.BaseChannelInitializer
;
import
iot.sixiang.license.net.BaseChannelInitializer
;
public
class
OperateChannelInitializer
extends
BaseChannelInitializer
{
public
class
OperateChannelInitializer
extends
BaseChannelInitializer
{
private
OperateClientHandler
handler
;
private
OperateClientHandler
handler
;
static
final
EventExecutorGroup
workGroup
=
new
DefaultEventExecutorGroup
(
Const
s
.
OPERATE_THREAD_NUM
);
static
final
EventExecutorGroup
workGroup
=
new
DefaultEventExecutorGroup
(
Const
ant
.
OPERATE_THREAD_NUM
);
public
OperateChannelInitializer
(
OperateClientHandler
handler
)
{
public
OperateChannelInitializer
(
OperateClientHandler
handler
)
{
this
.
handler
=
handler
;
this
.
handler
=
handler
;
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
0493c149
package
iot
.
sixiang
.
license
.
util
;
package
iot
.
sixiang
.
license
.
util
;
import
iot.sixiang.license.consts.Const
s
;
import
iot.sixiang.license.consts.Const
ant
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.system.ApplicationHome
;
import
org.springframework.boot.system.ApplicationHome
;
...
@@ -79,7 +79,7 @@ public class CommonUtil {
...
@@ -79,7 +79,7 @@ public class CommonUtil {
}
}
public
static
String
getServerParentDirectory
()
{
public
static
String
getServerParentDirectory
()
{
return
new
File
(
new
ApplicationHome
(
Const
s
.
class
).
getSource
().
getParentFile
().
getPath
()).
getParent
();
return
new
File
(
new
ApplicationHome
(
Const
ant
.
class
).
getSource
().
getParentFile
().
getPath
()).
getParent
();
}
}
public
static
String
getLibFilePathByFileName
(
String
fileName
)
{
public
static
String
getLibFilePathByFileName
(
String
fileName
)
{
...
...
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