Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
5851f9ad
Commit
5851f9ad
authored
May 27, 2022
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
d5d1c336
Show whitespace changes
Inline
Side-by-side
Showing
57 changed files
with
737 additions
and
47 deletions
+737
-47
.gitignore
+1
-1
admin-server/src/main/java/com/zq/admin/AdminApplication.java
+57
-0
config/sql/eladmin.sql
+2
-2
logging-server/pom.xml
+35
-0
logging-server/src/main/java/com/zq/logging/annotation/Log.java
+1
-1
logging-server/src/main/java/com/zq/logging/aspect/LogAspect.java
+101
-0
logging-server/src/main/java/com/zq/logging/entity/SysLog.java
+103
-0
logging-server/src/main/java/com/zq/logging/mapper/SysLogMapper.java
+29
-0
logging-server/src/main/java/com/zq/logging/service/LogService.java
+40
-0
logging-server/src/main/java/com/zq/logging/service/impl/LogServiceImpl.java
+105
-0
pom.xml
+1
-0
sys-server/pom.xml
+5
-0
sys-server/src/main/java/com/zq/system/SysApplication.java
+3
-0
sys-server/src/main/java/com/zq/system/annotation/DataPermission.java
+1
-1
sys-server/src/main/java/com/zq/system/annotation/Query.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/rest/AppController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/rest/DatabaseController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/rest/DeployController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/rest/DeployHistoryController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/rest/ServerDeployController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/AppQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/DatabaseQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/DeployHistoryQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/DeployQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/ServerDeployQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/quartz/rest/QuartzJobController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/quartz/service/dto/JobQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/DeptController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/DictController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/DictDetailController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/JobController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/LogController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/MenuController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/RoleController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/rest/UserController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/DeptQueryCriteria.java
+2
-2
sys-server/src/main/java/com/zq/system/modules/system/service/dto/DictDetailQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/DictQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/JobQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/LogQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/MenuQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/RoleQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/dto/UserQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/system/service/impl/LogServiceImpl.java
+3
-1
sys-server/src/main/java/com/zq/system/modules/tools/rest/AliPayController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/tools/rest/EmailController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/tools/rest/LocalStorageController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/tools/rest/QiniuController.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/tools/service/dto/LocalStorageQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/tools/service/dto/PictureQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/modules/tools/service/dto/QiniuQueryCriteria.java
+1
-1
sys-server/src/main/java/com/zq/system/utils/QueryHelp.java
+2
-2
user-server/src/main/resources/logback-spring.xml
+2
-2
xxx-common-utils/src/main/java/com/zq/common/exception/BadConfigurationException.java
+98
-0
xxx-common-utils/src/main/java/com/zq/common/exception/BadRequestException.java
+41
-0
xxx-common-utils/src/main/java/com/zq/common/exception/EntityExistException.java
+35
-0
xxx-common-utils/src/main/java/com/zq/common/exception/EntityNotFoundException.java
+35
-0
No files found.
.gitignore
View file @
5851f9ad
...
...
@@ -6,7 +6,7 @@ HELP.md
**/out/
**/logs/
!gradle/wrapper/gradle-wrapper.jar
*.
l
og
*.
sysL
og
### STS ###
.apt_generated
...
...
admin-server/src/main/java/com/zq/admin/AdminApplication.java
0 → 100644
View file @
5851f9ad
package
com
.
zq
.
admin
;
import
com.zq.common.annotation.rest.AnonymousGetMapping
;
import
com.zq.common.config.base.SpringContextHolder
;
import
io.swagger.annotations.Api
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 开启审计功能 -> @EnableJpaAuditing
*
* @author Zheng Jie
* @date 2018/11/15 9:20:19
*/
@Api
(
hidden
=
true
)
@EnableAsync
@RestController
@EnableTransactionManagement
@EnableJpaAuditing
(
auditorAwareRef
=
"auditorAware"
)
@SpringBootApplication
(
scanBasePackages
=
{
"com.zq.admin"
,
"com.zq.common.config"
})
public
class
AdminApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
AdminApplication
.
class
,
args
);
}
@Bean
public
SpringContextHolder
springContextHolder
()
{
return
new
SpringContextHolder
();
}
@Bean
public
ServletWebServerFactory
webServerFactory
()
{
TomcatServletWebServerFactory
fa
=
new
TomcatServletWebServerFactory
();
fa
.
addConnectorCustomizers
(
connector
->
connector
.
setProperty
(
"relaxedQueryChars"
,
"[]{}"
));
return
fa
;
}
/**
* 访问首页提示
*
* @return /
*/
@AnonymousGetMapping
(
"/"
)
public
String
index
()
{
return
"Backend service started successfully"
;
}
}
\ No newline at end of file
config/sql/eladmin.sql
View file @
5851f9ad
...
...
@@ -357,7 +357,7 @@ INSERT INTO `sys_menu` VALUES (2, 1, 3, 1, '用户管理', 'User', 'system/user/
INSERT
INTO
`sys_menu`
VALUES
(
3
,
1
,
3
,
1
,
'角色管理'
,
'Role'
,
'system/role/index'
,
3
,
'role'
,
'role'
,
b
'0'
,
b
'0'
,
b
'0'
,
'roles:list'
,
NULL
,
NULL
,
'2018-12-18 15:16:07'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
5
,
1
,
3
,
1
,
'菜单管理'
,
'Menu'
,
'system/menu/index'
,
5
,
'menu'
,
'menu'
,
b
'0'
,
b
'0'
,
b
'0'
,
'menu:list'
,
NULL
,
NULL
,
'2018-12-18 15:17:28'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
6
,
NULL
,
5
,
0
,
'系统监控'
,
NULL
,
NULL
,
10
,
'monitor'
,
'monitor'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2018-12-18 15:17:48'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
7
,
6
,
0
,
1
,
'操作日志'
,
'Log'
,
'monitor/
log/index'
,
11
,
'l
og'
,
'logs'
,
b
'0'
,
b
'1'
,
b
'0'
,
NULL
,
NULL
,
'admin'
,
'2018-12-18 15:18:26'
,
'2020-06-06 13:11:57'
);
INSERT
INTO
`sys_menu`
VALUES
(
7
,
6
,
0
,
1
,
'操作日志'
,
'Log'
,
'monitor/
sysLog/index'
,
11
,
'sysL
og'
,
'logs'
,
b
'0'
,
b
'1'
,
b
'0'
,
NULL
,
NULL
,
'admin'
,
'2018-12-18 15:18:26'
,
'2020-06-06 13:11:57'
);
INSERT
INTO
`sys_menu`
VALUES
(
9
,
6
,
0
,
1
,
'SQL监控'
,
'Sql'
,
'monitor/sql/index'
,
18
,
'sqlMonitor'
,
'druid'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2018-12-18 15:19:34'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
10
,
NULL
,
5
,
0
,
'组件管理'
,
NULL
,
NULL
,
50
,
'zujian'
,
'components'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2018-12-19 13:38:16'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
11
,
10
,
0
,
1
,
'图标库'
,
'Icons'
,
'components/icons/index'
,
51
,
'icon'
,
'icon'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2018-12-19 13:38:49'
,
NULL
);
...
...
@@ -372,7 +372,7 @@ INSERT INTO `sys_menu` VALUES (24, 22, 0, 1, '三级菜单1', 'Test', 'nested/me
INSERT
INTO
`sys_menu`
VALUES
(
27
,
22
,
0
,
1
,
'三级菜单2'
,
NULL
,
'nested/menu1/menu1-2'
,
999
,
'menu'
,
'menu1-2'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2019-01-07 17:27:32'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
28
,
1
,
3
,
1
,
'任务调度'
,
'Timing'
,
'system/timing/index'
,
999
,
'timing'
,
'timing'
,
b
'0'
,
b
'0'
,
b
'0'
,
'timing:list'
,
NULL
,
NULL
,
'2019-01-07 20:34:40'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
30
,
36
,
0
,
1
,
'代码生成'
,
'GeneratorIndex'
,
'generator/index'
,
32
,
'dev'
,
'generator'
,
b
'0'
,
b
'1'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2019-01-11 15:45:55'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
32
,
6
,
0
,
1
,
'异常日志'
,
'ErrorLog'
,
'monitor/
l
og/errorLog'
,
12
,
'error'
,
'errorLog'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2019-01-13 13:49:03'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
32
,
6
,
0
,
1
,
'异常日志'
,
'ErrorLog'
,
'monitor/
sysL
og/errorLog'
,
12
,
'error'
,
'errorLog'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2019-01-13 13:49:03'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
33
,
10
,
0
,
1
,
'Markdown'
,
'Markdown'
,
'components/MarkDown'
,
53
,
'markdown'
,
'markdown'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2019-03-08 13:46:44'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
34
,
10
,
0
,
1
,
'Yaml编辑器'
,
'YamlEdit'
,
'components/YamlEdit'
,
54
,
'dev'
,
'yaml'
,
b
'0'
,
b
'0'
,
b
'0'
,
NULL
,
NULL
,
NULL
,
'2019-03-08 15:49:40'
,
NULL
);
INSERT
INTO
`sys_menu`
VALUES
(
35
,
1
,
3
,
1
,
'部门管理'
,
'Dept'
,
'system/dept/index'
,
6
,
'dept'
,
'dept'
,
b
'0'
,
b
'0'
,
b
'0'
,
'dept:list'
,
NULL
,
NULL
,
'2019-03-25 09:46:00'
,
NULL
);
...
...
logging-server/pom.xml
0 → 100644
View file @
5851f9ad
<?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>
<artifactId>
cloud-backend
</artifactId>
<groupId>
com.zq
</groupId>
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
logging-server
</artifactId>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
com.zq
</groupId>
<artifactId>
xxx-common-utils
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
</project>
\ No newline at end of file
xxx-common-utils/src/main/java/com/zq/common
/annotation/Log.java
→
logging-server/src/main/java/com/zq/logging
/annotation/Log.java
View file @
5851f9ad
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
zq
.
common
.
annotation
;
package
com
.
zq
.
logging
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
logging-server/src/main/java/com/zq/logging/aspect/LogAspect.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
logging
.
aspect
;
import
com.zq.common.context.ContextUtils
;
import
com.zq.common.http.HttpRequestUtils
;
import
com.zq.common.utils.ThrowableUtil
;
import
com.zq.common.vo.OnlineUserDto
;
import
com.zq.logging.entity.SysLog
;
import
com.zq.logging.service.LogService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.AfterThrowing
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Component
@Aspect
@Slf4j
public
class
LogAspect
{
private
final
LogService
logService
;
ThreadLocal
<
Long
>
currentTime
=
new
ThreadLocal
<>();
public
LogAspect
(
LogService
logService
)
{
this
.
logService
=
logService
;
}
/**
* 配置切入点
*/
@Pointcut
(
"@annotation(com.zq.logging.annotation.Log)"
)
public
void
logPointcut
()
{
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
}
/**
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
*
* @param joinPoint join point for advice
*/
@Around
(
"logPointcut()"
)
public
Object
logAround
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
Object
result
;
currentTime
.
set
(
System
.
currentTimeMillis
());
result
=
joinPoint
.
proceed
();
SysLog
sysLog
=
new
SysLog
(
"INFO"
,
System
.
currentTimeMillis
()
-
currentTime
.
get
());
currentTime
.
remove
();
HttpServletRequest
request
=
HttpRequestUtils
.
getRequest
();
logService
.
save
(
getUsername
(),
HttpRequestUtils
.
getBrowser
(
request
),
HttpRequestUtils
.
getClientIp
(
request
),
joinPoint
,
sysLog
);
return
result
;
}
/**
* 配置异常通知
*
* @param joinPoint join point for advice
* @param e exception
*/
@AfterThrowing
(
pointcut
=
"logPointcut()"
,
throwing
=
"e"
)
public
void
logAfterThrowing
(
JoinPoint
joinPoint
,
Throwable
e
)
{
SysLog
sysLog
=
new
SysLog
(
"ERROR"
,
System
.
currentTimeMillis
()
-
currentTime
.
get
());
currentTime
.
remove
();
sysLog
.
setExceptionDetail
(
ThrowableUtil
.
getStackTrace
(
e
).
getBytes
());
HttpServletRequest
request
=
HttpRequestUtils
.
getRequest
();
logService
.
save
(
getUsername
(),
HttpRequestUtils
.
getBrowser
(
request
),
HttpRequestUtils
.
getClientIp
(
request
),
(
ProceedingJoinPoint
)
joinPoint
,
sysLog
);
}
public
String
getUsername
()
{
try
{
OnlineUserDto
adminContext
=
ContextUtils
.
getAdminContext
();
return
adminContext
.
getUserName
();
}
catch
(
Exception
e
)
{
return
""
;
}
}
}
logging-server/src/main/java/com/zq/logging/entity/SysLog.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
logging
.
entity
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName
(
"sys_log"
)
public
class
SysLog
implements
Serializable
{
@TableId
(
value
=
"log_id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 操作用户
*/
private
String
username
;
/**
* 描述
*/
private
String
description
;
/**
* 方法名
*/
private
String
method
;
/**
* 参数
*/
private
String
params
;
/**
* 日志类型
*/
private
String
logType
;
/**
* 请求ip
*/
private
String
requestIp
;
/**
* 地址
*/
private
String
address
;
/**
* 浏览器
*/
private
String
browser
;
/**
* 请求耗时
*/
private
Long
time
;
/**
* 异常详细
*/
private
byte
[]
exceptionDetail
;
/**
* 创建日期
*/
private
Date
createTime
;
public
SysLog
(
String
logType
,
Long
time
)
{
this
.
logType
=
logType
;
this
.
time
=
time
;
this
.
createTime
=
DateUtil
.
date
();
}
}
logging-server/src/main/java/com/zq/logging/mapper/SysLogMapper.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
logging
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zq.logging.entity.SysLog
;
import
org.springframework.stereotype.Repository
;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Repository
public
interface
SysLogMapper
extends
BaseMapper
<
SysLog
>
{
}
logging-server/src/main/java/com/zq/logging/service/LogService.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
logging
.
service
;
import
com.zq.logging.entity.SysLog
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.springframework.scheduling.annotation.Async
;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
public
interface
LogService
{
/**
* 保存日志数据
*
* @param username 用户
* @param browser 浏览器
* @param ip 请求IP
* @param joinPoint /
* @param sysLog 日志实体
*/
@Async
void
save
(
String
username
,
String
browser
,
String
ip
,
ProceedingJoinPoint
joinPoint
,
SysLog
sysLog
);
}
logging-server/src/main/java/com/zq/logging/service/impl/LogServiceImpl.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
logging
.
service
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.zq.common.http.HttpRequestUtils
;
import
com.zq.logging.annotation.Log
;
import
com.zq.logging.entity.SysLog
;
import
com.zq.logging.mapper.SysLogMapper
;
import
com.zq.logging.service.LogService
;
import
lombok.RequiredArgsConstructor
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Parameter
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Service
@RequiredArgsConstructor
public
class
LogServiceImpl
implements
LogService
{
private
final
SysLogMapper
sysLogMapper
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
save
(
String
username
,
String
browser
,
String
ip
,
ProceedingJoinPoint
joinPoint
,
SysLog
sysLog
)
{
if
(
sysLog
==
null
)
{
throw
new
IllegalArgumentException
(
"Log 不能为 null!"
);
}
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
Method
method
=
signature
.
getMethod
();
Log
aopLog
=
method
.
getAnnotation
(
Log
.
class
);
// 方法路径
String
methodName
=
joinPoint
.
getTarget
().
getClass
().
getName
()
+
"."
+
signature
.
getName
()
+
"()"
;
// 描述
sysLog
.
setDescription
(
aopLog
.
value
());
sysLog
.
setRequestIp
(
ip
);
sysLog
.
setAddress
(
HttpRequestUtils
.
getCityInfo
(
sysLog
.
getRequestIp
()));
sysLog
.
setMethod
(
methodName
);
sysLog
.
setUsername
(
username
);
sysLog
.
setParams
(
getParameter
(
method
,
joinPoint
.
getArgs
()));
sysLog
.
setBrowser
(
browser
);
sysLogMapper
.
insert
(
sysLog
);
}
/**
* 根据方法和传入的参数获取请求参数
*/
private
String
getParameter
(
Method
method
,
Object
[]
args
)
{
List
<
Object
>
argList
=
new
ArrayList
<>();
Parameter
[]
parameters
=
method
.
getParameters
();
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
//将RequestBody注解修饰的参数作为请求参数
RequestBody
requestBody
=
parameters
[
i
].
getAnnotation
(
RequestBody
.
class
);
if
(
requestBody
!=
null
)
{
argList
.
add
(
args
[
i
]);
}
//将RequestParam注解修饰的参数作为请求参数
RequestParam
requestParam
=
parameters
[
i
].
getAnnotation
(
RequestParam
.
class
);
if
(
requestParam
!=
null
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
4
);
String
key
=
parameters
[
i
].
getName
();
if
(
StrUtil
.
isNotBlank
(
requestParam
.
value
()))
{
key
=
requestParam
.
value
();
}
map
.
put
(
key
,
args
[
i
]);
argList
.
add
(
map
);
}
}
if
(
argList
.
isEmpty
())
{
return
""
;
}
return
argList
.
size
()
==
1
?
JSONUtil
.
toJsonStr
(
argList
.
get
(
0
))
:
JSONUtil
.
toJsonStr
(
argList
);
}
}
pom.xml
View file @
5851f9ad
...
...
@@ -42,6 +42,7 @@
<module>
api-server
</module>
<module>
user-server
</module>
<module>
admin-server
</module>
<module>
logging-server
</module>
</modules>
<dependencies>
...
...
sys-server/pom.xml
View file @
5851f9ad
...
...
@@ -27,6 +27,11 @@
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
com.zq
</groupId>
<artifactId>
logging-server
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
...
...
sys-server/src/main/java/com/zq/system/SysApplication.java
View file @
5851f9ad
...
...
@@ -17,6 +17,7 @@ package com.zq.system;
import
com.zq.common.annotation.rest.AnonymousGetMapping
;
import
io.swagger.annotations.Api
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
...
...
@@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableAsync
@RestController
@Api
(
hidden
=
true
)
@MapperScan
({
"com.zq.logging.mapper"
})
@SpringBootApplication
(
scanBasePackages
=
{
"com.zq.system"
,
"com.zq.common.config"
})
@EnableTransactionManagement
@EnableJpaAuditing
(
auditorAwareRef
=
"auditorAware"
)
...
...
@@ -61,4 +63,5 @@ public class SysApplication {
public
String
index
()
{
return
"Backend service started successfully"
;
}
}
xxx-common-utils/src/main/java/com/zq/common
/annotation/DataPermission.java
→
sys-server/src/main/java/com/zq/system
/annotation/DataPermission.java
View file @
5851f9ad
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
zq
.
common
.
annotation
;
package
com
.
zq
.
system
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
xxx-common-utils/src/main/java/com/zq/common
/annotation/Query.java
→
sys-server/src/main/java/com/zq/system
/annotation/Query.java
View file @
5851f9ad
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
zq
.
common
.
annotation
;
package
com
.
zq
.
system
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/rest/AppController.java
View file @
5851f9ad
...
...
@@ -18,7 +18,7 @@ package com.zq.system.modules.mnt.rest;
import
com.zq.system.modules.mnt.domain.App
;
import
com.zq.system.modules.mnt.service.AppService
;
import
com.zq.system.modules.mnt.service.dto.AppQueryCriteria
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/rest/DatabaseController.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
mnt
.
rest
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/rest/DeployController.java
View file @
5851f9ad
...
...
@@ -21,7 +21,7 @@ import com.zq.system.modules.mnt.service.DeployService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.modules.mnt.service.dto.DeployQueryCriteria
;
import
com.zq.system.utils.FileUtil
;
import
org.springframework.data.domain.Pageable
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/rest/DeployHistoryController.java
View file @
5851f9ad
...
...
@@ -18,7 +18,7 @@ package com.zq.system.modules.mnt.rest;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.modules.mnt.service.DeployHistoryService
;
import
com.zq.system.modules.mnt.service.dto.DeployHistoryQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/rest/ServerDeployController.java
View file @
5851f9ad
...
...
@@ -21,7 +21,7 @@ import com.zq.system.modules.mnt.service.dto.ServerDeployQueryCriteria;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/AppQueryCriteria.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
mnt
.
service
.
dto
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
lombok.Data
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/DatabaseQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
mnt
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/DeployHistoryQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
mnt
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/DeployQueryCriteria.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
mnt
.
service
.
dto
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
lombok.Data
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/modules/mnt/service/dto/ServerDeployQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
mnt
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/quartz/rest/QuartzJobController.java
View file @
5851f9ad
...
...
@@ -22,7 +22,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
...
...
sys-server/src/main/java/com/zq/system/modules/quartz/service/dto/JobQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
quartz
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/DeptController.java
View file @
5851f9ad
...
...
@@ -23,7 +23,7 @@ import com.zq.system.modules.system.service.dto.DeptQueryCriteria;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
com.zq.system.utils.PageUtil
;
import
org.springframework.http.HttpStatus
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/DictController.java
View file @
5851f9ad
...
...
@@ -21,7 +21,7 @@ import com.zq.system.modules.system.service.dto.DictQueryCriteria;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/DictDetailController.java
View file @
5851f9ad
...
...
@@ -18,7 +18,7 @@ package com.zq.system.modules.system.rest;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
com.zq.system.modules.system.domain.DictDetail
;
import
com.zq.system.modules.system.service.DictDetailService
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/JobController.java
View file @
5851f9ad
...
...
@@ -18,7 +18,7 @@ package com.zq.system.modules.system.rest;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
com.zq.system.modules.system.domain.Job
;
import
com.zq.system.modules.system.service.JobService
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/LogController.java
View file @
5851f9ad
...
...
@@ -18,7 +18,7 @@ package com.zq.system.modules.system.rest;
import
com.zq.system.modules.system.service.LogService
;
import
com.zq.system.modules.system.service.dto.LogQueryCriteria
;
import
com.zq.system.utils.SecurityUtils
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/MenuController.java
View file @
5851f9ad
...
...
@@ -19,7 +19,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
com.zq.system.modules.system.domain.Menu
;
import
com.zq.system.modules.system.service.MenuService
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/RoleController.java
View file @
5851f9ad
...
...
@@ -23,7 +23,7 @@ import com.zq.system.modules.system.service.dto.RoleSmallDto;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.exception.BadRequestException
;
import
com.zq.system.modules.system.service.RoleService
;
import
com.zq.system.utils.SecurityUtils
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/rest/UserController.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
system
.
rest
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.system.config.RsaProperties
;
import
com.zq.system.exception.BadRequestException
;
import
com.zq.system.modules.system.domain.Dept
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/DeptQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,8 +16,8 @@
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.DataPermission
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.DataPermission
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/DictDetailQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
/**
* @author Zheng Jie
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/DictQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
/**
* @author Zheng Jie
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/JobQueryCriteria.java
View file @
5851f9ad
...
...
@@ -17,7 +17,7 @@ package com.zq.system.modules.system.service.dto;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/LogQueryCriteria.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
lombok.Data
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/MenuQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/RoleQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.sql.Timestamp
;
import
java.util.List
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/dto/UserQueryCriteria.java
View file @
5851f9ad
...
...
@@ -16,7 +16,7 @@
package
com
.
zq
.
system
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/modules/system/service/impl/LogServiceImpl.java
View file @
5851f9ad
...
...
@@ -55,6 +55,7 @@ import java.util.*;
@Service
@RequiredArgsConstructor
public
class
LogServiceImpl
implements
LogService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
LogServiceImpl
.
class
);
private
final
LogRepository
logRepository
;
private
final
LogErrorMapper
logErrorMapper
;
...
...
@@ -87,7 +88,7 @@ public class LogServiceImpl implements LogService {
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
Method
method
=
signature
.
getMethod
();
com
.
zq
.
common
.
annotation
.
Log
aopLog
=
method
.
getAnnotation
(
com
.
zq
.
common
.
annotation
.
Log
.
class
);
com
.
zq
.
logging
.
annotation
.
Log
aopLog
=
method
.
getAnnotation
(
com
.
zq
.
logging
.
annotation
.
Log
.
class
);
// 方法路径
String
methodName
=
joinPoint
.
getTarget
().
getClass
().
getName
()
+
"."
+
signature
.
getName
()
+
"()"
;
...
...
@@ -174,4 +175,5 @@ public class LogServiceImpl implements LogService {
public
void
delAllByInfo
()
{
logRepository
.
deleteByLogType
(
"INFO"
);
}
}
sys-server/src/main/java/com/zq/system/modules/tools/rest/AliPayController.java
View file @
5851f9ad
...
...
@@ -21,7 +21,7 @@ import com.zq.system.modules.tools.service.AliPayService;
import
com.zq.system.modules.tools.utils.AliPayStatusEnum
;
import
com.zq.system.modules.tools.utils.AlipayUtils
;
import
com.zq.common.annotation.AnonymousAccess
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
com.zq.common.annotation.rest.AnonymousGetMapping
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
sys-server/src/main/java/com/zq/system/modules/tools/rest/EmailController.java
View file @
5851f9ad
...
...
@@ -18,7 +18,7 @@ package com.zq.system.modules.tools.rest;
import
com.zq.system.modules.tools.domain.EmailConfig
;
import
com.zq.system.modules.tools.domain.vo.EmailVo
;
import
com.zq.system.modules.tools.service.EmailService
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
sys-server/src/main/java/com/zq/system/modules/tools/rest/LocalStorageController.java
View file @
5851f9ad
...
...
@@ -20,7 +20,7 @@ import com.zq.system.modules.tools.domain.LocalStorage;
import
com.zq.system.modules.tools.service.LocalStorageService
;
import
com.zq.system.modules.tools.service.dto.LocalStorageQueryCriteria
;
import
com.zq.system.utils.FileUtil
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
sys-server/src/main/java/com/zq/system/modules/tools/rest/QiniuController.java
View file @
5851f9ad
...
...
@@ -19,7 +19,7 @@ import com.zq.system.modules.tools.domain.QiniuConfig;
import
com.zq.system.modules.tools.domain.QiniuContent
;
import
com.zq.system.modules.tools.service.QiNiuService
;
import
com.zq.system.modules.tools.service.dto.QiniuQueryCriteria
;
import
com.zq.
common
.annotation.Log
;
import
com.zq.
logging
.annotation.Log
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
sys-server/src/main/java/com/zq/system/modules/tools/service/dto/LocalStorageQueryCriteria.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
tools
.
service
.
dto
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
lombok.Data
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/modules/tools/service/dto/PictureQueryCriteria.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
tools
.
service
.
dto
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
lombok.Data
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/modules/tools/service/dto/QiniuQueryCriteria.java
View file @
5851f9ad
...
...
@@ -15,7 +15,7 @@
*/
package
com
.
zq
.
system
.
modules
.
tools
.
service
.
dto
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.Query
;
import
lombok.Data
;
import
java.sql.Timestamp
;
...
...
sys-server/src/main/java/com/zq/system/utils/QueryHelp.java
View file @
5851f9ad
...
...
@@ -18,8 +18,8 @@ package com.zq.system.utils;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.zq.
common
.annotation.DataPermission
;
import
com.zq.
common
.annotation.Query
;
import
com.zq.
system
.annotation.DataPermission
;
import
com.zq.
system
.annotation.Query
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
user-server/src/main/resources/logback-spring.xml
View file @
5851f9ad
...
...
@@ -22,7 +22,7 @@
<pattern>
%d %-5p [%t] %logger : %m%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<file>
${LOG_FILE}.
l
og
</file>
<file>
${LOG_FILE}.
sysL
og
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
...
...
@@ -49,7 +49,7 @@
<pattern>
%d %-5p [%t] %logger : %m%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<file>
ratelimit.
l
og
</file>
<file>
ratelimit.
sysL
og
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/ratelimit.%d{yyyy-MM-dd}.%i.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
...
...
xxx-common-utils/src/main/java/com/zq/common/exception/BadConfigurationException.java
0 → 100644
View file @
5851f9ad
/*
* Copyright 2019-2020 the original author or authors.
*
* 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
com
.
zq
.
common
.
exception
;
/**
* 统一关于错误配置信息 异常
*
* @author: liaojinlong
* @date: 2020/6/10 18:06
*/
public
class
BadConfigurationException
extends
RuntimeException
{
/**
* Constructs a new runtime exception with {@code null} as its
* detail message. The cause is not initialized, and may subsequently be
* initialized by a call to {@link #initCause}.
*/
public
BadConfigurationException
()
{
super
();
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public
BadConfigurationException
(
String
message
)
{
super
(
message
);
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public
BadConfigurationException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
/**
* Constructs a new runtime exception with the specified cause and a
* detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
* {@code cause}). This constructor is useful for runtime exceptions
* that are little more than wrappers for other throwables.
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public
BadConfigurationException
(
Throwable
cause
)
{
super
(
cause
);
}
/**
* Constructs a new runtime exception with the specified detail
* message, cause, suppression enabled or disabled, and writable
* stack trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
protected
BadConfigurationException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
xxx-common-utils/src/main/java/com/zq/common/exception/BadRequestException.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
common
.
exception
;
import
lombok.Getter
;
import
org.springframework.http.HttpStatus
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
BAD_REQUEST
;
/**
* @author Zheng Jie
* @date 2018-11-23
* 统一异常处理
*/
@Getter
public
class
BadRequestException
extends
RuntimeException
{
private
Integer
status
=
BAD_REQUEST
.
value
();
public
BadRequestException
(
String
msg
){
super
(
msg
);
}
public
BadRequestException
(
HttpStatus
status
,
String
msg
){
super
(
msg
);
this
.
status
=
status
.
value
();
}
}
xxx-common-utils/src/main/java/com/zq/common/exception/EntityExistException.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
common
.
exception
;
import
org.springframework.util.StringUtils
;
/**
* @author Zheng Jie
* @date 2018-11-23
*/
public
class
EntityExistException
extends
RuntimeException
{
public
EntityExistException
(
Class
clazz
,
String
field
,
String
val
)
{
super
(
EntityExistException
.
generateMessage
(
clazz
.
getSimpleName
(),
field
,
val
));
}
private
static
String
generateMessage
(
String
entity
,
String
field
,
String
val
)
{
return
StringUtils
.
capitalize
(
entity
)
+
" with "
+
field
+
" "
+
val
+
" existed"
;
}
}
\ No newline at end of file
xxx-common-utils/src/main/java/com/zq/common/exception/EntityNotFoundException.java
0 → 100644
View file @
5851f9ad
/*
* 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
com
.
zq
.
common
.
exception
;
import
org.springframework.util.StringUtils
;
/**
* @author Zheng Jie
* @date 2018-11-23
*/
public
class
EntityNotFoundException
extends
RuntimeException
{
public
EntityNotFoundException
(
Class
clazz
,
String
field
,
String
val
)
{
super
(
EntityNotFoundException
.
generateMessage
(
clazz
.
getSimpleName
(),
field
,
val
));
}
private
static
String
generateMessage
(
String
entity
,
String
field
,
String
val
)
{
return
StringUtils
.
capitalize
(
entity
)
+
" with "
+
field
+
" "
+
val
+
" does not exist"
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment