🎨 优化项目模块.

This commit is contained in:
lijiahang
2025-01-07 18:23:39 +08:00
parent c0122079c1
commit 4119dbad6a
337 changed files with 556 additions and 551 deletions

View File

@@ -1,90 +0,0 @@
<?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>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>orion-visor-framework-common</artifactId>
<name>${project.artifactId}</name>
<packaging>jar</packaging>
<description>项目公共基准包</description>
<url>https://github.com/dromara/orion-visor</url>
<dependencies>
<dependency>
<groupId>cn.orionsec.kit</groupId>
<artifactId>orion-all</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- aspectj -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<!-- mapstruct -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
</dependency>
<!-- transmittable -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
<!-- validation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- configuration -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<!-- security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- doc -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
import cn.orionsec.kit.lang.constant.OrionConst;
/**
* 项目常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/19 18:56
*/
public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.2.3";
/**
* 同 ${spring.application.name}
*/
String APP_NAME = "orion-visor";
String GITHUB = "https://github.com/dromara/orion-visor";
String GITEE = "https://gitee.com/dromara/orion-visor";
String ISSUES = "https://github.com/dromara/orion-visor/issues";
}

View File

@@ -1,72 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 自动装配排序常量
* <p>
* 实际遵循 DependsOn
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/11 17:55
*/
public interface AutoConfigureOrderConst {
int FRAMEWORK_WEB = Integer.MIN_VALUE + 1100;
int FRAMEWORK_SECURITY = Integer.MIN_VALUE + 1200;
int FRAMEWORK_SECURITY_CRYPTO = Integer.MIN_VALUE + 1250;
int FRAMEWORK_WEBSOCKET = Integer.MIN_VALUE + 1300;
int FRAMEWORK_DESENSITIZE = Integer.MIN_VALUE + 1400;
int FRAMEWORK_LOG = Integer.MIN_VALUE + 1500;
int FRAMEWORK_SWAGGER = Integer.MIN_VALUE + 1600;
int FRAMEWORK_DATASOURCE = Integer.MIN_VALUE + 1700;
int FRAMEWORK_MYBATIS = Integer.MIN_VALUE + 1800;
int FRAMEWORK_REDIS = Integer.MIN_VALUE + 1900;
int FRAMEWORK_REDIS_CACHE = Integer.MIN_VALUE + 1950;
int FRAMEWORK_STORAGE = Integer.MIN_VALUE + 2000;
int FRAMEWORK_JOB = Integer.MIN_VALUE + 2100;
int FRAMEWORK_JOB_QUARTZ = Integer.MIN_VALUE + 2130;
int FRAMEWORK_JOB_ASYNC = Integer.MIN_VALUE + 2160;
int FRAMEWORK_MONITOR = Integer.MIN_VALUE + 2200;
int FRAMEWORK_BIZ_OPERATOR_LOG = Integer.MIN_VALUE + 3000;
int FRAMEWORK_BANNER = Integer.MIN_VALUE + 10000;
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* bean 排序常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/29 16:09
*/
public interface BeanOrderConst {
/**
* 公共返回值包装处理器
*/
int RESPONSE_ADVICE_WRAPPER = Integer.MIN_VALUE + 1000;
/**
* 演示模式切面
*/
int DEMO_DISABLE_API_ASPECT = Integer.MIN_VALUE + 10;
/**
* 全局日志打印
*/
int LOG_PRINT_ASPECT = Integer.MIN_VALUE + 20;
/**
* 操作日志切面
*/
int OPERATOR_LOG_ASPECT = Integer.MIN_VALUE + 30;
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 常量 - 中文
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/30 21:00
*/
public interface CnConst {
String CN_USER = "用户";
String CN_ROLE = "角色";
String CN_UNKNOWN = "未知";
String CN_INTRANET_IP = "内网IP";
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/23 18:49
*/
public interface Const extends cn.orionsec.kit.lang.constant.Const, FieldConst, CnConst {
Integer NOT_DELETE = 0;
Integer IS_DELETED = 1;
int BEARER_PREFIX_LEN = 7;
int MD5_LEN = 32;
Long ROOT_PARENT_ID = 0L;
Integer DEFAULT_SORT = 10;
Long NONE_ID = -1L;
Integer DEFAULT_VERSION = 1;
Long SYSTEM_USER_ID = 0L;
String SYSTEM_USERNAME = "system";
int BATCH_COUNT = 500;
}

View File

@@ -1,186 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
import cn.orionsec.kit.lang.define.wrapper.CodeInfo;
import cn.orionsec.kit.lang.define.wrapper.HttpWrapper;
import cn.orionsec.kit.lang.utils.Exceptions;
import cn.orionsec.kit.lang.utils.Strings;
/**
* 用于定义错误码
* <p>
* 1. http 通用 status
* 2. 前端需要特殊处理
* 3. @ExceptionHandler 全局异常
* 其他情况可以定义在 ExceprionMessage 中
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/6 16:14
*/
@SuppressWarnings("ALL")
public enum ErrorCode implements CodeInfo {
// -------------------- http message --------------------
BAD_REQUEST(400, "参数验证失败"),
UNAUTHORIZED(401, "当前认证信息已失效, 请重新登录"),
FORBIDDEN(403, "无操作权限"),
NOT_FOUND(404, "未找到该资源"),
METHOD_NOT_ALLOWED(405, "不支持此方法"),
REQUEST_TIMEOUT(408, "处理超时"),
CONFLICT(409, "数据状态发生改变, 请刷新后重试"),
PAYLOAD_TOO_LARGE(413, "请求过大"),
LOCKED(423, "当前操作已被锁定"),
TOO_MANY_REQUESTS(429, "请求过快"),
INTERNAL_SERVER_ERROR(500, "系统异常"),
// -------------------- 自定义 - 业务 --------------------
USER_DISABLED(700, "当前用户已禁用"),
USER_OTHER_DEVICE_LOGIN(701, "该账号于 {} 已在其他设备登录 {}({})"),
USER_OFFLINE(702, "该账号于 {} 已被强制下线 {}({})"),
// -------------------- 自定义 - 通用 --------------------
NETWORK_FLUCTUATION(900, "当前环境网路波动"),
HTTP_API_REQUEST_ERROR(901, "api 调用异常"),
IO_EXCEPTION(902, "网络异常"),
SQL_EXCEPTION(903, "数据异常"),
SFTP_EXCEPTION(904, "操作失败"),
EXCEL_PASSWORD_ERROR(905, "文档密码错误"),
PASER_FAILED(906, "解析失败"),
ENCRYPT_ERROR(907, "数据加密异常"),
DECRYPT_ERROR(908, "数据解密异常"),
TASK_EXECUTE_ERROR(909, "任务执行异常"),
CONNECT_ERROR(910, "建立连接失败"),
INTERRUPT_ERROR(911, "操作中断"),
UNSAFE_OPERATOR(912, "不安全的操作"),
VCS_OPETATOR_ERROR(913, "仓库操作执行失败"),
DIABLED_ERROR(914, "数据已被禁用"),
UNSUPPOETED(915, "不支持此操作"),
DEMO_DISABLE_API(916, "演示模式不支持此功能"),
;
ErrorCode(int code, String message) {
this.code = code;
this.message = message;
this.wrapper = HttpWrapper.of(this);
}
/**
* 错误码
*/
private final int code;
/**
* 错误信息
*/
private final String message;
private final HttpWrapper<?> wrapper;
/**
* 获取 wapper
*
* @param data data
* @return HttpWrapper
*/
public HttpWrapper<?> wrapper() {
return HttpWrapper.of(this);
}
/**
* 获取 wapper
*
* @param data data
* @param <T> T
* @return HttpWrapper
*/
public <T> HttpWrapper<T> wrapper(T data) {
return HttpWrapper.of(this, data);
}
@Override
public int code() {
return code;
}
@Override
public String message() {
return message;
}
/**
* @return 获取单例 wapper
*/
public HttpWrapper<?> getWrapper() {
return wrapper;
}
/**
* @return 获取异常
*/
public RuntimeException exception() {
return Exceptions.httpWrapper(this);
}
/**
* @param params 错误信息参数
* @return 获取异常
*/
public RuntimeException exception(Object... params) {
return Exceptions.httpWrapper(this.toHttpWrapper().msg(Strings.format(this.message, params)));
}
}

View File

@@ -1,186 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
import cn.orionsec.kit.lang.exception.ApplicationException;
import cn.orionsec.kit.lang.exception.argument.InvalidArgumentException;
/**
* 错误信息
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/7 18:51
*/
public interface ErrorMessage {
String MISSING = "{} 不能为空";
String PARAM_MISSING = "参数不能为空";
String PARAM_ERROR = "参数错误";
String ID_MISSING = "id 不能为空";
String INVALID_PARAM = "参数验证失败";
String DATA_MODIFIED = "数据发生变更, 请刷新后重试";
String DATA_ABSENT = "数据不存在";
String KEY_ABSENT = "主机密钥不存在";
String IDENTITY_ABSENT = "主机身份不存在";
String CONFIG_ABSENT = "配置不存在";
String CONFIG_PRESENT = "配置已存在";
String DATA_PRESENT = "数据已存在";
String NAME_PRESENT = "名称已存在";
String CODE_PRESENT = "编码已存在";
String NICKNAME_PRESENT = "花名已存在";
String USERNAME_PRESENT = "用户名已存在";
String ROLE_ABSENT = "角色不存在";
String ROLE_CODE_ABSENT = "角色 [{}] 不存在";
String INVALID_PARENT_MENU = "所选父菜单不合法";
String PARENT_MENU_ABSENT = "父菜单不存在";
String USERNAME_PASSWORD_ERROR = "用户名或密码错误";
String MAX_LOGIN_FAILED = "登录失败次数已上限";
String HISTORY_ABSENT = "历史值不存在";
String USER_ABSENT = "用户不存在";
String HOST_ABSENT = "主机不存在";
String GROUP_ABSENT = "分组不存在";
String HOST_TYPE_ERROR = "主机类型错误";
String HOST_NOT_ENABLED = "主机未启用";
String UNABLE_OPERATE_ADMIN_ROLE = "无法操作管理员账号";
String UNSUPPORTED_CHARSET = "不支持的编码 [{}]";
String PASSWORD_MISSING = "请输入密码";
String BEFORE_PASSWORD_ERROR = "原密码错误";
String DATA_NO_PERMISSION = "数据无权限";
String ANY_NO_PERMISSION = "{}无权限";
String SESSION_PRESENT = "会话已存在";
String SESSION_ABSENT = "会话不存在";
String PATH_NOT_NORMALIZE = "路径不合法";
String OPERATE_ERROR = "操作失败";
String UNKNOWN_TYPE = "未知类型";
String ERROR_TYPE = "错误的类型";
String FILE_ABSENT = "文件不存在";
String FILE_ABSENT_CLEAR = "文件不存在 (可能已被清理)";
String LOG_ABSENT = "日志不存在";
String TASK_ABSENT = "任务不存在";
String CONNECT_ERROR = "连接失败";
String AUTH_ERROR = "认证失败";
String FILE_UPLOAD_ERROR = "文件上传失败";
String SCRIPT_UPLOAD_ERROR = "脚本上传失败";
String EXEC_ERROR = "执行失败";
String ILLEGAL_STATUS = "当前状态不支持此操作";
String CHECK_AUTHORIZED_HOST = "请选择已授权的主机";
String FILE_READ_ERROR = "文件读取失败";
String FILE_READ_ERROR_CLEAR = "文件读取失败 (可能已被清理)";
String PLEASE_CHECK_HOST_SSH = "请检查主机 {} 是否存在/权限/SSH配置";
String CLIENT_ABORT = "手动中断";
String UNABLE_DOWNLOAD_FOLDER = "无法下载文件夹";
/**
* 是否为业务异常
*
* @param ex ex
* @return biz exception
*/
static boolean isBizException(Exception ex) {
if (ex == null) {
return false;
}
return ex instanceof InvalidArgumentException
|| ex instanceof IllegalArgumentException
|| ex instanceof ApplicationException;
}
/**
* 获取错误信息
*
* @param ex ex
* @param defaultMsg defaultMsg
* @return message
*/
static String getErrorMessage(Exception ex, String defaultMsg) {
if (ex == null) {
return null;
}
String message = ex.getMessage();
if (message == null) {
return defaultMsg;
}
// 业务异常
if (isBizException(ex)) {
return message;
}
return defaultMsg;
}
}

View File

@@ -1,72 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 额外字段常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/28 18:34
*/
public interface ExtraFieldConst extends FieldConst {
String USER_ID = "userId";
String TRACE_ID = "traceId";
String IDENTITY = "identity";
String GROUP_NAME = "groupName";
String ID_LIST = "idList";
String USERNAME = "username";
String HOME = "home";
String STATUS_NAME = "statusName";
String KEY_NAME = "keyName";
String POSITION_NAME = "positionName";
String GRANT_TYPE = "grantType";
String GRANT_NAME = "grantName";
String CHANNEL_ID = "channelId";
String SESSION_ID = "sessionId";
String CONNECT_TYPE = "connectType";
String HOST_ID = "hostId";
String HOST_NAME = "hostName";
String LOG_ID = "logId";
String DARK = "dark";
}

View File

@@ -1,108 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 字段常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/10/17 12:44
*/
public interface FieldConst {
String ID = "id";
String KEY = "key";
String CODE = "code";
String NAME = "name";
String TITLE = "title";
String VALUE = "value";
String LABEL = "label";
String TYPE = "type";
String COLOR = "color";
String STATUS = "status";
String INFO = "info";
String EXTRA = "extra";
String REL_ID = "relId";
String BEFORE = "before";
String AFTER = "after";
String SOURCE = "source";
String TARGET = "target";
String CHARSET = "charset";
String TOKEN = "token";
String SEQ = "seq";
String PATH = "path";
String ADDRESS = "address";
String MOD = "mod";
String COUNT = "count";
String DATE = "date";
String TIME = "time";
String TEXT = "text";
String ISSUE = "issue";
String EXPIRE = "expire";
String LOCATION = "location";
String USER_AGENT = "userAgent";
String ERROR_MESSAGE = "errorMessage";
String UUID = "uuid";
String REDIRECT = "redirect";
String SCHEMA = "schema";
String FILTER = "filter";
String ALL = "all";
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 文件常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/4/17 10:35
*/
public interface FileConst {
String ERROR_LOG = "error.log";
String EXEC = "exec";
String SCRIPT = "script";
}

View File

@@ -1,38 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 过滤器排序常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/16 17:04
*/
public interface FilterOrderConst {
int TRICE_ID_FILTER = Integer.MIN_VALUE + 1000;
int CORS_FILTER = Integer.MIN_VALUE + 2000;
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.constant;
/**
* 验证常量
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/10/20 11:45
*/
public interface ValidConst {
String USERNAME_4_32_PATTERN = "^[a-zA-Z0-9_]{4,32}$";
String USERNAME_4_32_MESSAGE = "只能为 4-32 位的数字,字母或下滑线";
String DICT_1_32_PATTERN = "^[a-zA-Z0-9_]{1,32}$";
String DICT_1_32_MESSAGE = "只能为 1-32 位的数字,字母或下滑线";
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.crypto;
import cn.orionsec.kit.lang.utils.codec.Base62s;
import cn.orionsec.kit.lang.utils.crypto.symmetric.SymmetricCrypto;
/**
* 数据加密器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/8 0:20
*/
public interface ValueCrypto extends SymmetricCrypto {
/**
* 初始化
*/
void init();
/**
* 加密后 base62 编码
*
* @param plain 明文
* @return 密文
*/
default String encryptBase62(String plain) {
return new String(Base62s.encode(this.encrypt(plain)));
}
/**
* base62 解码后解密
*
* @param text 密文
* @return 明文
*/
default String decryptBase62(String text) {
return new String(this.decrypt(Base62s.decode(text)));
}
}

View File

@@ -1,45 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 自动清理配置
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/24 15:03
*/
@Data
@Schema(name = "AutoClearConfig", description = "自动清理配置")
public class AutoClearConfig {
@Schema(description = "是否开启")
private Boolean enabled;
@Schema(description = "保留周期 (天)")
private Integer keepPeriod;
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
/**
* 数据清理请求 定义
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/8/29 11:26
*/
public interface DataClearRequest {
/**
* 获取清理数量限制
*
* @return 清理限制
*/
Integer getLimit();
/**
* 设置清理数量限制
*
* @param limit limit
*/
void setLimit(Integer limit);
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.visor.framework.common.validator.group.Page;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* 公共页码请求
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/12 23:14
*/
@Data
@Schema(name = "PageRequest", description = "公共页码请求")
public class PageRequest {
@NotNull(groups = Page.class)
@Min(value = 1, groups = Page.class)
@Max(value = 10000, groups = Page.class)
@Schema(description = "页码")
private Integer page;
@NotNull(groups = Page.class)
@Min(value = 1, groups = Page.class)
@Max(value = 200, groups = Page.class)
@Schema(description = "大小")
private Integer limit;
}

View File

@@ -1,78 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
import java.io.Serializable;
/**
* 请求留痕信息
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/2 16:23
*/
public interface RequestIdentity extends Serializable {
/**
* 获取请求地址
*
* @return address
*/
String getAddress();
/**
* 获取请求位置
*
* @return location
*/
String getLocation();
/**
* 获取请求 userAgent
*
* @return userAgent
*/
String getUserAgent();
/**
* 设置请求地址
*
* @param address address
*/
void setAddress(String address);
/**
* 设置请求位置
*
* @param location location
*/
void setLocation(String location);
/**
* 设置请求 userAgent
*
* @param userAgent userAgent
*/
void setUserAgent(String userAgent);
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 请求留痕模型
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/29 11:57
*/
@Data
@Schema(name = "RequestIdentityModel", description = "请求留痕模型")
public class RequestIdentityModel implements RequestIdentity {
@Schema(description = "请求地址")
private String address;
@Schema(description = "请求位置")
private String location;
@Schema(description = "userAgent")
private String userAgent;
}

View File

@@ -1,148 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
import cn.orionsec.kit.lang.utils.collect.Lists;
import cn.orionsec.kit.lang.utils.time.DateStream;
import cn.orionsec.kit.lang.utils.time.Dates;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 统计区间枚举
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 14:02
*/
public enum StatisticsRange {
/**
* 当天
*/
TODAY {
@Override
public Date getRangeEndTime(Date startTime) {
return DateStream.of(startTime)
.dayEnd()
.date();
}
@Override
public List<String> getDateRanges(Date startTime) {
return Lists.singleton(Dates.format(startTime, Dates.YMD));
}
},
/**
* 日视图
*/
DAY {
@Override
public Date getRangeEndTime(Date startTime) {
return DateStream.of(startTime)
.dayEnd()
.date();
}
@Override
public List<String> getDateRanges(Date startTime) {
return Lists.singleton(Dates.format(startTime, Dates.YMD));
}
},
/**
* 周视图
*/
WEEK {
@Override
public Date getRangeEndTime(Date startTime) {
return DateStream.of(startTime)
.addDay(7)
.dayEnd()
.date();
}
@Override
public List<String> getDateRanges(Date startTime) {
return Arrays.stream(Dates.getIncrementDayDates(startTime, 1, 7))
.map(s -> Dates.format(s, Dates.YMD))
.collect(Collectors.toList());
}
},
/**
* 月视图
*/
MONTH {
@Override
public Date getRangeEndTime(Date startTime) {
return DateStream.of(startTime)
.addMonth(1)
.dayEnd()
.date();
}
@Override
public List<String> getDateRanges(Date startTime) {
int monthLastDay = Dates.getMonthLastDay(startTime);
return Arrays.stream(Dates.getIncrementDayDates(startTime, 1, monthLastDay - 1))
.map(s -> Dates.format(s, Dates.YMD))
.collect(Collectors.toList());
}
},
;
/**
* 获取区间结束时间
*
* @param startTime startTime
* @return end
*/
public abstract Date getRangeEndTime(Date startTime);
/**
* 获取时间区间
*
* @param startTime startTime
* @return ranges
*/
public abstract List<String> getDateRanges(Date startTime);
public static StatisticsRange of(String type) {
if (type == null) {
return TODAY;
}
for (StatisticsRange value : values()) {
if (value.name().equals(type)) {
return value;
}
}
return TODAY;
}
}

View File

@@ -1,71 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity;
import java.util.List;
/**
* 树节点
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/23 16:52
*/
public interface TreeNode<T extends TreeNode<T>> {
/**
* id
*
* @return id
*/
Long getId();
/**
* parentId
*
* @return parentId
*/
Long getParentId();
/**
* sort
*
* @return sort
*/
Integer getSort();
/**
* children
*
* @return children
*/
List<T> getChildren();
/**
* 设置 children
*
* @param children children
*/
void setChildren(List<T> children);
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity.chart;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* 柱状图图单系列数据
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 13:42
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "BarSingleChartData", description = "柱状图图单系列数据")
public class BarSingleChartData {
@Schema(description = "数据")
private Map<String, Integer> data;
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity.chart;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
/**
* 折线图多系列数据
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 13:41
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "LineChartData", description = "折线图多系列数据")
public class LineChartData {
@Schema(description = "x轴")
private List<String> x;
@Schema(description = "数据")
private Map<String, List<Integer>> data;
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity.chart;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 折线图单系列数据
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 13:42
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "LineSingleChartData", description = "折线图单系列数据")
public class LineSingleChartData {
@Schema(description = "x轴")
private List<String> x;
@Schema(description = "数据")
private List<Integer> data;
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.entity.chart;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* 饼图数据
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/12/23 13:42
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PieChartData", description = "饼图数据")
public class PieChartData {
@Schema(description = "数据")
private Map<String, Integer> data;
}

View File

@@ -1,88 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* boolean 枚举
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/19 10:32
*/
@Getter
@AllArgsConstructor
public enum BooleanBit {
/**
* 假
*/
FALSE(0),
/**
* 真
*/
TRUE(1),
;
private final Integer value;
/**
* 是否为布尔值
*
* @return boolean
*/
public boolean booleanValue() {
return this == TRUE;
}
public static BooleanBit of(boolean value) {
return value ? TRUE : FALSE;
}
public static BooleanBit of(Integer value) {
if (value == null) {
return null;
}
for (BooleanBit e : values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
/**
* 转为布尔值
*
* @param value value
* @return boolean
*/
public static boolean toBoolean(Integer value) {
return TRUE.value.equals(value);
}
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 启用状态
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/10/12 16:02
*/
@Getter
@AllArgsConstructor
public enum EnableStatus {
/**
* 停用
*/
DISABLED(0),
/**
* 启用
*/
ENABLED(1),
;
private final Integer value;
public static EnableStatus of(Integer value) {
if (value == null) {
return null;
}
for (EnableStatus e : values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
}

View File

@@ -1,67 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.enums;
import cn.orionsec.kit.lang.utils.Strings;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 端点定义
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/21 19:15
*/
@Getter
@AllArgsConstructor
public enum EndpointDefine {
/**
* 上传临时分区
*/
UPLOAD_SWAP("/upload/swap/{}"),
/**
* 批量执行日志
*/
EXEC_LOG("/exec/{}/{}.log"),
;
/**
* 端点
*/
private final String endpoint;
/**
* 格式化
*
* @param params params
* @return path
*/
public String format(Object... params) {
return Strings.format(this.endpoint, params);
}
}

View File

@@ -1,70 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 移动位置
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/13 17:26
*/
@Getter
@AllArgsConstructor
public enum MovePosition {
/**
* 拖拽到目标元素上
*/
TOP(-1),
/**
* 拖拽到目标元素中
*/
IN(0),
/**
* 拖拽到目标元素下
*/
BOTTOM(1),
;
private final Integer position;
public static MovePosition of(Integer position) {
if (position == null) {
return null;
}
for (MovePosition value : values()) {
if (value.position.equals(position)) {
return value;
}
}
return null;
}
}

View File

@@ -1,161 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.file;
import java.io.InputStream;
import java.io.OutputStream;
/**
* 文件客户端
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/30 16:51
*/
public interface FileClient {
/**
* 上传文件
*
* @param path 文件路径
* @param content 文件内容
* @return 路径
* @throws Exception Exception
*/
String upload(String path, byte[] content) throws Exception;
/**
* 上传文件
*
* @param path 文件路径
* @param content 文件内容
* @param overrideIfExist 文件存在是否覆盖
* @return 路径
* @throws Exception Exception
*/
String upload(String path, byte[] content, boolean overrideIfExist) throws Exception;
/**
* 上传文件
*
* @param path 文件路径
* @param in in
* @return 路径
* @throws Exception Exception
*/
String upload(String path, InputStream in) throws Exception;
/**
* 上传文件
*
* @param path 文件路径
* @param in in
* @param autoClose autoClose
* @return 路径
* @throws Exception Exception
*/
String upload(String path, InputStream in, boolean autoClose) throws Exception;
/**
* 上传文件
*
* @param path 文件路径
* @param in in
* @param autoClose autoClose
* @param overrideIfExist 文件存在是否覆盖
* @return 路径
* @throws Exception Exception
*/
String upload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception;
/**
* 检查文件是否存在
*
* @param path path
* @return 是否存在
*/
boolean isExists(String path);
/**
* 删除文件
*
* @param path 路径
* @return 是否删除
* @throws Exception Exception
*/
boolean delete(String path) throws Exception;
/**
* 获取文件内容
*
* @param path path
* @return bytes
* @throws Exception Exception
*/
byte[] getContent(String path) throws Exception;
/**
* 获取文件输入流
*
* @param path path
* @return stream
* @throws Exception Exception
*/
InputStream getContentInputStream(String path) throws Exception;
/**
* 获取文件输出流
*
* @param path path
* @return stream
* @throws Exception Exception
*/
OutputStream getContentOutputStream(String path) throws Exception;
/**
* 获取文件输出流
*
* @param path path
* @param append append
* @return stream
* @throws Exception Exception
*/
OutputStream getContentOutputStream(String path, boolean append) throws Exception;
/**
* 获取返回路径 用于客户端返回
*
* @param path path
* @return returnPath
*/
String getReturnPath(String path);
/**
* 获取实际存储路径 用于服务端的存储
*
* @param returnPath returnPath
* @return absolutePath
*/
String getAbsolutePath(String returnPath);
}

View File

@@ -1,99 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.handler.data;
import cn.orionsec.kit.spring.SpringHolder;
import org.dromara.visor.framework.common.handler.data.model.GenericsDataModel;
import org.dromara.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
/**
* 标准数据定义
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/21 0:07
*/
@SuppressWarnings("unchecked")
public interface GenericsStrategyDefinition {
/**
* 获取数据处理策略
*
* @return class
*/
Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> getStrategyClass();
/**
* 获取数据模型策略处理器
*
* @param <M> Model
* @param <S> Strategy
* @return Strategy Bean
*/
default <M extends GenericsDataModel, S extends GenericsDataStrategy<M>> S getStrategy() {
return (S) SpringHolder.getBean(this.getStrategyClass());
}
/**
* 获取默认值
*
* @param <M> model
* @return model
*/
default <M extends GenericsDataModel> M getDefault() {
return (M) this.getStrategy().getDefault();
}
/**
* 执行完整验证链
*
* @param beforeModel beforeModel
* @param afterModel afterModel
*/
default void doValid(GenericsDataModel beforeModel, GenericsDataModel afterModel) {
this.getStrategy().doValid(beforeModel, afterModel);
}
/**
* 反序列化对象
*
* @param serialModel serialModel
* @param <M> model
* @return model
*/
default <M extends GenericsDataModel> M parse(String serialModel) {
return (M) this.getStrategy().parse(serialModel);
}
/**
* 转为视图对象
*
* @param serialModel serialModel
* @param <M> model
* @return viewModel
*/
default <M extends GenericsDataModel> M toView(String serialModel) {
return (M) this.getStrategy().toView(serialModel);
}
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.handler.data.model;
import com.alibaba.fastjson.JSON;
import java.util.Map;
/**
* 标准数据模型
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/20 22:07
*/
public interface GenericsDataModel {
/**
* 序列化
*
* @return json
*/
default String serial() {
return JSON.toJSONString(this);
}
/**
* 转为 map
*
* @return map
*/
default Map<String, Object> toMap() {
return JSON.parseObject(this.serial());
}
}

View File

@@ -1,96 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.handler.data.strategy;
import com.alibaba.fastjson.JSON;
import org.dromara.visor.framework.common.handler.data.model.GenericsDataModel;
/**
* 标准数据处理策略 基类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/11 21:44
*/
public abstract class AbstractGenericsDataStrategy<M extends GenericsDataModel> implements GenericsDataStrategy<M> {
protected final Class<M> modelClass;
public AbstractGenericsDataStrategy(Class<M> modelClass) {
this.modelClass = modelClass;
}
/**
* 更新填充
*
* @param beforeModel 修改前的配置
* @param afterModel 修改后的配置
*/
protected void updateFill(M beforeModel, M afterModel) {
}
/**
* 预校验参数
*
* @param model model
*/
protected void preValid(M model) {
}
/**
* 校验参数
*
* @param model model
*/
protected void valid(M model) {
}
@Override
public void doValid(M beforeModel, M afterModel) {
// 预校验参数
this.preValid(afterModel);
// 更新填充
this.updateFill(beforeModel, afterModel);
// 校验参数
this.valid(afterModel);
}
@Override
public M parse(String serialModel) {
return JSON.parseObject(serialModel, modelClass);
}
@Override
public void toView(M model) {
}
@Override
public M toView(String serialModel) {
// 解析
M parse = this.parse(serialModel);
// 转为视图对象
this.toView(parse);
return parse;
}
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.handler.data.strategy;
import org.dromara.visor.framework.common.handler.data.model.GenericsDataModel;
/**
* 标准数据处理策略
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/20 22:09
*/
public interface GenericsDataStrategy<M extends GenericsDataModel> {
/**
* 获取默认值
*
* @return 默认值
*/
M getDefault();
/**
* 执行完整验证链
* <p>
* preValid > updateFill > valid
*
* @param beforeModel beforeModel
* @param afterModel afterModel
*/
void doValid(M beforeModel, M afterModel);
/**
* 解析数据
*
* @param serialModel serialModel
* @return model
*/
M parse(String serialModel);
/**
* 转为视图配置
*
* @param model model
*/
void toView(M model);
/**
* 转为视图配置
*
* @param serialModel serialModel
* @return model
*/
M toView(String serialModel);
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.json.filter;
import cn.orionsec.kit.lang.utils.Desensitizes;
import cn.orionsec.kit.lang.utils.Objects1;
import cn.orionsec.kit.lang.utils.collect.Lists;
import com.alibaba.fastjson.serializer.ValueFilter;
import java.util.List;
/**
* 字段脱敏过滤器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/10/12 11:34
*/
public class FieldDesensitizeFilter implements ValueFilter {
private final int keepStart;
private final int keepEnd;
private final List<String> desensitizeFields;
public FieldDesensitizeFilter(List<String> desensitizeFields) {
this(1, 1, desensitizeFields);
}
public FieldDesensitizeFilter(int keepStart, int keepEnd, List<String> desensitizeFields) {
this.keepStart = keepStart;
this.keepEnd = keepEnd;
this.desensitizeFields = desensitizeFields;
}
@Override
public Object process(Object object, String name, Object value) {
if (Lists.isEmpty(desensitizeFields) || !desensitizeFields.contains(name)) {
return value;
}
return Desensitizes.mix(Objects1.toString(value), keepStart, keepEnd);
}
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.json.filter;
import cn.orionsec.kit.lang.utils.collect.Lists;
import com.alibaba.fastjson.serializer.PropertyFilter;
import java.util.List;
/**
* 字段忽略过滤器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/10/12 11:21
*/
public class FieldIgnoreFilter implements PropertyFilter {
private final List<String> ignoreFields;
public FieldIgnoreFilter(List<String> ignoreFields) {
this.ignoreFields = ignoreFields;
}
@Override
public boolean apply(Object object, String name, Object value) {
return Lists.isEmpty(ignoreFields) || !ignoreFields.contains(name);
}
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.lock;
import java.util.function.Supplier;
/**
* 分布式锁
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/5/16 12:24
*/
public interface Locker {
/**
* 尝试获取锁
*
* @param key key
* @param run run
* @return 是否获取到锁
*/
boolean tryLock(String key, Runnable run);
/**
* 尝试获取锁
*
* @param key key
* @param call call
* @param <T> T
* @return 执行结果
*/
<T> T tryLock(String key, Supplier<T> call);
}

View File

@@ -1,120 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.meta;
import cn.orionsec.kit.lang.id.UUIds;
import com.alibaba.ttl.TransmittableThreadLocal;
import org.slf4j.MDC;
/**
* traceId 持有者
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/16 17:35
*/
public class TraceIdHolder {
public static final String TRACE_ID_HEADER = "trace-id";
public static final String TRACE_ID_MDC = "tid";
private TraceIdHolder() {
}
/**
* 请求序列
*/
private static final ThreadLocal<String> HOLDER = new TransmittableThreadLocal<>();
/**
* 获取 traceId
*
* @return traceId
*/
public static String get() {
return HOLDER.get();
}
/**
* 设置 traceId
*/
public static void set() {
set(createTraceId());
}
/**
* 设置 traceId
*
* @param traceId traceId
*/
public static void set(String traceId) {
// 设置应用上下文
HOLDER.set(traceId);
// 设置日志上下文
setMdc(traceId);
}
/**
* 删除 traceId
*/
public static void remove() {
// 移除应用上下文
HOLDER.remove();
// 移除日志上下文
removeMdc();
}
/**
* 从应用上下文 设置到日志上下文
*/
public static void setMdc() {
setMdc(HOLDER.get());
}
/**
* 设置到日志上下文
*
* @param traceId traceId
*/
public static void setMdc(String traceId) {
MDC.put(TRACE_ID_MDC, traceId);
}
/**
* 移除日志上下文
*/
public static void removeMdc() {
MDC.remove(TRACE_ID_MDC);
}
/**
* 创建 traceId
*
* @return traceId
*/
public static String createTraceId() {
return UUIds.random32();
}
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* 当前登录用户
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/6 18:36
*/
@Data
@Schema(name = "LoginUser", description = "当前登录用户对象")
public class LoginUser {
@Schema(description = "id")
private Long id;
@Schema(description = "用户名")
private String username;
@Schema(description = "花名")
private String nickname;
@Schema(description = "用户状态")
private Integer status;
@Schema(description = "头像地址")
private String avatar;
@Schema(description = "登录时间戳")
private Long timestamp;
@Schema(description = "角色")
private List<UserRole> roles;
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.security;
import cn.orionsec.kit.lang.utils.Booleans;
import cn.orionsec.kit.lang.utils.Strings;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.framework.common.utils.CryptoUtils;
/**
* 密码修改器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/21 11:35
*/
public class PasswordModifier {
private PasswordModifier() {
}
/**
* 获取新密码
*
* @param action action
* @return password
*/
public static String getEncryptNewPassword(UpdatePasswordAction action) {
if (Booleans.isTrue(action.getUseNewPassword())) {
// 使用新密码
String password = action.getPassword();
if (Strings.isBlank(password)) {
return Const.EMPTY;
} else {
return CryptoUtils.encryptAsString(password);
}
} else {
return null;
}
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.security;
/**
* SecurityUtils 的 bean 对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/7 15:20
*/
public interface SecurityHolder {
/**
* 获取当前用户
*
* @return 当前用户
*/
LoginUser getLoginUser();
/**
* 获取当前用户id
*
* @return id
*/
Long getLoginUserId();
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.security;
import java.io.Serializable;
/**
* 更新密码操作
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/21 11:32
*/
public interface UpdatePasswordAction extends Serializable {
/**
* 是否使用新密码
*
* @return use
*/
Boolean getUseNewPassword();
/**
* 获取密码
*
* @return password
*/
String getPassword();
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.security;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
* 用户角色
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/20 23:39
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Schema(name = "UserRole", description = "用户角色")
public class UserRole {
@EqualsAndHashCode.Include
@Schema(description = "id")
private Long id;
@Schema(description = "角色")
private String code;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.thread;
import org.dromara.visor.framework.common.utils.ThreadMdcUtils;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
/**
* 自动注入 MDC 异步线程池
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/10 15:16
*/
public class ThreadPoolMdcTaskExecutor extends ThreadPoolTaskExecutor {
@Override
public void execute(Runnable task) {
super.execute(ThreadMdcUtils.wrap(task));
}
@Override
public <T> Future<T> submit(Callable<T> task) {
return super.submit(ThreadMdcUtils.wrap(task));
}
@Override
public Future<?> submit(Runnable task) {
return super.submit(ThreadMdcUtils.wrap(task));
}
}

View File

@@ -1,68 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.constant.Const;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 配置工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/28 23:21
*/
public class ConfigUtils {
private ConfigUtils() {
}
public static List<String> parseStringList(List<String> list) {
return parseStringList(list, Function.identity());
}
/**
* 解析配置 List<String:String[,]>
*
* @param list list
* @param mapper mapper
* @return config
*/
public static List<String> parseStringList(List<String> list, Function<String, String> mapper) {
return Optional.ofNullable(list)
.map(List::stream)
.orElseGet(Stream::empty)
.map(s -> s.split(Const.COMMA))
.flatMap(Arrays::stream)
.map(String::trim)
.map(mapper)
.collect(Collectors.toList());
}
}

View File

@@ -1,174 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.Exceptions;
import org.dromara.visor.framework.common.crypto.ValueCrypto;
/**
* 加密工具类
* <p>
* PrimaryValueCrypto 代理类工具
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/8 0:05
*/
public class CryptoUtils {
private static ValueCrypto delegate;
private CryptoUtils() {
}
/**
* 加密
*
* @param plain 明文
* @return 密文
*/
public static byte[] encrypt(byte[] plain) {
return delegate.encrypt(plain);
}
/**
* 加密
*
* @param plain 明文
* @return 密文
*/
public static byte[] encrypt(String plain) {
return delegate.encrypt(plain);
}
/**
* 加密
*
* @param plain 明文
* @return 密文
*/
public static String encryptAsString(String plain) {
return delegate.encryptAsString(plain);
}
/**
* 加密
*
* @param plain 明文
* @return 密文
*/
public static String encryptAsString(byte[] plain) {
return delegate.encryptAsString(plain);
}
/**
* 解密
*
* @param text 密文
* @return 明文
*/
public static byte[] decrypt(byte[] text) {
return delegate.decrypt(text);
}
/**
* 解密
*
* @param text 密文
* @return 明文
*/
public static byte[] decrypt(String text) {
return delegate.decrypt(text);
}
/**
* 解密
*
* @param text 密文
* @return 明文
*/
public static String decryptAsString(String text) {
return delegate.decryptAsString(text);
}
/**
* 解密
*
* @param text 密文
* @return 明文
*/
public static String decryptAsString(byte[] text) {
return delegate.decryptAsString(text);
}
/**
* 验证加密结果
*
* @param plain 明文
* @param text 密文
* @return 是否成功
*/
public static boolean verify(String plain, String text) {
return delegate.verify(plain, text);
}
/**
* 验证加密结果
*
* @param plain 明文
* @param text 密文
* @return 是否成功
*/
public static boolean verify(byte[] plain, byte[] text) {
return delegate.verify(plain, text);
}
/**
* 加密后 base62 编码
*
* @param plain 明文
* @return 密文
*/
public static String encryptBase62(String plain) {
return delegate.encryptBase62(plain);
}
/**
* base62 解码后解密
*
* @param text 密文
* @return 明文
*/
public static String decryptBase62(String text) {
return delegate.decryptBase62(text);
}
public static void setDelegate(ValueCrypto delegate) {
if (CryptoUtils.delegate != null) {
// unmodified
throw Exceptions.state();
}
CryptoUtils.delegate = delegate;
}
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.time.Dates;
import org.dromara.visor.framework.common.constant.Const;
/**
* 文件名称
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/8/31 17:57
*/
public class FileNames {
private FileNames() {
}
/**
* 导出文件名称
*
* @param title title
* @return name
*/
public static String exportName(String title) {
return title + "-" + Dates.current(Dates.YMD_HMS2) + "." + Const.SUFFIX_XLSX;
}
}

View File

@@ -1,115 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.ext.location.Region;
import cn.orionsec.kit.ext.location.region.LocationRegions;
import cn.orionsec.kit.web.servlet.web.Servlets;
import org.dromara.visor.framework.common.constant.Const;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* ip 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/14 16:26
*/
public class IpUtils {
private static final Map<String, String> CACHE = new HashMap<>();
private IpUtils() {
}
/**
* 获取请求地址
*
* @param request request
* @return addr
*/
public static String getRemoteAddr(HttpServletRequest request) {
// 获取实际地址 X_REAL_IP 在多代理情况下会有问题
// String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
// if (!Strings.isBlank(realIp)) {
// return realIp;
// }
// 获取请求地址
return Servlets.getRemoteAddr(request);
}
/**
* 获取 ip 位置
*
* @param ip ip
* @return ip 位置
*/
public static String getLocation(String ip) {
if (ip == null) {
return Const.CN_UNKNOWN;
}
// 查询缓存
return CACHE.computeIfAbsent(ip, IpUtils::queryLocation);
}
/**
* 查询 ip 位置
*
* @param ip ip
* @return ip 位置
*/
private static String queryLocation(String ip) {
if (ip == null) {
return Const.CN_UNKNOWN;
}
Region region;
try {
region = LocationRegions.getRegion(ip, 3);
} catch (Exception e) {
return Const.CN_UNKNOWN;
}
if (region != null) {
String net = region.getNet();
String province = region.getProvince();
if (net.equals(Const.CN_INTRANET_IP)) {
return net;
}
if (province.equals(Const.CN_UNKNOWN)) {
return province;
}
StringBuilder location = new StringBuilder()
.append(region.getCountry())
.append(Const.DASHED)
.append(province)
.append(Const.DASHED)
.append(region.getCity());
location.append(" (").append(net).append(')');
return location.toString();
}
return Const.CN_UNKNOWN;
}
}

View File

@@ -1,77 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.Exceptions;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.framework.common.lock.Locker;
import java.util.function.Supplier;
/**
* 分布式锁工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/4/25 16:42
*/
@Slf4j
public class LockerUtils {
private static Locker delegate;
private LockerUtils() {
}
/**
* 尝试获取锁
*
* @param key key
* @param run run
* @return 是否获取到锁
*/
public static boolean tryLock(String key, Runnable run) {
return delegate.tryLock(key, run);
}
/**
* 尝试获取锁
*
* @param key key
* @param call call
* @param <T> T
* @return 执行结果
*/
public static <T> T tryLock(String key, Supplier<T> call) {
return delegate.tryLock(key, call);
}
public static void setDelegate(Locker delegate) {
if (LockerUtils.delegate != null) {
// unmodified
throw Exceptions.state();
}
LockerUtils.delegate = delegate;
}
}

View File

@@ -1,139 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.Objects1;
import cn.orionsec.kit.lang.utils.Systems;
import cn.orionsec.kit.lang.utils.io.Files1;
import org.dromara.visor.framework.common.constant.AppConst;
import org.dromara.visor.framework.common.constant.Const;
/**
* 路径工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/4/17 10:28
*/
public class PathUtils {
private PathUtils() {
}
/**
* 获取用户根目录
*
* @param isWindows isWindows
* @param username 用户名
* @return 用户目录
*/
public static String getHomePath(boolean isWindows, String username) {
return getHomePath(isWindows, username, false);
}
/**
* 获取用户根目录
*
* @param isWindows isWindows
* @param username 用户名
* @param prependSeparator 是否在头部添加分隔符
* @return 用户目录
*/
public static String getHomePath(boolean isWindows, String username, boolean prependSeparator) {
if (isWindows) {
// windows
if (prependSeparator) {
return "/C:/Users/" + username;
} else {
return "C:/Users/" + username;
}
} else {
// linux
if (Const.ROOT.equals(username)) {
return "/" + Const.ROOT;
} else {
return "/home/" + username;
}
}
}
/**
* 获取应用路径
*
* @param isWindows isWindows
* @param username username
* @return path
*/
public static String getAppPath(boolean isWindows, String username) {
return getHomePath(isWindows, username)
+ "/" + AppConst.ORION
+ "/" + AppConst.APP_NAME;
}
/**
* 构建应用路径
*
* @param isWindows isWindows,
* @param username username
* @param paths paths
* @return path
*/
public static String buildAppPath(boolean isWindows, String username, Object... paths) {
StringBuilder path = new StringBuilder(getAppPath(isWindows, username));
for (Object o : paths) {
path.append("/").append(Objects1.toString(o));
}
return path.toString();
}
/**
* 头部添加分隔符
*
* @param path path
* @return path
*/
public static String prependSeparator(String path) {
if (path.startsWith("/")) {
return path;
}
return "/" + path;
}
/**
* 获取 orion path
*
* @param path path
* @return path
*/
public static String getOrionPath(String path) {
path = Systems.HOME_DIR
+ Files1.SEPARATOR
+ AppConst.ORION
+ Files1.SEPARATOR
+ AppConst.APP_NAME
+ Files1.SEPARATOR
+ path;
return Files1.getPath(path);
}
}

View File

@@ -1,73 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.web.servlet.web.Servlets;
import org.dromara.visor.framework.common.entity.RequestIdentity;
import org.dromara.visor.framework.common.entity.RequestIdentityModel;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Optional;
/**
* 请求工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/2 16:26
*/
public class Requests {
private Requests() {
}
/**
* 获取请求留痕信息
*
* @return model
*/
public static RequestIdentityModel getIdentity() {
RequestIdentityModel model = new RequestIdentityModel();
fillIdentity(model);
return model;
}
/**
* 填充请求留痕信息
*
* @param identity identity
*/
public static void fillIdentity(RequestIdentity identity) {
Optional.ofNullable(RequestContextHolder.getRequestAttributes())
.map(s -> (ServletRequestAttributes) s)
.map(ServletRequestAttributes::getRequest)
.ifPresent(request -> {
String address = IpUtils.getRemoteAddr(request);
identity.setAddress(address);
identity.setLocation(IpUtils.getLocation(address));
identity.setUserAgent(Servlets.getUserAgent(request));
});
}
}

View File

@@ -1,60 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import org.dromara.visor.framework.common.constant.Const;
/**
* sql 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/8/26 16:03
*/
public class SqlUtils {
private SqlUtils() {
}
/**
* limit n
*
* @param limit limit
* @return limit
*/
public static String limit(Number limit) {
return Const.LIMIT + Const.SPACE + limit;
}
/**
* limit offset limit
*
* @param offset offset
* @param limit limit
* @return limit
*/
public static String limit(Number offset, Number limit) {
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
}
}

View File

@@ -1,73 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.collect.Maps;
import cn.orionsec.kit.lang.utils.reflect.Annotations;
import io.swagger.v3.oas.annotations.Operation;
import org.dromara.visor.framework.common.constant.Const;
import java.lang.reflect.Method;
import java.util.Map;
/**
* swagger 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/6 14:52
*/
public class SwaggerUtils {
/**
* api 描述
*/
private static final Map<String, String> SUMMARY_MAPPING = Maps.newMap();
private SwaggerUtils() {
}
/**
* 获取 api 描述
*
* @param m method
* @return summary
*/
public static String getOperationSummary(Method m) {
// 缓存中获取描述
String key = m.toString();
String cache = SUMMARY_MAPPING.get(key);
if (cache != null) {
return cache;
}
// 获取注解描述
Operation operation = Annotations.getAnnotation(m, Operation.class);
String summary = Const.EMPTY;
if (operation != null) {
summary = operation.summary();
}
SUMMARY_MAPPING.put(key, summary);
return summary;
}
}

View File

@@ -1,106 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import org.dromara.visor.framework.common.meta.TraceIdHolder;
import org.slf4j.MDC;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* 多线程下 MDC 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/10 14:55
*/
public class ThreadMdcUtils {
private ThreadMdcUtils() {
}
/**
* 设置 MDC traceId
*/
public static void setTraceIdIfAbsent() {
if (MDC.get(TraceIdHolder.TRACE_ID_MDC) == null) {
MDC.put(TraceIdHolder.TRACE_ID_MDC, TraceIdHolder.get());
}
}
/**
* 设置线程 MDC 上下文
*
* @param callable callable
* @param <T> T
* @return callable
*/
public static <T> Callable<T> wrap(Callable<T> callable) {
// 获取当前线程 MDC 上下文
Map<String, String> callerContext = MDC.getCopyOfContextMap();
return () -> {
if (callerContext == null) {
MDC.clear();
} else {
MDC.setContextMap(callerContext);
}
// 设置 traceId
setTraceIdIfAbsent();
// 执行线程并且清理MDC
try {
return callable.call();
} finally {
MDC.clear();
}
};
}
/**
* 设置线程 MDC 上下文
*
* @param runnable runnable
* @return callable
*/
public static Runnable wrap(Runnable runnable) {
// 获取当前线程 MDC 上下文
Map<String, String> callerContext = MDC.getCopyOfContextMap();
return () -> {
//
if (callerContext == null) {
MDC.clear();
} else {
MDC.setContextMap(callerContext);
}
// 设置 traceId
setTraceIdIfAbsent();
// 执行线程并且清理MDC
try {
runnable.run();
} finally {
MDC.clear();
}
};
}
}

View File

@@ -1,105 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.collect.Lists;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.framework.common.entity.TreeNode;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 树工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/11/23 16:52
*/
public class TreeUtils {
private TreeUtils() {
}
/**
* 获取节点以及父节点
*
* @param nodes nodes
* @param idList idList
* @param result result
* @param <T> T
*/
public static <T extends TreeNode<T>> void getAllNodes(List<T> nodes,
List<Long> idList,
List<T> result) {
if (Lists.isEmpty(idList)) {
return;
}
// 获取当前节点的数据
List<T> currentNodes = nodes.stream()
.filter(s -> idList.contains(s.getId()))
.collect(Collectors.toList());
if (currentNodes.isEmpty()) {
return;
}
result.addAll(currentNodes);
// 获取父节点id
List<Long> parentIdList = currentNodes.stream()
.map(T::getParentId)
.distinct()
.collect(Collectors.toList());
// 如果为空 或者唯一的元素为 rootId 直接返回
if (parentIdList.isEmpty()
|| (parentIdList.size() == 1 && parentIdList.get(0).equals(Const.ROOT_PARENT_ID))) {
return;
}
// 递归
getAllNodes(nodes, parentIdList, result);
}
/**
* 构建树
*
* @param parentNode parentNode
* @param nodes nodes
* @param <T> T
*/
public static <T extends TreeNode<T>> void buildGroupTree(T parentNode,
List<T> nodes) {
// 获取子节点
List<T> childrenNodes = nodes.stream()
.filter(s -> parentNode.getId().equals(s.getParentId()))
.sorted(Comparator.comparing(T::getSort))
.collect(Collectors.toList());
if (childrenNodes.isEmpty()) {
return;
}
parentNode.setChildren(childrenNodes);
// 遍历子节点
for (T childrenNode : childrenNodes) {
buildGroupTree(childrenNode, nodes);
}
}
}

View File

@@ -1,162 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.utils;
import cn.orionsec.kit.lang.utils.Arrays1;
import cn.orionsec.kit.lang.utils.io.Files1;
import cn.orionsec.kit.spring.SpringHolder;
import org.dromara.visor.framework.common.constant.ErrorMessage;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
/**
* 验证器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/7/18 11:23
*/
public class Valid extends cn.orionsec.kit.lang.utils.Valid {
private static final Validator validator = SpringHolder.getBean(Validator.class);
public static <T> T notNull(T object) {
return notNull(object, ErrorMessage.PARAM_MISSING);
}
public static <T> T isNull(T object) {
return isNull(object, ErrorMessage.PARAM_ERROR);
}
public static String notBlank(String s) {
return notBlank(s, ErrorMessage.PARAM_MISSING);
}
public static <T extends Map<?, ?>> T notEmpty(T map) {
return notEmpty(map, ErrorMessage.PARAM_MISSING);
}
public static <T extends Collection<?>> T notEmpty(T object) {
return notEmpty(object, ErrorMessage.PARAM_MISSING);
}
public static void allNotNull(Object... objects) {
if (objects != null) {
for (Object t : objects) {
notNull(t, ErrorMessage.PARAM_MISSING);
}
}
}
public static void allNotBlank(String... ss) {
if (ss != null) {
for (String s : ss) {
notBlank(s, ErrorMessage.PARAM_MISSING);
}
}
}
public static void eq(Object o1, Object o2) {
eq(o1, o2, ErrorMessage.INVALID_PARAM);
}
public static boolean isTrue(boolean s) {
return isTrue(s, ErrorMessage.INVALID_PARAM);
}
public static boolean isFalse(boolean s) {
return isFalse(s, ErrorMessage.INVALID_PARAM);
}
public static <T extends Comparable<T>> T gte(T t1, T t2) {
return gte(t1, t2, ErrorMessage.INVALID_PARAM);
}
@SafeVarargs
public static <T> T in(T t, T... ts) {
notNull(t, ErrorMessage.INVALID_PARAM);
notEmpty(ts, ErrorMessage.INVALID_PARAM);
isTrue(Arrays1.contains(ts, t), ErrorMessage.INVALID_PARAM);
return t;
}
/**
* 验证枚举
*
* @param of of method
* @param obj obj
* @param <T> param
* @param <E> enum
* @return enum
*/
public static <T, E extends Enum<?>> E valid(Function<T, E> of, T obj) {
return notNull(of.apply(obj), ErrorMessage.INVALID_PARAM);
}
/**
* 验证对象
*
* @param obj obj
* @param groups groups
* @param <T> T
* @return obj
*/
public static <T> T valid(T obj, Class<?>... groups) {
notNull(obj, ErrorMessage.PARAM_MISSING);
// 验证对象
Set<ConstraintViolation<T>> set = validator.validate(obj, groups);
if (!set.isEmpty()) {
throw new ConstraintViolationException(set);
}
return obj;
}
/**
* 检查是否更新成功
*
* @param effect effect
* @return effect
*/
public static int version(int effect) {
isTrue(effect > 0, ErrorMessage.DATA_MODIFIED);
return effect;
}
/**
* 检查路径是否合法化 即不包含 ./ ../
*
* @param path path
*/
public static String checkNormalize(String path) {
Valid.notBlank(path);
Valid.isTrue(Files1.isNormalize(path), ErrorMessage.PATH_NOT_NORMALIZE);
return Files1.getPath(path);
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.validator.group;
/**
* 批量验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Batch {
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.validator.group;
/**
* 清理验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Clear {
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.validator.group;
/**
* 导出验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Export {
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.validator.group;
/**
* 分页验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Id {
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.validator.group;
/**
* 导出验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Import {
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.validator.group;
/**
* 分页验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Page {
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* 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 org.dromara.visor.framework.common.web.filter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import javax.servlet.Filter;
/**
* 过滤器构造器
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/6/25 15:05
*/
public class FilterCreator {
private FilterCreator() {
}
/**
* 创建过滤器
*
* @param filter filter
* @param order order
* @param <T> type
* @return filter bean
*/
public static <T extends Filter> FilterRegistrationBean<T> create(T filter, Integer order) {
FilterRegistrationBean<T> bean = new FilterRegistrationBean<>(filter);
bean.setOrder(order);
return bean;
}
}

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<dependency>

View File

@@ -22,8 +22,8 @@
*/
package org.dromara.visor.framework.banner.configuration;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.banner.core.runner.BannerApplicationRunner;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.context.annotation.Bean;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<dependency>

View File

@@ -24,15 +24,15 @@ package org.dromara.visor.framework.biz.operator.log.configuration;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.ValueFilter;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.json.filter.FieldDesensitizeFilter;
import org.dromara.visor.common.json.filter.FieldIgnoreFilter;
import org.dromara.visor.framework.biz.operator.log.configuration.config.OperatorLogConfig;
import org.dromara.visor.framework.biz.operator.log.core.aspect.OperatorLogAspect;
import org.dromara.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
import org.dromara.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkServiceDelegate;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogFiller;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.common.json.filter.FieldDesensitizeFilter;
import org.dromara.visor.framework.common.json.filter.FieldIgnoreFilter;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

View File

@@ -23,7 +23,7 @@
package org.dromara.visor.framework.biz.operator.log.configuration.config;
import lombok.Data;
import org.dromara.visor.framework.common.utils.ConfigUtils;
import org.dromara.visor.common.utils.ConfigUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;

View File

@@ -30,6 +30,9 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.dromara.visor.common.constant.BeanOrderConst;
import org.dromara.visor.common.security.LoginUser;
import org.dromara.visor.common.security.SecurityHolder;
import org.dromara.visor.framework.biz.operator.log.core.annotation.IgnoreParameter;
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import org.dromara.visor.framework.biz.operator.log.core.factory.OperatorTypeHolder;
@@ -38,9 +41,6 @@ import org.dromara.visor.framework.biz.operator.log.core.model.OperatorType;
import org.dromara.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogFiller;
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.common.constant.BeanOrderConst;
import org.dromara.visor.framework.common.security.LoginUser;
import org.dromara.visor.framework.common.security.SecurityHolder;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

View File

@@ -23,7 +23,7 @@
package org.dromara.visor.framework.biz.operator.log.core.model;
import lombok.Data;
import org.dromara.visor.framework.common.entity.RequestIdentity;
import org.dromara.visor.common.entity.RequestIdentity;
import java.util.Date;

View File

@@ -29,16 +29,16 @@ import cn.orionsec.kit.lang.utils.Strings;
import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatters;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeFilter;
import org.dromara.visor.common.entity.RequestIdentity;
import org.dromara.visor.common.enums.BooleanBit;
import org.dromara.visor.common.meta.TraceIdHolder;
import org.dromara.visor.common.security.LoginUser;
import org.dromara.visor.common.utils.Requests;
import org.dromara.visor.framework.biz.operator.log.configuration.config.OperatorLogConfig;
import org.dromara.visor.framework.biz.operator.log.core.enums.ReturnType;
import org.dromara.visor.framework.biz.operator.log.core.factory.OperatorTypeHolder;
import org.dromara.visor.framework.biz.operator.log.core.model.OperatorLogModel;
import org.dromara.visor.framework.biz.operator.log.core.model.OperatorType;
import org.dromara.visor.framework.common.entity.RequestIdentity;
import org.dromara.visor.framework.common.enums.BooleanBit;
import org.dromara.visor.framework.common.meta.TraceIdHolder;
import org.dromara.visor.framework.common.security.LoginUser;
import org.dromara.visor.framework.common.utils.Requests;
import java.util.Date;
import java.util.Map;

View File

@@ -26,8 +26,8 @@ import cn.orionsec.kit.lang.utils.Exceptions;
import cn.orionsec.kit.lang.utils.collect.Maps;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeFilter;
import org.dromara.visor.framework.common.constant.ExtraFieldConst;
import org.dromara.visor.framework.common.security.LoginUser;
import org.dromara.visor.common.constant.ExtraFieldConst;
import org.dromara.visor.common.security.LoginUser;
import java.util.Map;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<!-- mysql -->

View File

@@ -23,7 +23,7 @@
package org.dromara.visor.framework.datasource.configuration;
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.datasource.core.filter.DruidAdRemoveFilter;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<!-- web -->

View File

@@ -22,7 +22,7 @@
*/
package org.dromara.visor.framework.desensitize.configuration;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.desensitize.core.filter.DesensitizeValueFilter;
import org.dromara.visor.framework.desensitize.core.serializer.DesensitizeJsonSerializer;
import org.springframework.boot.autoconfigure.AutoConfiguration;

View File

@@ -30,7 +30,7 @@ import cn.orionsec.kit.lang.utils.reflect.Annotations;
import cn.orionsec.kit.lang.utils.reflect.Fields;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ValueFilter;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<dependency>

View File

@@ -22,8 +22,8 @@
*/
package org.dromara.visor.framework.job.configuration;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.common.thread.ThreadPoolMdcTaskExecutor;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.thread.ThreadPoolMdcTaskExecutor;
import org.dromara.visor.framework.job.configuration.config.AsyncExecutorConfig;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;

View File

@@ -22,7 +22,7 @@
*/
package org.dromara.visor.framework.job.configuration;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.job.core.utils.QuartzUtils;
import org.quartz.Scheduler;
import org.springframework.boot.autoconfigure.AutoConfiguration;

View File

@@ -22,7 +22,7 @@
*/
package org.dromara.visor.framework.job.configuration;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.context.annotation.Bean;

View File

@@ -25,7 +25,7 @@ package org.dromara.visor.framework.job.core.utils;
import cn.orionsec.kit.lang.utils.Exceptions;
import cn.orionsec.kit.lang.utils.Objects1;
import cn.orionsec.kit.lang.utils.collect.Maps;
import org.dromara.visor.framework.common.constant.FieldConst;
import org.dromara.visor.common.constant.FieldConst;
import org.quartz.*;
import java.util.Map;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<!-- doc -->

View File

@@ -22,8 +22,8 @@
*/
package org.dromara.visor.framework.log.configuration;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.common.constant.BeanOrderConst;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.BeanOrderConst;
import org.dromara.visor.framework.log.configuration.config.LogPrinterConfig;
import org.dromara.visor.framework.log.core.interceptor.LogPrinterInterceptor;
import org.dromara.visor.framework.log.core.interceptor.PrettyLogPrinterInterceptor;

View File

@@ -23,7 +23,7 @@
package org.dromara.visor.framework.log.configuration.config;
import lombok.Data;
import org.dromara.visor.framework.common.utils.ConfigUtils;
import org.dromara.visor.common.utils.ConfigUtils;
import org.dromara.visor.framework.log.core.enums.LogPrinterMode;
import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -29,10 +29,10 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.ValueFilter;
import org.aopalliance.intercept.MethodInvocation;
import org.dromara.visor.framework.common.json.filter.FieldDesensitizeFilter;
import org.dromara.visor.framework.common.json.filter.FieldIgnoreFilter;
import org.dromara.visor.framework.common.meta.TraceIdHolder;
import org.dromara.visor.framework.common.security.SecurityHolder;
import org.dromara.visor.common.json.filter.FieldDesensitizeFilter;
import org.dromara.visor.common.json.filter.FieldIgnoreFilter;
import org.dromara.visor.common.meta.TraceIdHolder;
import org.dromara.visor.common.security.SecurityHolder;
import org.dromara.visor.framework.log.configuration.config.LogPrinterConfig;
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;

View File

@@ -28,8 +28,8 @@ import cn.orionsec.kit.lang.utils.time.Dates;
import cn.orionsec.kit.web.servlet.web.Servlets;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInvocation;
import org.dromara.visor.framework.common.utils.IpUtils;
import org.dromara.visor.framework.common.utils.SwaggerUtils;
import org.dromara.visor.common.utils.IpUtils;
import org.dromara.visor.common.utils.SwaggerUtils;
import org.dromara.visor.framework.log.configuration.config.LogPrinterConfig;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

View File

@@ -29,8 +29,8 @@ import cn.orionsec.kit.web.servlet.web.Servlets;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInvocation;
import org.dromara.visor.framework.common.utils.IpUtils;
import org.dromara.visor.framework.common.utils.SwaggerUtils;
import org.dromara.visor.common.utils.IpUtils;
import org.dromara.visor.common.utils.SwaggerUtils;
import org.dromara.visor.framework.log.configuration.config.LogPrinterConfig;
import org.dromara.visor.framework.log.core.enums.LogFieldConst;
import org.springframework.web.context.request.RequestContextHolder;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<!-- actuator -->

View File

@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import de.codecentric.boot.admin.server.utils.jackson.AdminServerModule;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

View File

@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-framework-common</artifactId>
<artifactId>orion-visor-common</artifactId>
</dependency>
<!-- web -->

View File

@@ -26,8 +26,8 @@ import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.framework.common.security.SecurityHolder;
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
import org.dromara.visor.common.security.SecurityHolder;
import org.dromara.visor.framework.mybatis.core.handler.FieldFillHandler;
import org.dromara.visor.framework.mybatis.core.utils.DomainFillUtils;
import org.mybatis.spring.annotation.MapperScan;

View File

@@ -28,7 +28,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.common.constant.Const;
import java.io.Serializable;
import java.util.Date;

View File

@@ -36,7 +36,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.visor.framework.common.utils.Valid;
import org.dromara.visor.common.utils.Valid;
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
import org.dromara.visor.framework.mybatis.core.generator.template.Table;
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;

View File

@@ -31,8 +31,8 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import org.dromara.visor.framework.common.constant.AppConst;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.common.constant.AppConst;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.framework.mybatis.core.generator.template.Table;
import org.jetbrains.annotations.NotNull;

View File

@@ -27,8 +27,8 @@ import cn.orionsec.kit.lang.utils.Strings;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.generator.config.po.TableField;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.framework.common.constant.FieldConst;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.constant.FieldConst;
import org.dromara.visor.framework.mybatis.core.generator.template.DictMeta;
import org.dromara.visor.framework.mybatis.core.generator.template.Table;

View File

@@ -23,7 +23,7 @@
package org.dromara.visor.framework.mybatis.core.generator.template;
import cn.orionsec.kit.lang.utils.collect.Lists;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.common.constant.Const;
import java.util.LinkedHashMap;

View File

@@ -25,7 +25,7 @@ package org.dromara.visor.framework.mybatis.core.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.framework.mybatis.core.query.Conditions;
import org.dromara.visor.framework.mybatis.core.query.DataQuery;

View File

@@ -24,8 +24,8 @@ package org.dromara.visor.framework.mybatis.core.query;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import org.dromara.visor.framework.common.constant.ErrorMessage;
import org.dromara.visor.framework.common.utils.Valid;
import org.dromara.visor.common.constant.ErrorMessage;
import org.dromara.visor.common.utils.Valid;
import java.util.Collection;

View File

@@ -37,8 +37,8 @@ import com.baomidou.mybatisplus.core.conditions.interfaces.Join;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import org.dromara.visor.framework.common.constant.Const;
import org.dromara.visor.framework.common.utils.SqlUtils;
import org.dromara.visor.common.constant.Const;
import org.dromara.visor.common.utils.SqlUtils;
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
import java.io.Serializable;
@@ -96,8 +96,8 @@ public class DataQuery<T> {
return new DataQuery<>(dao, wrapper);
}
public DataQuery<T> page(org.dromara.visor.framework.common.entity.PageRequest page) {
org.dromara.visor.framework.common.entity.PageRequest pr = Valid.notNull(page, "page is null");
public DataQuery<T> page(org.dromara.visor.common.entity.PageRequest page) {
org.dromara.visor.common.entity.PageRequest pr = Valid.notNull(page, "page is null");
this.page = new PageRequest(pr.getPage(), pr.getLimit());
return this;
}

Some files were not shown because too many files have changed in this diff Show More