Commit 5851f9ad by 袁伟铭

1.0.0

parent d5d1c336
...@@ -6,7 +6,7 @@ HELP.md ...@@ -6,7 +6,7 @@ HELP.md
**/out/ **/out/
**/logs/ **/logs/
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
*.log *.sysLog
### STS ### ### STS ###
.apt_generated .apt_generated
......
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
...@@ -357,7 +357,7 @@ INSERT INTO `sys_menu` VALUES (2, 1, 3, 1, '用户管理', 'User', 'system/user/ ...@@ -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 (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 (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 (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, 'log', '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, 'sysLog', '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 (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 (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); 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 ...@@ -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 (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 (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 (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/log/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/sysLog/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 (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 (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); 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);
......
<?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
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.zq.common.annotation; package com.zq.logging.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
......
/*
* 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 "";
}
}
}
/*
* 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();
}
}
/*
* 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> {
}
/*
* 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);
}
/*
* 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);
}
}
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<module>api-server</module> <module>api-server</module>
<module>user-server</module> <module>user-server</module>
<module>admin-server</module> <module>admin-server</module>
<module>logging-server</module>
</modules> </modules>
<dependencies> <dependencies>
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.zq</groupId>
<artifactId>logging-server</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </dependency>
......
...@@ -17,6 +17,7 @@ package com.zq.system; ...@@ -17,6 +17,7 @@ package com.zq.system;
import com.zq.common.annotation.rest.AnonymousGetMapping; import com.zq.common.annotation.rest.AnonymousGetMapping;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
...@@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableAsync @EnableAsync
@RestController @RestController
@Api(hidden = true) @Api(hidden = true)
@MapperScan({"com.zq.logging.mapper"})
@SpringBootApplication(scanBasePackages = {"com.zq.system", "com.zq.common.config"}) @SpringBootApplication(scanBasePackages = {"com.zq.system", "com.zq.common.config"})
@EnableTransactionManagement @EnableTransactionManagement
@EnableJpaAuditing(auditorAwareRef = "auditorAware") @EnableJpaAuditing(auditorAwareRef = "auditorAware")
...@@ -61,4 +63,5 @@ public class SysApplication { ...@@ -61,4 +63,5 @@ public class SysApplication {
public String index() { public String index() {
return "Backend service started successfully"; return "Backend service started successfully";
} }
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.zq.common.annotation; package com.zq.system.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.zq.common.annotation; package com.zq.system.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
......
...@@ -18,7 +18,7 @@ package com.zq.system.modules.mnt.rest; ...@@ -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.domain.App;
import com.zq.system.modules.mnt.service.AppService; import com.zq.system.modules.mnt.service.AppService;
import com.zq.system.modules.mnt.service.dto.AppQueryCriteria; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.mnt.rest; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -21,7 +21,7 @@ import com.zq.system.modules.mnt.service.DeployService; ...@@ -21,7 +21,7 @@ import com.zq.system.modules.mnt.service.DeployService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; 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.modules.mnt.service.dto.DeployQueryCriteria;
import com.zq.system.utils.FileUtil; import com.zq.system.utils.FileUtil;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
......
...@@ -18,7 +18,7 @@ package com.zq.system.modules.mnt.rest; ...@@ -18,7 +18,7 @@ package com.zq.system.modules.mnt.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 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.DeployHistoryService;
import com.zq.system.modules.mnt.service.dto.DeployHistoryQueryCriteria; import com.zq.system.modules.mnt.service.dto.DeployHistoryQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
......
...@@ -21,7 +21,7 @@ import com.zq.system.modules.mnt.service.dto.ServerDeployQueryCriteria; ...@@ -21,7 +21,7 @@ import com.zq.system.modules.mnt.service.dto.ServerDeployQueryCriteria;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import com.zq.common.annotation.Log; import com.zq.logging.annotation.Log;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.mnt.service.dto; package com.zq.system.modules.mnt.service.dto;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.mnt.service.dto; package com.zq.system.modules.mnt.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.mnt.service.dto; package com.zq.system.modules.mnt.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.mnt.service.dto; package com.zq.system.modules.mnt.service.dto;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.mnt.service.dto; package com.zq.system.modules.mnt.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -22,7 +22,7 @@ import io.swagger.annotations.Api; ...@@ -22,7 +22,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.zq.common.annotation.Log; import com.zq.logging.annotation.Log;
import com.zq.system.exception.BadRequestException; import com.zq.system.exception.BadRequestException;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.quartz.service.dto; package com.zq.system.modules.quartz.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -23,7 +23,7 @@ import com.zq.system.modules.system.service.dto.DeptQueryCriteria; ...@@ -23,7 +23,7 @@ import com.zq.system.modules.system.service.dto.DeptQueryCriteria;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; 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.exception.BadRequestException;
import com.zq.system.utils.PageUtil; import com.zq.system.utils.PageUtil;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
......
...@@ -21,7 +21,7 @@ import com.zq.system.modules.system.service.dto.DictQueryCriteria; ...@@ -21,7 +21,7 @@ import com.zq.system.modules.system.service.dto.DictQueryCriteria;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; 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.exception.BadRequestException;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
......
...@@ -18,7 +18,7 @@ package com.zq.system.modules.system.rest; ...@@ -18,7 +18,7 @@ package com.zq.system.modules.system.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 lombok.RequiredArgsConstructor;
import com.zq.common.annotation.Log; import com.zq.logging.annotation.Log;
import com.zq.system.exception.BadRequestException; import com.zq.system.exception.BadRequestException;
import com.zq.system.modules.system.domain.DictDetail; import com.zq.system.modules.system.domain.DictDetail;
import com.zq.system.modules.system.service.DictDetailService; import com.zq.system.modules.system.service.DictDetailService;
......
...@@ -18,7 +18,7 @@ package com.zq.system.modules.system.rest; ...@@ -18,7 +18,7 @@ package com.zq.system.modules.system.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 lombok.RequiredArgsConstructor;
import com.zq.common.annotation.Log; import com.zq.logging.annotation.Log;
import com.zq.system.exception.BadRequestException; import com.zq.system.exception.BadRequestException;
import com.zq.system.modules.system.domain.Job; import com.zq.system.modules.system.domain.Job;
import com.zq.system.modules.system.service.JobService; import com.zq.system.modules.system.service.JobService;
......
...@@ -18,7 +18,7 @@ package com.zq.system.modules.system.rest; ...@@ -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.LogService;
import com.zq.system.modules.system.service.dto.LogQueryCriteria; import com.zq.system.modules.system.service.dto.LogQueryCriteria;
import com.zq.system.utils.SecurityUtils; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -19,7 +19,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -19,7 +19,7 @@ import cn.hutool.core.collection.CollectionUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; 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.exception.BadRequestException;
import com.zq.system.modules.system.domain.Menu; import com.zq.system.modules.system.domain.Menu;
import com.zq.system.modules.system.service.MenuService; import com.zq.system.modules.system.service.MenuService;
......
...@@ -23,7 +23,7 @@ import com.zq.system.modules.system.service.dto.RoleSmallDto; ...@@ -23,7 +23,7 @@ import com.zq.system.modules.system.service.dto.RoleSmallDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; 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.exception.BadRequestException;
import com.zq.system.modules.system.service.RoleService; import com.zq.system.modules.system.service.RoleService;
import com.zq.system.utils.SecurityUtils; import com.zq.system.utils.SecurityUtils;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.system.rest; package com.zq.system.modules.system.rest;
import cn.hutool.core.collection.CollectionUtil; 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.config.RsaProperties;
import com.zq.system.exception.BadRequestException; import com.zq.system.exception.BadRequestException;
import com.zq.system.modules.system.domain.Dept; import com.zq.system.modules.system.domain.Dept;
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.DataPermission; import com.zq.system.annotation.DataPermission;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
/** /**
* @author Zheng Jie * @author Zheng Jie
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
/** /**
* @author Zheng Jie * @author Zheng Jie
......
...@@ -17,7 +17,7 @@ package com.zq.system.modules.system.service.dto; ...@@ -17,7 +17,7 @@ package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.zq.system.modules.system.service.dto; package com.zq.system.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -55,6 +55,7 @@ import java.util.*; ...@@ -55,6 +55,7 @@ import java.util.*;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class LogServiceImpl implements LogService { public class LogServiceImpl implements LogService {
private static final Logger log = LoggerFactory.getLogger(LogServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(LogServiceImpl.class);
private final LogRepository logRepository; private final LogRepository logRepository;
private final LogErrorMapper logErrorMapper; private final LogErrorMapper logErrorMapper;
...@@ -87,7 +88,7 @@ public class LogServiceImpl implements LogService { ...@@ -87,7 +88,7 @@ public class LogServiceImpl implements LogService {
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod(); 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() + "()"; String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
...@@ -174,4 +175,5 @@ public class LogServiceImpl implements LogService { ...@@ -174,4 +175,5 @@ public class LogServiceImpl implements LogService {
public void delAllByInfo() { public void delAllByInfo() {
logRepository.deleteByLogType("INFO"); logRepository.deleteByLogType("INFO");
} }
} }
...@@ -21,7 +21,7 @@ import com.zq.system.modules.tools.service.AliPayService; ...@@ -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.AliPayStatusEnum;
import com.zq.system.modules.tools.utils.AlipayUtils; import com.zq.system.modules.tools.utils.AlipayUtils;
import com.zq.common.annotation.AnonymousAccess; 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 com.zq.common.annotation.rest.AnonymousGetMapping;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
......
...@@ -18,7 +18,7 @@ package com.zq.system.modules.tools.rest; ...@@ -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.EmailConfig;
import com.zq.system.modules.tools.domain.vo.EmailVo; import com.zq.system.modules.tools.domain.vo.EmailVo;
import com.zq.system.modules.tools.service.EmailService; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -20,7 +20,7 @@ import com.zq.system.modules.tools.domain.LocalStorage; ...@@ -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.LocalStorageService;
import com.zq.system.modules.tools.service.dto.LocalStorageQueryCriteria; import com.zq.system.modules.tools.service.dto.LocalStorageQueryCriteria;
import com.zq.system.utils.FileUtil; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -19,7 +19,7 @@ import com.zq.system.modules.tools.domain.QiniuConfig; ...@@ -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.domain.QiniuContent;
import com.zq.system.modules.tools.service.QiNiuService; import com.zq.system.modules.tools.service.QiNiuService;
import com.zq.system.modules.tools.service.dto.QiniuQueryCriteria; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.tools.service.dto; package com.zq.system.modules.tools.service.dto;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.tools.service.dto; package com.zq.system.modules.tools.service.dto;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.zq.system.modules.tools.service.dto; package com.zq.system.modules.tools.service.dto;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.sql.Timestamp;
......
...@@ -18,8 +18,8 @@ package com.zq.system.utils; ...@@ -18,8 +18,8 @@ package com.zq.system.utils;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
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 com.zq.common.annotation.DataPermission; import com.zq.system.annotation.DataPermission;
import com.zq.common.annotation.Query; import com.zq.system.annotation.Query;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<pattern>%d %-5p [%t] %logger : %m%n</pattern> <pattern>%d %-5p [%t] %logger : %m%n</pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
<file>${LOG_FILE}.log</file> <file>${LOG_FILE}.sysLog</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern> <fileNamePattern>${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<pattern>%d %-5p [%t] %logger : %m%n</pattern> <pattern>%d %-5p [%t] %logger : %m%n</pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
<file>ratelimit.log</file> <file>ratelimit.sysLog</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/ratelimit.%d{yyyy-MM-dd}.%i.gz</fileNamePattern> <fileNamePattern>${LOG_PATH}/ratelimit.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
......
/*
* 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);
}
}
/*
* 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();
}
}
/*
* 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
/*
* 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment