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
8e9e0707
Commit
8e9e0707
authored
Jun 09, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'm33' into 'master'
修改格式 See merge request
!7
parents
673dae1d
bef33545
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
35 additions
and
99 deletions
+35
-99
DeviceController.java
...java/iot/sixiang/license/controller/DeviceController.java
+6
-6
DeviceTypeController.java
.../iot/sixiang/license/controller/DeviceTypeController.java
+3
-3
LicenseController.java
...ava/iot/sixiang/license/controller/LicenseController.java
+10
-10
LoginController.java
.../java/iot/sixiang/license/controller/LoginController.java
+2
-2
ServerController.java
...java/iot/sixiang/license/controller/ServerController.java
+6
-6
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+5
-5
JwtFilter.java
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
+1
-2
RespResult.java
...e/src/main/java/iot/sixiang/license/model/RespResult.java
+0
-39
UserVo.java
...se/src/main/java/iot/sixiang/license/model/vo/UserVo.java
+2
-0
UserServiceImpl.java
...ava/iot/sixiang/license/service/impl/UserServiceImpl.java
+0
-1
Configuration.java
...src/main/java/iot/sixiang/license/util/Configuration.java
+0
-25
No files found.
license/src/main/java/iot/sixiang/license/controller/DeviceController.java
View file @
8e9e0707
...
...
@@ -34,8 +34,8 @@ public class DeviceController {
*/
@PostMapping
(
"add"
)
public
BaseResult
addDevice
(
@RequestBody
JSONObject
jsonObject
)
{
int
userId
=
jsonObject
.
getInteger
(
"user
_i
d"
);
int
typeId
=
jsonObject
.
getInteger
(
"type
_i
d"
);
int
userId
=
jsonObject
.
getInteger
(
"user
I
d"
);
int
typeId
=
jsonObject
.
getInteger
(
"type
I
d"
);
int
count
=
jsonObject
.
getInteger
(
"count"
);
boolean
res
=
deviceService
.
addDevice
(
userId
,
typeId
,
count
);
if
(
res
)
{
...
...
@@ -54,10 +54,10 @@ public class DeviceController {
* @return
*/
@GetMapping
(
"list"
)
public
PageResult
getDeviceList
(
@RequestParam
(
"page
_n
o"
)
int
pageNo
,
@RequestParam
(
"page
_s
ize"
)
int
pageSize
,
@RequestParam
(
value
=
"type
_n
ame"
,
required
=
false
)
String
typeName
,
@RequestParam
(
value
=
"user
_i
d"
,
required
=
false
)
Integer
userId
)
{
public
PageResult
getDeviceList
(
@RequestParam
(
"page
N
o"
)
int
pageNo
,
@RequestParam
(
"page
S
ize"
)
int
pageSize
,
@RequestParam
(
value
=
"type
N
ame"
,
required
=
false
)
String
typeName
,
@RequestParam
(
value
=
"user
I
d"
,
required
=
false
)
Integer
userId
)
{
PageInfoModel
<
DeviceTypeVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
typeName
,
userId
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
...
...
license/src/main/java/iot/sixiang/license/controller/DeviceTypeController.java
View file @
8e9e0707
...
...
@@ -2,7 +2,7 @@ package iot.sixiang.license.controller;
import
iot.sixiang.license.entity.DeviceType
;
import
iot.sixiang.license.model.Res
p
Result
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.service.DeviceTypeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -32,9 +32,9 @@ public class DeviceTypeController {
* @return
*/
@GetMapping
(
"type"
)
public
Res
p
Result
getDeviceTypeList
()
{
public
ResResult
getDeviceTypeList
()
{
List
<
DeviceType
>
records
=
deviceTypeService
.
getDeviceTypeList
();
return
Res
p
Result
.
success
().
record
(
records
);
return
ResResult
.
success
().
record
(
records
);
}
}
license/src/main/java/iot/sixiang/license/controller/LicenseController.java
View file @
8e9e0707
...
...
@@ -4,7 +4,7 @@ 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.Res
p
Result
;
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.*
;
...
...
@@ -33,9 +33,9 @@ public class LicenseController {
*/
@PostMapping
(
"add"
)
public
BaseResult
addLicense
(
@RequestBody
JSONObject
jsonObject
){
String
appId
=
jsonObject
.
getString
(
"app
_i
d"
);
String
appKey
=
jsonObject
.
getString
(
"app
_k
ey"
);
String
userId
=
jsonObject
.
getString
(
"user
_i
d"
);
String
appId
=
jsonObject
.
getString
(
"app
I
d"
);
String
appKey
=
jsonObject
.
getString
(
"app
K
ey"
);
String
userId
=
jsonObject
.
getString
(
"user
I
d"
);
boolean
res
=
licenseService
.
addLicense
(
appId
,
appKey
,
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
...
...
@@ -50,7 +50,7 @@ public class LicenseController {
* @return
*/
@PostMapping
(
"delete"
)
public
BaseResult
deleteLicense
(
@RequestParam
(
"app
_i
d"
)
String
appId
)
{
public
BaseResult
deleteLicense
(
@RequestParam
(
"app
I
d"
)
String
appId
)
{
boolean
res
=
licenseService
.
deleteLicense
(
appId
);
if
(
res
)
{
return
BaseResult
.
success
();
...
...
@@ -66,9 +66,9 @@ public class LicenseController {
*/
@PostMapping
(
"update"
)
public
BaseResult
updateLicense
(
@RequestBody
JSONObject
jsonObject
){
String
appId
=
jsonObject
.
getString
(
"app
_i
d"
);
String
appKey
=
jsonObject
.
getString
(
"app
_k
ey"
);
String
userId
=
jsonObject
.
getString
(
"user
_i
d"
);
String
appId
=
jsonObject
.
getString
(
"app
I
d"
);
String
appKey
=
jsonObject
.
getString
(
"app
K
ey"
);
String
userId
=
jsonObject
.
getString
(
"user
I
d"
);
boolean
res
=
licenseService
.
updateLicense
(
appId
,
appKey
,
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
...
...
@@ -84,9 +84,9 @@ public class LicenseController {
* @return
*/
@GetMapping
(
"list"
)
public
Res
pResult
getLicenseList
(
@RequestParam
(
"page_no"
)
int
pageNo
,
@RequestParam
(
"page_s
ize"
)
int
pageSize
)
{
public
Res
Result
getLicenseList
(
@RequestParam
(
"pageNo"
)
int
pageNo
,
@RequestParam
(
"pageS
ize"
)
int
pageSize
)
{
List
<
License
>
records
=
licenseService
.
getLicenseList
(
pageNo
,
pageSize
);
return
Res
p
Result
.
success
().
record
(
records
);
return
ResResult
.
success
().
record
(
records
);
}
...
...
license/src/main/java/iot/sixiang/license/controller/LoginController.java
View file @
8e9e0707
...
...
@@ -33,7 +33,7 @@ public class LoginController {
*/
@GetMapping
(
"login"
)
public
ResResult
login
(
@RequestParam
(
"user
_n
ame"
)
String
userName
,
@RequestParam
(
"password"
)
String
password
)
{
public
ResResult
login
(
@RequestParam
(
"user
N
ame"
)
String
userName
,
@RequestParam
(
"password"
)
String
password
)
{
// @RequestBody JSONObject jsonObject
LoginUser
user
=
new
LoginUser
();
user
.
setUser_name
(
userName
);
...
...
@@ -53,7 +53,7 @@ public class LoginController {
}
@GetMapping
(
"logout"
)
public
ResResult
logout
(
@RequestParam
(
"user
_n
ame"
)
String
userName
,
@RequestParam
(
"password"
)
String
password
)
{
public
ResResult
logout
(
@RequestParam
(
"user
N
ame"
)
String
userName
,
@RequestParam
(
"password"
)
String
password
)
{
// @RequestBody JSONObject jsonObject
LoginUser
user
=
new
LoginUser
();
user
.
setUser_name
(
userName
);
...
...
license/src/main/java/iot/sixiang/license/controller/ServerController.java
View file @
8e9e0707
...
...
@@ -4,7 +4,7 @@ package iot.sixiang.license.controller;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.entity.Server
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.Res
p
Result
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.service.ServerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -33,7 +33,7 @@ public class ServerController {
*/
@PostMapping
(
"add"
)
public
BaseResult
addServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"server
_i
p"
);
String
serverIp
=
jsonObject
.
getString
(
"server
I
p"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
addServer
(
serverIp
,
port
);
if
(
res
)
{
...
...
@@ -49,7 +49,7 @@ public class ServerController {
* @return
*/
@PostMapping
(
"delete"
)
public
BaseResult
deleteServer
(
@RequestParam
(
"server
_i
p"
)
String
serverIp
)
{
public
BaseResult
deleteServer
(
@RequestParam
(
"server
I
p"
)
String
serverIp
)
{
boolean
res
=
serverService
.
deleteServer
(
serverIp
);
if
(
res
)
{
return
BaseResult
.
success
();
...
...
@@ -65,7 +65,7 @@ public class ServerController {
*/
@PostMapping
(
"update"
)
public
BaseResult
updateServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"server
_i
p"
);
String
serverIp
=
jsonObject
.
getString
(
"server
I
p"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
updateServer
(
serverIp
,
port
);
if
(
res
)
{
...
...
@@ -83,9 +83,9 @@ public class ServerController {
* @return
*/
@GetMapping
(
"list"
)
public
Res
pResult
getServerList
(
@RequestParam
(
"page_no"
)
int
pageNo
,
@RequestParam
(
"page_s
ize"
)
int
pageSize
)
{
public
Res
Result
getServerList
(
@RequestParam
(
"pageNo"
)
int
pageNo
,
@RequestParam
(
"pageS
ize"
)
int
pageSize
)
{
List
<
Server
>
records
=
serverService
.
getServerList
(
pageNo
,
pageSize
);
return
Res
p
Result
.
success
().
record
(
records
);
return
ResResult
.
success
().
record
(
records
);
}
}
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
8e9e0707
...
...
@@ -35,7 +35,7 @@ public class UserController {
*/
@PostMapping
(
"add"
)
public
BaseResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
String
userName
=
(
String
)
jsonObject
.
get
(
"user
_n
ame"
);
String
userName
=
(
String
)
jsonObject
.
get
(
"user
N
ame"
);
String
company
=
(
String
)
jsonObject
.
get
(
"company"
);
String
password
=
CommonUtil
.
genRandomNum
(
18
);
boolean
res
=
userService
.
addUser
(
userName
,
company
,
password
);
...
...
@@ -52,7 +52,7 @@ public class UserController {
* @return
*/
@PostMapping
(
"delete"
)
public
BaseResult
deleteUser
(
@RequestParam
(
"user
_i
d"
)
int
userId
)
{
public
BaseResult
deleteUser
(
@RequestParam
(
"user
I
d"
)
int
userId
)
{
boolean
res
=
userService
.
deleteUser
(
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
...
...
@@ -68,7 +68,7 @@ public class UserController {
*/
@PostMapping
(
"update"
)
public
BaseResult
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
int
userId
=
jsonObject
.
getInteger
(
"user
_i
d"
);
int
userId
=
jsonObject
.
getInteger
(
"user
I
d"
);
String
password
=
jsonObject
.
getString
(
"password"
);
boolean
res
=
userService
.
updateUser
(
userId
,
password
);
if
(
res
)
{
...
...
@@ -86,8 +86,8 @@ public class UserController {
* @return
*/
@GetMapping
(
"list"
)
public
PageResult
getUserList
(
@RequestParam
(
"page
_no"
)
int
pageNo
,
@RequestParam
(
"page_s
ize"
)
int
pageSize
,
@RequestParam
(
value
=
"user
_n
ame"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
public
PageResult
getUserList
(
@RequestParam
(
"page
No"
)
int
pageNo
,
@RequestParam
(
"pageS
ize"
)
int
pageSize
,
@RequestParam
(
value
=
"user
N
ame"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
...
...
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
View file @
8e9e0707
...
...
@@ -7,14 +7,13 @@ import iot.sixiang.license.model.ResResult;
import
lombok.extern.slf4j.Slf4j
;
import
javax.servlet.*
;
import
javax.servlet.annotation.WebFilter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.Map
;
@Slf4j
@WebFilter
(
filterName
=
"jwtFilter"
,
urlPatterns
=
"/iot_license/*"
)
//
@WebFilter(filterName = "jwtFilter", urlPatterns = "/iot_license/*")
public
class
JwtFilter
implements
Filter
{
...
...
license/src/main/java/iot/sixiang/license/model/RespResult.java
deleted
100644 → 0
View file @
673dae1d
package
iot
.
sixiang
.
license
.
model
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
RespResult
{
private
int
code
;
private
String
msg
;
private
Object
data
;
public
static
RespResult
success
()
{
RespResult
respResult
=
new
RespResult
();
respResult
.
setCode
(
200
);
respResult
.
setMsg
(
"success"
);
return
respResult
;
}
public
static
RespResult
fail
()
{
RespResult
respResult
=
new
RespResult
();
respResult
.
setCode
(
400
);
respResult
.
setMsg
(
"fail"
);
return
respResult
;
}
public
RespResult
msg
(
String
message
)
{
this
.
msg
=
message
;
return
this
;
}
public
RespResult
record
(
Object
data
){
this
.
data
=
data
;
return
this
;
}
}
license/src/main/java/iot/sixiang/license/model/vo/UserVo.java
View file @
8e9e0707
package
iot
.
sixiang
.
license
.
model
.
vo
;
import
iot.sixiang.license.entity.User
;
import
lombok.Data
;
/**
* Created by m33 on 2022/6/8 17:26
*/
@Data
public
class
UserVo
extends
User
{
public
int
count
;
}
license/src/main/java/iot/sixiang/license/service/impl/UserServiceImpl.java
View file @
8e9e0707
...
...
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.mapper.UserMapper
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.JsonUtil
;
...
...
license/src/main/java/iot/sixiang/license/util/Configuration.java
deleted
100644 → 0
View file @
673dae1d
package
iot
.
sixiang
.
license
.
util
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.cors.UrlBasedCorsConfigurationSource
;
import
org.springframework.web.filter.CorsFilter
;
@Configuration
class
MyCorsConfig
{
// 跨域请求处理
@Bean
public
CorsFilter
corsFilter
()
{
CorsConfiguration
config
=
new
CorsConfiguration
();
//允许所有域名进行跨域调用
config
.
addAllowedOrigin
(
"*"
);
//允许所有请求头
config
.
addAllowedHeader
(
"*"
);
//允许所有方法
config
.
addAllowedMethod
(
"*"
);
UrlBasedCorsConfigurationSource
source
=
new
UrlBasedCorsConfigurationSource
();
source
.
registerCorsConfiguration
(
"/**"
,
config
);
return
new
CorsFilter
(
source
);
}
}
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