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
fc99621e
Commit
fc99621e
authored
Jul 15, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
a8e382c2
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
70 deletions
+71
-70
DeviceController.java
...java/iot/sixiang/license/controller/DeviceController.java
+35
-50
OperateController.java
...ava/iot/sixiang/license/controller/OperateController.java
+7
-1
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+29
-19
No files found.
license/src/main/java/iot/sixiang/license/controller/DeviceController.java
View file @
fc99621e
This diff is collapsed.
Click to expand it.
license/src/main/java/iot/sixiang/license/controller/OperateController.java
View file @
fc99621e
...
@@ -28,6 +28,7 @@ import iot.sixiang.license.service.ServerService;
...
@@ -28,6 +28,7 @@ import iot.sixiang.license.service.ServerService;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.owasp.esapi.ESAPI
;
import
org.owasp.esapi.ESAPI
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -56,6 +57,11 @@ public class OperateController {
...
@@ -56,6 +57,11 @@ public class OperateController {
@Autowired
@Autowired
HttpServletResponse
response
;
HttpServletResponse
response
;
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
)
{
binder
.
setDisallowedFields
(
new
String
[]{
"adminCome"
});
}
@ApiOperation
(
value
=
"服务接口"
,
notes
=
"用于获取服务列表"
)
@ApiOperation
(
value
=
"服务接口"
,
notes
=
"用于获取服务列表"
)
@GetMapping
(
"monitor/server"
)
@GetMapping
(
"monitor/server"
)
@MyLog
(
title
=
"获取服务列表"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取服务列表"
,
businessType
=
BusinessType
.
SELECT
)
...
@@ -95,7 +101,7 @@ public class OperateController {
...
@@ -95,7 +101,7 @@ public class OperateController {
@GetMapping
(
"alarm/list"
)
@GetMapping
(
"alarm/list"
)
@MyLog
(
title
=
"获取告警列表"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取告警列表"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
<
List
<
AlarmVo
>>
getAlarmList
()
{
public
ResResult
<
List
<
AlarmVo
>>
getAlarmList
()
{
response
.
setHeader
(
"Set-Cookie"
,
"cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly"
);
response
.
setHeader
(
"Set-Cookie"
,
"cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly"
);
String
user
=
UserUtils
.
getLoginUserId
();
String
user
=
UserUtils
.
getLoginUserId
();
int
userI
=
Integer
.
valueOf
(
user
);
int
userI
=
Integer
.
valueOf
(
user
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
userI
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
userI
);
...
...
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
fc99621e
...
@@ -18,13 +18,14 @@ import iot.sixiang.license.model.vo.UserVo;
...
@@ -18,13 +18,14 @@ import iot.sixiang.license.model.vo.UserVo;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* <p>
* <p>
*
前端控制器
* 前端控制器
* </p>
* </p>
*
*
* @author m33
* @author m33
...
@@ -38,17 +39,23 @@ public class UserController {
...
@@ -38,17 +39,23 @@ public class UserController {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
)
{
binder
.
setDisallowedFields
(
new
String
[]{
"adminCome"
});
}
/**
/**
* 添加user
* 添加user
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"用户添加接口"
,
notes
=
"用于添加用户"
)
@ApiOperation
(
value
=
"用户添加接口"
,
notes
=
"用于添加用户"
)
@PostMapping
(
"add"
)
@PostMapping
(
"add"
)
@MyLog
(
title
=
"添加用户"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@MyLog
(
title
=
"添加用户"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"userName"
,
value
=
"账户名"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"userName"
,
value
=
"账户名"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"company"
,
value
=
"公司名"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
@DynamicParameter
(
name
=
"company"
,
value
=
"公司名"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
}))
}))
public
BaseResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
String
userName
=
(
String
)
jsonObject
.
get
(
"userName"
);
String
userName
=
(
String
)
jsonObject
.
get
(
"userName"
);
...
@@ -64,6 +71,7 @@ public class UserController {
...
@@ -64,6 +71,7 @@ public class UserController {
/**
/**
* 删除user
* 删除user
*
* @param userId
* @param userId
* @return
* @return
*/
*/
...
@@ -81,15 +89,16 @@ public class UserController {
...
@@ -81,15 +89,16 @@ public class UserController {
/**
/**
* 修改user
* 修改user
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"用户修改接口"
,
notes
=
"修改用户"
)
@ApiOperation
(
value
=
"用户修改接口"
,
notes
=
"修改用户"
)
@PostMapping
(
"update"
)
@PostMapping
(
"update"
)
@MyLog
(
title
=
"修改用户"
,
optParam
=
"#{userId},#{password}"
,
businessType
=
BusinessType
.
UPDATE
)
@MyLog
(
title
=
"修改用户"
,
optParam
=
"#{userId},#{password}"
,
businessType
=
BusinessType
.
UPDATE
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"userId"
,
value
=
"用户Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
),
@DynamicParameter
(
name
=
"userId"
,
value
=
"用户Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
),
@DynamicParameter
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
@DynamicParameter
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
}))
}))
public
BaseResult
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
int
userId
=
jsonObject
.
getInteger
(
"userId"
);
int
userId
=
jsonObject
.
getInteger
(
"userId"
);
...
@@ -105,6 +114,7 @@ public class UserController {
...
@@ -105,6 +114,7 @@ public class UserController {
/**
/**
* 分页查询所有的user
* 分页查询所有的user
*
* @param pageNo
* @param pageNo
* @param pageSize
* @param pageSize
* @return
* @return
...
@@ -113,24 +123,24 @@ public class UserController {
...
@@ -113,24 +123,24 @@ public class UserController {
@GetMapping
(
"list"
)
@GetMapping
(
"list"
)
@MyLog
(
title
=
"获取用户列表"
,
optParam
=
"#{pageNo},#{pageSize},#{userName},#{company}"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取用户列表"
,
optParam
=
"#{pageNo},#{pageSize},#{userName},#{company}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
),
@ApiImplicitParam
(
name
=
"company"
,
value
=
"公司名"
)
@ApiImplicitParam
(
name
=
"company"
,
value
=
"公司名"
)
})
})
public
PageResult
<
UserVo
>
getUserList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
public
PageResult
<
UserVo
>
getUserList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
int
total
=
records
.
getTotal
();
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
)
{
if
(
mod
!=
0
)
{
pages
=
pages
+
1
;
pages
=
pages
+
1
;
}
}
List
<
UserVo
>
result
=
records
.
getResult
();
List
<
UserVo
>
result
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
}
}
}
}
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