1. 操作日志支持国际化

This commit is contained in:
黄昕 2024-04-09 14:52:58 +08:00
parent 41aecab513
commit ec3a59ffad
20 changed files with 159 additions and 68 deletions

View File

@ -156,6 +156,7 @@ CREATE TABLE IF NOT EXISTS `sys_operation_log`
`operation_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作类型',
`operation_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作状态',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作说明',
`access_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '访问用户',
`request_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求来源 IP 地址',
`call_function` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求接口',
`http_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'HTTP 请求类型',

View File

@ -28,7 +28,7 @@ public class JwtAccessDeniedHandler implements AccessDeniedHandler {
HttpServletResponse response,
AccessDeniedException accessDeniedException) throws IOException {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
SecurityResponseUtils.authenticationResponse(request, response, ErrorCode.ERR_PERMISSION, accessDeniedException.getMessage(),
SecurityResponseUtils.authenticationResponse(request, response, ErrorCode.ERR_PERMISSION, ErrorCode.ERR_PERMISSION.getStringValue(),
optLogDbService);
}
}

View File

@ -27,6 +27,6 @@ public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
HttpServletResponse response,
AuthenticationException authException) throws IOException {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
SecurityResponseUtils.authenticationResponse(request, response, ErrorCode.ERR_PARAMEXCEPTION, authException.getMessage(), optLogDbService);
SecurityResponseUtils.authenticationResponse(request, response, ErrorCode.ERR_PARAMEXCEPTION, ErrorCode.ERR_PARAMEXCEPTION.getStringValue(), optLogDbService);
}
}

View File

@ -95,6 +95,6 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
private void handleException(HttpServletRequest request, HttpServletResponse response, ErrorCode err) throws IOException {
// 特定处理逻辑例如设置响应状态记录日志重定向等
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
SecurityResponseUtils.authenticationResponse(request, response, err, err.getDescription(), optLogDbService);
SecurityResponseUtils.authenticationResponse(request, response, err, err.getStringValue(), optLogDbService);
}
}

View File

@ -39,7 +39,6 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
import org.springframework.web.bind.annotation.RequestMethod;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
@ -74,7 +73,7 @@ public class JwtCustomUsernamePassword extends UsernamePasswordAuthenticationFil
try {
ProtocolReq<LoginReq> loginReq = ProtocolJsonUtils.jsonGetObject(request.getInputStream(),
new TypeReference<>() {
});
});
List<String> validate = HelperUtils.validate(loginReq, ValidGroups.ProtocolCommonValid.class,
ValidGroups.LogoutReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -131,12 +130,15 @@ public class JwtCustomUsernamePassword extends UsernamePasswordAuthenticationFil
if (failed instanceof AuthenticationServiceException) {
if (failed.getCause() instanceof CommonAuthException ex) {
err = ex.getErr();
rsp.setStatus(ex.getErr().getCode());
} else {
err = ErrorCode.ERR_ACCOUNT;
rsp.setStatus(ErrorCode.ERR_ACCOUNT.getCode());
}
rsp.setMessage(new String[] {failed.getMessage()});
} else if (failed instanceof CommonAuthException ex) {
err = ex.getErr();
rsp.setStatus(ex.getErr().getCode());
rsp.setMessage(ex.getDescription());
} else {
@ -144,8 +146,7 @@ public class JwtCustomUsernamePassword extends UsernamePasswordAuthenticationFil
rsp.setMessage(new String[] {err.getDescription()});
}
SecurityResponseUtils.authenticationResponse(request, response, rsp, Arrays.toString(rsp.getMessage()),
optLogDbService);
SecurityResponseUtils.authenticationResponse(request, response, rsp, err.getStringValue(), optLogDbService);
}
@Override
@ -182,8 +183,7 @@ public class JwtCustomUsernamePassword extends UsernamePasswordAuthenticationFil
ApiContextUtils.setJwtUserInfo(jwt, au.getUsername(), au.getUid(), au.getId());
try {
SecurityResponseUtils.authenticationResponse(request, response, loginRsp,
"[" + authResult.getName() + "] login", optLogDbService);
SecurityResponseUtils.authenticationResponse(request, response, loginRsp, "SYSLOG_DESC_LOGIN", optLogDbService);
} finally {
ApiContextUtils.clear();
}

View File

@ -17,7 +17,6 @@ import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Arrays;
/**
* The type Jwt logout handler.
@ -40,20 +39,20 @@ public class JwtLogoutHandler implements LogoutHandler {
try {
ApiContext ctx = ApiContextUtils.get();
String username = ctx.getUsername();
ErrorCode err;
if (!HelperUtils.stringNotEmptyOrNull(username)) {
rsp.setStatus(ErrorCode.ERR_TOKENNOTFOUND.getCode());
rsp.setMessage(new String[] {ErrorCode.ERR_TOKENNOTFOUND.getDescription()});
err = ErrorCode.ERR_TOKENNOTFOUND;
} else {
// 校验通过才会执行业务逻辑处理
accountJwtCacheService.deleteAccountJwtCache(ctx.getUid());
rsp.setStatus(ErrorCode.ERR_OK.getCode());
rsp.setMessage(new String[] {ErrorCode.ERR_OK.getDescription()});
err = ErrorCode.ERR_OK;
}
rsp.setStatus(err.getCode());
rsp.setMessage(new String[] {err.getDescription()});
rsp.setUsername(username);
SecurityResponseUtils.authenticationResponse(request, response, rsp, Arrays.toString(rsp.getMessage()),
optLogDbService);
SecurityResponseUtils.authenticationResponse(request, response, rsp, err.getStringValue(), optLogDbService);
} catch (IOException e) {
throw new AuthenticationServiceException(e.getMessage());
}

View File

@ -32,6 +32,6 @@ public class JwtLogoutSuccessHandler implements LogoutSuccessHandler {
new SecurityContextLogoutHandler().logout(request, response, authentication);
}
SecurityResponseUtils.authenticationResponse(request, response, ErrorCode.ERR_OK, "logout", optLogDbService);
SecurityResponseUtils.authenticationResponse(request, response, ErrorCode.ERR_OK, "SYSLOG_DESC_LOGOUT", optLogDbService);
}
}

View File

@ -25,7 +25,7 @@ public class LocaleConfig {
Locale.setDefault(Locale.CHINA);
ResourceBundleMessageSource source = new ResourceBundleMessageSource();
//设置国际化文件存储路径和名称 i18n目录messages文件名
source.setBasenames("i18n/message", "i18n/errorMessage", "i18n/enumMessage");
source.setBasenames("i18n/message", "i18n/errorMessage", "i18n/enumMessage", "i18n/syslogMessage");
//设置根据key如果没有获取到对应的文本信息,则返回key作为信息
source.setUseCodeAsDefaultMessage(true);
//设置字符编码

View File

@ -56,7 +56,13 @@ public class MessageUtil {
}
private static String get(String key, Object[] params, Locale language) {
return getInstance().getMessage(key, params, language);
String ret = getInstance().getMessage(key, params, language);
if (HelperUtils.stringNotEmptyOrNull(ret)) {
return ret;
}
return key;
}
private static MessageSource getInstance() {

View File

@ -0,0 +1,38 @@
SYSLOG_MOD_COMMON=Universal Module
SYSLOG_MOD_SYSLOG=Operation Log Module
SYSLOG_MOD_AUTH=Rights Management Module
SYSLOG_MOD_DICT=Dictionary Module
SYSLOG_MOD_SYSINFO=System Information Module
SYSLOG_MOD_USER_MGR=User Management Module
SYSLOG_MOD_SECURITY=System Safety Module
SYSLOG_TYPE_AUTH=Authentication/Authentication
SYSLOG_TYPE_READ=READ
SYSLOG_TYPE_WRITE=WRITE
SYSLOG_TYPE_CREATE=CREATE
SYSLOG_TYPE_DEL=DELETE
SYSLOG_TYPE_MODIFY=MODIFY
SYSLOG_DESC_GET_VERSION=Obtain the current system version information
SYSLOG_DESC_GET_SYSLOG_SUMMARY=Obtain the brief information about operationlogs
SYSLOG_DESC_GET_SYSLOG_DETAIL=Obtain operation logdetails
SYSLOG_DESC_GET_CUR_USR_RES_RIGHT=Get the current user resource rights
SYSLOG_DESC_GET_USR_RES_RIGHT=Obtain user resource rights
SYSLOG_DESC_GET_ALL_USR_GROUP=Get all current user groups
SYSLOG_DESC_CREATE_RESOURCE=Register a new resource
SYSLOG_DESC_DEL_RESOURCE=Delete resource
SYSLOG_DESC_GET_ALL_ENUM_DICT=Get all enumeration dictionary type information of the system
SYSLOG_DESC_GET_ENUM_DETAIL=Gets the details of the system enumeration dictionary
SYSLOG_DESC_CREATE_USER_DICT=Creating a user dictionary
SYSLOG_DESC_MODIFY_USER_DICT=Modify the contents of the user dictionary
SYSLOG_DESC_GET_ALL_USER_DICT=Get all user dictionaries
SYSLOG_DESC_GET_USER_DETAIL=Get the user dictionary content item
SYSLOG_DESC_CREATE_USER_DICT_ITEM=Add user dictionary content items
SYSLOG_DESC_GET_OS_INFO=Obtain information about the current operating system
SYSLOG_DESC_GET_CPU_INFO=Gets current processor information
SYSLOG_DESC_GET_HW_INFO=Obtain system hardware information
SYSLOG_DESC_GET_USER=Get user information
SYSLOG_DESC_GET_USER_LIST=Get user list
SYSLOG_DESC_GET_CUR_USER=get current user information
SYSLOG_DESC_CREATE_USER=Create new user
SYSLOG_DESC_DEL_USER=Delete user
SYSLOG_DESC_LOGOUT=Logout
SYSLOG_DESC_LOGIN=Login

View File

@ -0,0 +1,38 @@
SYSLOG_MOD_COMMON=\u901A\u7528\u6A21\u5757
SYSLOG_MOD_SYSLOG=\u64CD\u4F5C\u65E5\u5FD7\u6A21\u5757
SYSLOG_MOD_AUTH=\u6743\u9650\u7BA1\u7406\u6A21\u5757
SYSLOG_MOD_DICT=\u5B57\u5178\u6A21\u5757
SYSLOG_MOD_SYSINFO=\u7CFB\u7EDF\u4FE1\u606F\u6A21\u5757
SYSLOG_MOD_USER_MGR=\u7528\u6237\u7BA1\u7406\u6A21\u5757
SYSLOG_MOD_SECURITY=\u7CFB\u7EDF\u5B89\u5168\u6A21\u5757
SYSLOG_TYPE_AUTH=\u8BA4\u8BC1/\u9274\u6743
SYSLOG_TYPE_READ=\u8BFB\u53D6
SYSLOG_TYPE_WRITE=\u5199\u5165
SYSLOG_TYPE_CREATE=\u521B\u5EFA
SYSLOG_TYPE_DEL=\u5220\u9664
SYSLOG_TYPE_MODIFY=\u4FEE\u6539
SYSLOG_DESC_GET_VERSION=\u83B7\u53D6\u5F53\u524D\u7CFB\u7EDF\u7248\u672C\u4FE1\u606F
SYSLOG_DESC_GET_SYSLOG_SUMMARY=\u83B7\u53D6\u64CD\u4F5C\u65E5\u5FD7\u7B80\u8981\u4FE1\u606F
SYSLOG_DESC_GET_SYSLOG_DETAIL=\u83B7\u53D6\u64CD\u4F5C\u65E5\u5FD7\u8BE6\u7EC6\u4FE1\u606F
SYSLOG_DESC_GET_CUR_USR_RES_RIGHT=\u83B7\u53D6\u5F53\u524D\u7528\u6237\u8D44\u6E90\u6743\u9650
SYSLOG_DESC_GET_USR_RES_RIGHT=\u83B7\u53D6\u7528\u6237\u8D44\u6E90\u6743\u9650
SYSLOG_DESC_GET_ALL_USR_GROUP=\u83B7\u53D6\u5F53\u524D\u6240\u6709\u7528\u6237\u7EC4
SYSLOG_DESC_CREATE_RESOURCE=\u6CE8\u518C\u65B0\u7684\u8D44\u6E90
SYSLOG_DESC_DEL_RESOURCE=\u5220\u9664\u8D44\u6E90
SYSLOG_DESC_GET_ALL_ENUM_DICT=\u83B7\u53D6\u7CFB\u7EDF\u6240\u6709\u679A\u4E3E\u5B57\u5178\u7C7B\u578B\u4FE1\u606F
SYSLOG_DESC_GET_ENUM_DETAIL=\u83B7\u53D6\u7CFB\u7EDF\u679A\u4E3E\u5B57\u5178\u8BE6\u7EC6\u5185\u5BB9
SYSLOG_DESC_CREATE_USER_DICT=\u65B0\u5EFA\u7528\u6237\u5B57\u5178
SYSLOG_DESC_MODIFY_USER_DICT=\u4FEE\u6539\u7528\u6237\u5B57\u5178\u5185\u5BB9
SYSLOG_DESC_GET_ALL_USER_DICT=\u83B7\u53D6\u6240\u6709\u7528\u6237\u5B57\u5178
SYSLOG_DESC_GET_USER_DETAIL=\u83B7\u53D6\u7528\u6237\u5B57\u5178\u5185\u5BB9\u9879
SYSLOG_DESC_CREATE_USER_DICT_ITEM=\u65B0\u589E\u7528\u6237\u5B57\u5178\u5185\u5BB9\u9879
SYSLOG_DESC_GET_OS_INFO=\u83B7\u53D6\u5F53\u524D\u64CD\u4F5C\u7CFB\u7EDF\u4FE1\u606F
SYSLOG_DESC_GET_CPU_INFO=\u83B7\u53D6\u5F53\u524D\u5904\u7406\u5668\u4FE1\u606F
SYSLOG_DESC_GET_HW_INFO=\u83B7\u53D6\u7CFB\u7EDF\u786C\u4EF6\u4FE1\u606F
SYSLOG_DESC_GET_USER=\u83B7\u53D6\u7528\u6237\u4FE1\u606F
SYSLOG_DESC_GET_USER_LIST=\u83B7\u53D6\u7528\u6237\u5217\u8868
SYSLOG_DESC_GET_CUR_USER=\u83B7\u53D6\u5F53\u524D\u7528\u6237\u4FE1\u606F
SYSLOG_DESC_CREATE_USER=\u521B\u5EFA\u65B0\u7528\u6237
SYSLOG_DESC_DEL_USER=\u5220\u9664\u7528\u6237
SYSLOG_DESC_LOGOUT=\u6CE8\u9500
SYSLOG_DESC_LOGIN=\u767B\u5F55

View File

@ -59,6 +59,10 @@ public class OperationLog {
@Column(value = "description")
private String description;
@Schema(description = "访问用户")
@Column(value = "access_user")
private String accessUser;
/**
* 请求来源 IP 地址
*/

View File

@ -58,8 +58,8 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
OperationLogAnnotation annotation,
ErrorCode errorCode) {
if (annotation != null) {
systemOperationLog(call, request, result, annotation.OperationModule(), annotation.OperationType(),
annotation.OperationDesc(), errorCode);
systemOperationLog(call, request, result, annotation.OperationModule(), annotation.OperationType(), annotation.OperationDesc(),
errorCode);
} else {
systemOperationLog(call, request, result, "", "", "", errorCode);
}
@ -76,12 +76,13 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
return;
}
optLog.setOperationStatus(errorCode.getDescription());
optLog.setOperationStatus(errorCode.getStringValue());
//获取注解操作信息
optLog.setModule("系统安全模块");
optLog.setOperationType("认证/鉴权");
optLog.setModule("SYSLOG_MOD_SECURITY");
optLog.setOperationType("SYSLOG_TYPE_AUTH");
optLog.setDescription(readme);
optLog.setAccessUser(ctx.getUsername());
optLog.setUserId(-1L);
//操作时间
@ -108,7 +109,6 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
}
if (HelperUtils.stringNotEmptyOrNull(ctx.getJwt())) {
optLog.setDescription(ctx.getUsername() + " " + optLog.getDescription());
optLog.setUserId(ctx.getId() != null ? ctx.getId() : -1L);
}
}
@ -141,10 +141,7 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
}
@Override
public Page<OperationLog> getSystemOperationSummary(Long pageNumber,
Long pageSize,
Long totalSize,
List<String> userName) {
public Page<OperationLog> getSystemOperationSummary(Long pageNumber, Long pageSize, Long totalSize, List<String> userName) {
QueryWrapper wrapper;
ApiContext ctx = ApiContextUtils.get();
@ -163,19 +160,17 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
.where(OPERATION_LOG.USER_ID.eq(USER.ID)
.and(USER.ID.in(idArray))
.and(USER.ROLE_ID.ge(
select(distinct(USER.ROLE_ID)).from(
USER.as("u"))
.where(USER.ID.eq(
ctx.getId())))));
select(distinct(USER.ROLE_ID))
.from(USER.as("u"))
.where(USER.ID.eq(ctx.getId())))));
} else {
wrapper = new QueryWrapper().select(OPERATION_LOG.ALL_COLUMNS)
.from(OPERATION_LOG.as("o"), USER.as("u1"))
.where(OPERATION_LOG.USER_ID.eq(USER.ID)
.and(USER.ROLE_ID.ge(
select(distinct(USER.ROLE_ID)).from(
USER.as("u"))
.where(USER.ID.eq(
ctx.getId())))));
select(distinct(USER.ROLE_ID))
.from(USER.as("u"))
.where(USER.ID.eq(ctx.getId())))));
}
return operationLogMapper.paginate(pageNumber, pageSize, totalSize, wrapper);
@ -187,10 +182,7 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
@Override
public List<OperationLog> getSystemOperationDetails(List<Long> operationId) {
QueryWrapper wrapper = QueryWrapper.create()
.from(OPERATION_LOG)
.select()
.where(OPERATION_LOG.ID.in(operationId));
QueryWrapper wrapper = QueryWrapper.create().from(OPERATION_LOG).select().where(OPERATION_LOG.ID.in(operationId));
return operationLogMapper.selectListByQuery(wrapper);
}
@ -210,12 +202,13 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
return;
}
optLog.setOperationStatus(errorCode.getDescription());
optLog.setOperationStatus(errorCode.getStringValue());
optLog.setCallFunction(call);
//获取注解操作信息
optLog.setModule(module);
optLog.setOperationType(optType);
optLog.setDescription(desc);
optLog.setAccessUser(ctx.getUsername());
//操作时间
optLog.setOperationTime(new Timestamp(System.currentTimeMillis()));
// 请求方法

View File

@ -28,6 +28,9 @@ public class OptLogSummaryResp {
@Schema(description = "操作说明")
private String description;
@Schema(description = "访问用户")
private String accessUser;
@Schema(description = "请求来源 IP 地址")
private String requestIp;

View File

@ -36,7 +36,7 @@ public class CommonFrameworkApi {
@EncryptionProtocol
@DecryptionProtocol
@PostMapping("/version")
@OperationLogAnnotation(OperationModule = "通用模块", OperationType = "读取", OperationDesc = "获取当前系统版本信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_COMMON", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_VERSION")
public ProtocolResp<VersionResp> getVersion() {
return ProtocolResp.result(VersionResp.builder()
.version(VersionInfo.builder()
@ -57,7 +57,7 @@ public class CommonFrameworkApi {
*/
@GetMapping("/version")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "通用模块", OperationType = "读取", OperationDesc = "获取当前系统版本信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_COMMON", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_VERSION")
public ProtocolResp<VersionResp> getVersionV2() {
return ProtocolResp.result(VersionResp.builder()
.version(VersionInfo.builder()

View File

@ -3,7 +3,9 @@ package com.cf.cs.restful.controller;
import com.cf.cs.base.annotation.OperationLogAnnotation;
import com.cf.cs.base.common.ErrorCode;
import com.cf.cs.base.misc.ApiContextUtils;
import com.cf.cs.base.misc.HelperUtils;
import com.cf.cs.base.misc.MessageUtil;
import com.cf.cs.crypto.annotation.EncryptionProtocol;
import com.cf.cs.base.pojo.po.PageResults;
import com.cf.cs.protocol.pojo.dto.OperationLogDetailsReq;
@ -49,7 +51,7 @@ public class OperationLogApi {
*/
@PostMapping("/summary")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "操作日志模块", OperationType = "读取", OperationDesc = "获取操作日志简要信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_SYSLOG", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_SYSLOG_SUMMARY")
public ProtocolResp<? extends BaseRespStatus> getSummary(@RequestBody ProtocolReq<OperationLogReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class,
ValidGroups.BasePagedReqValid.class,
@ -61,6 +63,13 @@ public class OperationLogApi {
PageResults<OptLogSummaryResp> ret = operationLogService.getOperationLogSummary(req.getPageNumber(), req.getPageSize(),
req.getTotalSize(), req.getUserName());
ret.getItems().forEach(k -> {
k.setOperationStatus(MessageUtil.get(k.getOperationStatus(), ApiContextUtils.getLanguare()));
k.setModule(MessageUtil.get(k.getModule(), ApiContextUtils.getLanguare()));
k.setOperationType(MessageUtil.get(k.getOperationType(), ApiContextUtils.getLanguare()));
k.setDescription(MessageUtil.get(k.getDescription(), ApiContextUtils.getLanguare()));
});
return ProtocolResp.result(BasePageResultResp.<OptLogSummaryResp>builder()
.items(ret)
.build());
@ -79,7 +88,7 @@ public class OperationLogApi {
*/
@PostMapping("/details")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "操作日志模块", OperationType = "读取", OperationDesc = "获取操作日志详细信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_SYSLOG", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_SYSLOG_DETAIL")
public ProtocolResp<? extends BaseRespStatus> getDetails(@RequestBody ProtocolReq<OperationLogDetailsReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class,
ValidGroups.OperationLogReqValid.class);

View File

@ -62,7 +62,7 @@ public class PermissionManagerApi {
*/
@GetMapping("resourcePermission")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "权限管理模块", OperationType = "读取", OperationDesc = "获取当前用户资源权限")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_AUTH", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DEC_GET_CUR_USR_RES_RIGHT")
public ProtocolResp<? extends BaseRespStatus> getCurrentUserResourcePermission() {
AuthAccountUser au = authUsersService.getAuthAccountByUserName(ApiContextUtils.get().getUsername());
@ -86,7 +86,7 @@ public class PermissionManagerApi {
@PostMapping("resourcePermission")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "权限管理模块", OperationType = "读取", OperationDesc = "获取用户资源权限")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_AUTH", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DEC_GET_USR_RES_RIGHT")
public ProtocolResp<? extends BaseRespStatus> getUserResourcePermission(@RequestBody ProtocolReq<UserIdReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.OperationLogReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -115,7 +115,7 @@ public class PermissionManagerApi {
*/
@GetMapping("/allRoles")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "权限管理模块", OperationType = "读取", OperationDesc = "获取当前所有用户组")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_AUTH", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_ALL_USR_GROUP")
public ProtocolResp<? extends BaseRespStatus> getAllRoles() {
return ProtocolResp.result(GetRoleResp.builder().roles(userPermissionService.getAllUserGroup()).build());
}
@ -129,7 +129,7 @@ public class PermissionManagerApi {
@PutMapping("/resource")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "权限管理模块", OperationType = "创建", OperationDesc = "注册新的资源")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_AUTH", OperationType = "SYSLOG_TYPE_CREATE", OperationDesc = "SYSLOG_DESC_CREATE_RESOURCE")
public ProtocolResp<? extends BaseRespStatus> registerResource(@RequestBody ProtocolReq<RegisterResourceReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.ResourceReqValid.class,
ValidGroups.ResourceInfoValid.class);
@ -155,7 +155,7 @@ public class PermissionManagerApi {
@DeleteMapping("/resource")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "权限管理模块", OperationType = "删除", OperationDesc = "删除资源")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_AUTH", OperationType = "SYSLOG_TYPE_DEL", OperationDesc = "SYSLOG_DESC_DEL_RESOURCE")
public ProtocolResp<? extends BaseRespStatus> removeResourceById(@RequestBody ProtocolReq<IdArrayReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.UserIdReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项

View File

@ -57,7 +57,7 @@ public class SystemDictController {
*/
@GetMapping("/enum/allDict")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "读取", OperationDesc = "获取系统所有枚举字典类型信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_ALL_ENUM_DICT")
public ProtocolResp<? extends BaseRespStatus> getEnumDictionary() {
Set<String> ret = dictionaryService.getAllEnumDictionary();
@ -74,7 +74,7 @@ public class SystemDictController {
*/
@PostMapping("/enum/dictContent")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "读取", OperationDesc = "获取系统枚举字典详细内容")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_ENUM_DETAIL")
public ProtocolResp<? extends BaseRespStatus> getEnumDictionaryContent(@RequestBody ProtocolReq<DictContentReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class,
ValidGroups.DictReqValid.class);
@ -103,7 +103,7 @@ public class SystemDictController {
@PutMapping("/user/add")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "创建", OperationDesc = "新建用户字典")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_CREATE", OperationDesc = "新建用户字典")
public ProtocolResp<? extends BaseRespStatus> createNewDictionary(@RequestBody ProtocolReq<NewUserDictReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.DictReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -128,7 +128,7 @@ public class SystemDictController {
@DeleteMapping("/user/delete")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "创建", OperationDesc = "新建用户字典")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_CREATE", OperationDesc = "SYSLOG_DESC_CREATE_USER_DICT")
public ProtocolResp<? extends BaseRespStatus> removeDictionary(@RequestBody ProtocolReq<RemoveDictReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.DictReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -153,7 +153,7 @@ public class SystemDictController {
@PostMapping("/user/upgrade")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "修改", OperationDesc = "修改用户字典内容")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_MODIFY", OperationDesc = "SYSLOG_DESC_MODIFY_USER_DICT")
public ProtocolResp<? extends BaseRespStatus> upgradeDictionary(@RequestBody ProtocolReq<NewUserDictReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.DictReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -178,7 +178,7 @@ public class SystemDictController {
@PostMapping("/user/allDict")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "读取", OperationDesc = "获取所有用户字典")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_ALL_USER_DICT")
public ProtocolResp<? extends BaseRespStatus> getUserDictionary(@RequestBody ProtocolReq<BasePagedReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.BasePagedReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -205,7 +205,7 @@ public class SystemDictController {
@PostMapping("/user/getDictContent")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "读取", OperationDesc = "获取用户字典内容项")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_USER_DETAIL")
public ProtocolResp<? extends BaseRespStatus> getUserDictionaryContent(@RequestBody ProtocolReq<DictContentReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.DictReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -231,7 +231,7 @@ public class SystemDictController {
@PutMapping("/user/addDictContent")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "字典模块", OperationType = "创建", OperationDesc = "新增用户字典内容项")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_DICT", OperationType = "SYSLOG_TYPE_CREATE", OperationDesc = "SYSLOG_DESC_CREATE_USER_DICT_ITEM")
public ProtocolResp<? extends BaseRespStatus> createNewDictionaryContent(@RequestBody ProtocolReq<AddDictContentReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.DictReqValid.class,
ValidGroups.DictReqContentValid.class);

View File

@ -36,7 +36,7 @@ public class SystemInfoApi {
*/
@GetMapping("/osInfo")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "系统信息模块", OperationType = "读取", OperationDesc = "获取当前操作系统信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_SYSINFO", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_OS_INFO")
public ProtocolResp<GetOsInfoResp> getOsInfo() {
return ProtocolResp.result(GetOsInfoResp.builder()
.os(systemInfoService.getOsName())
@ -51,7 +51,7 @@ public class SystemInfoApi {
*/
@GetMapping("/processorInfo")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "系统信息模块", OperationType = "读取", OperationDesc = "获取当前处理器信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_SYSINFO", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_CPU_INFO")
public ProtocolResp<GetProcessorInfoResp> getProcessorInfo() {
return ProtocolResp.result(GetProcessorInfoResp.builder().cpuInfo(systemInfoService.getProcessInfo()).build());
}
@ -63,7 +63,7 @@ public class SystemInfoApi {
*/
@GetMapping("/hwInfo")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "系统信息模块", OperationType = "读取", OperationDesc = "获取系统硬件信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_SYSINFO", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_HW_INFO")
public ProtocolResp<GetHwInfoResp> getHwInfo() {
return ProtocolResp.result(GetHwInfoResp.builder().hwInfo(systemInfoService.getHardwareInfo()).build());
}

View File

@ -58,7 +58,7 @@ public class UserManagerApi {
@PostMapping("/userInfo")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "用户管理模块", OperationType = "读取", OperationDesc = "获取用户信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_USER_MGR", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_USER")
public ProtocolResp<? extends BaseRespStatus> getUserInfoById(@RequestBody ProtocolReq<UserIdReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.OperationLogReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -82,7 +82,7 @@ public class UserManagerApi {
@PostMapping("/userList")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "用户管理模块", OperationType = "读取", OperationDesc = "获取用户列表")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_USER_MGR", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_USER_LIST")
public ProtocolResp<? extends BaseRespStatus> getAllUserInfoPaged(@RequestBody ProtocolReq<BasePagedReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.BasePagedReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -106,7 +106,7 @@ public class UserManagerApi {
*/
@GetMapping("/userInfo")
@EncryptionProtocol
@OperationLogAnnotation(OperationModule = "用户管理模块", OperationType = "读取", OperationDesc = "获取当前用户信息")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_USER_MGR", OperationType = "SYSLOG_TYPE_READ", OperationDesc = "SYSLOG_DESC_GET_CUR_USER")
public ProtocolResp<GetUserInfoResp> getCurrentUserInfo() {
return ProtocolResp.result(GetUserInfoResp.builder()
.userInfo(userDbService.getCurrentUserInfo())
@ -122,7 +122,7 @@ public class UserManagerApi {
@PutMapping("/register")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "用户管理模块", OperationType = "创建", OperationDesc = "创建新用户")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_USER_MGR", OperationType = "SYSLOG_TYPE_CREATE", OperationDesc = "SYSLOG_DESC_CREATE_USER")
public ProtocolResp<? extends BaseRespStatus> createNewUser(@RequestBody ProtocolReq<RegisterUserReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.UserReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项
@ -148,7 +148,7 @@ public class UserManagerApi {
@DeleteMapping("/remove")
@EncryptionProtocol
@DecryptionProtocol
@OperationLogAnnotation(OperationModule = "用户管理模块", OperationType = "删除", OperationDesc = "删除用户")
@OperationLogAnnotation(OperationModule = "SYSLOG_MOD_USER_MGR", OperationType = "SYSLOG_TYPE_DEL", OperationDesc = "SYSLOG_DESC_DEL_USER")
public ProtocolResp<BaseRespStatus> removeUser(@RequestBody ProtocolReq<UserIdReq> mr) {
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.UserIdReqValid.class);
// 如果校验通过validate为空否则validate包含未校验通过项