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
7c35a79c
Commit
7c35a79c
authored
May 05, 2020
by
ZhengJie
Browse files
[新增功能](el-admin v2.5): v2.5 beta
详情
https://www.ydyno.com/archives/1225.html
parent
d35ffc9d
Changes
295
Hide whitespace changes
Inline
Side-by-side
eladmin-generator/src/main/java/me/zhengjie/service/GeneratorService.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service
;
package
me.zhengjie.service
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
...
@@ -32,7 +47,7 @@ public interface GeneratorService {
...
@@ -32,7 +47,7 @@ public interface GeneratorService {
/**
/**
* 同步表数据
* 同步表数据
* @param columnInfos /
* @param columnInfos /
* @param columnInfoList
* @param columnInfoList
/
*/
*/
@Async
@Async
void
sync
(
List
<
ColumnInfo
>
columnInfos
,
List
<
ColumnInfo
>
columnInfoList
);
void
sync
(
List
<
ColumnInfo
>
columnInfos
,
List
<
ColumnInfo
>
columnInfoList
);
...
...
eladmin-generator/src/main/java/me/zhengjie/service/impl/GenConfigServiceImpl.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.impl
;
package
me.zhengjie.service.impl
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.repository.GenConfigRepository
;
import
me.zhengjie.repository.GenConfigRepository
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.utils.StringUtils
;
import
me.zhengjie.utils.StringUtils
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
import
java.io.File
;
...
@@ -15,17 +28,12 @@ import java.io.File;
...
@@ -15,17 +28,12 @@ import java.io.File;
* @date 2019-01-14
* @date 2019-01-14
*/
*/
@Service
@Service
@
CacheConfig
(
cacheNames
=
"genConfig"
)
@
RequiredArgsConstructor
public
class
GenConfigServiceImpl
implements
GenConfigService
{
public
class
GenConfigServiceImpl
implements
GenConfigService
{
private
final
GenConfigRepository
genConfigRepository
;
private
final
GenConfigRepository
genConfigRepository
;
public
GenConfigServiceImpl
(
GenConfigRepository
genConfigRepository
)
{
this
.
genConfigRepository
=
genConfigRepository
;
}
@Override
@Override
@Cacheable
(
key
=
"#p0"
)
public
GenConfig
find
(
String
tableName
)
{
public
GenConfig
find
(
String
tableName
)
{
GenConfig
genConfig
=
genConfigRepository
.
findByTableName
(
tableName
);
GenConfig
genConfig
=
genConfigRepository
.
findByTableName
(
tableName
);
if
(
genConfig
==
null
){
if
(
genConfig
==
null
){
...
@@ -35,7 +43,6 @@ public class GenConfigServiceImpl implements GenConfigService {
...
@@ -35,7 +43,6 @@ public class GenConfigServiceImpl implements GenConfigService {
}
}
@Override
@Override
@CachePut
(
key
=
"#p0"
)
public
GenConfig
update
(
String
tableName
,
GenConfig
genConfig
)
{
public
GenConfig
update
(
String
tableName
,
GenConfig
genConfig
)
{
// 如果 api 路径为空,则自动生成路径
// 如果 api 路径为空,则自动生成路径
if
(
StringUtils
.
isBlank
(
genConfig
.
getApiPath
())){
if
(
StringUtils
.
isBlank
(
genConfig
.
getApiPath
())){
...
...
eladmin-generator/src/main/java/me/zhengjie/service/impl/GeneratorServiceImpl.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.impl
;
package
me.zhengjie.service.impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.vo.TableInfo
;
import
me.zhengjie.domain.vo.TableInfo
;
...
@@ -33,7 +49,7 @@ import java.util.stream.Collectors;
...
@@ -33,7 +49,7 @@ import java.util.stream.Collectors;
* @date 2019-01-02
* @date 2019-01-02
*/
*/
@Service
@Service
@
SuppressWarnings
({
"unchecked"
,
"all"
})
@
RequiredArgsConstructor
public
class
GeneratorServiceImpl
implements
GeneratorService
{
public
class
GeneratorServiceImpl
implements
GeneratorService
{
@PersistenceContext
@PersistenceContext
...
@@ -41,10 +57,6 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -41,10 +57,6 @@ public class GeneratorServiceImpl implements GeneratorService {
private
final
ColumnInfoRepository
columnInfoRepository
;
private
final
ColumnInfoRepository
columnInfoRepository
;
public
GeneratorServiceImpl
(
ColumnInfoRepository
columnInfoRepository
)
{
this
.
columnInfoRepository
=
columnInfoRepository
;
}
@Override
@Override
public
Object
getTables
()
{
public
Object
getTables
()
{
// 使用预编译防止sql注入
// 使用预编译防止sql注入
...
@@ -117,7 +129,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -117,7 +129,7 @@ public class GeneratorServiceImpl implements GeneratorService {
// 第一种情况,数据库类字段改变或者新增字段
// 第一种情况,数据库类字段改变或者新增字段
for
(
ColumnInfo
columnInfo
:
columnInfoList
)
{
for
(
ColumnInfo
columnInfo
:
columnInfoList
)
{
// 根据字段名称查找
// 根据字段名称查找
List
<
ColumnInfo
>
columns
=
new
ArrayList
<
ColumnInfo
>(
columnInfos
.
stream
().
filter
(
c
->
c
.
getColumnName
().
equals
(
columnInfo
.
getColumnName
())).
collect
(
Collectors
.
toList
())
)
;
List
<
ColumnInfo
>
columns
=
columnInfos
.
stream
().
filter
(
c
->
c
.
getColumnName
().
equals
(
columnInfo
.
getColumnName
())).
collect
(
Collectors
.
toList
());
// 如果能找到,就修改部分可能被字段
// 如果能找到,就修改部分可能被字段
if
(
CollectionUtil
.
isNotEmpty
(
columns
)){
if
(
CollectionUtil
.
isNotEmpty
(
columns
)){
ColumnInfo
column
=
columns
.
get
(
0
);
ColumnInfo
column
=
columns
.
get
(
0
);
...
@@ -136,7 +148,7 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -136,7 +148,7 @@ public class GeneratorServiceImpl implements GeneratorService {
// 第二种情况,数据库字段删除了
// 第二种情况,数据库字段删除了
for
(
ColumnInfo
columnInfo
:
columnInfos
)
{
for
(
ColumnInfo
columnInfo
:
columnInfos
)
{
// 根据字段名称查找
// 根据字段名称查找
List
<
ColumnInfo
>
columns
=
new
ArrayList
<
ColumnInfo
>(
columnInfoList
.
stream
().
filter
(
c
->
c
.
getColumnName
().
equals
(
columnInfo
.
getColumnName
())).
collect
(
Collectors
.
toList
())
)
;
List
<
ColumnInfo
>
columns
=
columnInfoList
.
stream
().
filter
(
c
->
c
.
getColumnName
().
equals
(
columnInfo
.
getColumnName
())).
collect
(
Collectors
.
toList
());
// 如果找不到,就代表字段被删除了,则需要删除该字段
// 如果找不到,就代表字段被删除了,则需要删除该字段
if
(
CollectionUtil
.
isEmpty
(
columns
)){
if
(
CollectionUtil
.
isEmpty
(
columns
)){
columnInfoRepository
.
delete
(
columnInfo
);
columnInfoRepository
.
delete
(
columnInfo
);
...
...
eladmin-generator/src/main/java/me/zhengjie/utils/ColUtil.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.utils
;
package
me.zhengjie.utils
;
import
org.apache.commons.configuration.*
;
import
org.apache.commons.configuration.*
;
...
...
eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.utils
;
package
me.zhengjie.utils
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
...
...
eladmin-logging/src/main/java/me/zhengjie/aop/log/Log.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.aop.log
;
package
me.zhengjie.aop.log
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.ElementType
;
...
...
eladmin-logging/src/main/java/me/zhengjie/aspect/LogAspect.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.aspect
;
package
me.zhengjie.aspect
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -14,7 +29,6 @@ import org.aspectj.lang.annotation.Around;
...
@@ -14,7 +29,6 @@ import org.aspectj.lang.annotation.Around;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
/**
/**
...
...
eladmin-logging/src/main/java/me/zhengjie/domain/Log.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.domain
;
package
me.zhengjie.domain
;
import
lombok.
Data
;
import
lombok.
Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -12,12 +28,14 @@ import java.sql.Timestamp;
...
@@ -12,12 +28,14 @@ import java.sql.Timestamp;
* @date 2018-11-24
* @date 2018-11-24
*/
*/
@Entity
@Entity
@Data
@Getter
@Table
(
name
=
"log"
)
@Setter
@Table
(
name
=
"sys_log"
)
@NoArgsConstructor
@NoArgsConstructor
public
class
Log
implements
Serializable
{
public
class
Log
implements
Serializable
{
@Id
@Id
@Column
(
name
=
"log_id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
Long
id
;
...
@@ -31,19 +49,15 @@ public class Log implements Serializable {
...
@@ -31,19 +49,15 @@ public class Log implements Serializable {
private
String
method
;
private
String
method
;
/** 参数 */
/** 参数 */
@Column
(
columnDefinition
=
"text"
)
private
String
params
;
private
String
params
;
/** 日志类型 */
/** 日志类型 */
@Column
(
name
=
"log_type"
)
private
String
logType
;
private
String
logType
;
/** 请求ip */
/** 请求ip */
@Column
(
name
=
"request_ip"
)
private
String
requestIp
;
private
String
requestIp
;
/** 地址 */
/** 地址 */
@Column
(
name
=
"address"
)
private
String
address
;
private
String
address
;
/** 浏览器 */
/** 浏览器 */
...
@@ -53,12 +67,10 @@ public class Log implements Serializable {
...
@@ -53,12 +67,10 @@ public class Log implements Serializable {
private
Long
time
;
private
Long
time
;
/** 异常详细 */
/** 异常详细 */
@Column
(
name
=
"exception_detail"
,
columnDefinition
=
"text"
)
private
byte
[]
exceptionDetail
;
private
byte
[]
exceptionDetail
;
/** 创建日期 */
/** 创建日期 */
@CreationTimestamp
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
private
Timestamp
createTime
;
public
Log
(
String
logType
,
Long
time
)
{
public
Log
(
String
logType
,
Long
time
)
{
...
...
eladmin-logging/src/main/java/me/zhengjie/repository/LogRepository.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.repository
;
package
me.zhengjie.repository
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.domain.Log
;
...
@@ -7,8 +22,6 @@ import org.springframework.data.jpa.repository.Modifying;
...
@@ -7,8 +22,6 @@ import org.springframework.data.jpa.repository.Modifying;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
javax.transaction.Transactional
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @date 2018-11-24
* @date 2018-11-24
...
@@ -16,20 +29,11 @@ import javax.transaction.Transactional;
...
@@ -16,20 +29,11 @@ import javax.transaction.Transactional;
@Repository
@Repository
public
interface
LogRepository
extends
JpaRepository
<
Log
,
Long
>,
JpaSpecificationExecutor
<
Log
>
{
public
interface
LogRepository
extends
JpaRepository
<
Log
,
Long
>,
JpaSpecificationExecutor
<
Log
>
{
/**
* 获取一个时间段的IP记录
* @param date1 startTime
* @param date2 entTime
* @return IP数目
*/
@Query
(
value
=
"select count(*) FROM (select request_ip FROM log where create_time between ?1 and ?2 GROUP BY request_ip) as s"
,
nativeQuery
=
true
)
Long
findIp
(
String
date1
,
String
date2
);
/**
/**
* 根据日志类型删除信息
* 根据日志类型删除信息
* @param logType 日志类型
* @param logType 日志类型
*/
*/
@Query
(
nativeQuery
=
true
,
value
=
"delete from log where log_type = ?1"
)
@Modifying
@Modifying
@Query
(
value
=
"delete from sys_log where log_type = ?1"
,
nativeQuery
=
true
)
void
deleteByLogType
(
String
logType
);
void
deleteByLogType
(
String
logType
);
}
}
eladmin-logging/src/main/java/me/zhengjie/rest/LogController.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.rest
;
package
me.zhengjie.rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.service.LogService
;
import
me.zhengjie.service.LogService
;
import
me.zhengjie.service.dto.LogQueryCriteria
;
import
me.zhengjie.service.dto.LogQueryCriteria
;
...
@@ -19,16 +35,13 @@ import java.io.IOException;
...
@@ -19,16 +35,13 @@ import java.io.IOException;
* @date 2018-11-24
* @date 2018-11-24
*/
*/
@RestController
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/api/logs"
)
@RequestMapping
(
"/api/logs"
)
@Api
(
tags
=
"
监控
:日志管理"
)
@Api
(
tags
=
"
系统
:日志管理"
)
public
class
LogController
{
public
class
LogController
{
private
final
LogService
logService
;
private
final
LogService
logService
;
public
LogController
(
LogService
logService
)
{
this
.
logService
=
logService
;
}
@Log
(
"导出数据"
)
@Log
(
"导出数据"
)
@ApiOperation
(
"导出数据"
)
@ApiOperation
(
"导出数据"
)
@GetMapping
(
value
=
"/download"
)
@GetMapping
(
value
=
"/download"
)
...
...
eladmin-logging/src/main/java/me/zhengjie/service/LogService.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service
;
package
me.zhengjie.service
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.domain.Log
;
...
...
eladmin-logging/src/main/java/me/zhengjie/service/dto/LogErrorDTO.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.dto
;
package
me.zhengjie.service.dto
;
import
lombok.Data
;
import
lombok.Data
;
...
...
eladmin-logging/src/main/java/me/zhengjie/service/dto/LogQueryCriteria.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.dto
;
package
me.zhengjie.service.dto
;
import
lombok.Data
;
import
lombok.Data
;
...
...
eladmin-logging/src/main/java/me/zhengjie/service/dto/LogSmallDTO.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.dto
;
package
me.zhengjie.service.dto
;
import
lombok.Data
;
import
lombok.Data
;
...
...
eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.impl
;
package
me.zhengjie.service.impl
;
import
cn.hutool.core.lang.Dict
;
import
cn.hutool.core.lang.Dict
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.domain.Log
;
import
me.zhengjie.repository.LogRepository
;
import
me.zhengjie.repository.LogRepository
;
import
me.zhengjie.service.LogService
;
import
me.zhengjie.service.LogService
;
...
@@ -17,7 +33,6 @@ import org.springframework.data.domain.Pageable;
...
@@ -17,7 +33,6 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
...
@@ -31,21 +46,14 @@ import java.util.Map;
...
@@ -31,21 +46,14 @@ import java.util.Map;
* @date 2018-11-24
* @date 2018-11-24
*/
*/
@Service
@Service
@RequiredArgsConstructor
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
LogServiceImpl
implements
LogService
{
public
class
LogServiceImpl
implements
LogService
{
private
final
LogRepository
logRepository
;
private
final
LogRepository
logRepository
;
private
final
LogErrorMapper
logErrorMapper
;
private
final
LogErrorMapper
logErrorMapper
;
private
final
LogSmallMapper
logSmallMapper
;
private
final
LogSmallMapper
logSmallMapper
;
public
LogServiceImpl
(
LogRepository
logRepository
,
LogErrorMapper
logErrorMapper
,
LogSmallMapper
logSmallMapper
)
{
this
.
logRepository
=
logRepository
;
this
.
logErrorMapper
=
logErrorMapper
;
this
.
logSmallMapper
=
logSmallMapper
;
}
@Override
@Override
public
Object
queryAll
(
LogQueryCriteria
criteria
,
Pageable
pageable
){
public
Object
queryAll
(
LogQueryCriteria
criteria
,
Pageable
pageable
){
Page
<
Log
>
page
=
logRepository
.
findAll
(((
root
,
criteriaQuery
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
cb
)),
pageable
);
Page
<
Log
>
page
=
logRepository
.
findAll
(((
root
,
criteriaQuery
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
cb
)),
pageable
);
...
...
eladmin-logging/src/main/java/me/zhengjie/service/mapper/LogErrorMapper.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.mapper
;
package
me.zhengjie.service.mapper
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.base.BaseMapper
;
...
...
eladmin-logging/src/main/java/me/zhengjie/service/mapper/LogSmallMapper.java
View file @
7c35a79c
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me.zhengjie.service.mapper
;
package
me.zhengjie.service.mapper
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.base.BaseMapper
;
...
...
eladmin-monitor/README.md
deleted
100644 → 0
View file @
d35ffc9d
<h1
style=
"text-align: center"
>
el-admin 客户端监控模块
</h1>
<div
style=
"text-align: center"
>
[

](https://github.com/elunez/eladmin/blob/master/LICENSE)
[

](https://gitee.com/elunez/eladmin)
[

](https://github.com/elunez/eladmin)
[

](https://github.com/elunez/eladmin)
</div>
#### 项目简介
希望通过简单的配置即可实现对服务器CPU、内存、磁盘以及交换区占用情况的监控
**开发文档**
[
https://docs.auauz.net/
](
https://docs.auauz.net
)
**体验地址**
[
https://auauz.net/
](
https://auauz.net/
)
**账号密码**
```admin/123456```
(默认密码都是123456)
#### 项目源码
| | 后端源码 | 前端源码 |
|--- |--- | --- |
| github | https://github.com/elunez/eladmin | https://github.com/elunez/eladmin-qd |
| 码云 | https://gitee.com/elunez/eladmin | https://gitee.com/elunez/eladmin-qt |
#### 使用说明
-
将打包好的eladmin-monitor-2.2.jar 放到服务器上,执行 nohup java -jar eladmin-monitor-2.2.jar & 即可
#### 项目捐赠
项目的发展离不开你的支持,请作者喝杯咖啡吧 ☕!
[
Donate
](
https://docs.auauz.net/#/jz
)
#### 反馈交流
-
QQ交流群:891137268
eladmin-monitor/pom.xml
deleted
100644 → 0
View file @
d35ffc9d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.1.0.RELEASE
</version>
<relativePath/>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-monitor
</artifactId>
<version>
2.4
</version>
<name>
客户端监控模块
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
<jna.version>
5.5.0
</jna.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.oshi/oshi-core -->
<dependency>
<groupId>
com.github.oshi
</groupId>
<artifactId>
oshi-core
</artifactId>
<version>
4.4.2
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>
public
</id>
<name>
aliyun nexus
</name>
<url>
http://maven.aliyun.com/nexus/content/groups/public/
</url>
<releases>
<enabled>
true
</enabled>
</releases>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!-- 跳过单元测试 -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<skipTests>
true
</skipTests>
<excludes>
</excludes>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<filtering>
true
</filtering>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
eladmin-monitor/src/main/java/me/zhengjie/MonitorRun.java
deleted
100644 → 0
View file @
d35ffc9d
package
me.zhengjie
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableAsync
;
/**
*
* @author: Zhang houying
* @date: 2019/11/3
*/
@EnableAsync
@SpringBootApplication
public
class
MonitorRun
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
MonitorRun
.
class
,
args
);
}
}
Prev
1
2
3
4
5
6
7
…
15
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