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
"vscode:/vscode.git/clone" did not exist on "64e608b8df55902b4f3b40165e037a21abc67c3f"
Commit
7b11e81f
authored
Nov 19, 2019
by
zhanghouying
Browse files
添加运维系统
parent
f81b4fd3
Changes
58
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service
;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.service.dto.AppDTO
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
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
*/
AppDTO
findById
(
String
id
);
/**
* create
* @param resources
* @return
*/
AppDTO
create
(
App
resources
);
/**
* update
* @param resources
*/
void
update
(
App
resources
);
/**
* delete
* @param id
*/
void
delete
(
String
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service
;
import
me.zhengjie.modules.mnt.domain.Database
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseDTO
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
/**
* @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
*/
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
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
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
);
/**
* findById
* @param id
* @return
*/
DeployHistoryDTO
findById
(
String
id
);
/**
* create
* @param resources
* @return
*/
DeployHistoryDTO
create
(
DeployHistory
resources
);
/**
* update
* @param resources
*/
void
update
(
DeployHistory
resources
);
/**
* delete
* @param id
*/
void
delete
(
String
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service
;
import
me.zhengjie.modules.mnt.domain.Deploy
;
import
me.zhengjie.modules.mnt.domain.DeployHistory
;
import
me.zhengjie.modules.mnt.service.dto.DeployDTO
;
import
me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
DeployService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
DeployQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
DeployQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
DeployDTO
findById
(
String
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
(
String
id
);
/**
* 部署文件到服务器
* @param fileSavePath
* @param appId
* @return
*/
public
String
deploy
(
String
fileSavePath
,
String
appId
);
/**
* 查询部署状态
* @param resources
* @return
*/
public
String
serverStatus
(
Deploy
resources
);
/**
* 启动服务
* @param resources
* @return
*/
public
String
startServer
(
Deploy
resources
);
/**
* 停止服务
* @param resources
* @return
*/
public
String
stopServer
(
Deploy
resources
);
/**
* 停止服务
* @param resources
* @return
*/
public
String
serverReduction
(
DeployHistory
resources
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerAccountService.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service
;
import
me.zhengjie.modules.mnt.domain.ServerAccount
;
import
me.zhengjie.modules.mnt.service.dto.ServerAccountDTO
;
import
me.zhengjie.modules.mnt.service.dto.ServerAccountQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
public
interface
ServerAccountService
{
/**
* queryAll 分页
* @param criteria
* @param pageable
* @return
*/
Object
queryAll
(
ServerAccountQueryCriteria
criteria
,
Pageable
pageable
);
/**
* queryAll 不分页
* @param criteria
* @return
*/
public
Object
queryAll
(
ServerAccountQueryCriteria
criteria
);
/**
* findById
* @param id
* @return
*/
ServerAccountDTO
findById
(
String
id
);
/**
* create
* @param resources
* @return
*/
ServerAccountDTO
create
(
ServerAccount
resources
);
/**
* update
* @param resources
*/
void
update
(
ServerAccount
resources
);
/**
* delete
* @param id
*/
void
delete
(
String
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service
;
import
me.zhengjie.modules.mnt.domain.ServerDeploy
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployDTO
;
import
me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
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
*/
ServerDeployDTO
findById
(
String
id
);
/**
* create
* @param resources
* @return
*/
ServerDeployDTO
create
(
ServerDeploy
resources
);
/**
* update
* @param resources
*/
void
update
(
ServerDeploy
resources
);
/**
* delete
* @param id
*/
void
delete
(
String
id
);
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppDTO.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
AppDTO
implements
Serializable
{
/**
* 应用编号
*/
private
String
id
;
/**
* 应用名称
*/
private
String
name
;
/**
* 端口
*/
private
int
port
;
/**
* 上传目录
*/
private
String
uploadPath
;
/**
* 部署目录
*/
private
String
deployPath
;
/**
* 备份目录
*/
private
String
backupPath
;
/**
* 启动脚本
*/
private
String
startScript
;
/**
* 部署脚本
*/
private
String
deployScript
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppQueryCriteria.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
AppQueryCriteria
{
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
name
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DatabaseDTO.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
DatabaseDTO
implements
Serializable
{
/**
* id
*/
private
String
id
;
/**
* 数据库名称
*/
private
String
name
;
/**
* 数据库连接地址
*/
private
String
jdbcUrl
;
/**
* 数据库密码
*/
private
String
pwd
;
/**
* 用户名
*/
private
String
userName
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DatabaseQueryCriteria.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
DatabaseQueryCriteria
{
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
name
;
/**
* 精确
*/
@Query
private
String
jdbcUrl
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployDTO.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
DeployDTO
implements
Serializable
{
/**
* 部署编号
*/
private
String
id
;
/**
* 应用编号
*/
private
String
appId
;
/**
* IP列表
*/
private
String
ip
;
/**
* 服务状态
*/
private
String
status
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryDTO.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
DeployHistoryDTO
implements
Serializable
{
/**
* 编号
*/
private
String
id
;
/**
* 应用名称
*/
private
String
appName
;
/**
* 部署IP
*/
private
String
ip
;
/**
* 部署时间
*/
private
String
deployDate
;
/**
* 部署人员
*/
private
String
deployUser
;
/**
* 部署编号
*/
private
String
deployId
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryQueryCriteria.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
DeployHistoryQueryCriteria
{
/**
* 精确
*/
@Query
private
String
deployId
;
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
deployDate
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployQueryCriteria.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
DeployQueryCriteria
{
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
EQUAL
)
private
String
appId
;
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
ip
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerAccountDTO.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
ServerAccountDTO
implements
Serializable
{
/**
* 编号
*/
private
String
id
;
/**
* 名称
*/
private
String
name
;
/**
* 账号
*/
private
String
account
;
/**
* 密码
*/
private
String
password
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerAccountQueryCriteria.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
ServerAccountQueryCriteria
{
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
name
;
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
account
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerDeployDTO.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
ServerDeployDTO
implements
Serializable
{
/**
* 服务器IP
*/
private
String
id
;
/**
* 服务器账号
*/
private
String
accountId
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerDeployQueryCriteria.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Data
public
class
ServerDeployQueryCriteria
{
/**
* 模糊
*/
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
id
;
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.impl
;
import
cn.hutool.core.util.IdUtil
;
import
me.zhengjie.modules.mnt.domain.App
;
import
me.zhengjie.modules.mnt.repository.AppRepository
;
import
me.zhengjie.modules.mnt.service.AppService
;
import
me.zhengjie.modules.mnt.service.dto.AppDTO
;
import
me.zhengjie.modules.mnt.service.dto.AppQueryCriteria
;
import
me.zhengjie.modules.mnt.service.mapper.AppMapper
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Optional
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Service
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
AppServiceImpl
implements
AppService
{
private
AppRepository
appRepository
;
private
AppMapper
appMapper
;
public
AppServiceImpl
(
AppRepository
appRepository
,
AppMapper
appMapper
)
{
this
.
appMapper
=
appMapper
;
this
.
appRepository
=
appRepository
;
}
@Override
public
Object
queryAll
(
AppQueryCriteria
criteria
,
Pageable
pageable
){
Page
<
App
>
page
=
appRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
appMapper:
:
toDto
));
}
@Override
public
Object
queryAll
(
AppQueryCriteria
criteria
){
return
appMapper
.
toDto
(
appRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
@Override
public
AppDTO
findById
(
String
id
)
{
Optional
<
App
>
app
=
appRepository
.
findById
(
id
);
ValidationUtil
.
isNull
(
app
,
"App"
,
"id"
,
id
);
return
appMapper
.
toDto
(
app
.
get
());
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
AppDTO
create
(
App
resources
)
{
resources
.
setId
(
IdUtil
.
fastUUID
());
return
appMapper
.
toDto
(
appRepository
.
save
(
resources
));
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
App
resources
)
{
Optional
<
App
>
optionalApp
=
appRepository
.
findById
(
resources
.
getId
());
ValidationUtil
.
isNull
(
optionalApp
,
"App"
,
"id"
,
resources
.
getId
());
App
App
=
optionalApp
.
get
();
App
.
copy
(
resources
);
appRepository
.
save
(
App
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
String
id
)
{
appRepository
.
deleteById
(
id
);
}
}
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java
0 → 100644
View file @
7b11e81f
package
me.zhengjie.modules.mnt.service.impl
;
import
cn.hutool.core.util.IdUtil
;
import
me.zhengjie.modules.mnt.domain.Database
;
import
me.zhengjie.modules.mnt.repository.DatabaseRepository
;
import
me.zhengjie.modules.mnt.service.DatabaseService
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseDTO
;
import
me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria
;
import
me.zhengjie.modules.mnt.service.mapper.DatabaseMapper
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Optional
;
/**
* @author zhanghouying
* @date 2019-08-24
*/
@Service
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
DatabaseServiceImpl
implements
DatabaseService
{
private
DatabaseRepository
databaseRepository
;
private
DatabaseMapper
databaseMapper
;
public
DatabaseServiceImpl
(
DatabaseRepository
databaseRepository
,
DatabaseMapper
databaseMapper
){
this
.
databaseMapper
=
databaseMapper
;
this
.
databaseRepository
=
databaseRepository
;
}
@Override
public
Object
queryAll
(
DatabaseQueryCriteria
criteria
,
Pageable
pageable
){
Page
<
Database
>
page
=
databaseRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
databaseMapper:
:
toDto
));
}
@Override
public
Object
queryAll
(
DatabaseQueryCriteria
criteria
){
return
databaseMapper
.
toDto
(
databaseRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
@Override
public
DatabaseDTO
findById
(
String
id
)
{
Optional
<
Database
>
database
=
databaseRepository
.
findById
(
id
);
ValidationUtil
.
isNull
(
database
,
"Database"
,
"id"
,
id
);
return
databaseMapper
.
toDto
(
database
.
get
());
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
DatabaseDTO
create
(
Database
resources
)
{
resources
.
setId
(
IdUtil
.
simpleUUID
());
return
databaseMapper
.
toDto
(
databaseRepository
.
save
(
resources
));
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
Database
resources
)
{
Optional
<
Database
>
optionalDatabase
=
databaseRepository
.
findById
(
resources
.
getId
());
ValidationUtil
.
isNull
(
optionalDatabase
,
"Database"
,
"id"
,
resources
.
getId
());
Database
database
=
optionalDatabase
.
get
();
database
.
copy
(
resources
);
databaseRepository
.
save
(
database
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
String
id
)
{
databaseRepository
.
deleteById
(
id
);
}
}
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