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
3e628fa5
Commit
3e628fa5
authored
Jun 14, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并controller
parent
2d76ca93
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
261 deletions
+146
-261
AlarmController.java
.../java/iot/sixiang/license/controller/AlarmController.java
+0
-44
AlarmReadController.java
...a/iot/sixiang/license/controller/AlarmReadController.java
+0
-46
OperateController.java
...ava/iot/sixiang/license/controller/OperateController.java
+144
-0
SamMapController.java
...java/iot/sixiang/license/controller/SamMapController.java
+0
-47
ServerController.java
...java/iot/sixiang/license/controller/ServerController.java
+0
-122
SysOperLogController.java
.../iot/sixiang/license/controller/SysOperLogController.java
+2
-2
No files found.
license/src/main/java/iot/sixiang/license/controller/AlarmController.java
deleted
100644 → 0
View file @
2d76ca93
package
iot
.
sixiang
.
license
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.vo.AlarmVo
;
import
iot.sixiang.license.service.AlarmService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 前端控制器
* </p>
*
* @author m33
* @since 2022-06-10
*/
@RestController
@RequestMapping
(
"/iot_license/alarm"
)
@Api
(
value
=
"告警模块"
,
tags
=
{
"告警模块"
})
public
class
AlarmController
{
@Autowired
private
AlarmService
alarmService
;
@ApiOperation
(
value
=
"获取告警列表接口"
,
notes
=
"用于获取告警列表"
)
@GetMapping
(
"list"
)
@MyLog
(
title
=
"获取告警列表"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
getAlarmList
()
{
String
userId
=
UserUtils
.
getLoginUserId
();
int
Id
=
Integer
.
valueOf
(
userId
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
Id
);
return
ResResult
.
success
().
record
(
alarmList
);
}
}
\ No newline at end of file
license/src/main/java/iot/sixiang/license/controller/AlarmReadController.java
deleted
100644 → 0
View file @
2d76ca93
package
iot
.
sixiang
.
license
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.service.AlarmReadService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 前端控制器
* </p>
*
* @author m33
* @since 2022-06-10
*/
@RestController
@RequestMapping
(
"/iot_license/alarm_read"
)
@Api
(
value
=
"告警模块"
,
tags
=
{
"告警模块"
})
public
class
AlarmReadController
{
@Autowired
private
AlarmReadService
alarmReadService
;
@ApiOperation
(
value
=
"告警已读接口"
,
notes
=
"将告警信息状态设为已读"
)
@PostMapping
(
"read"
)
@MyLog
(
title
=
"将告警信息状态设为已读"
,
businessType
=
BusinessType
.
OTHER
)
public
BaseResult
readAlarm
(){
String
id
=
UserUtils
.
getLoginUserId
();
int
userId
=
Integer
.
valueOf
(
id
);
boolean
res
=
alarmReadService
.
readAlarm
(
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
}
license/src/main/java/iot/sixiang/license/controller/OperateController.java
View file @
3e628fa5
package
iot
.
sixiang
.
license
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.DynamicParameter
;
import
com.github.xiaoymin.knife4j.annotations.DynamicParameters
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.entity.Server
;
import
iot.sixiang.license.forward.ForwardManager
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.SamMonitor
;
import
iot.sixiang.license.model.vo.AlarmVo
;
import
iot.sixiang.license.model.vo.ServerStatusVo
;
import
iot.sixiang.license.operate.OperateManager
;
import
iot.sixiang.license.service.AlarmReadService
;
import
iot.sixiang.license.service.AlarmService
;
import
iot.sixiang.license.service.MonitorService
;
import
iot.sixiang.license.service.ServerService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@RestController
...
...
@@ -24,6 +37,12 @@ import java.util.List;
@Api
(
value
=
"运维模块"
,
tags
=
{
"运维模块"
})
public
class
OperateController
{
@Autowired
private
AlarmService
alarmService
;
@Autowired
private
AlarmReadService
alarmReadService
;
@Autowired
private
ServerService
serverService
;
@Autowired
private
OperateManager
operateManager
;
@Autowired
...
...
@@ -64,4 +83,129 @@ public class OperateController {
ServerStatusVo
serverStatus
=
forwardManager
.
getServerStatus
();
return
ResResult
.
success
().
record
(
serverStatus
);
}
@ApiOperation
(
value
=
"获取告警列表接口"
,
notes
=
"用于获取告警列表"
)
@GetMapping
(
"alarm/list"
)
@MyLog
(
title
=
"获取告警列表"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
getAlarmList
()
{
String
userId
=
UserUtils
.
getLoginUserId
();
int
Id
=
Integer
.
valueOf
(
userId
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
Id
);
return
ResResult
.
success
().
record
(
alarmList
);
}
@ApiOperation
(
value
=
"告警已读接口"
,
notes
=
"将告警信息状态设为已读"
)
@PostMapping
(
"alarm/read"
)
@MyLog
(
title
=
"将告警信息状态设为已读"
,
businessType
=
BusinessType
.
OTHER
)
public
BaseResult
readAlarm
(){
String
id
=
UserUtils
.
getLoginUserId
();
int
userId
=
Integer
.
valueOf
(
id
);
boolean
res
=
alarmReadService
.
readAlarm
(
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
@ApiOperation
(
value
=
"统计sam总数接口"
,
notes
=
"用于统计sam的总数和总在线数量"
)
@GetMapping
(
"sam/count"
)
@MyLog
(
title
=
"统计sam总数"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
getSamTotalCount
()
{
Map
<
String
,
SamMonitor
>
samMonitorMap
=
operateManager
.
getSamMonitorMap
();
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
int
totalSamCount
=
0
;
int
totalOnlineCount
=
0
;
for
(
SamMonitor
samMonitor:
samMonitorMap
.
values
())
{
totalSamCount
+=
samMonitor
.
getSamCount
();
totalOnlineCount
+=
samMonitor
.
getOnlineCount
();
}
map
.
put
(
"totalSamCount"
,
totalSamCount
);
map
.
put
(
"totalOnlineCount"
,
totalOnlineCount
);
return
ResResult
.
success
().
record
(
map
);
}
/**
* 添加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
)
}))
public
BaseResult
addServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"serverIp"
);
int
port
=
jsonObject
.
getIntValue
(
"port"
);
boolean
res
=
serverService
.
addServer
(
serverIp
,
port
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 删除server
* @param serverIp
* @return
*/
@MyLog
(
title
=
"删除服务"
,
optParam
=
"#{serverIp}"
,
businessType
=
BusinessType
.
DELETE
)
@ApiOperation
(
value
=
"删除服务接口"
,
notes
=
"删除服务"
)
@PostMapping
(
"server/delete"
)
public
BaseResult
deleteServer
(
@RequestParam
(
"serverIp"
)
String
serverIp
)
{
boolean
res
=
serverService
.
deleteServer
(
serverIp
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 修改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
)
}))
public
BaseResult
updateServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"serverIp"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
updateServer
(
serverIp
,
port
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 分页查询所有的server
* @param pageNo
* @param pageSize
* @return
*/
@ApiOperation
(
value
=
"获取服务列表接口"
,
notes
=
"用于获取服务列表"
)
@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"
)
})
public
ResResult
getServerList
(
@RequestParam
(
"pageNo"
)
int
pageNo
,
@RequestParam
(
"pageSize"
)
int
pageSize
)
{
List
<
Server
>
records
=
serverService
.
getServerList
(
pageNo
,
pageSize
);
return
ResResult
.
success
().
record
(
records
);
}
}
license/src/main/java/iot/sixiang/license/controller/SamMapController.java
deleted
100644 → 0
View file @
2d76ca93
package
iot
.
sixiang
.
license
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.SamMonitor
;
import
iot.sixiang.license.operate.OperateManager
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by m33 on 2022/6/10 16:43
*/
@Slf4j
@RestController
@RequestMapping
(
"/iot_license/sam"
)
@Api
(
value
=
"sam管理模块"
,
tags
=
{
"sam管理模块"
})
public
class
SamMapController
{
@Autowired
public
OperateManager
operateManager
;
@ApiOperation
(
value
=
"统计sam总数接口"
,
notes
=
"用于统计sam的总数和总在线数量"
)
@GetMapping
(
"count"
)
@MyLog
(
title
=
"统计sam总数"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
getSamTotalCount
()
{
Map
<
String
,
SamMonitor
>
samMonitorMap
=
operateManager
.
getSamMonitorMap
();
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
int
totalSamCount
=
0
;
int
totalOnlineCount
=
0
;
for
(
SamMonitor
samMonitor:
samMonitorMap
.
values
())
{
totalSamCount
+=
samMonitor
.
getSamCount
();
totalOnlineCount
+=
samMonitor
.
getOnlineCount
();
}
map
.
put
(
"totalSamCount"
,
totalSamCount
);
map
.
put
(
"totalOnlineCount"
,
totalOnlineCount
);
return
ResResult
.
success
().
record
(
map
);
}
}
license/src/main/java/iot/sixiang/license/controller/ServerController.java
deleted
100644 → 0
View file @
2d76ca93
package
iot
.
sixiang
.
license
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.DynamicParameter
;
import
com.github.xiaoymin.knife4j.annotations.DynamicParameters
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.entity.Server
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.BaseResult
;
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.*
;
import
java.util.List
;
/**
* <p>
* 前端控制器
* </p>
*
* @author m33
* @since 2022-06-06
*/
@RestController
@RequestMapping
(
"/iot_license/server"
)
@Api
(
value
=
"服务模块"
,
tags
=
{
"服务模块"
})
public
class
ServerController
{
@Autowired
private
ServerService
serverService
;
/**
* 添加server
* @param jsonObject
* @return
*/
@ApiOperation
(
value
=
"添加服务接口"
,
notes
=
"用于添加服务"
)
@PostMapping
(
"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
)
}))
public
BaseResult
addServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"serverIp"
);
int
port
=
jsonObject
.
getIntValue
(
"port"
);
boolean
res
=
serverService
.
addServer
(
serverIp
,
port
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 删除server
* @param serverIp
* @return
*/
@MyLog
(
title
=
"删除服务"
,
optParam
=
"#{serverIp}"
,
businessType
=
BusinessType
.
DELETE
)
@ApiOperation
(
value
=
"删除服务接口"
,
notes
=
"删除服务"
)
@PostMapping
(
"delete"
)
public
BaseResult
deleteServer
(
@RequestParam
(
"serverIp"
)
String
serverIp
)
{
boolean
res
=
serverService
.
deleteServer
(
serverIp
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 修改server
* @param jsonObject
* @return
*/
@ApiOperation
(
value
=
"修改服务接口"
,
notes
=
"修改服务"
)
@PostMapping
(
"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
)
}))
public
BaseResult
updateServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"serverIp"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
updateServer
(
serverIp
,
port
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 分页查询所有的server
* @param pageNo
* @param pageSize
* @return
*/
@ApiOperation
(
value
=
"获取服务列表接口"
,
notes
=
"用于获取服务列表"
)
@GetMapping
(
"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"
)
})
public
ResResult
getServerList
(
@RequestParam
(
"pageNo"
)
int
pageNo
,
@RequestParam
(
"pageSize"
)
int
pageSize
)
{
List
<
Server
>
records
=
serverService
.
getServerList
(
pageNo
,
pageSize
);
return
ResResult
.
success
().
record
(
records
);
}
}
license/src/main/java/iot/sixiang/license/controller/SysOperLogController.java
View file @
3e628fa5
...
...
@@ -22,7 +22,7 @@ import java.util.List;
* Created by m33 on 2022/6/14 13:54
*/
@RestController
@RequestMapping
(
"/iot_license/
oper_
log"
)
@RequestMapping
(
"/iot_license/log"
)
@Api
(
value
=
"日志模块"
,
tags
=
{
"日志模块"
})
public
class
SysOperLogController
{
...
...
@@ -36,7 +36,7 @@ public class SysOperLogController {
* @return
*/
@ApiOperation
(
value
=
"获取日志列表接口"
,
notes
=
"用于获取日志列表"
)
@GetMapping
(
"list"
)
@GetMapping
(
"
operate/
list"
)
@MyLog
(
title
=
"获取日志列表"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
...
...
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