Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
6d941c09
"eladmin-system/src/main/vscode:/vscode.git/clone" did not exist on "db6d523adbc72461000544cb01c110cf800d077f"
Commit
6d941c09
authored
Nov 25, 2019
by
dqjdda
Browse files
代码优化
parent
2853f394
Changes
27
Hide whitespace changes
Inline
Side-by-side
eladmin-monitor/pom.xml
View file @
6d941c09
...
...
@@ -13,7 +13,7 @@
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-monitor
</artifactId>
<version>
2.
2
</version>
<version>
2.
3
</version>
<name>
客户端监控模块
</name>
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Deploy.java
View file @
6d941c09
...
...
@@ -3,8 +3,11 @@ package me.zhengjie.modules.mnt.domain;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Set
;
/**
...
...
@@ -37,6 +40,9 @@ public class Deploy implements Serializable {
@JoinTable
(
name
=
"mnt_deploy_server"
,
joinColumns
=
{
@JoinColumn
(
name
=
"deploy_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"server_id"
,
referencedColumnName
=
"id"
)})
private
Set
<
ServerDeploy
>
deploys
;
@CreationTimestamp
private
Timestamp
createTime
;
public
void
copy
(
Deploy
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/DeployHistory.java
View file @
6d941c09
...
...
@@ -3,8 +3,11 @@ package me.zhengjie.modules.mnt.domain;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* @author zhanghouying
...
...
@@ -37,8 +40,9 @@ public class DeployHistory implements Serializable {
/**
* 部署时间
*/
@Column
(
name
=
"deploy_date"
,
nullable
=
false
)
private
String
deployDate
;
@Column
(
name
=
"deploy_date"
)
@CreationTimestamp
private
Timestamp
deployDate
;
/**
* 部署人员
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DatabaseRepository.java
View file @
6d941c09
...
...
@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
DatabaseRepository
extends
JpaRepository
<
Database
,
String
>,
JpaSpecificationExecutor
{
public
interface
DatabaseRepository
extends
JpaRepository
<
Database
,
String
>,
JpaSpecificationExecutor
<
Database
>
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployHistoryRepository.java
View file @
6d941c09
...
...
@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
DeployHistoryRepository
extends
JpaRepository
<
DeployHistory
,
String
>,
JpaSpecificationExecutor
{
public
interface
DeployHistoryRepository
extends
JpaRepository
<
DeployHistory
,
String
>,
JpaSpecificationExecutor
<
DeployHistory
>
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/ServerDeployRepository.java
View file @
6d941c09
...
...
@@ -12,9 +12,5 @@ import org.springframework.data.jpa.repository.Query;
*/
public
interface
ServerDeployRepository
extends
JpaRepository
<
ServerDeploy
,
Long
>,
JpaSpecificationExecutor
<
ServerDeploy
>
{
@Modifying
@Query
(
value
=
"update mnt_server set account_id = null where account_id = ?1"
,
nativeQuery
=
true
)
void
changeByAccount
(
String
id
);
ServerDeploy
findByIp
(
String
ip
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java
View file @
6d941c09
...
...
@@ -6,7 +6,6 @@ import me.zhengjie.aop.log.Log;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.service.AppService
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -23,31 +22,30 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"/api/app"
)
public
class
AppController
{
@Autowired
private
AppService
appService
;
private
final
AppService
appService
;
public
AppController
(
AppService
appService
){
this
.
appService
=
this
.
appService
;
}
this
.
appService
=
appService
;
}
@Log
(
"查询
App
"
)
@ApiOperation
(
value
=
"查询
App
"
)
@Log
(
"查询
应用
"
)
@ApiOperation
(
value
=
"查询
应用
"
)
@GetMapping
@PreAuthorize
(
"@el.check('app:list')"
)
public
ResponseEntity
getApps
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
appService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
appService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增
App
"
)
@ApiOperation
(
value
=
"新增
App
"
)
@Log
(
"新增
应用
"
)
@ApiOperation
(
value
=
"新增
应用
"
)
@PostMapping
@PreAuthorize
(
"@el.check('app:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
App
resources
){
return
new
ResponseEntity
(
appService
.
create
(
resources
),
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>
(
appService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改
App
"
)
@ApiOperation
(
value
=
"修改
App
"
)
@Log
(
"修改
应用
"
)
@ApiOperation
(
value
=
"修改
应用
"
)
@PutMapping
@PreAuthorize
(
"@el.check('app:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
App
resources
){
...
...
@@ -55,8 +53,8 @@ public class AppController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除
App
"
)
@ApiOperation
(
value
=
"删除
App
"
)
@Log
(
"删除
应用
"
)
@ApiOperation
(
value
=
"删除
应用
"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('app:del')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java
View file @
6d941c09
...
...
@@ -6,7 +6,6 @@ import me.zhengjie.aop.log.Log;
import
me.zhengjie.modules.mnt.domain.Database
;
import
me.zhengjie.modules.mnt.service.DatabaseService
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -23,27 +22,30 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"/api/database"
)
public
class
DatabaseController
{
@Autowired
private
DatabaseService
databaseService
;
private
final
DatabaseService
databaseService
;
@Log
(
"查询Database"
)
@ApiOperation
(
value
=
"查询Database"
)
public
DatabaseController
(
DatabaseService
databaseService
)
{
this
.
databaseService
=
databaseService
;
}
@Log
(
"查询数据库"
)
@ApiOperation
(
value
=
"查询数据库"
)
@GetMapping
@PreAuthorize
(
"@el.check('database:list')"
)
public
ResponseEntity
getDatabases
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
databaseService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
databaseService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增
Database
"
)
@ApiOperation
(
value
=
"新增
Database
"
)
@Log
(
"新增
数据库
"
)
@ApiOperation
(
value
=
"新增
数据库
"
)
@PostMapping
@PreAuthorize
(
"@el.check('database:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
Database
resources
){
return
new
ResponseEntity
(
databaseService
.
create
(
resources
),
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>
(
databaseService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改
Database
"
)
@ApiOperation
(
value
=
"修改
Database
"
)
@Log
(
"修改
数据库
"
)
@ApiOperation
(
value
=
"修改
数据库
"
)
@PutMapping
@PreAuthorize
(
"@el.check('database:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
Database
resources
){
...
...
@@ -51,8 +53,8 @@ public class DatabaseController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除
Database
"
)
@ApiOperation
(
value
=
"删除
Database
"
)
@Log
(
"删除
数据库
"
)
@ApiOperation
(
value
=
"删除
数据库
"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('database:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java
View file @
6d941c09
...
...
@@ -8,7 +8,6 @@ import me.zhengjie.modules.mnt.domain.DeployHistory;
import
me.zhengjie.modules.mnt.service.DeployService
;
import
me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria
;
import
me.zhengjie.utils.FileUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -16,12 +15,11 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* @author zhanghouying
...
...
@@ -34,27 +32,30 @@ public class DeployController {
private
String
fileSavePath
=
System
.
getProperty
(
"java.io.tmpdir"
);
@Autowired
private
DeployService
deployService
;
private
final
DeployService
deployService
;
public
DeployController
(
DeployService
deployService
)
{
this
.
deployService
=
deployService
;
}
@Log
(
"查询
Deploy
"
)
@ApiOperation
(
value
=
"查询
Deploy
"
)
@Log
(
"查询
部署
"
)
@ApiOperation
(
value
=
"查询
部署
"
)
@GetMapping
@PreAuthorize
(
"@el.check('deploy:list')"
)
public
ResponseEntity
getDeploys
(
DeployQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
deployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
deployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增
Deploy
"
)
@ApiOperation
(
value
=
"新增
Deploy
"
)
@Log
(
"新增
部署
"
)
@ApiOperation
(
value
=
"新增
部署
"
)
@PostMapping
@PreAuthorize
(
"@el.check('deploy:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
Deploy
resources
){
return
new
ResponseEntity
(
deployService
.
create
(
resources
),
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>
(
deployService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改
Deploy
"
)
@ApiOperation
(
value
=
"修改
Deploy
"
)
@Log
(
"修改
部署
"
)
@ApiOperation
(
value
=
"修改
部署
"
)
@PutMapping
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
Deploy
resources
){
...
...
@@ -62,8 +63,8 @@ public class DeployController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除
Deploy
"
)
@ApiOperation
(
value
=
"删除
Deploy
"
)
@Log
(
"删除
部署
"
)
@ApiOperation
(
value
=
"删除
部署
"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('deploy:del')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
...
...
@@ -71,11 +72,11 @@ public class DeployController {
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
@Log
(
"上传文件
Deploy
"
)
@ApiOperation
(
value
=
"上传文件
Deploy
"
)
@Log
(
"上传文件
部署
"
)
@ApiOperation
(
value
=
"上传文件
部署
"
)
@PostMapping
(
value
=
"/upload"
)
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
upload
(
@RequestBody
MultipartFile
file
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
upload
(
@RequestBody
MultipartFile
file
,
HttpServletRequest
request
)
throws
Exception
{
Long
id
=
Long
.
valueOf
(
request
.
getParameter
(
"id"
));
String
fileName
=
""
;
if
(
file
!=
null
){
...
...
@@ -88,42 +89,42 @@ public class DeployController {
}
else
{
System
.
out
.
println
(
"没有找到相对应的文件"
);
}
System
.
out
.
println
(
"文件上传的原名称为:"
+
file
.
getOriginalFilename
());
Map
map
=
new
HashMap
(
2
);
System
.
out
.
println
(
"文件上传的原名称为:"
+
Objects
.
requireNonNull
(
file
)
.
getOriginalFilename
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>
(
2
);
map
.
put
(
"errno"
,
0
);
map
.
put
(
"id"
,
fileName
);
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
map
,
HttpStatus
.
OK
);
}
@Log
(
"系统还原"
)
@ApiOperation
(
value
=
"系统还原"
)
@PostMapping
(
value
=
"/serverReduction"
)
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
serverReduction
(
@Validated
@RequestBody
DeployHistory
resources
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
serverReduction
(
@Validated
@RequestBody
DeployHistory
resources
)
{
String
result
=
deployService
.
serverReduction
(
resources
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
result
,
HttpStatus
.
OK
);
}
@Log
(
"服务运行状态"
)
@ApiOperation
(
value
=
"服务运行状态"
)
@PostMapping
(
value
=
"/serverStatus"
)
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
serverStatus
(
@Validated
@RequestBody
Deploy
resources
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
serverStatus
(
@Validated
@RequestBody
Deploy
resources
)
{
String
result
=
deployService
.
serverStatus
(
resources
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
result
,
HttpStatus
.
OK
);
}
@Log
(
"启动服务"
)
@ApiOperation
(
value
=
"启动服务"
)
@PostMapping
(
value
=
"/startServer"
)
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
startServer
(
@Validated
@RequestBody
Deploy
resources
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
startServer
(
@Validated
@RequestBody
Deploy
resources
)
{
String
result
=
deployService
.
startServer
(
resources
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
result
,
HttpStatus
.
OK
);
}
@Log
(
"停止服务"
)
@ApiOperation
(
value
=
"停止服务"
)
@PostMapping
(
value
=
"/stopServer"
)
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
stopServer
(
@Validated
@RequestBody
Deploy
resources
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
stopServer
(
@Validated
@RequestBody
Deploy
resources
)
{
String
result
=
deployService
.
stopServer
(
resources
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
result
,
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java
View file @
6d941c09
...
...
@@ -23,19 +23,22 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"/api/deployHistory"
)
public
class
DeployHistoryController
{
@Autowired
private
DeployHistoryService
deployhistoryService
;
private
final
DeployHistoryService
deployhistoryService
;
@Log
(
"查询DeployHistory"
)
@ApiOperation
(
value
=
"查询DeployHistory"
)
public
DeployHistoryController
(
DeployHistoryService
deployhistoryService
)
{
this
.
deployhistoryService
=
deployhistoryService
;
}
@Log
(
"查询部署历史"
)
@ApiOperation
(
value
=
"查询部署历史"
)
@GetMapping
@PreAuthorize
(
"@el.check('deployHistory:list')"
)
public
ResponseEntity
getDeployHistorys
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
deployhistoryService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
deployhistoryService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"删除DeployHistory"
)
@ApiOperation
(
value
=
"删除
DeployHistory
"
)
@ApiOperation
(
value
=
"删除
部署历史
"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"hasAnyRole('deployHistory:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java
View file @
6d941c09
...
...
@@ -6,7 +6,6 @@ import me.zhengjie.aop.log.Log;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
me.zhengjie.modules.mnt.service.ServerDeployService
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -18,32 +17,35 @@ import org.springframework.web.bind.annotation.*;
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"服务器
部署
管理"
)
@Api
(
tags
=
"服务器管理"
)
@RestController
@RequestMapping
(
"/api/serverDeploy"
)
public
class
ServerDeployController
{
@Autowired
private
ServerDeployService
serverDeployService
;
private
final
ServerDeployService
serverDeployService
;
@Log
(
"查询Server"
)
@ApiOperation
(
value
=
"查询Server"
)
public
ServerDeployController
(
ServerDeployService
serverDeployService
)
{
this
.
serverDeployService
=
serverDeployService
;
}
@Log
(
"查询服务器"
)
@ApiOperation
(
value
=
"查询服务器"
)
@GetMapping
@PreAuthorize
(
"@el.check('serverDeploy:list')"
)
public
ResponseEntity
getServers
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
serverDeployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
serverDeployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增
Server
"
)
@ApiOperation
(
value
=
"新增
Server
"
)
@Log
(
"新增
服务器
"
)
@ApiOperation
(
value
=
"新增
服务器
"
)
@PostMapping
@PreAuthorize
(
"@el.check('serverDeploy:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
ServerDeploy
resources
){
return
new
ResponseEntity
(
serverDeployService
.
create
(
resources
),
HttpStatus
.
CREATED
);
return
new
ResponseEntity
<>
(
serverDeployService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改
Server
"
)
@ApiOperation
(
value
=
"修改
Server
"
)
@Log
(
"修改
服务器
"
)
@ApiOperation
(
value
=
"修改
服务器
"
)
@PutMapping
@PreAuthorize
(
"@el.check('serverDeploy:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
ServerDeploy
resources
){
...
...
@@ -51,7 +53,7 @@ public class ServerDeployController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除
Server
"
)
@Log
(
"删除
服务器
"
)
@ApiOperation
(
value
=
"删除Server"
)
@DeleteMapping
(
value
=
"/{id:.+}"
)
@PreAuthorize
(
"@el.check('serverDeploy:del')"
)
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java
View file @
6d941c09
...
...
@@ -11,44 +11,15 @@ import org.springframework.data.domain.Pageable;
*/
public
interface
AppService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
AppQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
AppQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
Object
queryAll
(
AppQueryCriteria
criteria
);
AppDTO
findById
(
Long
id
);
/**
* create
* @param resources
* @return
*/
AppDTO
create
(
App
resources
);
/**
* update
* @param resources
*/
void
update
(
App
resources
);
/**
* delete
* @param id
*/
void
delete
(
Long
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java
View file @
6d941c09
...
...
@@ -6,49 +6,20 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
import
org.springframework.data.domain.Pageable
;
/**
* @author
:
ZhangHouYing
* @author ZhangHouYing
* @date 2019-08-24
*/
public
interface
DatabaseService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
DatabaseQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
Object
queryAll
(
DatabaseQueryCriteria
criteria
);
DatabaseDTO
findById
(
String
id
);
/**
* create
* @param resources
* @return
*/
DatabaseDTO
create
(
Database
resources
);
/**
* update
* @param resources
*/
void
update
(
Database
resources
);
/**
* delete
* @param id
*/
void
delete
(
String
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java
View file @
6d941c09
...
...
@@ -5,45 +5,15 @@ import me.zhengjie.modules.mnt.service.dto.DeployHistoryDTO;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
/**
*
* @author: ZhangHouYing
* @date 2019-08-24
*/
public
interface
DeployHistoryService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
DeployHistoryQueryCriteria
criteria
);
Object
queryAll
(
DeployHistoryQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
DeployHistoryDTO
findById
(
String
id
);
/**
* create
* @param resources
* @return
*/
DeployHistoryDTO
create
(
DeployHistory
resources
);
/**
* delete
* @param id
*/
void
delete
(
String
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java
View file @
6d941c09
...
...
@@ -12,81 +12,49 @@ import org.springframework.data.domain.Pageable;
*/
public
interface
DeployService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
DeployQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
DeployQueryCriteria
criteria
);
Object
queryAll
(
DeployQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
DeployDTO
findById
(
Long
id
);
/**
* create
* @CacheEvict(allEntries = true)
* @param resources
* @return
*/
DeployDTO
create
(
Deploy
resources
);
/**
* update
* @CacheEvict(allEntries = true)
* @param resources
*/
void
update
(
Deploy
resources
);
/**
* delete
* @CacheEvict(allEntries = true)
* @param id
*/
void
delete
(
Long
id
);
/**
* 部署文件到服务器
* @param fileSavePath
* @param appId
* @return
* @param fileSavePath
文件路径
* @param appId
应用ID
* @return
/
*/
public
String
deploy
(
String
fileSavePath
,
Long
appId
);
String
deploy
(
String
fileSavePath
,
Long
appId
);
/**
* 查询部署状态
* @param resources
* @return
* @param resources
/
* @return
/
*/
public
String
serverStatus
(
Deploy
resources
);
String
serverStatus
(
Deploy
resources
);
/**
* 启动服务
* @param resources
* @return
* @param resources
/
* @return
/
*/
public
String
startServer
(
Deploy
resources
);
String
startServer
(
Deploy
resources
);
/**
* 停止服务
* @param resources
* @return
* @param resources
/
* @return
/
*/
public
String
stopServer
(
Deploy
resources
);
String
stopServer
(
Deploy
resources
);
/**
* 停止服务
* @param resources
* @return
* @param resources
/
* @return
/
*/
public
String
serverReduction
(
DeployHistory
resources
);
String
serverReduction
(
DeployHistory
resources
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java
View file @
6d941c09
...
...
@@ -11,45 +11,16 @@ import org.springframework.data.domain.Pageable;
*/
public
interface
ServerDeployService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
ServerDeployQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
Object
queryAll
(
ServerDeployQueryCriteria
criteria
);
ServerDeployDTO
findById
(
Long
id
);
/**
* create
* @param resources
* @return
*/
ServerDeployDTO
create
(
ServerDeploy
resources
);
/**
* update
* @param resources
*/
void
update
(
ServerDeploy
resources
);
/**
* delete
* @param id
*/
void
delete
(
Long
id
);
ServerDeployDTO
findByIp
(
String
ip
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppDTO.java
View file @
6d941c09
...
...
@@ -16,7 +16,7 @@ public class AppDTO implements Serializable {
/**
* 应用编号
*/
private
Stri
ng
id
;
private
Lo
ng
id
;
/**
* 应用名称
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployDTO.java
View file @
6d941c09
package
me.zhengjie.modules.mnt.service.dto
;
import
cn.hutool.core.collection.CollectionUtil
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -24,9 +27,19 @@ public class DeployDTO implements Serializable {
*/
private
Set
<
ServerDeployDTO
>
deploys
;
private
String
servers
;
/**
* 服务状态
*/
private
String
status
;
private
Timestamp
createTime
;
public
String
getServers
()
{
if
(
CollectionUtil
.
isNotEmpty
(
deploys
)){
return
deploys
.
stream
().
map
(
ServerDeployDTO:
:
getName
).
collect
(
Collectors
.
joining
(
","
));
}
return
servers
;
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryDTO.java
View file @
6d941c09
...
...
@@ -2,6 +2,7 @@ package me.zhengjie.modules.mnt.service.dto;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
...
...
@@ -29,7 +30,7 @@ public class DeployHistoryDTO implements Serializable {
/**
* 部署时间
*/
private
String
deployDate
;
private
Timestamp
deployDate
;
/**
* 部署人员
...
...
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryQueryCriteria.java
View file @
6d941c09
...
...
@@ -2,6 +2,8 @@ package me.zhengjie.modules.mnt.service.dto;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
/**
* @author zhanghouying
...
...
@@ -15,4 +17,7 @@ public class DeployHistoryQueryCriteria{
*/
@Query
(
blurry
=
"appName,ip,deployUser,deployId"
)
private
String
blurry
;
@Query
(
type
=
Query
.
Type
.
BETWEEN
)
private
List
<
Timestamp
>
deployDate
;
}
Prev
1
2
Next
Write
Preview
Supports
Markdown
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