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
7b11e81f
Commit
7b11e81f
authored
Nov 19, 2019
by
zhanghouying
Browse files
添加运维系统
parent
f81b4fd3
Changes
58
Hide whitespace changes
Inline
Side-by-side
eladmin-system/pom.xml
View file @
7b11e81f
...
@@ -25,6 +25,11 @@
...
@@ -25,6 +25,11 @@
<version>
2.3
</version>
<version>
2.3
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<!--jwt-->
<!--jwt-->
<dependency>
<dependency>
<groupId>
io.jsonwebtoken
</groupId>
<groupId>
io.jsonwebtoken
</groupId>
...
@@ -38,6 +43,18 @@
...
@@ -38,6 +43,18 @@
<artifactId>
quartz
</artifactId>
<artifactId>
quartz
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
ch.ethz.ganymed
</groupId>
<artifactId>
ganymed-ssh2
</artifactId>
<version>
build210
</version>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.55
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
@@ -56,4 +73,4 @@
...
@@ -56,4 +73,4 @@
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
</project>
</project>
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/config/WebSocketConfig.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.socket.server.standard.ServerEndpointExporter
;
/**
* @author: ZhangHouYing
* @date: 2019-08-24 15:44
*/
@Configuration
public
class
WebSocketConfig
{
@Bean
public
ServerEndpointExporter
serverEndpointExporter
()
{
return
new
ServerEndpointExporter
();
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/App.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.domain
;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Entity
@Data
@Table
(
name
=
"mnt_app"
)
public
class
App
implements
Serializable
{
/**
* 应用编号
*/
@Id
@Column
(
name
=
"id"
)
private
String
id
;
/**
* 应用名称
*/
@Column
(
name
=
"name"
)
private
String
name
;
/**
* 端口
*/
@Column
(
name
=
"port"
)
private
int
port
;
/**
* 上传目录
*/
@Column
(
name
=
"upload_path"
)
private
String
uploadPath
;
/**
* 部署目录
*/
@Column
(
name
=
"deploy_path"
)
private
String
deployPath
;
/**
* 备份目录
*/
@Column
(
name
=
"backup_path"
)
private
String
backupPath
;
/**
* 启动脚本
*/
@Column
(
name
=
"start_script"
)
private
String
startScript
;
/**
* 部署脚本
*/
@Column
(
name
=
"deploy_script"
)
private
String
deployScript
;
public
void
copy
(
App
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Database.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.domain
;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Entity
@Data
@Table
(
name
=
"mnt_database"
)
public
class
Database
implements
Serializable
{
/**
* id
*/
@Id
@Column
(
name
=
"id"
)
private
String
id
;
/**
* 数据库名称
*/
@Column
(
name
=
"name"
,
nullable
=
false
)
private
String
name
;
/**
* 数据库连接地址
*/
@Column
(
name
=
"jdbc_url"
,
nullable
=
false
)
private
String
jdbcUrl
;
/**
* 数据库密码
*/
@Column
(
name
=
"pwd"
,
nullable
=
false
)
private
String
pwd
;
/**
* 用户名
*/
@Column
(
name
=
"user_name"
,
nullable
=
false
)
private
String
userName
;
public
void
copy
(
Database
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Deploy.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.domain
;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Entity
@Data
@Table
(
name
=
"mnt_deploy"
)
public
class
Deploy
implements
Serializable
{
/**
* 部署编号
*/
@Id
@Column
(
name
=
"id"
)
private
String
id
;
/**
* 应用编号
*/
@Column
(
name
=
"app_id"
)
private
String
appId
;
/**
* IP列表
*/
@Column
(
name
=
"ip"
)
private
String
ip
;
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
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.domain
;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Entity
@Data
@Table
(
name
=
"mnt_deploy_history"
)
public
class
DeployHistory
implements
Serializable
{
/**
* 编号
*/
@Id
@Column
(
name
=
"id"
)
private
String
id
;
/**
* 应用名称
*/
@Column
(
name
=
"app_name"
,
nullable
=
false
)
private
String
appName
;
/**
* 部署IP
*/
@Column
(
name
=
"ip"
,
nullable
=
false
)
private
String
ip
;
/**
* 部署时间
*/
@Column
(
name
=
"deploy_date"
,
nullable
=
false
)
private
String
deployDate
;
/**
* 部署人员
*/
@Column
(
name
=
"deploy_user"
,
nullable
=
false
)
private
String
deployUser
;
/**
* 部署编号
*/
@Column
(
name
=
"deploy_id"
,
nullable
=
false
)
private
String
deployId
;
public
void
copy
(
DeployHistory
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/ServerAccount.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.domain
;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Entity
@Data
@Table
(
name
=
"mnt_server_account"
)
public
class
ServerAccount
implements
Serializable
{
/**
* 编号
*/
@Id
@Column
(
name
=
"id"
)
private
String
id
;
/**
* 名称
*/
@Column
(
name
=
"name"
)
private
String
name
;
/**
* 账号
*/
@Column
(
name
=
"account"
)
private
String
account
;
/**
* 密码
*/
@Column
(
name
=
"password"
)
private
String
password
;
public
void
copy
(
ServerAccount
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/ServerDeploy.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.domain
;
import
lombok.Data
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
javax.persistence.*
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Entity
@Data
@Table
(
name
=
"mnt_server"
)
public
class
ServerDeploy
implements
Serializable
{
/**
* 服务器IP
*/
@Id
@Column
(
name
=
"id"
)
private
String
id
;
/**
* 服务器账号
*/
@Column
(
name
=
"account_id"
)
private
String
accountId
;
public
void
copy
(
ServerDeploy
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/AppRepository.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.repository
;
import
me.zhengjie.modules.mnt.domain.App
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
AppRepository
extends
JpaRepository
<
App
,
String
>,
JpaSpecificationExecutor
<
App
>
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DatabaseRepository.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.repository
;
import
me.zhengjie.modules.mnt.domain.Database
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
DatabaseRepository
extends
JpaRepository
<
Database
,
String
>,
JpaSpecificationExecutor
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployHistoryRepository.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.repository
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
DeployHistoryRepository
extends
JpaRepository
<
DeployHistory
,
String
>,
JpaSpecificationExecutor
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployRepository.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.repository
;
import
me.zhengjie.modules.mnt.domain.Deploy
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
DeployRepository
extends
JpaRepository
<
Deploy
,
String
>,
JpaSpecificationExecutor
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/ServerAccountRepository.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.repository
;
import
me.zhengjie.modules.mnt.domain.ServerAccount
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
ServerAccountRepository
extends
JpaRepository
<
ServerAccount
,
String
>,
JpaSpecificationExecutor
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/ServerDeployRepository.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.repository
;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
ServerDeployRepository
extends
JpaRepository
<
ServerDeploy
,
String
>,
JpaSpecificationExecutor
{
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
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
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"应用管理"
)
@RestController
@RequestMapping
(
"/api/app"
)
public
class
AppController
{
@Autowired
private
AppService
appService
;
public
AppController
(
AppService
appService
){
this
.
appService
=
this
.
appService
;
}
@Log
(
"查询App"
)
@ApiOperation
(
value
=
"查询App"
)
@GetMapping
@PreAuthorize
(
"@el.check('app:list')"
)
public
ResponseEntity
getApps
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
appService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增App"
)
@ApiOperation
(
value
=
"新增App"
)
@PostMapping
@PreAuthorize
(
"@el.check('app:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
App
resources
){
return
new
ResponseEntity
(
appService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改App"
)
@ApiOperation
(
value
=
"修改App"
)
@PutMapping
@PreAuthorize
(
"@el.check('app:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
App
resources
){
appService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除App"
)
@ApiOperation
(
value
=
"删除App"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('app:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
appService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
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
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"数据库管理"
)
@RestController
@RequestMapping
(
"/api/database"
)
public
class
DatabaseController
{
@Autowired
private
DatabaseService
databaseService
;
@Log
(
"查询Database"
)
@ApiOperation
(
value
=
"查询Database"
)
@GetMapping
@PreAuthorize
(
"@el.check('database:list')"
)
public
ResponseEntity
getDatabases
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
databaseService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增Database"
)
@ApiOperation
(
value
=
"新增Database"
)
@PostMapping
@PreAuthorize
(
"@el.check('database:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
Database
resources
){
return
new
ResponseEntity
(
databaseService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改Database"
)
@ApiOperation
(
value
=
"修改Database"
)
@PutMapping
@PreAuthorize
(
"@el.check('database:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
Database
resources
){
databaseService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除Database"
)
@ApiOperation
(
value
=
"删除Database"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('database:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
databaseService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.mnt.domain.Deploy
;
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
;
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
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"部署管理"
)
@RestController
@RequestMapping
(
"/api/deploy"
)
public
class
DeployController
{
private
String
fileSavePath
=
System
.
getProperty
(
"java.io.tmpdir"
);
@Autowired
private
DeployService
deployService
;
@Log
(
"查询Deploy"
)
@ApiOperation
(
value
=
"查询Deploy"
)
@GetMapping
@PreAuthorize
(
"@el.check('deploy:list')"
)
public
ResponseEntity
getDeploys
(
DeployQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
deployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增Deploy"
)
@ApiOperation
(
value
=
"新增Deploy"
)
@PostMapping
@PreAuthorize
(
"@el.check('deploy:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
Deploy
resources
){
return
new
ResponseEntity
(
deployService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改Deploy"
)
@ApiOperation
(
value
=
"修改Deploy"
)
@PutMapping
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
Deploy
resources
){
deployService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除Deploy"
)
@ApiOperation
(
value
=
"删除Deploy"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('deploy:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
deployService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
@Log
(
"上传文件Deploy"
)
@ApiOperation
(
value
=
"上传文件Deploy"
)
@PostMapping
(
value
=
"/upload"
)
@PreAuthorize
(
"@el.check('deploy:edit')"
)
public
ResponseEntity
upload
(
@RequestBody
MultipartFile
file
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
String
id
=
request
.
getParameter
(
"id"
);
String
fileName
=
""
;
if
(
file
!=
null
){
fileName
=
file
.
getOriginalFilename
();
File
deployFile
=
new
File
(
fileSavePath
+
fileName
);
FileUtil
.
del
(
deployFile
);
file
.
transferTo
(
deployFile
);
//文件下一步要根据文件名字来
deployService
.
deploy
(
fileSavePath
+
fileName
,
id
);
}
else
{
System
.
out
.
println
(
"没有找到相对应的文件"
);
}
System
.
out
.
println
(
"文件上传的原名称为:"
+
file
.
getOriginalFilename
());
Map
map
=
new
HashMap
(
2
);
map
.
put
(
"errno"
,
0
);
map
.
put
(
"id"
,
fileName
);
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
{
String
result
=
deployService
.
serverReduction
(
resources
);
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
{
String
result
=
deployService
.
serverStatus
(
resources
);
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
{
String
result
=
deployService
.
startServer
(
resources
);
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
{
String
result
=
deployService
.
stopServer
(
resources
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.service.DeployHistoryService
;
import
me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"部署历史管理"
)
@RestController
@RequestMapping
(
"/api/deployHistory"
)
public
class
DeployHistoryController
{
@Autowired
private
DeployHistoryService
deployhistoryService
;
@Log
(
"查询DeployHistory"
)
@ApiOperation
(
value
=
"查询DeployHistory"
)
@GetMapping
@PreAuthorize
(
"@el.check('deployHistory:list')"
)
public
ResponseEntity
getDeployHistorys
(
DeployHistoryQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
deployhistoryService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增DeployHistory"
)
@ApiOperation
(
value
=
"新增DeployHistory"
)
@PostMapping
@PreAuthorize
(
"@el.check('deployHistory:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
DeployHistory
resources
){
return
new
ResponseEntity
(
deployhistoryService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改DeployHistory"
)
@ApiOperation
(
value
=
"修改DeployHistory"
)
@PutMapping
@PreAuthorize
(
"@el.check('deployHistory:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
DeployHistory
resources
){
deployhistoryService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除DeployHistory"
)
@ApiOperation
(
value
=
"删除DeployHistory"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"hasAnyRole('deployHistory:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
deployhistoryService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerAccountController.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.mnt.domain.ServerAccount
;
import
me.zhengjie.modules.mnt.service.dto.ServerAccountQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"服务器账号管理"
)
@RestController
@RequestMapping
(
"/api/serverAccount"
)
public
class
ServerAccountController
{
@Autowired
private
me
.
zhengjie
.
modules
.
mnt
.
service
.
ServerAccountService
ServerAccountService
;
@Log
(
"查询ServerAccount"
)
@ApiOperation
(
value
=
"查询ServerAccount"
)
@GetMapping
@PreAuthorize
(
"@el.check('serverAccount:list')"
)
public
ResponseEntity
getServerAccounts
(
ServerAccountQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
ServerAccountService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增ServerAccount"
)
@ApiOperation
(
value
=
"新增ServerAccount"
)
@PostMapping
@PreAuthorize
(
"@el.check('serverAccount:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
ServerAccount
resources
){
return
new
ResponseEntity
(
ServerAccountService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改ServerAccount"
)
@ApiOperation
(
value
=
"修改ServerAccount"
)
@PutMapping
@PreAuthorize
(
"@el.check('serverAccount:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
ServerAccount
resources
){
ServerAccountService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除ServerAccount"
)
@ApiOperation
(
value
=
"删除ServerAccount"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('serverAccount:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
ServerAccountService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
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
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Api
(
tags
=
"服务器部署管理"
)
@RestController
@RequestMapping
(
"/api/serverDeploy"
)
public
class
ServerDeployController
{
@Autowired
private
ServerDeployService
serverDeployService
;
@Log
(
"查询Server"
)
@ApiOperation
(
value
=
"查询Server"
)
@GetMapping
@PreAuthorize
(
"@el.check('serverDeploy:list')"
)
public
ResponseEntity
getServers
(
ServerDeployQueryCriteria
criteria
,
Pageable
pageable
){
return
new
ResponseEntity
(
serverDeployService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增Server"
)
@ApiOperation
(
value
=
"新增Server"
)
@PostMapping
@PreAuthorize
(
"@el.check('serverDeploy:add')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
ServerDeploy
resources
){
return
new
ResponseEntity
(
serverDeployService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
@Log
(
"修改Server"
)
@ApiOperation
(
value
=
"修改Server"
)
@PutMapping
@PreAuthorize
(
"@el.check('serverDeploy:edit')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
ServerDeploy
resources
){
serverDeployService
.
update
(
resources
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除Server"
)
@ApiOperation
(
value
=
"删除Server"
)
@DeleteMapping
(
value
=
"/{id:.+}"
)
@PreAuthorize
(
"@el.check('serverDeploy:del')"
)
public
ResponseEntity
delete
(
@PathVariable
String
id
){
serverDeployService
.
delete
(
id
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
Prev
1
2
3
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