提交 63cc12d6 编写于 作者: dong.an's avatar dong.an

权限中台

上级 1f81b8fd
...@@ -83,4 +83,33 @@ public class AuthDto { ...@@ -83,4 +83,33 @@ public class AuthDto {
public void setSysCode(String sysCode) { public void setSysCode(String sysCode) {
this.sysCode = sysCode; this.sysCode = sysCode;
} }
@Override
public String toString() {
return "AuthDto{" +
"productType=" + productType +
", userId=" + userId +
", authType=" + authType +
", roleCodes=" + this.getRoleCodesStr() +
", url='" + url + '\'' +
", dataAuth=" + dataAuth +
", sysCode='" + sysCode + '\'' +
'}';
}
private String getRoleCodesStr() {
if (this.roleCodes == null || this.roleCodes.size() == 0) {
return "[]";
}
StringBuilder sb = new StringBuilder(50);
sb.append("[");
for (int i = 0; i < roleCodes.size(); i++) {
if (i > 0) {
sb.append(",");
}
sb.append(roleCodes.get(i));
}
sb.append("]");
return sb.toString();
}
} }
...@@ -50,4 +50,14 @@ public class GrantDto { ...@@ -50,4 +50,14 @@ public class GrantDto {
public void setSysCode(String sysCode) { public void setSysCode(String sysCode) {
this.sysCode = sysCode; this.sysCode = sysCode;
} }
@Override
public String toString() {
return "GrantDto{" +
"userId=" + userId +
", grantCode='" + grantCode + '\'' +
", createdId=" + createdId +
", sysCode='" + sysCode + '\'' +
'}';
}
} }
...@@ -79,4 +79,17 @@ public class UserRoleDto { ...@@ -79,4 +79,17 @@ public class UserRoleDto {
public void setModifiedId(Integer modifiedId) { public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId; this.modifiedId = modifiedId;
} }
@Override
public String toString() {
return "UserRoleDto{" +
"id=" + id +
", productType=" + productType +
", userId=" + userId +
", roleId=" + roleId +
", roleCode='" + roleCode + '\'' +
", createdId=" + createdId +
", modifiedId=" + modifiedId +
'}';
}
} }
package com.pica.cloud.permission.permission.server.aop;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* @author andong
* @create 2019/9/17
*/
@Aspect
@Component
public class PicaLogAspect {
private static final Logger logger = LoggerFactory.getLogger(PicaLogAspect.class);
@Pointcut("execution(public * com.pica.cloud..*Controller.*(..))")
public void weblog() {}
@Around("weblog()")
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
String url = request.getRequestURL().toString();
String method = request.getMethod();
String queryString = request.getQueryString();
String requestBody = "";
if (!"GET".equalsIgnoreCase(method) && !"DELETE".equalsIgnoreCase(method)) {
Object[] args = joinPoint.getArgs();
if (args != null && args.length > 0) {
requestBody = args[0].toString();
}
}
long startTime = System.currentTimeMillis();
logger.info("request start, controller params==>, url: {}, method: {}, params: {}, body: {}", url, method, queryString, requestBody);
Object result = joinPoint.proceed();
logger.info("request spent time milliSeconds ==>" + (System.currentTimeMillis() - startTime));
return result;
}
}
...@@ -102,4 +102,18 @@ public class DataPrivilege { ...@@ -102,4 +102,18 @@ public class DataPrivilege {
public void setModifiedTime(Date modifiedTime) { public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
@Override
public String toString() {
return "DataPrivilege{" +
"id=" + id +
", resourceId=" + resourceId +
", description='" + description + '\'' +
", config='" + config + '\'' +
", configExt='" + configExt + '\'' +
", deleteFlag=" + deleteFlag +
", createdId=" + createdId +
", modifiedId=" + modifiedId +
'}';
}
} }
\ No newline at end of file
...@@ -152,4 +152,21 @@ public class Resource { ...@@ -152,4 +152,21 @@ public class Resource {
public void setModifiedTime(Date modifiedTime) { public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
@Override
public String toString() {
return "Resource{" +
"id=" + id +
", productType=" + productType +
", category=" + category +
", type=" + type +
", code='" + code + '\'' +
", name='" + name + '\'' +
", url='" + url + '\'' +
", level=" + level +
", parentId=" + parentId +
", createdId=" + createdId +
", modifiedId=" + modifiedId +
'}';
}
} }
\ No newline at end of file
...@@ -92,4 +92,16 @@ public class Role { ...@@ -92,4 +92,16 @@ public class Role {
public void setModifiedTime(Date modifiedTime) { public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
@Override
public String toString() {
return "Role{" +
"id=" + id +
", productType=" + productType +
", code='" + code + '\'' +
", name='" + name + '\'' +
", createdId=" + createdId +
", modifiedId=" + modifiedId +
'}';
}
} }
\ No newline at end of file
...@@ -92,4 +92,16 @@ public class RoleResource { ...@@ -92,4 +92,16 @@ public class RoleResource {
public void setModifiedTime(Date modifiedTime) { public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
@Override
public String toString() {
return "RoleResource{" +
"id=" + id +
", roleId=" + roleId +
", resourceId=" + resourceId +
", dataPrivilegeId=" + dataPrivilegeId +
", createdId=" + createdId +
", modifiedId=" + modifiedId +
'}';
}
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册