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
6f12179b
Commit
6f12179b
authored
Jul 12, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
5f66a4f5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
32 deletions
+40
-32
LoginController.java
.../java/iot/sixiang/license/controller/LoginController.java
+1
-1
OperateController.java
...ava/iot/sixiang/license/controller/OperateController.java
+28
-24
ResResult.java
...se/src/main/java/iot/sixiang/license/model/ResResult.java
+11
-6
antisamy-esapi.xml
license/src/main/resources/antisamy-esapi.xml
+0
-1
No files found.
license/src/main/java/iot/sixiang/license/controller/LoginController.java
View file @
6f12179b
...
...
@@ -53,7 +53,7 @@ public class LoginController {
String
token
=
JwtUtil
.
createToken
(
dbUser
);
LoginVo
loginVo
=
new
LoginVo
();
loginVo
.
setAuthorization
(
token
);
return
ResResult
.
success
().
r
ecord
(
loginVo
);
return
ResResult
.
success
().
goR
ecord
(
loginVo
);
}
}
return
ResResult
.
failed
().
setMsgValue
(
"用户名或密码错误"
);
...
...
license/src/main/java/iot/sixiang/license/controller/OperateController.java
View file @
6f12179b
...
...
@@ -57,7 +57,7 @@ public class OperateController {
@MyLog
(
title
=
"获取服务列表"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
<
SamMonitor
>
getDeviceTypes
()
{
List
<
SamMonitor
>
records
=
operateManager
.
getSamMonitorList
();
return
ResResult
.
success
().
r
ecord
(
records
);
return
ResResult
.
success
().
goR
ecord
(
records
);
}
...
...
@@ -71,10 +71,10 @@ public class OperateController {
@ApiOperation
(
value
=
"获取并发量接口"
,
notes
=
"用于获取并发量"
)
@GetMapping
(
"monitor/qps"
)
@MyLog
(
title
=
"获取并发量"
,
optParam
=
"#{type}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型:0:今天 1:昨天 2:七天前 3:三十天前"
,
required
=
true
,
dataType
=
"int"
)
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型:0:今天 1:昨天 2:七天前 3:三十天前"
,
required
=
true
,
dataType
=
"int"
)
public
ResResult
<
QpsVo
>
getQps
(
@RequestParam
(
"type"
)
int
type
)
{
HashMap
<
String
,
List
<
Integer
>>
monitorList
=
monitorService
.
getMonitorList
(
type
);
return
ResResult
.
success
().
r
ecord
(
monitorList
);
return
ResResult
.
success
().
goR
ecord
(
monitorList
);
}
@ApiOperation
(
value
=
"获取服务自诊断信息接口"
,
notes
=
"用于获取服务诊断信息"
)
...
...
@@ -83,7 +83,7 @@ public class OperateController {
@ApiImplicitParam
()
public
ResResult
<
ServerStatusVo
>
getDiagnosisInfo
()
{
ServerStatusVo
serverStatus
=
forwardManager
.
getServerStatus
();
return
ResResult
.
success
().
r
ecord
(
serverStatus
);
return
ResResult
.
success
().
goR
ecord
(
serverStatus
);
}
...
...
@@ -94,13 +94,13 @@ public class OperateController {
String
userId
=
UserUtils
.
getLoginUserId
();
int
Id
=
Integer
.
valueOf
(
userId
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
Id
);
return
ResResult
.
success
().
r
ecord
(
alarmList
);
return
ResResult
.
success
().
goR
ecord
(
alarmList
);
}
@ApiOperation
(
value
=
"告警已读接口"
,
notes
=
"将告警信息状态设为已读"
)
@PostMapping
(
"alarm/read"
)
@MyLog
(
title
=
"将告警信息状态设为已读"
,
businessType
=
BusinessType
.
OTHER
)
public
BaseResult
readAlarm
(){
public
BaseResult
readAlarm
()
{
String
id
=
UserUtils
.
getLoginUserId
();
int
userId
=
Integer
.
valueOf
(
id
);
boolean
res
=
alarmReadService
.
readAlarm
(
userId
);
...
...
@@ -116,35 +116,36 @@ public class OperateController {
@MyLog
(
title
=
"统计sam总数"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
<
SamVo
>
getSamTotalCount
()
{
Map
<
String
,
SamMonitor
>
samMonitorMap
=
operateManager
.
getSamMonitorMap
();
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
int
totalSamCount
=
0
;
int
totalOnlineCount
=
0
;
for
(
SamMonitor
samMonitor:
samMonitorMap
.
values
())
{
for
(
SamMonitor
samMonitor
:
samMonitorMap
.
values
())
{
totalSamCount
+=
samMonitor
.
getSamCount
();
totalOnlineCount
+=
samMonitor
.
getOnlineCount
();
}
SamVo
samVo
=
new
SamVo
();
samVo
.
setTotalOnlineCount
(
totalOnlineCount
);
samVo
.
setTotalSamCount
(
totalSamCount
);
return
ResResult
.
success
().
r
ecord
(
samVo
);
return
ResResult
.
success
().
goR
ecord
(
samVo
);
}
/**
* 添加server
*
* @param jsonObject
* @return
*/
@ApiOperation
(
value
=
"添加服务接口"
,
notes
=
"用于添加服务"
)
@PostMapping
(
"server/add"
)
@MyLog
(
title
=
"添加服务"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"serverIp"
,
value
=
"服务Ip"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"port"
,
value
=
"端口"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"serverIp"
,
value
=
"服务Ip"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"port"
,
value
=
"端口"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)
}))
public
BaseResult
addServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"serverIp"
);
int
port
=
jsonObject
.
getIntValue
(
"port"
);
boolean
res
=
serverService
.
addServer
(
serverIp
,
port
);
boolean
res
=
serverService
.
addServer
(
serverIp
,
port
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
...
...
@@ -154,6 +155,7 @@ public class OperateController {
/**
* 删除server
*
* @param serverIp
* @return
*/
...
...
@@ -171,20 +173,21 @@ public class OperateController {
/**
* 修改server
*
* @param jsonObject
* @return
*/
@ApiOperation
(
value
=
"修改服务接口"
,
notes
=
"修改服务"
)
@PostMapping
(
"server/update"
)
@MyLog
(
title
=
"修改服务"
,
optParam
=
"#{serverIp},#{port}"
,
businessType
=
BusinessType
.
UPDATE
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"serverIp"
,
value
=
"服务Ip"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"port"
,
value
=
"端口"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"serverIp"
,
value
=
"服务Ip"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"port"
,
value
=
"端口"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)
}))
public
BaseResult
updateServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"serverIp"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
updateServer
(
serverIp
,
port
);
boolean
res
=
serverService
.
updateServer
(
serverIp
,
port
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
...
...
@@ -195,6 +198,7 @@ public class OperateController {
/**
* 分页查询所有的server
*
* @param pageNo
* @param pageSize
* @return
...
...
@@ -203,12 +207,12 @@ public class OperateController {
@GetMapping
(
"server/list"
)
@MyLog
(
title
=
"获取服务列表"
,
optParam
=
"#{pageNo},#{pageSize}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
)
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
)
})
public
ResResult
<
List
<
Server
>>
getServerList
(
@RequestParam
(
"pageNo"
)
int
pageNo
,
@RequestParam
(
"pageSize"
)
int
pageSize
)
{
List
<
Server
>
records
=
serverService
.
getServerList
(
pageNo
,
pageSize
);
return
ResResult
.
success
().
r
ecord
(
records
);
List
<
Server
>
records
=
serverService
.
getServerList
(
pageNo
,
pageSize
);
return
ResResult
.
success
().
goR
ecord
(
records
);
}
}
license/src/main/java/iot/sixiang/license/model/ResResult.java
View file @
6f12179b
...
...
@@ -30,46 +30,51 @@ public class ResResult<T> {
/**
* code = 200
* msg = 操作成功
*
* @return
*/
public
static
ResResult
success
()
{
return
new
ResResult
(
ResultCode
.
SUCCESS
.
getCode
(),
ResultCode
.
SUCCESS
.
getMsg
());
return
new
ResResult
(
ResultCode
.
SUCCESS
.
getCode
(),
ResultCode
.
SUCCESS
.
getMsg
());
}
/**
* code = 400
* msg = 服务异常
*
* @return
*/
public
static
ResResult
serverException
()
{
return
new
ResResult
(
ResultCode
.
SERVER_EXCEPTION
.
getCode
(),
ResultCode
.
SERVER_EXCEPTION
.
getMsg
());
return
new
ResResult
(
ResultCode
.
SERVER_EXCEPTION
.
getCode
(),
ResultCode
.
SERVER_EXCEPTION
.
getMsg
());
}
/**
* code = 401
* msg = 暂未登录或token已经过期
*
* @return
*/
public
static
ResResult
unauthorized
()
{
return
new
ResResult
(
ResultCode
.
UNAUTHORIZED
.
getCode
(),
ResultCode
.
UNAUTHORIZED
.
getMsg
());
return
new
ResResult
(
ResultCode
.
UNAUTHORIZED
.
getCode
(),
ResultCode
.
UNAUTHORIZED
.
getMsg
());
}
/**
* code = 402
* msg = 参数校验失败
*
* @return
*/
public
static
ResResult
validate_failed
()
{
return
new
ResResult
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
return
new
ResResult
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
/**
* code = 403
* msg = 操作失败(数据库增删改查等失败)
*
* @return
*/
public
static
ResResult
failed
()
{
return
new
ResResult
(
ResultCode
.
SUCCESS
.
getCode
(),
ResultCode
.
SUCCESS
.
getMsg
());
return
new
ResResult
(
ResultCode
.
SUCCESS
.
getCode
(),
ResultCode
.
SUCCESS
.
getMsg
());
}
...
...
@@ -83,7 +88,7 @@ public class ResResult<T> {
return
this
;
}
public
ResResult
record
(
T
data
)
{
public
ResResult
goRecord
(
T
data
)
{
this
.
record
=
data
;
return
this
;
}
...
...
license/src/main/resources/antisamy-esapi.xml
View file @
6f12179b
...
...
@@ -70,7 +70,6 @@ Slashdot allowed tags taken from "Reply" page:
<attribute
name=
"href"
onInvalid=
"filterTag"
>
<regexp-list>
<regexp
name=
"onsiteURL"
/>
<regexp
name=
"offsiteURL"
/>
</regexp-list>
</attribute>
...
...
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