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
1115ec57
Commit
1115ec57
authored
Jun 13, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'm33' into 'master'
删除License相关内容和修改部分文件 See merge request
!21
parents
e216ecce
f0ebda73
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
13 additions
and
264 deletions
+13
-264
AuthManager.java
...e/src/main/java/iot/sixiang/license/auth/AuthManager.java
+1
-10
LicenseController.java
...ava/iot/sixiang/license/controller/LicenseController.java
+0
-94
Device.java
license/src/main/java/iot/sixiang/license/entity/Device.java
+1
-1
License.java
...nse/src/main/java/iot/sixiang/license/entity/License.java
+0
-31
OperateSAMStatusResponseEventHandler.java
...g/license/event/OperateSAMStatusResponseEventHandler.java
+1
-1
LicenseMapper.java
...c/main/java/iot/sixiang/license/mapper/LicenseMapper.java
+0
-21
TcpServer.java
license/src/main/java/iot/sixiang/license/net/TcpServer.java
+9
-4
OperateManager.java
...main/java/iot/sixiang/license/operate/OperateManager.java
+0
-1
LicenseService.java
...main/java/iot/sixiang/license/service/LicenseService.java
+0
-25
LicenseServiceImpl.java
.../iot/sixiang/license/service/impl/LicenseServiceImpl.java
+0
-60
OperateSchedu.java
...src/main/java/iot/sixiang/license/util/OperateSchedu.java
+1
-1
LicenseMapper.xml
license/src/main/resources/mapper/LicenseMapper.xml
+0
-15
No files found.
license/src/main/java/iot/sixiang/license/auth/AuthManager.java
View file @
1115ec57
...
...
@@ -2,16 +2,9 @@ package iot.sixiang.license.auth;
import
iot.sixiang.license.device.DeviceManager
;
import
iot.sixiang.license.entity.Apply
;
import
iot.sixiang.license.entity.Device
;
import
iot.sixiang.license.entity.License
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.AppVo
;
import
iot.sixiang.license.model.vo.DeviceVo
;
import
iot.sixiang.license.service.ApplyService
;
import
iot.sixiang.license.service.DeviceService
;
import
iot.sixiang.license.service.LicenseService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.HmacUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -25,8 +18,6 @@ import java.util.Map;
@Component
@Slf4j
public
class
AuthManager
{
@Autowired
private
UserService
userService
;
@Autowired
private
ApplyService
applyService
;
@Autowired
...
...
@@ -35,7 +26,7 @@ public class AuthManager {
private
Map
<
String
,
Apply
>
allApply
=
null
;
public
AuthManager
()
{
allApply
=
new
HashMap
<
String
,
Apply
>();
allApply
=
new
HashMap
<>();
}
@PostConstruct
...
...
license/src/main/java/iot/sixiang/license/controller/LicenseController.java
deleted
100644 → 0
View file @
e216ecce
package
iot
.
sixiang
.
license
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.entity.License
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.service.LicenseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* <p>
* 前端控制器
* </p>
*
* @author m33
* @since 2022-06-06
*/
@RestController
@RequestMapping
(
"/iot_license/license"
)
public
class
LicenseController
{
@Autowired
private
LicenseService
licenseService
;
/**
* 添加license
* @param jsonObject
* @return
*/
@PostMapping
(
"add"
)
public
BaseResult
addLicense
(
@RequestBody
JSONObject
jsonObject
){
String
appId
=
jsonObject
.
getString
(
"appId"
);
String
appKey
=
jsonObject
.
getString
(
"appKey"
);
String
userId
=
jsonObject
.
getString
(
"userId"
);
boolean
res
=
licenseService
.
addLicense
(
appId
,
appKey
,
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 删除license
* @param appId
* @return
*/
@PostMapping
(
"delete"
)
public
BaseResult
deleteLicense
(
@RequestParam
(
value
=
"appId"
,
defaultValue
=
"0"
)
String
appId
)
{
boolean
res
=
licenseService
.
deleteLicense
(
appId
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 修改license
* @param jsonObject
* @return
*/
@PostMapping
(
"update"
)
public
BaseResult
updateLicense
(
@RequestBody
JSONObject
jsonObject
){
String
appId
=
jsonObject
.
getString
(
"appId"
);
String
appKey
=
jsonObject
.
getString
(
"appKey"
);
String
userId
=
jsonObject
.
getString
(
"userId"
);
boolean
res
=
licenseService
.
updateLicense
(
appId
,
appKey
,
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 分页查询所有的license
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping
(
"list"
)
public
ResResult
getLicenseList
(
@RequestParam
(
"pageNo"
)
int
pageNo
,
@RequestParam
(
"pageSize"
)
int
pageSize
)
{
List
<
License
>
records
=
licenseService
.
getLicenseList
(
pageNo
,
pageSize
);
return
ResResult
.
success
().
record
(
records
);
}
}
license/src/main/java/iot/sixiang/license/entity/Device.java
View file @
1115ec57
...
...
@@ -28,6 +28,6 @@ public class Device implements Serializable {
private
String
sn
;
private
Integer
app
ly
Id
;
private
Integer
appId
;
}
license/src/main/java/iot/sixiang/license/entity/License.java
deleted
100644 → 0
View file @
e216ecce
package
iot
.
sixiang
.
license
.
entity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* <p>
*
* </p>
*
* @author m33
* @since 2022-06-06
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
public
class
License
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
appId
;
private
String
appKey
;
private
Integer
userId
;
}
license/src/main/java/iot/sixiang/license/event/OperateSAMStatusResponseEventHandler.java
View file @
1115ec57
...
...
@@ -38,7 +38,7 @@ public class OperateSAMStatusResponseEventHandler {
int
samCount
=
samInfoList
.
size
();
int
onlineCount
=
0
;
for
(
SamInfo
samInfo
:
samInfoList
)
{
if
(
samInfo
.
getStatus
()
==
0
||
samInfo
.
getStatus
()
==
1
||
samInfo
.
getStatus
()
==
2
||
samInfo
.
getStatus
()
==
4
)
{
if
(
samInfo
.
getStatus
()
==
2
||
samInfo
.
getStatus
()
==
4
)
{
onlineCount
++;
}
else
{
int
index
=
samInfo
.
getIndex
();
...
...
license/src/main/java/iot/sixiang/license/mapper/LicenseMapper.java
deleted
100644 → 0
View file @
e216ecce
package
iot
.
sixiang
.
license
.
mapper
;
import
iot.sixiang.license.entity.License
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author m33
* @since 2022-06-06
*/
public
interface
LicenseMapper
extends
BaseMapper
<
License
>
{
boolean
deleteLicense
(
String
appId
);
boolean
addLicense
(
String
appId
,
String
appKey
,
String
userId
);
boolean
updateLicense
(
String
appId
,
String
appKey
,
String
userId
);
}
license/src/main/java/iot/sixiang/license/net/TcpServer.java
View file @
1115ec57
...
...
@@ -30,17 +30,22 @@ public class TcpServer {
Thread
thread
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
//创建两个线程组 bossGroup、workerGroup
EventLoopGroup
bossGroup
=
new
NioEventLoopGroup
(
4
);
EventLoopGroup
workerGroup
=
new
NioEventLoopGroup
(
4
);
logger
.
debug
(
"begin open the port:"
+
port
);
try
{
//创建服务端的启动对象,设置参数
ServerBootstrap
b
=
new
ServerBootstrap
();
b
.
group
(
bossGroup
,
workerGroup
).
channel
(
NioServerSocketChannel
.
class
)
//设置两个线程组boosGroup和workerGroup
b
.
group
(
bossGroup
,
workerGroup
)
//设置服务端通道实现类型
.
channel
(
NioServerSocketChannel
.
class
)
// .handler(new LoggingHandler(LogLevel.INFO))
.
childHandler
(
channelInitializer
)
.
option
(
ChannelOption
.
SO_BACKLOG
,
1024
)
// 设置tcp缓冲区
// 设置tcp缓冲区
.
option
(
ChannelOption
.
SO_BACKLOG
,
1024
)
//设置保持活动连接状态
.
childOption
(
ChannelOption
.
SO_KEEPALIVE
,
true
);
ChannelFuture
f
;
try
{
...
...
license/src/main/java/iot/sixiang/license/operate/OperateManager.java
View file @
1115ec57
...
...
@@ -73,7 +73,6 @@ public class OperateManager {
Map
.
Entry
<
String
,
Server
>
next
=
iterator
.
next
();
Server
server
=
next
.
getValue
();
//TODO 创建运维客户端去查询相关的运维消息
String
serverIp
=
server
.
getServerIp
();
Integer
port
=
server
.
getPort
();
this
.
startTcpClient
(
serverIp
,
port
);
...
...
license/src/main/java/iot/sixiang/license/service/LicenseService.java
deleted
100644 → 0
View file @
e216ecce
package
iot
.
sixiang
.
license
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
iot.sixiang.license.entity.License
;
import
java.util.List
;
/**
* <p>
* 服务类
* </p>
*
* @author m33
* @since 2022-06-06
*/
public
interface
LicenseService
extends
IService
<
License
>
{
List
<
License
>
getLicenseList
(
int
pageNo
,
int
pageSize
);
boolean
deleteLicense
(
String
appId
);
boolean
addLicense
(
String
appId
,
String
appKey
,
String
userId
);
boolean
updateLicense
(
String
appId
,
String
appKey
,
String
userId
);
}
license/src/main/java/iot/sixiang/license/service/impl/LicenseServiceImpl.java
deleted
100644 → 0
View file @
e216ecce
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
iot.sixiang.license.entity.License
;
import
iot.sixiang.license.mapper.LicenseMapper
;
import
iot.sixiang.license.service.LicenseService
;
import
iot.sixiang.license.util.JsonUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>
* 服务实现类
* </p>
*
* @author m33
* @since 2022-06-06
*/
@Service
public
class
LicenseServiceImpl
extends
ServiceImpl
<
LicenseMapper
,
License
>
implements
LicenseService
{
@Resource
LicenseMapper
licenseMapper
;
@Override
public
List
<
License
>
getLicenseList
(
int
pageNo
,
int
pageSize
)
{
Page
<
License
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
baseMapper
.
selectPage
(
page
,
null
);
List
<
License
>
records
=
page
.
getRecords
();
return
records
;
}
@Override
public
boolean
deleteLicense
(
String
appId
)
{
if
(
JsonUtil
.
isNull
(
appId
))
{
return
false
;
}
return
licenseMapper
.
deleteLicense
(
appId
);
}
@Override
public
boolean
addLicense
(
String
appId
,
String
appKey
,
String
userId
)
{
if
(
JsonUtil
.
isNull
(
appId
)
||
JsonUtil
.
isNull
(
appKey
)
||
JsonUtil
.
isNull
(
userId
))
{
return
false
;
}
return
licenseMapper
.
addLicense
(
appId
,
appKey
,
userId
);
}
@Override
public
boolean
updateLicense
(
String
appId
,
String
appKey
,
String
userId
)
{
if
(
JsonUtil
.
isNull
(
appId
)
||
JsonUtil
.
isNull
(
appKey
)
||
JsonUtil
.
isNull
(
userId
))
{
return
false
;
}
return
licenseMapper
.
updateLicense
(
appId
,
appKey
,
userId
);
}
}
license/src/main/java/iot/sixiang/license/util/OperateSchedu.java
View file @
1115ec57
...
...
@@ -19,9 +19,9 @@ public class OperateSchedu {
@Scheduled
(
cron
=
"0 0 0/1 * * ?"
)
public
void
scheduled
()
{
operateManager
.
createProxyClient
();
int
count
=
operateManager
.
getCount
();
monitorService
.
addMonitor
(
count
);
operateManager
.
clearCount
();
}
}
license/src/main/resources/mapper/LicenseMapper.xml
deleted
100644 → 0
View file @
e216ecce
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.LicenseMapper"
>
<insert
id=
"addLicense"
parameterType=
"iot.sixiang.license.entity.License"
>
insert into license(app_id, app_key, user_id) values (#{appId},#{appKey},#{userId})
</insert>
<delete
id=
"deleteLicense"
parameterType=
"iot.sixiang.license.entity.License"
>
delete from license where app_id = #{appId}
</delete>
<update
id=
"updateLicense"
parameterType=
"iot.sixiang.license.entity.License"
>
update license set app_key = #{appKey} , user_id = #{userId} where app_id = #{appId}
</update>
</mapper>
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