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
0f54fe57
Commit
0f54fe57
authored
Nov 23, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加设备使用记录
parent
4c6a24a7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
3 deletions
+144
-3
update.sql
license/doc/update.sql
+5
-3
DeviceServerHandler.java
.../java/iot/sixiang/license/device/DeviceServerHandler.java
+3
-0
PmsUseLog.java
...e/src/main/java/iot/sixiang/license/entity/PmsUseLog.java
+42
-0
PmsUseLogMapper.java
...main/java/iot/sixiang/license/mapper/PmsUseLogMapper.java
+13
-0
PmsUseService.java
.../main/java/iot/sixiang/license/service/PmsUseService.java
+10
-0
PmsUseServiceImpl.java
...a/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
+30
-0
BaseTest.java
license/src/test/java/iot/sixiang/license/BaseTest.java
+20
-0
PmsUseServiceTest.java
...t/java/iot/sixiang/license/service/PmsUseServiceTest.java
+21
-0
No files found.
license/doc/update.sql
View file @
0f54fe57
...
...
@@ -3,7 +3,7 @@ DROP TABLE IF EXISTS `pms_use_log`;
CREATE
TABLE
`pms_use_log`
(
`id`
int
(
10
)
NOT
NULL
AUTO_INCREMENT
,
`sn`
varchar
(
30
)
DEFAULT
NULL
COMMENT
'
业务流程唯一标识
'
,
`sn`
varchar
(
30
)
DEFAULT
NULL
COMMENT
'
设备编号
'
,
`status`
int
(
1
)
DEFAULT
'0'
COMMENT
'状态 1:成功,0:失败'
,
`error_code`
varchar
(
10
)
DEFAULT
NULL
COMMENT
'如果失败,则这是失败的代号'
,
`message`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'如果失败,则这里是失败的信息'
,
...
...
@@ -15,6 +15,8 @@ CREATE TABLE `pms_use_log`
AUTO_INCREMENT
=
0
DEFAULT
CHARSET
=
utf8
COMMENT
=
'使用记录表'
;
ALTER
TABLE
`device`
ADD
COLUMN
`status`
int
(
1
)
NULL
DEFAULT
NULL
COMMENT
'状态 0:未使用,1:已使用,2:失效'
AFTER
`app_id`
;
ALTER
TABLE
`device`
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
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/device/DeviceServerHandler.java
View file @
0f54fe57
...
...
@@ -128,6 +128,9 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
log
.
info
(
"设备鉴权信息和结果,{},{},{},{} "
,
appId
,
sn
,
sign
,
license
);
String
channelId
=
channel
.
id
().
asLongText
();
if
(
license
)
{
// 创建一条使用记录
SessionContext
session
=
new
SessionContext
();
session
.
setRemoteIp
(
remoteIp
);
session
.
setRemotePort
(
remotePort
);
...
...
license/src/main/java/iot/sixiang/license/entity/PmsUseLog.java
0 → 100644
View file @
0f54fe57
package
iot
.
sixiang
.
license
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.util.Date
;
/**
* Created by M=54G
* Date 11/23/22 3:12 PM
* Description
*/
@Data
public
class
PmsUseLog
{
@ApiModelProperty
(
"记录标识"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
"设备编号"
)
private
String
sn
;
@ApiModelProperty
(
"状态 1:成功,0:失败"
)
private
Integer
status
;
@ApiModelProperty
(
"如果失败,则这是失败的代号"
)
private
String
errorCode
;
@ApiModelProperty
(
"如果失败,则这里是失败的信息"
)
private
String
message
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"逻辑删除标识 1:删除,0:未删除"
)
private
Integer
deleted
;
}
license/src/main/java/iot/sixiang/license/mapper/PmsUseLogMapper.java
0 → 100644
View file @
0f54fe57
package
iot
.
sixiang
.
license
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
iot.sixiang.license.entity.Monitor
;
import
iot.sixiang.license.entity.PmsUseLog
;
/**
* Created by M=54G
* Date 11/23/22 3:12 PM
* Description
*/
public
interface
PmsUseLogMapper
extends
BaseMapper
<
PmsUseLog
>
{
}
license/src/main/java/iot/sixiang/license/service/PmsUseService.java
0 → 100644
View file @
0f54fe57
package
iot
.
sixiang
.
license
.
service
;
/**
* Created by M=54G
* Date 11/23/22 3:09 PM
* Description
*/
public
interface
PmsUseService
{
int
createUseLog
(
String
sn
);
}
license/src/main/java/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
0 → 100644
View file @
0f54fe57
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
iot.sixiang.license.entity.PmsUseLog
;
import
iot.sixiang.license.mapper.PmsUseLogMapper
;
import
iot.sixiang.license.service.PmsUseService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
/**
* Created by M=54G
* Date 11/23/22 3:10 PM
* Description
*/
@Service
public
class
PmsUseServiceImpl
implements
PmsUseService
{
@Resource
private
PmsUseLogMapper
pmsUseLogMapper
;
@Override
public
int
createUseLog
(
String
sn
)
{
PmsUseLog
pmsUseLog
=
new
PmsUseLog
();
Date
date
=
new
Date
();
pmsUseLog
.
setCreateTime
(
date
);
pmsUseLog
.
setUpdateTime
(
date
);
pmsUseLog
.
setSn
(
sn
);
return
pmsUseLogMapper
.
insert
(
pmsUseLog
);
}
}
license/src/test/java/iot/sixiang/license/BaseTest.java
0 → 100644
View file @
0f54fe57
package
iot
.
sixiang
.
license
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ActiveProfiles
;
/**
* Created by M=54G
* Date 9/14/22 3:08 PM
* Description
*/
@SpringBootTest
@ActiveProfiles
({
"test-acc"
})
@Slf4j
public
class
BaseTest
{
protected
void
log
(
Object
object
)
{
log
.
info
(
JSON
.
toJSONString
(
object
));
}
}
\ No newline at end of file
license/src/test/java/iot/sixiang/license/service/PmsUseServiceTest.java
0 → 100644
View file @
0f54fe57
package
iot
.
sixiang
.
license
.
service
;
import
iot.sixiang.license.BaseTest
;
import
org.junit.jupiter.api.Test
;
import
javax.annotation.Resource
;
/**
* Created by M=54G
* Date 11/23/22 3:39 PM
* Description
*/
public
class
PmsUseServiceTest
extends
BaseTest
{
@Resource
private
PmsUseService
pmsUseService
;
@Test
void
addLog
()
{
log
(
pmsUseService
.
createUseLog
(
"abcd"
));
}
}
\ No newline at end of file
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