修改日志打印逻辑.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.orion.ops.framework.common.annotation;
|
package com.orion.ops.framework.common.annotation;
|
||||||
|
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,4 +15,12 @@ import java.lang.annotation.*;
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface IgnoreLog {
|
public @interface IgnoreLog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志忽略模式
|
||||||
|
*
|
||||||
|
* @return 日志忽略模式
|
||||||
|
*/
|
||||||
|
IgnoreLogMode value() default IgnoreLogMode.ALL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.orion.ops.framework.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志忽略模式
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/7/21 9:54
|
||||||
|
*/
|
||||||
|
public enum IgnoreLogMode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不打印任何日志
|
||||||
|
*/
|
||||||
|
ALL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不打印参数
|
||||||
|
*/
|
||||||
|
ARGS,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不打印返回值
|
||||||
|
*/
|
||||||
|
RET,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不打印参数以及返回值
|
||||||
|
*/
|
||||||
|
ARGS_RET,
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,18 +5,17 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.serializer.PropertyFilter;
|
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||||
|
import com.orion.lang.utils.Arrays1;
|
||||||
import com.orion.lang.utils.Desensitizes;
|
import com.orion.lang.utils.Desensitizes;
|
||||||
import com.orion.lang.utils.Objects1;
|
import com.orion.lang.utils.Objects1;
|
||||||
import com.orion.lang.utils.collect.Lists;
|
|
||||||
import com.orion.lang.utils.collect.Maps;
|
import com.orion.lang.utils.collect.Maps;
|
||||||
import com.orion.lang.utils.reflect.Classes;
|
import com.orion.lang.utils.reflect.Classes;
|
||||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
import com.orion.ops.framework.common.meta.TraceIdHolder;
|
import com.orion.ops.framework.common.meta.TraceIdHolder;
|
||||||
import com.orion.ops.framework.common.security.SecurityHolder;
|
import com.orion.ops.framework.common.security.SecurityHolder;
|
||||||
import com.orion.ops.framework.log.core.config.LogPrinterConfig;
|
import com.orion.ops.framework.log.core.config.LogPrinterConfig;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
@@ -24,8 +23,8 @@ import javax.servlet.ServletResponse;
|
|||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +36,8 @@ import java.util.function.Predicate;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterceptor {
|
public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterceptor {
|
||||||
|
|
||||||
|
private static final ThreadLocal<IgnoreLogMode> IGNORE_LOG_MODE = new ThreadLocal<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求头过滤器
|
* 请求头过滤器
|
||||||
*/
|
*/
|
||||||
@@ -60,9 +61,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
@Resource
|
@Resource
|
||||||
protected SecurityHolder securityHolder;
|
protected SecurityHolder securityHolder;
|
||||||
|
|
||||||
@SuppressWarnings("ALL")
|
@Resource
|
||||||
@Autowired(required = false)
|
|
||||||
@Qualifier("desensitizeValueFilter")
|
|
||||||
private ValueFilter desensitizeValueFilter;
|
private ValueFilter desensitizeValueFilter;
|
||||||
|
|
||||||
public AbstractLogPrinterInterceptor(LogPrinterConfig config) {
|
public AbstractLogPrinterInterceptor(LogPrinterConfig config) {
|
||||||
@@ -74,8 +73,6 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
public void init() {
|
public void init() {
|
||||||
// 请求头过滤器
|
// 请求头过滤器
|
||||||
this.headerFilter = header -> config.getHeaders().contains(header);
|
this.headerFilter = header -> config.getHeaders().contains(header);
|
||||||
// 字段过滤器
|
|
||||||
List<SerializeFilter> fieldFilterList = Lists.newList();
|
|
||||||
// 忽略字段过滤器
|
// 忽略字段过滤器
|
||||||
PropertyFilter ignoreFilter = (Object object, String name, Object value) -> !config.getField().getIgnore().contains(name);
|
PropertyFilter ignoreFilter = (Object object, String name, Object value) -> !config.getField().getIgnore().contains(name);
|
||||||
// 脱敏字段过滤器
|
// 脱敏字段过滤器
|
||||||
@@ -86,31 +83,36 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fieldFilterList.add(ignoreFilter);
|
this.fieldFilters = Arrays1.of(ignoreFilter, desensitizeFilter, desensitizeValueFilter);
|
||||||
fieldFilterList.add(desensitizeFilter);
|
|
||||||
// 注解脱敏 未引入
|
|
||||||
if (desensitizeValueFilter != null) {
|
|
||||||
fieldFilterList.add(desensitizeValueFilter);
|
|
||||||
}
|
|
||||||
this.fieldFilters = fieldFilterList.toArray(new SerializeFilter[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||||
|
// 日志忽略模式
|
||||||
|
IgnoreLogMode ignoreLogMode = Optional.ofNullable(invocation.getMethod().getAnnotation(IgnoreLog.class))
|
||||||
|
.map(IgnoreLog::value)
|
||||||
|
.orElse(null);
|
||||||
|
// 如果不打印任何日志 则直接跳出逻辑
|
||||||
|
if (IgnoreLogMode.ALL.equals(ignoreLogMode)) {
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
IGNORE_LOG_MODE.set(ignoreLogMode);
|
||||||
Date startTime = new Date();
|
Date startTime = new Date();
|
||||||
String traceId = TraceIdHolder.get();
|
String traceId = TraceIdHolder.get();
|
||||||
// 打印请求日志
|
// 打印请求日志
|
||||||
this.requestPrinter(startTime, traceId, invocation);
|
this.printRequestLog(startTime, traceId, invocation);
|
||||||
try {
|
try {
|
||||||
// 执行方法
|
// 执行方法
|
||||||
Object ret = invocation.proceed();
|
Object ret = invocation.proceed();
|
||||||
// 打印响应日志
|
// 打印响应日志
|
||||||
this.responsePrinter(startTime, traceId, invocation, ret);
|
this.printResponseLog(startTime, traceId, invocation, ret);
|
||||||
return ret;
|
return ret;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// 打印异常日志
|
// 打印异常日志
|
||||||
this.errorPrinter(startTime, traceId, t);
|
this.printExceptionLog(startTime, traceId, t);
|
||||||
throw t;
|
throw t;
|
||||||
|
} finally {
|
||||||
|
IGNORE_LOG_MODE.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +123,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
* @param traceId traceId
|
* @param traceId traceId
|
||||||
* @param invocation invocation
|
* @param invocation invocation
|
||||||
*/
|
*/
|
||||||
protected abstract void requestPrinter(Date startTime, String traceId, MethodInvocation invocation);
|
protected abstract void printRequestLog(Date startTime, String traceId, MethodInvocation invocation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印响应信息
|
* 打印响应信息
|
||||||
@@ -131,7 +133,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
* @param invocation invocation
|
* @param invocation invocation
|
||||||
* @param ret return
|
* @param ret return
|
||||||
*/
|
*/
|
||||||
protected abstract void responsePrinter(Date startTime, String traceId, MethodInvocation invocation, Object ret);
|
protected abstract void printResponseLog(Date startTime, String traceId, MethodInvocation invocation, Object ret);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印异常信息
|
* 打印异常信息
|
||||||
@@ -140,7 +142,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
* @param traceId traceId
|
* @param traceId traceId
|
||||||
* @param throwable ex
|
* @param throwable ex
|
||||||
*/
|
*/
|
||||||
protected abstract void errorPrinter(Date startTime, String traceId, Throwable throwable);
|
protected abstract void printExceptionLog(Date startTime, String traceId, Throwable throwable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求参数 json
|
* 请求参数 json
|
||||||
@@ -152,7 +154,12 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
protected String requestToString(Method method, Object[] args) {
|
protected String requestToString(Method method, Object[] args) {
|
||||||
int length = args.length;
|
int length = args.length;
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
return EMPTY_ARG;
|
return EMPTY_TAG;
|
||||||
|
}
|
||||||
|
// 忽略日志
|
||||||
|
IgnoreLogMode ignoreLogMode = IGNORE_LOG_MODE.get();
|
||||||
|
if (IgnoreLogMode.ARGS.equals(ignoreLogMode) || IgnoreLogMode.ARGS_RET.equals(ignoreLogMode)) {
|
||||||
|
return IGNORED_TAG;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 检查是否需要忽略字段
|
// 检查是否需要忽略字段
|
||||||
@@ -167,7 +174,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
}
|
}
|
||||||
if (printCount == 0) {
|
if (printCount == 0) {
|
||||||
// 无打印参数
|
// 无打印参数
|
||||||
return EMPTY_ARG;
|
return EMPTY_TAG;
|
||||||
} else if (printCount == 1) {
|
} else if (printCount == 1) {
|
||||||
// 单个打印参数
|
// 单个打印参数
|
||||||
return JSON.toJSONString(args[lastPrintIndex], fieldFilters);
|
return JSON.toJSONString(args[lastPrintIndex], fieldFilters);
|
||||||
@@ -182,7 +189,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
return JSON.toJSONString(arr, fieldFilters);
|
return JSON.toJSONString(arr, fieldFilters);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ERROR_ARG;
|
return ERROR_TAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,10 +200,18 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
|||||||
* @return json
|
* @return json
|
||||||
*/
|
*/
|
||||||
protected String responseToString(Object o) {
|
protected String responseToString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return NULL_TAG;
|
||||||
|
}
|
||||||
|
// 忽略日志
|
||||||
|
IgnoreLogMode ignoreLogMode = IGNORE_LOG_MODE.get();
|
||||||
|
if (IgnoreLogMode.RET.equals(ignoreLogMode) || IgnoreLogMode.ARGS_RET.equals(ignoreLogMode)) {
|
||||||
|
return IGNORED_TAG;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return JSON.toJSONString(o, fieldFilters);
|
return JSON.toJSONString(o, fieldFilters);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ERROR_ARG;
|
return ERROR_TAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,15 @@ import org.aopalliance.intercept.MethodInterceptor;
|
|||||||
*/
|
*/
|
||||||
public interface LogPrinterInterceptor extends MethodInterceptor {
|
public interface LogPrinterInterceptor extends MethodInterceptor {
|
||||||
|
|
||||||
String EMPTY_ARG = "<EMPTY>";
|
String EMPTY_TAG = "<EMPTY>";
|
||||||
|
|
||||||
String ERROR_ARG = "<ERROR>";
|
String ERROR_TAG = "<ERROR>";
|
||||||
|
|
||||||
String VOID_RES = "<VOID>";
|
String VOID_TAG = "<VOID>";
|
||||||
|
|
||||||
|
String NULL_TAG = "<NULL>";
|
||||||
|
|
||||||
|
String IGNORED_TAG = "<IGNORED>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 初始化
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void requestPrinter(Date startTime, String traceId, MethodInvocation invocation) {
|
protected void printRequestLog(Date startTime, String traceId, MethodInvocation invocation) {
|
||||||
StringBuilder requestLog = new StringBuilder("\napi请求-开始\n");
|
StringBuilder requestLog = new StringBuilder("\napi请求-开始\n");
|
||||||
// http请求信息
|
// http请求信息
|
||||||
HttpServletRequest request = Optional.ofNullable(RequestContextHolder.getRequestAttributes())
|
HttpServletRequest request = Optional.ofNullable(RequestContextHolder.getRequestAttributes())
|
||||||
@@ -80,7 +80,7 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void responsePrinter(Date startTime, String traceId, MethodInvocation invocation, Object ret) {
|
protected void printResponseLog(Date startTime, String traceId, MethodInvocation invocation, Object ret) {
|
||||||
Date endTime = new Date();
|
Date endTime = new Date();
|
||||||
// 响应日志
|
// 响应日志
|
||||||
StringBuilder responseLog = new StringBuilder("\napi请求-结束\n")
|
StringBuilder responseLog = new StringBuilder("\napi请求-结束\n")
|
||||||
@@ -89,7 +89,7 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
|||||||
.append("\tused: ").append(endTime.getTime() - startTime.getTime()).append("ms \n");
|
.append("\tused: ").append(endTime.getTime() - startTime.getTime()).append("ms \n");
|
||||||
|
|
||||||
if (invocation.getMethod().getReturnType().equals(Void.TYPE)) {
|
if (invocation.getMethod().getReturnType().equals(Void.TYPE)) {
|
||||||
responseLog.append("\tresponse: ").append(VOID_RES);
|
responseLog.append("\tresponse: ").append(VOID_TAG);
|
||||||
} else {
|
} else {
|
||||||
responseLog.append("\tresponse: ").append(this.responseToString(ret));
|
responseLog.append("\tresponse: ").append(this.responseToString(ret));
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void errorPrinter(Date startTime, String traceId, Throwable throwable) {
|
protected void printExceptionLog(Date startTime, String traceId, Throwable throwable) {
|
||||||
Date endTime = new Date();
|
Date endTime = new Date();
|
||||||
// 异常日志
|
// 异常日志
|
||||||
StringBuilder errorLog = new StringBuilder("\napi请求-异常\n")
|
StringBuilder errorLog = new StringBuilder("\napi请求-异常\n")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void requestPrinter(Date startTime, String traceId, MethodInvocation invocation) {
|
protected void printRequestLog(Date startTime, String traceId, MethodInvocation invocation) {
|
||||||
// http请求信息
|
// http请求信息
|
||||||
HttpServletRequest request = Optional.ofNullable(RequestContextHolder.getRequestAttributes())
|
HttpServletRequest request = Optional.ofNullable(RequestContextHolder.getRequestAttributes())
|
||||||
.map(s -> (ServletRequestAttributes) s)
|
.map(s -> (ServletRequestAttributes) s)
|
||||||
@@ -81,7 +81,7 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void responsePrinter(Date startTime, String traceId, MethodInvocation invocation, Object ret) {
|
protected void printResponseLog(Date startTime, String traceId, MethodInvocation invocation, Object ret) {
|
||||||
Date endTime = new Date();
|
Date endTime = new Date();
|
||||||
// 响应日志
|
// 响应日志
|
||||||
Map<String, Object> fields = new LinkedHashMap<>();
|
Map<String, Object> fields = new LinkedHashMap<>();
|
||||||
@@ -89,7 +89,7 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
|||||||
fields.put(END, Dates.format(endTime, Dates.YMD_HMSS));
|
fields.put(END, Dates.format(endTime, Dates.YMD_HMSS));
|
||||||
fields.put(USED, endTime.getTime() - startTime.getTime() + "ms");
|
fields.put(USED, endTime.getTime() - startTime.getTime() + "ms");
|
||||||
if (invocation.getMethod().getReturnType().equals(Void.TYPE)) {
|
if (invocation.getMethod().getReturnType().equals(Void.TYPE)) {
|
||||||
fields.put(RESPONSE, VOID_RES);
|
fields.put(RESPONSE, VOID_TAG);
|
||||||
} else {
|
} else {
|
||||||
fields.put(RESPONSE, this.responseToString(ret));
|
fields.put(RESPONSE, this.responseToString(ret));
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void errorPrinter(Date startTime, String traceId, Throwable throwable) {
|
protected void printExceptionLog(Date startTime, String traceId, Throwable throwable) {
|
||||||
Date endTime = new Date();
|
Date endTime = new Date();
|
||||||
// 异常日志
|
// 异常日志
|
||||||
Map<String, Object> fields = new LinkedHashMap<>();
|
Map<String, Object> fields = new LinkedHashMap<>();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package ${package.Controller};
|
|||||||
import com.orion.lang.define.wrapper.DataGrid;
|
import com.orion.lang.define.wrapper.DataGrid;
|
||||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
import ${package.Service}.*;
|
import ${package.Service}.*;
|
||||||
#foreach($pkg in ${customFilePackages})
|
#foreach($pkg in ${customFilePackages})
|
||||||
import ${pkg}.*;
|
import ${pkg}.*;
|
||||||
@@ -58,7 +59,7 @@ public class ${table.controllerName} {
|
|||||||
return ${typeLower}Service.update${type}(request);
|
return ${typeLower}Service.update${type}(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "${apiComment.get}")
|
@Operation(summary = "${apiComment.get}")
|
||||||
@Parameter(name = "id", description = "id", required = true)
|
@Parameter(name = "id", description = "id", required = true)
|
||||||
@@ -67,7 +68,7 @@ public class ${table.controllerName} {
|
|||||||
return ${typeLower}Service.get${type}(id);
|
return ${typeLower}Service.get${type}(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "${apiComment.list}")
|
@Operation(summary = "${apiComment.list}")
|
||||||
@Parameter(name = "idList", description = "idList", required = true)
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
@@ -76,7 +77,7 @@ public class ${table.controllerName} {
|
|||||||
return ${typeLower}Service.get${type}List(idList);
|
return ${typeLower}Service.get${type}List(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@PostMapping("/query")
|
@PostMapping("/query")
|
||||||
@Operation(summary = "${apiComment.query}")
|
@Operation(summary = "${apiComment.query}")
|
||||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ orion:
|
|||||||
# 全局日志打印
|
# 全局日志打印
|
||||||
printer:
|
printer:
|
||||||
mode: PRETTY
|
mode: PRETTY
|
||||||
expression: 'execution (* com.orion.ops..*.controller..*.*(..)) && !@annotation(com.orion.ops.framework.common.annotation.IgnoreLog)'
|
expression: 'execution (* com.orion.ops..*.controller..*.*(..))'
|
||||||
headers:
|
headers:
|
||||||
- user-agent,accept
|
- user-agent,accept
|
||||||
- content-type
|
- content-type
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.orion.ops.module.infra.controller;
|
|||||||
import com.orion.lang.define.wrapper.HttpWrapper;
|
import com.orion.lang.define.wrapper.HttpWrapper;
|
||||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
import com.orion.ops.framework.security.core.utils.SecurityUtils;
|
import com.orion.ops.framework.security.core.utils.SecurityUtils;
|
||||||
import com.orion.ops.module.infra.entity.request.user.UserLoginRequest;
|
import com.orion.ops.module.infra.entity.request.user.UserLoginRequest;
|
||||||
import com.orion.ops.module.infra.entity.request.user.UserResetPasswordRequest;
|
import com.orion.ops.module.infra.entity.request.user.UserResetPasswordRequest;
|
||||||
@@ -51,7 +52,7 @@ public class AuthenticationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@Operation(summary = "登出")
|
@Operation(summary = "登出")
|
||||||
@GetMapping("/logout")
|
@GetMapping("/logout")
|
||||||
public HttpWrapper<?> logout(HttpServletRequest servletRequest) {
|
public HttpWrapper<?> logout(HttpServletRequest servletRequest) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.orion.ops.module.infra.controller;
|
|||||||
import com.orion.lang.define.wrapper.HttpWrapper;
|
import com.orion.lang.define.wrapper.HttpWrapper;
|
||||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
import com.orion.ops.module.infra.entity.vo.SystemMenuVO;
|
import com.orion.ops.module.infra.entity.vo.SystemMenuVO;
|
||||||
import com.orion.ops.module.infra.entity.vo.UserPermissionVO;
|
import com.orion.ops.module.infra.entity.vo.UserPermissionVO;
|
||||||
import com.orion.ops.module.infra.service.PermissionService;
|
import com.orion.ops.module.infra.service.PermissionService;
|
||||||
@@ -45,14 +46,14 @@ public class PermissionController {
|
|||||||
return HttpWrapper.ok();
|
return HttpWrapper.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/menu")
|
@GetMapping("/menu")
|
||||||
@Operation(summary = "获取用户菜单")
|
@Operation(summary = "获取用户菜单")
|
||||||
public List<SystemMenuVO> getUserMenuList() {
|
public List<SystemMenuVO> getUserMenuList() {
|
||||||
return permissionService.getUserMenuList();
|
return permissionService.getUserMenuList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/permission")
|
@GetMapping("/permission")
|
||||||
@Operation(summary = "获取用户权限")
|
@Operation(summary = "获取用户权限")
|
||||||
public UserPermissionVO getUserPermission() {
|
public UserPermissionVO getUserPermission() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.orion.ops.module.infra.controller;
|
|||||||
|
|
||||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
import com.orion.ops.module.infra.entity.request.menu.*;
|
import com.orion.ops.module.infra.entity.request.menu.*;
|
||||||
import com.orion.ops.module.infra.entity.vo.SystemMenuVO;
|
import com.orion.ops.module.infra.entity.vo.SystemMenuVO;
|
||||||
import com.orion.ops.module.infra.service.SystemMenuService;
|
import com.orion.ops.module.infra.service.SystemMenuService;
|
||||||
@@ -67,7 +68,7 @@ public class SystemMenuController {
|
|||||||
return systemRoleMenuService.bindRoleMenu(request);
|
return systemRoleMenuService.bindRoleMenu(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "通过 id 查询菜单")
|
@Operation(summary = "通过 id 查询菜单")
|
||||||
@Parameter(name = "id", description = "id", required = true)
|
@Parameter(name = "id", description = "id", required = true)
|
||||||
@@ -76,7 +77,7 @@ public class SystemMenuController {
|
|||||||
return systemMenuService.getSystemMenu(id);
|
return systemMenuService.getSystemMenu(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "查询菜单")
|
@Operation(summary = "查询菜单")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:query')")
|
@PreAuthorize("@ss.hasPermission('infra:system-menu:query')")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.orion.ops.module.infra.controller;
|
|||||||
import com.orion.lang.define.wrapper.DataGrid;
|
import com.orion.lang.define.wrapper.DataGrid;
|
||||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||||
|
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||||
import com.orion.ops.module.infra.entity.request.role.SystemRoleCreateRequest;
|
import com.orion.ops.module.infra.entity.request.role.SystemRoleCreateRequest;
|
||||||
import com.orion.ops.module.infra.entity.request.role.SystemRoleQueryRequest;
|
import com.orion.ops.module.infra.entity.request.role.SystemRoleQueryRequest;
|
||||||
import com.orion.ops.module.infra.entity.request.role.SystemRoleStatusRequest;
|
import com.orion.ops.module.infra.entity.request.role.SystemRoleStatusRequest;
|
||||||
@@ -60,7 +61,7 @@ public class SystemRoleController {
|
|||||||
return systemRoleService.updateRoleStatus(request);
|
return systemRoleService.updateRoleStatus(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "通过 id 查询角色")
|
@Operation(summary = "通过 id 查询角色")
|
||||||
@Parameter(name = "id", description = "id", required = true)
|
@Parameter(name = "id", description = "id", required = true)
|
||||||
@@ -69,7 +70,7 @@ public class SystemRoleController {
|
|||||||
return systemRoleService.getSystemRole(id);
|
return systemRoleService.getSystemRole(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "查询所有角色")
|
@Operation(summary = "查询所有角色")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
||||||
@@ -77,7 +78,7 @@ public class SystemRoleController {
|
|||||||
return systemRoleService.getSystemRoleList();
|
return systemRoleService.getSystemRoleList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@PostMapping("/query")
|
@PostMapping("/query")
|
||||||
@Operation(summary = "分页查询角色")
|
@Operation(summary = "分页查询角色")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
||||||
|
|||||||
Reference in New Issue
Block a user