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
8c4d1044
Commit
8c4d1044
authored
Nov 23, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加设备使用记录
parent
0f54fe57
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
DeviceServerHandler.java
.../java/iot/sixiang/license/device/DeviceServerHandler.java
+10
-2
SessionContext.java
...c/main/java/iot/sixiang/license/model/SessionContext.java
+1
-0
No files found.
license/src/main/java/iot/sixiang/license/device/DeviceServerHandler.java
View file @
8c4d1044
...
...
@@ -14,6 +14,7 @@ import iot.sixiang.license.event.EventPublisher;
import
iot.sixiang.license.event.ForwardClientRequestEvent
;
import
iot.sixiang.license.idreader.Safety
;
import
iot.sixiang.license.model.SessionContext
;
import
iot.sixiang.license.service.PmsUseService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.HexUtil
;
import
iot.sixiang.license.util.SpringUtil
;
...
...
@@ -21,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.net.InetSocketAddress
;
@Component
...
...
@@ -31,6 +33,8 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
EventPublisher
eventPublisher
;
@Autowired
Safety
safety
;
@Resource
private
PmsUseService
pmsUseService
;
public
DeviceServerHandler
()
{
super
();
...
...
@@ -129,13 +133,17 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
String
channelId
=
channel
.
id
().
asLongText
();
if
(
license
)
{
// 创建一条使用记录
int
useLogId
=
pmsUseService
.
createUseLog
(
sn
);
if
(
useLogId
<=
0
)
{
log
.
info
(
"创建使用日志不成功..."
);
return
false
;
}
SessionContext
session
=
new
SessionContext
();
session
.
setRemoteIp
(
remoteIp
);
session
.
setRemotePort
(
remotePort
);
session
.
setAppId
(
appId
);
session
.
setSn
(
sn
);
session
.
setUseLogId
(
useLogId
);
session
.
setChannelId
(
channelId
);
session
.
setClientChannel
(
channel
);
session
.
setAuthStatus
(
true
);
...
...
license/src/main/java/iot/sixiang/license/model/SessionContext.java
View file @
8c4d1044
...
...
@@ -11,6 +11,7 @@ public class SessionContext {
private
String
appId
;
private
String
appKey
;
private
String
sn
;
private
int
useLogId
;
// 使用日志标识
private
boolean
authStatus
;
//授权验证状态
private
int
status
;
//当前状态,0 offline,1 online
private
String
online
;
//上线时间
...
...
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