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
7f5f31d6
Commit
7f5f31d6
authored
Nov 29, 2022
by
马33
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://120.77.240.215:9701/tianlai3/ioc_sixiang_license
parents
76c12b3f
ea51d299
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
10 deletions
+21
-10
update.sql
license/doc/update.sql
+2
-2
TerminalDeviceController.java
.../sixiang/license/controller/TerminalDeviceController.java
+6
-2
DeviceManager.java
...c/main/java/iot/sixiang/license/device/DeviceManager.java
+5
-3
TerminalDeviceService.java
...va/iot/sixiang/license/service/TerminalDeviceService.java
+1
-1
PmsUseServiceImpl.java
...a/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
+1
-1
TerminalDeviceServiceImpl.java
...xiang/license/service/impl/TerminalDeviceServiceImpl.java
+6
-1
No files found.
license/doc/update.sql
View file @
7f5f31d6
...
...
@@ -4,7 +4,7 @@ CREATE TABLE `pms_use_log`
(
`id`
int
(
10
)
NOT
NULL
AUTO_INCREMENT
,
`sn`
varchar
(
30
)
DEFAULT
NULL
COMMENT
'设备编号'
,
`status`
int
(
1
)
DEFAULT
'
0
'
COMMENT
'状态 1:成功,0:失败'
,
`status`
int
(
1
)
DEFAULT
'
1
'
COMMENT
'状态 1:成功,0:失败'
,
`error_code`
varchar
(
10
)
DEFAULT
NULL
COMMENT
'如果失败,则这是失败的代号'
,
`message`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'如果失败,则这里是失败的信息'
,
`create_time`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
...
...
@@ -16,7 +16,7 @@ CREATE TABLE `pms_use_log`
DEFAULT
CHARSET
=
utf8
COMMENT
=
'使用记录表'
;
ALTER
TABLE
`device`
ADD
COLUMN
`status`
int
(
1
)
NULL
DEFAULT
'0'
COMMENT
'状态 0:未使用,1:已使用,2:失效'
AFTER
`app_id`
;
ADD
COLUMN
`status`
int
(
1
)
NULL
DEFAULT
NULL
COMMENT
'状态 0:未使用,1:已使用,2:失效'
AFTER
`app_id`
;
ALTER
TABLE
`device`
ADD
COLUMN
`sn_bind`
varchar
(
30
)
NULL
DEFAULT
NULL
COMMENT
'绑定的SN'
AFTER
`status`
;
\ No newline at end of file
license/src/main/java/iot/sixiang/license/controller/TerminalDeviceController.java
View file @
7f5f31d6
...
...
@@ -9,7 +9,11 @@ import iot.sixiang.license.model.dto.ReportErrorMsgDTO;
import
iot.sixiang.license.model.dto.TerminalDevieBindDTO
;
import
iot.sixiang.license.service.TerminalDeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
...
...
@@ -35,6 +39,6 @@ public class TerminalDeviceController {
@PostMapping
(
"/bind"
)
@ApiOperation
(
value
=
"终端设备绑定接口"
,
notes
=
"终端设备绑定接口"
)
public
BaseResult
terminalDevieBind
(
@RequestBody
TerminalDevieBindDTO
terminalDevieBindDTO
)
{
return
terminalDeviceService
.
terminalDevieBind
(
terminalDevieBindDTO
);
return
terminalDeviceService
.
terminalDevi
c
eBind
(
terminalDevieBindDTO
);
}
}
license/src/main/java/iot/sixiang/license/device/DeviceManager.java
View file @
7f5f31d6
...
...
@@ -13,14 +13,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
@Component
@Slf4j
public
class
DeviceManager
{
private
Map
<
String
,
SessionContext
>
sessionContexts
=
null
;
private
DeviceChannelInitializer
channelInitializer
;
private
TcpServer
server
=
null
;
...
...
license/src/main/java/iot/sixiang/license/service/TerminalDeviceService.java
View file @
7f5f31d6
...
...
@@ -13,5 +13,5 @@ public interface TerminalDeviceService {
BaseResult
reportErrorMsg
(
List
<
ReportErrorMsgDTO
>
reportErrorMsgDTO
);
BaseResult
terminalDevieBind
(
TerminalDevieBindDTO
terminalDevieBindDTO
);
BaseResult
terminalDevi
c
eBind
(
TerminalDevieBindDTO
terminalDevieBindDTO
);
}
license/src/main/java/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
View file @
7f5f31d6
...
...
@@ -35,7 +35,7 @@ public class PmsUseServiceImpl implements PmsUseService {
@Override
public
void
createFailUseLog
(
String
sn
,
String
message
)
{
PmsUseLog
pmsUseLog
=
getPmsUseLog
(
sn
);
pmsUseLog
.
setStatus
(
0
);
//
pmsUseLog.setStatus(0);
pmsUseLog
.
setMessage
(
message
);
pmsUseLogMapper
.
insert
(
pmsUseLog
);
}
...
...
license/src/main/java/iot/sixiang/license/service/impl/TerminalDeviceServiceImpl.java
View file @
7f5f31d6
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
iot.sixiang.license.auth.AuthManager
;
import
iot.sixiang.license.device.DeviceManager
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.jwt.JwtUtil
;
import
iot.sixiang.license.jwt.LoginUser
;
...
...
@@ -17,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Comparator
;
import
java.util.List
;
...
...
@@ -29,6 +31,8 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService {
private
DeviceService
deviceService
;
@Autowired
private
PmsUseService
pmsUseService
;
@Resource
private
DeviceManager
deviceManager
;
@Override
public
ResResult
getToken
(
GetTerminalDeviceTokenDTO
getTerminalDeviceTokenDTO
)
{
...
...
@@ -89,7 +93,7 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService {
}
@Override
public
BaseResult
terminalDevieBind
(
TerminalDevieBindDTO
terminalDevieBindDTO
)
{
public
BaseResult
terminalDevi
c
eBind
(
TerminalDevieBindDTO
terminalDevieBindDTO
)
{
String
sn
=
terminalDevieBindDTO
.
getSn
();
String
snBind
=
terminalDevieBindDTO
.
getSnBind
();
if
(
StringUtils
.
isEmpty
(
sn
)
||
StringUtils
.
isEmpty
(
snBind
))
{
...
...
@@ -97,6 +101,7 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService {
}
Boolean
res
=
deviceService
.
terminalDevieBind
(
terminalDevieBindDTO
);
if
(
res
)
{
deviceManager
.
initDevices
();
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
failed
();
...
...
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