mirror of
https://gitee.com/dromara/orion-visor.git
synced 2026-06-11 05:26:53 +08:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5a7ed8980 | ||
|
|
e774531fcb | ||
|
|
238ec20b7c | ||
|
|
4da3fc9356 | ||
|
|
8a1bf72d30 | ||
|
|
0dbdafe138 | ||
|
|
1285db903d | ||
|
|
35d3112339 | ||
|
|
d49952bef4 | ||
|
|
2b316febcd | ||
|
|
e17d15c112 | ||
|
|
8f0cd4ad24 | ||
|
|
b207c5d253 | ||
|
|
5335a8d008 | ||
|
|
1e74659f15 | ||
|
|
58a1a7abd4 | ||
|
|
6c125a1c0d | ||
|
|
5162b99e3e | ||
|
|
263436405c | ||
|
|
2296ca46a4 | ||
|
|
ffcb3baf44 | ||
|
|
501755231a | ||
|
|
f4ddeb3e6c | ||
|
|
40afc03203 | ||
|
|
7c479b1720 | ||
|
|
6c6f69ae24 | ||
|
|
d1cb056adf | ||
|
|
14dc8e0407 | ||
|
|
528cfc90f2 | ||
|
|
327bb72659 | ||
|
|
c6b248ab6f | ||
|
|
0ece84bdf1 | ||
|
|
61fa7a6e32 | ||
|
|
21e7d29077 |
@@ -7,7 +7,12 @@ DEMO_MODE=false
|
||||
|
||||
API_CORS=true
|
||||
API_IP_HEADERS=X-Forwarded-For,X-Real-IP
|
||||
# api 地址 (需要改为宿主机 IP)
|
||||
API_HOST=0.0.0.0
|
||||
# API_URL=http://127.0.0.1:9200/orion-visor/api
|
||||
# api 密钥 (建议修改)
|
||||
API_EXPOSE_TOKEN=pmqeHOyZaumHm0Wt
|
||||
# 加密密钥 (建议修改)
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
|
||||
NGINX_SERVICE_HOST=service
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@@ -17,6 +17,8 @@ body:
|
||||
required: true
|
||||
- label: 我已搜索 [issue](https://github.com/dromara/orion-visor/issues) 并没有找到相关问题
|
||||
required: true
|
||||
- label: 我已 star 了此项目, 否则可能会被自动关闭
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
|
||||
12
README.md
12
README.md
@@ -38,8 +38,8 @@
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitcode.com/dromara/orion-visor">
|
||||
<img src="https://gitcode.com/dromara/orion-visor/star/badge.svg" alt="star"/>
|
||||
href="https://atomgit.com/dromara/orion-visor">
|
||||
<img src="https://atomgit.com/dromara/orion-visor/star/2025top.svg" alt="star" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
* 🔗 演示地址: [https://dv.orionsec.cn/](https://dv.orionsec.cn/)
|
||||
* 🔏 演示账号: admin/admin
|
||||
* ⭐ 体验后可以点一下 `star`
|
||||
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor)
|
||||
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [atomgit](https://atomgit.com/dromara/orion-visor)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
# clone
|
||||
git clone --depth=1 https://github.com/dromara/orion-visor
|
||||
cd orion-visor
|
||||
# 复制配置
|
||||
cp .env.example .env
|
||||
# 修改配置
|
||||
vim .env
|
||||
# 启动
|
||||
docker compose up -d
|
||||
# 等待后端服务启动后 (2min±) 访问 http://localhost:1081/
|
||||
@@ -171,6 +175,6 @@ QQ群: 755242157
|
||||
|
||||

|
||||
|
||||
## GitCode 最有影响力的开源项目 G-Star
|
||||
## AtomGit 最有影响力的开源项目 G-Star
|
||||
|
||||

|
||||
|
||||
169
docker-compose-bt.yml
Normal file
169
docker-compose-bt.yml
Normal file
@@ -0,0 +1,169 @@
|
||||
# https://github.com/aaPanel/appstore/tree/main/apps/orion_visor
|
||||
|
||||
services:
|
||||
orion-ui:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:latest
|
||||
ports:
|
||||
- ${HOST_IP}:${WEB_HTTP_PORT}:80
|
||||
environment:
|
||||
NGINX_SERVICE_HOST: ${NGINX_SERVICE_HOST:-orion-service}
|
||||
NGINX_SERVICE_PORT: ${NGINX_SERVICE_PORT:-9200}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
orion-service:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- baota_net
|
||||
|
||||
orion-service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:${VERSION}
|
||||
privileged: true
|
||||
ports:
|
||||
- "9200:9200"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-prod}
|
||||
MYSQL_HOST: orion-mysql
|
||||
MYSQL_PORT: ${MYSQL_PORT:-3306}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-orion_visor}
|
||||
MYSQL_USER: ${MYSQL_USER:-orion}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-Data@123456}
|
||||
REDIS_HOST: orion-redis
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-Data@123456}
|
||||
REDIS_DATABASE: ${REDIS_DATABASE:-0}
|
||||
REDIS_DATA_VERSION: ${REDIS_DATA_VERSION:-1}
|
||||
INFLUXDB_ENABLED: true
|
||||
INFLUXDB_HOST: orion-influxdb
|
||||
INFLUXDB_PORT: ${INFLUXDB_PORT:-8086}
|
||||
INFLUXDB_ORG: ${INFLUXDB_ORG:-orion-visor}
|
||||
INFLUXDB_BUCKET: ${INFLUXDB_BUCKET:-metrics}
|
||||
INFLUXDB_TOKEN: ${INFLUXDB_TOKEN:-Data@123456}
|
||||
GUACD_HOST: orion-guacd
|
||||
GUACD_PORT: ${GUACD_PORT:-4822}
|
||||
GUACD_DRIVE_PATH: ${GUACD_DRIVE_PATH:-/drive}
|
||||
SECRET_KEY: ${SECRET_KEY:-uQeacXV8b3isvKLK}
|
||||
API_EXPOSE_TOKEN: ${API_EXPOSE_TOKEN:-pmqeHOyZaumHm0Wt}
|
||||
API_IP_HEADERS: ${API_IP_HEADERS:-X-Forwarded-For,X-Real-IP}
|
||||
# 这里需要改为具体的服务地址 (宿主机ip)
|
||||
API_HOST: ${HOST_IP}
|
||||
# 若 API_HOST 不满足, 可以修改这里 http://<ip>:<port>/orion-visor/api
|
||||
API_URL: ${API_URL:-}
|
||||
API_CORS: ${API_CORS:-true}
|
||||
DEMO_MODE: ${DEMO_MODE:-false}
|
||||
volumes:
|
||||
- ${APP_PATH}/service/root-orion:/root/orion
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 65536
|
||||
hard: 65536
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
|
||||
interval: 15s
|
||||
timeout: 300s
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
depends_on:
|
||||
orion-mysql:
|
||||
condition: service_healthy
|
||||
orion-redis:
|
||||
condition: service_healthy
|
||||
orion-influxdb:
|
||||
condition: service_healthy
|
||||
labels:
|
||||
createdBy: "bt_apps"
|
||||
networks:
|
||||
- baota_net
|
||||
|
||||
orion-mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:${VERSION}
|
||||
privileged: true
|
||||
environment:
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
|
||||
- MYSQL_USER=${MYSQL_USER:-orion}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-Data@123456}
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-Data@123456}
|
||||
volumes:
|
||||
- ${APP_PATH}/mysql/var-lib-mysql:/var/lib/mysql
|
||||
- ${APP_PATH}/mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
|
||||
interval: 15s
|
||||
timeout: 60s
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
labels:
|
||||
createdBy: "bt_apps"
|
||||
networks:
|
||||
- baota_net
|
||||
|
||||
orion-redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${VERSION}
|
||||
privileged: true
|
||||
environment:
|
||||
- REDIS_PASSWORD=${REDIS_PASSWORD:-Data@123456}
|
||||
volumes:
|
||||
- ${APP_PATH}/redis/data:/data
|
||||
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 15s
|
||||
timeout: 60s
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
labels:
|
||||
createdBy: "bt_apps"
|
||||
networks:
|
||||
- baota_net
|
||||
|
||||
orion-influxdb:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-influxdb:latest
|
||||
privileged: true
|
||||
ports:
|
||||
- "8086:8086"
|
||||
environment:
|
||||
DOCKER_INFLUXDB_INIT_MODE: setup
|
||||
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_ADMIN_USERNAME:-admin}
|
||||
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_ADMIN_PASSWORD:-Data@123456}
|
||||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_TOKEN:-Data@123456}
|
||||
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORG:-orion-visor}
|
||||
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET:-metrics}
|
||||
volumes:
|
||||
- ${APP_PATH}/influxdb/data:/var/lib/influxdb2
|
||||
- ${APP_PATH}/influxdb/config:/etc/influxdb2
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8086" ]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- baota_net
|
||||
|
||||
orion-guacd:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-guacd:latest
|
||||
ports:
|
||||
- "4822:4822"
|
||||
environment:
|
||||
GUACD_LOG_LEVEL: info
|
||||
GUACD_LOG_FILE: /var/log/guacd.log
|
||||
volumes:
|
||||
- ${APP_PATH}/guacd/drive:${GUACD_DRIVE_PATH:-/drive}
|
||||
- ${APP_PATH}/guacd/var-logs:/var/log
|
||||
- ${APP_PATH}/guacd/local-guacamole-lib:/usr/local/guacamole/lib
|
||||
- ${APP_PATH}/guacd/local-guacamole-extensions:/usr/local/guacamole/extensions
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "nc", "-vz", "localhost", "4822" ]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- baota_net
|
||||
|
||||
networks:
|
||||
baota_net:
|
||||
external: true
|
||||
@@ -1,5 +1,3 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:latest
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
version: '3.3'
|
||||
|
||||
# latest = 2.5.5
|
||||
# latest = 2.5.7
|
||||
|
||||
# 支持以下源
|
||||
# lijiahangmax/*
|
||||
@@ -32,7 +30,7 @@ services:
|
||||
MYSQL_HOST: ${MYSQL_HOST:-mysql}
|
||||
MYSQL_PORT: ${MYSQL_PORT:-3306}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-orion_visor}
|
||||
MYSQL_USER: ${MYSQL_USER:-root}
|
||||
MYSQL_USER: ${MYSQL_USER:-orion}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-Data@123456}
|
||||
REDIS_HOST: ${REDIS_HOST:-redis}
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-Data@123456}
|
||||
@@ -50,6 +48,10 @@ services:
|
||||
SECRET_KEY: ${SECRET_KEY:-uQeacXV8b3isvKLK}
|
||||
API_EXPOSE_TOKEN: ${API_EXPOSE_TOKEN:-pmqeHOyZaumHm0Wt}
|
||||
API_IP_HEADERS: ${API_IP_HEADERS:-X-Forwarded-For,X-Real-IP}
|
||||
# 这里需要改为具体的服务地址 (宿主机ip)
|
||||
API_HOST: ${API_HOST:-0.0.0.0}
|
||||
# 若 API_HOST 不满足, 可以修改这里 http://<ip>:<port>/orion-visor/api
|
||||
API_URL: ${API_URL:-}
|
||||
API_CORS: ${API_CORS:-true}
|
||||
DEMO_MODE: ${DEMO_MODE:-false}
|
||||
volumes:
|
||||
|
||||
@@ -7,7 +7,7 @@ set -e
|
||||
source ./project-build.sh "$@"
|
||||
|
||||
# 版本号
|
||||
version=2.5.5
|
||||
version=2.5.7
|
||||
# 是否推送镜像
|
||||
push_image=false
|
||||
# 是否构建 latest
|
||||
@@ -140,7 +140,7 @@ function modify_dockerfiles() {
|
||||
if [ -f "$file" ]; then
|
||||
echo "备份并修改: $file"
|
||||
cp "$file" "$file$backup_suffix"
|
||||
sed -i 's/--platform=\TARGETPLATFORM//g' "$file"
|
||||
sed -i "s/--platform=\$TARGETPLATFORM//g" "$file"
|
||||
else
|
||||
echo "文件不存在 -> $file"
|
||||
fi
|
||||
@@ -189,7 +189,7 @@ function push_image_to_registry() {
|
||||
# 推送版本
|
||||
docker push "${namespace}/${image_name}:${version}"
|
||||
# 推送 latest
|
||||
if [ "latest_image" = true ]; then
|
||||
if [ "$latest_image" = true ]; then
|
||||
docker push "${namespace}/${image_name}:latest"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
# DockerContext: orion-visor
|
||||
|
||||
# 版本号
|
||||
version=2.5.5
|
||||
version=2.5.7
|
||||
# 是否构建 service
|
||||
export build_service=false
|
||||
# 是否构建 ui
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.5.5";
|
||||
String VERSION = "2.5.7";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
|
||||
@@ -55,4 +55,6 @@ public interface Const extends cn.orionsec.kit.lang.constant.Const, FieldConst,
|
||||
|
||||
int BATCH_COUNT = 500;
|
||||
|
||||
String IP_0000 = "0.0.0.0";
|
||||
|
||||
}
|
||||
|
||||
@@ -210,6 +210,12 @@ public interface ErrorMessage {
|
||||
|
||||
String PLEASE_SELECT_SUFFIX_FILE = "请选择 {} 类型的文件";
|
||||
|
||||
String SPEC_FORMAT_INCORRECT = "规格格式不正确";
|
||||
|
||||
String INFLUXDB_UNSUPPORTED = "InfluxDB 服务未开启";
|
||||
|
||||
String AGENT_KEY_NOT_FOUND = "未通过 agentKey 查询到对应的主机 ({})";
|
||||
|
||||
/**
|
||||
* 是否为业务异常
|
||||
*
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.common.handler.data.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.common.handler.data.strategy;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.common.json;
|
||||
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 com.alibaba.fastjson2.filter.ValueFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FieldDesensitizeFilter implements ValueFilter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object process(Object object, String name, Object value) {
|
||||
public Object apply(Object object, String name, Object value) {
|
||||
if (Lists.isEmpty(desensitizeFields) || !desensitizeFields.contains(name)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.common.json;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||
import com.alibaba.fastjson2.filter.PropertyFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
*/
|
||||
package org.dromara.visor.common.mapstruct;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
/**
|
||||
* json 转换器
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.5.5</revision>
|
||||
<revision>2.5.7</revision>
|
||||
<spring.boot.version>2.7.17</spring.boot.version>
|
||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||
<orion.kit.version>2.0.5</orion.kit.version>
|
||||
<orion.kit.version>2.0.6</orion.kit.version>
|
||||
<aspectj.version>1.9.7</aspectj.version>
|
||||
<lombok.version>1.18.26</lombok.version>
|
||||
<springdoc.version>1.6.15</springdoc.version>
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.biz.operator.log.configuration;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||
import com.alibaba.fastjson2.filter.Filter;
|
||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.common.json.FieldDesensitizeFilter;
|
||||
import org.dromara.visor.common.json.FieldIgnoreFilter;
|
||||
@@ -55,7 +54,7 @@ import javax.annotation.Resource;
|
||||
public class OrionOperatorLogAutoConfiguration {
|
||||
|
||||
@Resource
|
||||
private ValueFilter desensitizeValueFilter;
|
||||
private Filter desensitizeValueFilter;
|
||||
|
||||
/**
|
||||
* 操作日志委托类
|
||||
@@ -82,7 +81,7 @@ public class OrionOperatorLogAutoConfiguration {
|
||||
public OperatorLogAspect operatorLogAspect(OperatorLogConfig operatorLogConfig,
|
||||
OperatorLogFrameworkService service) {
|
||||
// 参数过滤器
|
||||
SerializeFilter[] serializeFilters = new SerializeFilter[]{
|
||||
Filter[] serializeFilters = new Filter[]{
|
||||
// 忽略字段过滤器
|
||||
new FieldIgnoreFilter(operatorLogConfig.getIgnore()),
|
||||
// 脱敏字段过滤器
|
||||
|
||||
@@ -27,8 +27,8 @@ import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Refs;
|
||||
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 com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.filter.Filter;
|
||||
import org.dromara.visor.common.entity.RequestIdentity;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.common.security.LoginUser;
|
||||
@@ -54,7 +54,7 @@ import java.util.Optional;
|
||||
*/
|
||||
public class OperatorLogFiller implements Gettable<OperatorLogModel> {
|
||||
|
||||
private static SerializeFilter[] serializeFilters;
|
||||
private static Filter[] serializeFilters;
|
||||
|
||||
private static OperatorLogConfig operatorLogConfig;
|
||||
|
||||
@@ -275,7 +275,7 @@ public class OperatorLogFiller implements Gettable<OperatorLogModel> {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void setSerializeFilters(SerializeFilter[] serializeFilters) {
|
||||
public static void setSerializeFilters(Filter[] serializeFilters) {
|
||||
if (OperatorLogFiller.serializeFilters != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
|
||||
@@ -25,9 +25,8 @@ package org.dromara.visor.framework.biz.operator.log.core.utils;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.filter.Filter;
|
||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||
import org.dromara.visor.common.security.LoginUser;
|
||||
|
||||
@@ -44,7 +43,7 @@ public class OperatorLogs implements ExtraFieldConst {
|
||||
|
||||
private static final String UN_SAVE_FLAG = "__un__save__";
|
||||
|
||||
private static SerializeFilter[] serializeFilters;
|
||||
private static Filter[] serializeFilters;
|
||||
|
||||
/**
|
||||
* 拓展信息
|
||||
@@ -98,7 +97,7 @@ public class OperatorLogs implements ExtraFieldConst {
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
if (obj instanceof JSONObject || obj instanceof com.alibaba.fastjson2.JSONObject) {
|
||||
if (obj instanceof com.alibaba.fastjson2.JSONObject || obj instanceof com.alibaba.fastjson2.JSONObject) {
|
||||
EXTRA_HOLDER.get().putAll(JSON.parseObject(toJsonString(obj)));
|
||||
} else if (obj instanceof Map) {
|
||||
EXTRA_HOLDER.get().putAll((Map<String, ?>) obj);
|
||||
@@ -204,7 +203,7 @@ public class OperatorLogs implements ExtraFieldConst {
|
||||
.replaceAll("<br/>", "\n");
|
||||
}
|
||||
|
||||
public static void setSerializeFilters(SerializeFilter[] serializeFilters) {
|
||||
public static void setSerializeFilters(Filter[] serializeFilters) {
|
||||
if (OperatorLogs.serializeFilters != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.framework.biz.push.core.entity;
|
||||
|
||||
import cn.orionsec.kit.lang.able.IJsonObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.biz.push.core.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.framework.biz.push.core.entity;
|
||||
|
||||
import cn.orionsec.kit.lang.able.IJsonObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.framework.biz.push.core.entity;
|
||||
|
||||
import cn.orionsec.kit.lang.able.IJsonObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.biz.push.core.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.biz.push.core.enums;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.dromara.visor.framework.biz.push.core.message.*;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.framework.biz.push.core.service;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.entity.PushUser;
|
||||
|
||||
@@ -31,7 +31,7 @@ import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.codec.Base64s;
|
||||
import cn.orionsec.kit.lang.utils.crypto.Signatures;
|
||||
import cn.orionsec.kit.lang.utils.math.Hex;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.framework.biz.push.core.annotation.MessageChannel;
|
||||
|
||||
@@ -30,7 +30,7 @@ import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.codec.Base64s;
|
||||
import cn.orionsec.kit.lang.utils.crypto.Signatures;
|
||||
import cn.orionsec.kit.lang.utils.crypto.enums.SecretKeySpecMode;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.biz.push.core.annotation.MessageChannel;
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.framework.biz.push.core.service;
|
||||
import cn.orionsec.kit.http.ok.OkRequests;
|
||||
import cn.orionsec.kit.http.ok.OkResponse;
|
||||
import cn.orionsec.kit.lang.constant.StandardContentType;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.biz.push.core.annotation.MessageChannel;
|
||||
|
||||
@@ -28,8 +28,8 @@ import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
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 com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.filter.ValueFilter;
|
||||
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;
|
||||
@@ -53,7 +53,7 @@ public class DesensitizeValueFilter implements ValueFilter {
|
||||
private static final Map<String, Map<String, Desensitize>> DESENSITIZE_FIELDS = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Object process(Object object, String name, Object value) {
|
||||
public Object apply(Object object, String name, Object value) {
|
||||
if (object == null || value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.framework.executor.core.context;
|
||||
|
||||
import cn.orionsec.kit.lang.define.thread.RejectPolicy;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.thread.ThreadPoolMdcTaskExecutor;
|
||||
import org.dromara.visor.framework.executor.configuration.config.ExecutorConfig;
|
||||
|
||||
@@ -30,7 +30,9 @@ import com.influxdb.client.write.Point;
|
||||
import com.influxdb.query.FluxRecord;
|
||||
import com.influxdb.query.FluxTable;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.entity.chart.TimeChartSeries;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.influxdb.core.query.FluxQueryBuilder;
|
||||
|
||||
import java.time.Instant;
|
||||
@@ -66,6 +68,7 @@ public class InfluxdbUtils {
|
||||
* @param points points
|
||||
*/
|
||||
public static void writePoints(List<Point> points) {
|
||||
Assert.notNull(client, ErrorMessage.INFLUXDB_UNSUPPORTED);
|
||||
try (WriteApi api = client.makeWriteApi()) {
|
||||
// 写入指标
|
||||
api.writePoints(points);
|
||||
@@ -79,6 +82,7 @@ public class InfluxdbUtils {
|
||||
* @return points
|
||||
*/
|
||||
public static List<FluxTable> queryTable(String query) {
|
||||
Assert.notNull(client, ErrorMessage.INFLUXDB_UNSUPPORTED);
|
||||
return client.getQueryApi().query(query);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ package org.dromara.visor.framework.log.core.interceptor;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import cn.orionsec.kit.lang.utils.reflect.Classes;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.filter.Filter;
|
||||
import com.alibaba.fastjson2.filter.ValueFilter;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.dromara.visor.common.json.FieldDesensitizeFilter;
|
||||
import org.dromara.visor.common.json.FieldIgnoreFilter;
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
||||
/**
|
||||
* 字段过滤器
|
||||
*/
|
||||
protected SerializeFilter[] serializeFilters;
|
||||
protected Filter[] serializeFilters;
|
||||
|
||||
/**
|
||||
* 脱敏配置
|
||||
@@ -91,7 +91,7 @@ public abstract class AbstractLogPrinterInterceptor implements LogPrinterInterce
|
||||
@Override
|
||||
public void init() {
|
||||
// 参数过滤器
|
||||
this.serializeFilters = new SerializeFilter[]{
|
||||
this.serializeFilters = new Filter[]{
|
||||
// 忽略字段过滤器
|
||||
new FieldIgnoreFilter(config.getField().getIgnore()),
|
||||
// 脱敏字段过滤器
|
||||
|
||||
@@ -26,7 +26,7 @@ import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import cn.orionsec.kit.web.servlet.web.Servlets;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.dromara.visor.common.utils.IpUtils;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.framework.mybatis.core.generator.core;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableField;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.mybatis.core.type;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.mybatis.core.type;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
@@ -25,18 +25,19 @@ package ${package.ServiceImpl};
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
#if($meta.enableCache)
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
#end
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#if($meta.enableCache)
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
#end
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
@@ -59,222 +60,222 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
|
||||
@Resource
|
||||
private ${type}DAO ${typeLower}DAO;
|
||||
@Resource
|
||||
private ${type}DAO ${typeLower}DAO;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create${type}(${type}CreateRequest request) {
|
||||
log.info("${type}Service-create${type} request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
${type}DO record = ${type}Convert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.check${type}Present(record);
|
||||
// 插入
|
||||
int effect = ${typeLower}DAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("${type}Service-create${type} id: {}, effect: {}", id, effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer update${type}ById(${type}UpdateRequest request) {
|
||||
Long id = Assert.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
log.info("${type}Service-update${type}ById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||
// 查询
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Assert.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
${type}DO updateRecord = ${type}Convert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.check${type}Present(updateRecord);
|
||||
// 更新
|
||||
int effect = ${typeLower}DAO.updateById(updateRecord);
|
||||
log.info("${type}Service-update${type}ById effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer update${type}(${type}QueryRequest query, ${type}UpdateRequest update) {
|
||||
log.info("${type}Service.update${type} query: {}, update: {}", JSON.toJSONString(query), JSON.toJSONString(update));
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(query);
|
||||
// 转换
|
||||
${type}DO updateRecord = ${type}Convert.MAPPER.to(update);
|
||||
// 更新
|
||||
int effect = ${typeLower}DAO.update(updateRecord, wrapper);
|
||||
log.info("${type}Service.update${type} effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${type}VO get${type}ById(Long id) {
|
||||
// 查询
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Assert.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return ${type}Convert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}VO> get${type}ByIdList(List<Long> idList) {
|
||||
// 查询
|
||||
List<${type}DO> records = ${typeLower}DAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
return Lists.empty();
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create${type}(${type}CreateRequest request) {
|
||||
log.info("${type}Service-create${type} request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
${type}DO record = ${type}Convert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.check${type}Present(record);
|
||||
// 插入
|
||||
int effect = ${typeLower}DAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("${type}Service-create${type} id: {}, effect: {}", id, effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return id;
|
||||
}
|
||||
// 转换
|
||||
return ${type}Convert.MAPPER.to(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}VO> get${type}List(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper)
|
||||
.order(request, ${type}DO::getId)
|
||||
.list(${type}Convert.MAPPER::to);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer update${type}ById(${type}UpdateRequest request) {
|
||||
Long id = Assert.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
log.info("${type}Service-update${type}ById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||
// 查询
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Assert.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
${type}DO updateRecord = ${type}Convert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.check${type}Present(updateRecord);
|
||||
// 更新
|
||||
int effect = ${typeLower}DAO.updateById(updateRecord);
|
||||
log.info("${type}Service-update${type}ById effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer update${type}(${type}QueryRequest query, ${type}UpdateRequest update) {
|
||||
log.info("${type}Service.update${type} query: {}, update: {}", JSON.toJSONString(query), JSON.toJSONString(update));
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(query);
|
||||
// 转换
|
||||
${type}DO updateRecord = ${type}Convert.MAPPER.to(update);
|
||||
// 更新
|
||||
int effect = ${typeLower}DAO.update(updateRecord, wrapper);
|
||||
log.info("${type}Service.update${type} effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${type}VO get${type}ById(Long id) {
|
||||
// 查询
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Assert.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return ${type}Convert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}VO> get${type}ByIdList(List<Long> idList) {
|
||||
// 查询
|
||||
List<${type}DO> records = ${typeLower}DAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
return Lists.empty();
|
||||
}
|
||||
// 转换
|
||||
return ${type}Convert.MAPPER.to(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}VO> get${type}List(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper)
|
||||
.order(request, ${type}DO::getId)
|
||||
.list(${type}Convert.MAPPER::to);
|
||||
}
|
||||
#if($meta.enableCache)
|
||||
|
||||
@Override
|
||||
public List<${type}VO> get${type}ListByCache() {
|
||||
// 查询缓存
|
||||
List<${type}CacheDTO> list = RedisMaps.valuesJson(${type}CacheKeyDefine.${typeConst});
|
||||
if (list.isEmpty()) {
|
||||
// 查询数据库
|
||||
list = ${typeLower}DAO.of().list(${type}Convert.MAPPER::toCache);
|
||||
// 设置屏障 防止穿透
|
||||
CacheBarriers.checkBarrier(list, ${type}CacheDTO::new);
|
||||
// 设置缓存
|
||||
RedisMaps.putAllJson(${type}CacheKeyDefine.${typeConst}, s -> s.getId().toString(), list);
|
||||
}
|
||||
// 删除屏障
|
||||
CacheBarriers.removeBarrier(list);
|
||||
// 转换
|
||||
return list.stream()
|
||||
.map(${type}Convert.MAPPER::to)
|
||||
.sorted(Comparator.comparing(${type}VO::getId).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@Override
|
||||
public List<${type}VO> get${type}ListByCache() {
|
||||
// 查询缓存
|
||||
List<${type}CacheDTO> list = RedisMaps.valuesJson(${type}CacheKeyDefine.${typeConst});
|
||||
if (list.isEmpty()) {
|
||||
// 查询数据库
|
||||
list = ${typeLower}DAO.of().list(${type}Convert.MAPPER::toCache);
|
||||
// 设置屏障 防止穿透
|
||||
CacheBarriers.checkBarrier(list, ${type}CacheDTO::new);
|
||||
// 设置缓存
|
||||
RedisMaps.putAllJson(${type}CacheKeyDefine.${typeConst}, s -> s.getId().toString(), list);
|
||||
}
|
||||
// 删除屏障
|
||||
CacheBarriers.removeBarrier(list);
|
||||
// 转换
|
||||
return list.stream()
|
||||
.map(${type}Convert.MAPPER::to)
|
||||
.sorted(Comparator.comparing(${type}VO::getId).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
#end
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.order(request, ${type}DO::getId)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
}
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.order(request, ${type}DO::getId)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long get${type}Count(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
@Override
|
||||
public Long get${type}Count(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}ById(Long id) {
|
||||
log.info("${type}Service-delete${type}ById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Assert.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = ${typeLower}DAO.deleteById(id);
|
||||
log.info("${type}Service-delete${type}ById id: {}, effect: {}", id, effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst}, id);
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}ById(Long id) {
|
||||
log.info("${type}Service-delete${type}ById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Assert.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = ${typeLower}DAO.deleteById(id);
|
||||
log.info("${type}Service-delete${type}ById id: {}, effect: {}", id, effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst}, id);
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}ByIdList(List<Long> idList) {
|
||||
log.info("${type}Service-delete${type}ByIdList idList: {}", idList);
|
||||
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
||||
log.info("${type}Service-delete${type}ByIdList effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst}, idList);
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}ByIdList(List<Long> idList) {
|
||||
log.info("${type}Service-delete${type}ByIdList idList: {}", idList);
|
||||
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
||||
log.info("${type}Service-delete${type}ByIdList effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst}, idList);
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}(${type}QueryRequest request) {
|
||||
log.info("${type}Service.delete${type} request: {}", JSON.toJSONString(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 删除
|
||||
int effect = ${typeLower}DAO.delete(wrapper);
|
||||
log.info("${type}Service.delete${type} effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisMaps.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}(${type}QueryRequest request) {
|
||||
log.info("${type}Service.delete${type} request: {}", JSON.toJSONString(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 删除
|
||||
int effect = ${typeLower}DAO.delete(wrapper);
|
||||
log.info("${type}Service.delete${type} effect: {}", effect);
|
||||
#if($meta.enableCache)
|
||||
// 删除缓存
|
||||
RedisUtils.delete(${type}CacheKeyDefine.${typeConst});
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void check${type}Present(${type}DO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${typeLower}DAO.wrapper()
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void check${type}Present(${type}DO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${typeLower}DAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(${type}DO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
#foreach($field in ${table.fields})
|
||||
#foreach($field in ${table.fields})
|
||||
#if("$!field.propertyName" != "id")
|
||||
.eq(${type}DO::get${field.capitalName}, domain.get${field.capitalName}())#if(!$foreach.hasNext);#end
|
||||
.eq(${type}DO::get${field.capitalName}, domain.get${field.capitalName}())#if(!$foreach.hasNext);#end
|
||||
#end
|
||||
#end
|
||||
// 检查是否存在
|
||||
boolean present = ${typeLower}DAO.of(wrapper).present();
|
||||
Assert.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
#end
|
||||
// 检查是否存在
|
||||
boolean present = ${typeLower}DAO.of(wrapper).present();
|
||||
Assert.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
|
||||
String searchValue = request.getSearchValue();
|
||||
return ${typeLower}DAO.wrapper()
|
||||
@Override
|
||||
public LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
|
||||
String searchValue = request.getSearchValue();
|
||||
return ${typeLower}DAO.wrapper()
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, request.get${field.capitalName}())
|
||||
#end
|
||||
.and(Strings.isNotEmpty(searchValue), c -> c
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end
|
||||
.eq(${type}DO::get${field.capitalName}, request.get${field.capitalName}())
|
||||
#end
|
||||
);
|
||||
}
|
||||
.and(Strings.isNotEmpty(searchValue), c -> c
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end
|
||||
#end
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#foreach($pkg in ${customProviderFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#foreach($pkg in ${customProviderFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
@@ -66,7 +66,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.create${type} dto: {}", JSON.toJSONString(dto));
|
||||
Assert.valid(dto);
|
||||
// 转换
|
||||
${type}CreateRequest request = ${type}ProviderConvert.MAPPER.toRequest(dto);
|
||||
${type}CreateRequest request = ${type}ProviderConvert.MAPPER.toRequest(dto);
|
||||
// 创建
|
||||
return ${typeLower}Service.create${type}(request);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.update${type}ById dto: {}", JSON.toJSONString(dto));
|
||||
Assert.valid(dto);
|
||||
// 转换
|
||||
${type}UpdateRequest request = ${type}ProviderConvert.MAPPER.toRequest(dto);
|
||||
${type}UpdateRequest request = ${type}ProviderConvert.MAPPER.toRequest(dto);
|
||||
// 修改
|
||||
return ${typeLower}Service.update${type}ById(request);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
Assert.valid(update);
|
||||
// 更新
|
||||
int effect = ${typeLower}Service.update${type}(${type}ProviderConvert.MAPPER.toRequest(query),
|
||||
${type}ProviderConvert.MAPPER.toRequest(update));
|
||||
${type}ProviderConvert.MAPPER.toRequest(update));
|
||||
log.info("${type}Api.update${type} effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.get${type}ById id: {}", id);
|
||||
Assert.notNull(id, ErrorMessage.ID_MISSING);
|
||||
// 修改
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
if (record == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -129,14 +129,14 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
}
|
||||
|
||||
#if($meta.enableCache)
|
||||
@Override
|
||||
public List<${type}DTO> get${type}ListByCache() {
|
||||
return ${typeLower}Service.get${type}ListByCache()
|
||||
.stream()
|
||||
.map(${type}ProviderConvert.MAPPER::to)
|
||||
.sorted(Comparator.comparing(${type}DTO::getId))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@Override
|
||||
public List<${type}DTO> get${type}ListByCache() {
|
||||
return ${typeLower}Service.get${type}ListByCache()
|
||||
.stream()
|
||||
.map(${type}ProviderConvert.MAPPER::to)
|
||||
.sorted(Comparator.comparing(${type}DTO::getId))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
#end
|
||||
@Override
|
||||
@@ -186,7 +186,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryDTO dto) {
|
||||
return ${typeLower}DAO.wrapper()
|
||||
return ${typeLower}DAO.wrapper()
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, dto.get${field.capitalName}())#if(!$foreach.hasNext);#end
|
||||
#end
|
||||
|
||||
@@ -169,7 +169,6 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -200,7 +199,6 @@
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -135,8 +135,6 @@
|
||||
}
|
||||
handleClose();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -139,8 +139,6 @@
|
||||
}
|
||||
handleClose();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,6 @@
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -220,7 +219,6 @@
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -246,7 +244,6 @@
|
||||
#if($vue.enableRowSelection)
|
||||
selectedKeys.value = [];
|
||||
#end
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.framework.redis.core.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,7 +27,7 @@ import cn.orionsec.kit.lang.function.Functions;
|
||||
import cn.orionsec.kit.lang.utils.Objects1;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,9 +24,9 @@ package org.dromara.visor.framework.redis.core.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.common.constant.FilterOrderConst;
|
||||
import org.dromara.visor.common.web.WebFilterCreator;
|
||||
import org.dromara.visor.framework.web.configuration.config.ExposeApiConfig;
|
||||
import org.dromara.visor.framework.web.configuration.config.OrionApiConfig;
|
||||
import org.dromara.visor.framework.web.core.aspect.DemoDisableApiAspect;
|
||||
import org.dromara.visor.framework.web.core.aspect.ExposeApiAspect;
|
||||
import org.dromara.visor.framework.web.core.filter.TraceIdFilter;
|
||||
@@ -71,7 +72,7 @@ import java.util.List;
|
||||
@DependsOn({"executorContext"})
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_WEB)
|
||||
@EnableConfigurationProperties(ExposeApiConfig.class)
|
||||
@EnableConfigurationProperties({ExposeApiConfig.class, OrionApiConfig.class})
|
||||
public class OrionWebAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Value("${orion.prefix}")
|
||||
|
||||
@@ -36,6 +36,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties("orion.api.expose")
|
||||
public class ExposeApiConfig {
|
||||
|
||||
/**
|
||||
* 对外服务地址
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* 对外服务请求头
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.web.configuration.config;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.net.IPs;
|
||||
import lombok.Data;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* api 配置属性
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/12/8 14:00
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties("orion.api")
|
||||
public class OrionApiConfig {
|
||||
|
||||
private static final String URL_TEMPLATE = "http://{}:{}{}";
|
||||
|
||||
/**
|
||||
* 公共 api 前缀
|
||||
*/
|
||||
private String prefix;
|
||||
|
||||
/**
|
||||
* 服务端主机地址
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* 服务端口
|
||||
*/
|
||||
@Value("${server.port}")
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 服务端 url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
public String getHost() {
|
||||
if (Const.IP_0000.equalsIgnoreCase(host)) {
|
||||
// 本机
|
||||
return IPs.IP;
|
||||
} else {
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (!Strings.isBlank(url)) {
|
||||
return url;
|
||||
}
|
||||
// 构建
|
||||
return Strings.format(URL_TEMPLATE, this.getHost(), port, prefix);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,16 @@
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "是否开启 cors 过滤器."
|
||||
},
|
||||
{
|
||||
"name": "orion.api.host",
|
||||
"type": "java.lang.String",
|
||||
"description": "服务端主机地址."
|
||||
},
|
||||
{
|
||||
"name": "orion.api.url",
|
||||
"type": "java.lang.String",
|
||||
"description": "服务端接口地址."
|
||||
},
|
||||
{
|
||||
"name": "orion.api.ip-headers",
|
||||
"type": "java.lang.String",
|
||||
|
||||
@@ -26,7 +26,7 @@ import cn.orionsec.kit.lang.constant.StandardHttpHeader;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Threads;
|
||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.framework.websocket.core.constant.CloseCode;
|
||||
|
||||
@@ -74,6 +74,10 @@ orion:
|
||||
api:
|
||||
# 是否允许跨域
|
||||
cors: ${API_CORS:true}
|
||||
# 服务端主机地址
|
||||
host: ${API_HOST:0.0.0.0}
|
||||
# 服务端接口地址 默认自动生成
|
||||
url: ${API_URL:}
|
||||
# 获取 IP 的请求头
|
||||
ip-headers: ${API_IP_HEADERS:X-Forwarded-For,X-Real-IP}
|
||||
# 对外服务
|
||||
|
||||
@@ -175,6 +175,10 @@ orion:
|
||||
prefix: ${orion.prefix}/api
|
||||
# 是否允许跨域
|
||||
cors: true
|
||||
# 服务端主机地址
|
||||
host: 0.0.0.0
|
||||
# 服务端接口地址 默认自动生成
|
||||
url:
|
||||
# 获取 IP 的请求头
|
||||
ip-headers: X-Forwarded-For,X-Real-IP
|
||||
# 对外服务
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.dromara.visor.launch;
|
||||
|
||||
import cn.orionsec.kit.lang.define.StopWatch;
|
||||
import cn.orionsec.kit.lang.utils.io.FileReaders;
|
||||
import cn.orionsec.kit.lang.utils.io.FileWriters;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 替换 fastjson 版本
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/12/23 10:21
|
||||
*/
|
||||
public class ReplaceFastjson {
|
||||
|
||||
private static final String PATH = new File("").getAbsolutePath();
|
||||
|
||||
public static void main(String[] args) {
|
||||
StopWatch sw = StopWatch.begin();
|
||||
// 扫描文件
|
||||
List<File> files = Files1.listFilesFilter(PATH, file -> file.isFile()
|
||||
&& (file.getName().endsWith(".java") || file.getName().endsWith(".java.vm"))
|
||||
&& !file.getAbsolutePath().contains("generated-sources")
|
||||
&& !file.getAbsolutePath().contains("node_modules"), true, false);
|
||||
sw.tag(" list");
|
||||
// 添加头
|
||||
files.forEach(ReplaceFastjson::replaceFastjson2ToFile);
|
||||
sw.tag("replace");
|
||||
sw.stop();
|
||||
System.out.println();
|
||||
System.out.println(sw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换 license
|
||||
*
|
||||
* @param file file
|
||||
*/
|
||||
private static void replaceFastjson2ToFile(File file) {
|
||||
String path = file.getAbsolutePath().substring(PATH.length());
|
||||
if (path.contains("ReplaceFastjson")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String line = FileReaders.readLine(file);
|
||||
if (line == null) {
|
||||
return;
|
||||
}
|
||||
// 替换文件内容
|
||||
byte[] bytes = new String(FileReaders.readAllBytesFast(file))
|
||||
.replaceAll("com.alibaba.fastjson\\.", "com.alibaba.fastjson2.")
|
||||
.replaceAll("com.alibaba.fastjson2.JSONPath", "com.alibaba.fastjson.JSONPath")
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
// 写入
|
||||
FileWriters.writeFast(file, bytes);
|
||||
System.out.println("OK " + path);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed " + path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,9 +39,9 @@ import java.util.function.Function;
|
||||
*/
|
||||
public class ReplaceVersion {
|
||||
|
||||
private static final String TARGET_VERSION = "2.5.4";
|
||||
private static final String TARGET_VERSION = "2.5.6";
|
||||
|
||||
private static final String REPLACE_VERSION = "2.5.5";
|
||||
private static final String REPLACE_VERSION = "2.5.7";
|
||||
|
||||
private static final String PATH = new File("").getAbsolutePath();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.module.asset.entity.dto.host.HostRdpConfigDTO;
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机探针端点 api
|
||||
@@ -90,9 +91,8 @@ public class HostAgentController {
|
||||
@PostMapping("/install")
|
||||
@Operation(summary = "安装主机探针")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:install-agent')")
|
||||
public Boolean installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
|
||||
hostAgentService.installAgent(request);
|
||||
return true;
|
||||
public Map<String, Long> installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
|
||||
return hostAgentService.installAgent(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.dromara.visor.module.asset.entity.vo.HostAgentStatusVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机探针 服务类
|
||||
@@ -49,8 +50,9 @@ public interface HostAgentService {
|
||||
* 安装探针
|
||||
*
|
||||
* @param request request
|
||||
* @return agentKey:installId
|
||||
*/
|
||||
void installAgent(HostAgentInstallRequest request);
|
||||
Map<String, Long> installAgent(HostAgentInstallRequest request);
|
||||
|
||||
/**
|
||||
* 上传探针发布包
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
|
||||
import org.dromara.visor.module.asset.entity.request.host.HostExtraUpdateRequest;
|
||||
import org.dromara.visor.module.asset.handler.host.extra.HostExtraItemEnum;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class HostAgentEndpointServiceImpl implements HostAgentEndpointService {
|
||||
try {
|
||||
// 查询主机信息
|
||||
Long hostId = hostDAO.selectIdByAgentKey(agentKey);
|
||||
Assert.notNull(hostId, ErrorMessage.HOST_ABSENT);
|
||||
Assert.notNull(hostId, ErrorMessage.AGENT_KEY_NOT_FOUND, agentKey);
|
||||
// 查询主机规格信息
|
||||
HostSpecExtraModel spec = hostExtraService.getHostExtra(Const.SYSTEM_USER_ID, hostId, HostExtraItemEnum.SPEC);
|
||||
Boolean synced = Optional.ofNullable(spec)
|
||||
@@ -149,7 +149,7 @@ public class HostAgentEndpointServiceImpl implements HostAgentEndpointService {
|
||||
log.info("HostAgentEndpointService setAgentOffline agentKey: {}", agentKey);
|
||||
// 查询主机信息
|
||||
Long hostId = hostDAO.selectIdByAgentKey(agentKey);
|
||||
Assert.notNull(hostId, ErrorMessage.HOST_ABSENT);
|
||||
Assert.notNull(hostId, ErrorMessage.AGENT_KEY_NOT_FOUND, agentKey);
|
||||
// 修改缓存
|
||||
ONLINE_STATUS_CACHE.put(agentKey, AgentOnlineStatusEnum.OFFLINE.getValue());
|
||||
HEARTBEAT_RECV_CACHE.put(agentKey, 0L);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.function.Functions;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
@@ -31,7 +32,6 @@ import cn.orionsec.kit.lang.utils.io.FileReaders;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import cn.orionsec.kit.lang.utils.io.compress.CompressTypeEnum;
|
||||
import cn.orionsec.kit.lang.utils.io.compress.FileDecompressor;
|
||||
import cn.orionsec.kit.lang.utils.net.IPs;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
@@ -41,6 +41,8 @@ import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.common.utils.PathUtils;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
|
||||
import org.dromara.visor.framework.web.configuration.config.ExposeApiConfig;
|
||||
import org.dromara.visor.framework.web.configuration.config.OrionApiConfig;
|
||||
import org.dromara.visor.module.asset.convert.HostConvert;
|
||||
import org.dromara.visor.module.asset.dao.HostAgentLogDAO;
|
||||
import org.dromara.visor.module.asset.dao.HostDAO;
|
||||
@@ -53,7 +55,6 @@ import org.dromara.visor.module.asset.enums.*;
|
||||
import org.dromara.visor.module.asset.handler.agent.intstall.AgentInstaller;
|
||||
import org.dromara.visor.module.asset.handler.agent.model.AgentInstallParams;
|
||||
import org.dromara.visor.module.asset.service.HostAgentService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -77,8 +78,11 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
|
||||
private String localVersion;
|
||||
|
||||
@Value("${orion.api.expose.token}")
|
||||
private String exposeToken;
|
||||
@Resource
|
||||
private OrionApiConfig orionApiConfig;
|
||||
|
||||
@Resource
|
||||
private ExposeApiConfig exposeApiConfig;
|
||||
|
||||
@Resource
|
||||
private HostDAO hostDAO;
|
||||
@@ -130,7 +134,7 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installAgent(HostAgentInstallRequest request) {
|
||||
public Map<String, Long> installAgent(HostAgentInstallRequest request) {
|
||||
// 查询主机信息
|
||||
List<Long> idList = request.getIdList();
|
||||
List<HostDO> hosts = hostDAO.selectBatchIds(idList);
|
||||
@@ -178,6 +182,12 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
// 执行任务
|
||||
AgentInstaller.start(params);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return agentLogs.stream()
|
||||
.collect(Collectors.toMap(HostAgentLogDO::getAgentKey,
|
||||
HostAgentLogDO::getId,
|
||||
Functions.right()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -302,8 +312,8 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
*/
|
||||
private Map<String, String> getReplaceVars() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("SERVER_HOST", IPs.IP);
|
||||
map.put("SERVER_TOKEN", exposeToken);
|
||||
map.put("SERVER_URL", orionApiConfig.getUrl());
|
||||
map.put("SERVER_TOKEN", exposeApiConfig.getToken());
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.function.Functions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||
|
||||
@@ -22,10 +22,13 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
|
||||
@@ -44,6 +47,7 @@ import org.dromara.visor.module.infra.enums.DataExtraTypeEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -55,6 +59,7 @@ import java.util.stream.Collectors;
|
||||
* @version 1.0.0
|
||||
* @since 2023/12/20 12:11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HostExtraServiceImpl implements HostExtraService {
|
||||
|
||||
@@ -156,40 +161,57 @@ public class HostExtraServiceImpl implements HostExtraService {
|
||||
|
||||
@Override
|
||||
public void syncHostSpec(String key, String taskId, JSONObject spec) {
|
||||
try {
|
||||
// 查询主机id
|
||||
Long id = hostDAO.selectIdByAgentKey(key);
|
||||
Assert.notNull(id, ErrorMessage.HOST_ABSENT);
|
||||
// 设置已同步标识
|
||||
spec.put(Const.SYNCED, true);
|
||||
// 查询配置信息
|
||||
String newSpec;
|
||||
HostSpecExtraModel beforeSpec = this.getHostSpecMap(Lists.singleton(id)).get(id);
|
||||
if (beforeSpec == null) {
|
||||
// 新增
|
||||
newSpec = spec.toString();
|
||||
} else {
|
||||
// 合并
|
||||
JSONObject beforeSpecValue = JSON.parseObject(beforeSpec.serial());
|
||||
spec.forEach((k, v) -> {
|
||||
if (v != null) {
|
||||
beforeSpecValue.put(k, v);
|
||||
// 查询主机id
|
||||
Long id = hostDAO.selectIdByAgentKey(key);
|
||||
Assert.notNull(id, ErrorMessage.HOST_ABSENT);
|
||||
// 设置已同步标识
|
||||
spec.put(Const.SYNCED, true);
|
||||
// 查询配置信息
|
||||
String newSpec;
|
||||
HostSpecExtraModel beforeSpec = this.getHostSpecMap(Lists.singleton(id)).get(id);
|
||||
if (beforeSpec == null) {
|
||||
// 新增
|
||||
newSpec = spec.toString();
|
||||
} else {
|
||||
// 合并
|
||||
JSONObject beforeSpecValue = JSON.parseObject(beforeSpec.serial());
|
||||
spec.forEach((k, v) -> {
|
||||
// 获取原数据
|
||||
Object beforeValue = beforeSpecValue.get(k);
|
||||
// 检查是否存在
|
||||
boolean present = false;
|
||||
if (beforeValue != null) {
|
||||
if (beforeValue instanceof String) {
|
||||
present = !Strings.isBlank((String) beforeValue);
|
||||
} else if (beforeValue instanceof Collection) {
|
||||
present = !Lists.isEmpty((Collection<?>) beforeValue);
|
||||
} else if (beforeValue instanceof Map) {
|
||||
present = !Maps.isEmpty((Map<?, ?>) beforeValue);
|
||||
} else {
|
||||
present = true;
|
||||
}
|
||||
});
|
||||
newSpec = beforeSpecValue.toJSONString();
|
||||
}
|
||||
// 修改规格
|
||||
DataExtraSetDTO update = new DataExtraSetDTO();
|
||||
update.setUserId(Const.SYSTEM_USER_ID);
|
||||
update.setRelId(id);
|
||||
update.setItem(HostExtraItemEnum.SPEC.name());
|
||||
update.setValue(newSpec);
|
||||
dataExtraApi.setExtraItem(update, DataExtraTypeEnum.HOST);
|
||||
// 回调成功
|
||||
} catch (Exception e) {
|
||||
// 回调失败
|
||||
throw e;
|
||||
}
|
||||
// 不存在则覆盖
|
||||
if (!present && v != null) {
|
||||
beforeSpecValue.put(k, v);
|
||||
}
|
||||
});
|
||||
newSpec = beforeSpecValue.toJSONString();
|
||||
}
|
||||
// 检查是否能反解析 防止格式错误导致其他地方报错
|
||||
try {
|
||||
JSON.parseObject(newSpec, HostSpecExtraModel.class);
|
||||
} catch (Exception e) {
|
||||
log.error("HostExtraService-setHostSpec error: {}, spec: {}", e.getMessage(), newSpec, e);
|
||||
throw Exceptions.app(ErrorMessage.SPEC_FORMAT_INCORRECT, e);
|
||||
}
|
||||
// 修改规格
|
||||
DataExtraSetDTO update = new DataExtraSetDTO();
|
||||
update.setUserId(Const.SYSTEM_USER_ID);
|
||||
update.setRelId(id);
|
||||
update.setItem(HostExtraItemEnum.SPEC.name());
|
||||
update.setValue(newSpec);
|
||||
dataExtraApi.setExtraItem(update, DataExtraTypeEnum.HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.service.impl;
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -110,7 +110,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
||||
int effect = hostIdentityDAO.insert(record);
|
||||
log.info("HostIdentityService-createHostIdentity effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
||||
int effect = hostIdentityDAO.update(updateRecord, wrapper);
|
||||
log.info("HostIdentityService-updateHostIdentityById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.service.impl;
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
@@ -104,7 +104,7 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
log.info("HostKeyService-createHostKey effect: {}", effect);
|
||||
Long id = record.getId();
|
||||
// 删除缓存
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
int effect = hostKeyDAO.updateById(updateRecord);
|
||||
// 删除缓存
|
||||
if (!record.getName().equals(updateRecord.getName())) {
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
}
|
||||
log.info("HostKeyService-updateHostKeyById effect: {}", effect);
|
||||
return effect;
|
||||
|
||||
@@ -28,7 +28,7 @@ import cn.orionsec.kit.lang.utils.Booleans;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -39,6 +39,7 @@ import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.mybatis.core.query.DataQuery;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import org.dromara.visor.module.asset.convert.HostConvert;
|
||||
import org.dromara.visor.module.asset.dao.HostConfigDAO;
|
||||
@@ -376,7 +377,7 @@ public class HostServiceImpl implements HostService {
|
||||
|
||||
@Override
|
||||
public void clearCache() {
|
||||
RedisMaps.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
||||
RedisUtils.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.meta;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||
import cn.orionsec.kit.lang.utils.Colors;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.io.FileReaders;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.alibaba.fastjson2.filter.ValueFilter;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -27,7 +27,7 @@ import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.net.host.sftp.SftpExecutor;
|
||||
import cn.orionsec.kit.net.host.sftp.SftpFile;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.visor.module.common.config.AppSftpConfig;
|
||||
import org.dromara.visor.module.common.entity.dto.SftpFileBackupDTO;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import cn.orionsec.kit.net.host.SessionStore;
|
||||
import cn.orionsec.kit.net.host.sftp.SftpExecutor;
|
||||
import cn.orionsec.kit.net.host.ssh.command.CommandExecutor;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
|
||||
@@ -32,8 +32,8 @@ import cn.orionsec.kit.lang.utils.io.FileReaders;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.exec.service.impl;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
|
||||
@@ -28,7 +28,7 @@ import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.time.cron.Cron;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -32,7 +32,7 @@ import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import cn.orionsec.kit.web.servlet.web.Servlets;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.exec.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -29,7 +29,7 @@ import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -29,7 +29,7 @@ import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import cn.orionsec.kit.lang.utils.json.matcher.NoMatchStrategy;
|
||||
import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatter;
|
||||
import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatters;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.module.exec.entity.dto.ExecParameterSchemaDTO;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.infra.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.infra.api.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.module.infra.api.DictValueApi;
|
||||
import org.dromara.visor.module.infra.service.DictValueService;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.infra.api.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.module.infra.controller;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.infra.define.cache;
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyBuilder;
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
|
||||
import cn.orionsec.kit.lang.define.cache.key.struct.RedisCacheStruct;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.visor.module.infra.entity.dto.DictKeyCacheDTO;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
/*
|
||||
* 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.module.infra.entity.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.module.infra.handler.preference.model;
|
||||
|
||||
import cn.orionsec.kit.lang.able.IJsonObject;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.infra.handler.preference.strategy;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.net.host.ssh.TerminalType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.visor.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||
import org.dromara.visor.module.infra.handler.preference.model.TerminalPreferenceModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.infra.handler.upload;
|
||||
|
||||
import cn.orionsec.kit.lang.annotation.Keep;
|
||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||
import org.dromara.visor.common.file.FileClient;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.module.infra.handler.upload.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.file.FileClient;
|
||||
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.module.infra.service;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.visor.module.infra.entity.request.dict.DictValueCreateRequest;
|
||||
import org.dromara.visor.module.infra.entity.request.dict.DictValueQueryRequest;
|
||||
import org.dromara.visor.module.infra.entity.request.dict.DictValueRollbackRequest;
|
||||
|
||||
@@ -27,7 +27,7 @@ import cn.orionsec.kit.lang.utils.Booleans;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.crypto.Signatures;
|
||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.visor.common.config.ConfigStore;
|
||||
import org.dromara.visor.common.constant.ConfigKeys;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
@@ -42,6 +42,7 @@ import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.common.utils.Requests;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
|
||||
import org.dromara.visor.module.common.config.AppLoginConfig;
|
||||
import org.dromara.visor.module.infra.api.SystemMessageApi;
|
||||
@@ -420,7 +421,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
||||
}
|
||||
// 删除续签信息
|
||||
if (Booleans.isTrue(appLoginConfig.getAllowRefresh())) {
|
||||
RedisStrings.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
|
||||
RedisUtils.scanKeysDelete(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.framework.mybatis.core.query.ThenLambdaWrapper;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import org.dromara.visor.module.infra.dao.DataExtraDAO;
|
||||
import org.dromara.visor.module.infra.define.cache.DataExtraCacheKeyDefine;
|
||||
@@ -92,7 +93,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
insert.setValue(request.getValue());
|
||||
dataExtraDAO.insert(insert);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
|
||||
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(request.getUserId(), request.getType(), request.getItem()));
|
||||
return insert.getId();
|
||||
}
|
||||
|
||||
@@ -114,7 +115,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
Set<String> keys = rows.stream()
|
||||
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
|
||||
.collect(Collectors.toSet());
|
||||
RedisMaps.delete(keys);
|
||||
RedisUtils.delete(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +134,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
// 更新
|
||||
int effect = dataExtraDAO.updateById(update);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
|
||||
RedisUtils.delete(DataExtraCacheKeyDefine.DATA_EXTRA.format(data.getUserId(), data.getType(), data.getItem()));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -315,7 +316,7 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
.map(s -> DataExtraCacheKeyDefine.DATA_EXTRA.format(s.getUserId(), s.getType(), s.getItem()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
RedisMaps.delete(keys);
|
||||
RedisUtils.delete(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.module.infra.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -346,7 +346,7 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
.map(s -> DataPermissionCacheKeyDefine.DATA_PERMISSION_USER.format(value, s))
|
||||
.forEach(keys::add);
|
||||
}
|
||||
RedisLists.delete(keys);
|
||||
RedisUtils.delete(keys);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import cn.orionsec.kit.lang.utils.Objects1;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -25,8 +25,8 @@ package org.dromara.visor.module.infra.service.impl;
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisLists;
|
||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
|
||||
import org.dromara.visor.module.infra.convert.FavoriteConvert;
|
||||
@@ -79,7 +80,7 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
// 插入
|
||||
favoriteDAO.insert(record);
|
||||
// 删除缓存
|
||||
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
// 删除库
|
||||
int effect = favoriteDAO.deleteFavorite(type, userId, relId);
|
||||
// 删除缓存
|
||||
RedisLists.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
RedisUtils.delete(FavoriteCacheKeyDefine.FAVORITE.format(type, userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.infra.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.module.infra.convert.HistoryValueConvert;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.module.infra.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.infra.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.utils.Arrays1;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
|
||||
@@ -26,7 +26,7 @@ import cn.orionsec.kit.lang.function.Functions;
|
||||
import cn.orionsec.kit.lang.utils.Objects1;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Assert;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user