Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b53924dbd | ||
|
|
3359d163fb | ||
|
|
2ef1517338 | ||
|
|
a5bee66afa | ||
|
|
88fd0e31e0 | ||
|
|
226dfb2c25 | ||
|
|
94ed071897 | ||
|
|
4efd2b5ec2 | ||
|
|
76e766367f | ||
|
|
b3009bb65e | ||
|
|
819520ef73 | ||
|
|
a2acbc0c3a | ||
|
|
2e8a7c40d9 | ||
|
|
94c0b6a785 | ||
|
|
9752dfa680 | ||
|
|
bc776e4186 | ||
|
|
cdce5a0dc1 | ||
|
|
0db732fc19 | ||
|
|
69f331c048 | ||
|
|
032f1763f6 | ||
|
|
d071ef64d8 | ||
|
|
c820443a3b | ||
|
|
14c4e77445 | ||
|
|
79d9f69ed4 | ||
|
|
6c9065072d | ||
|
|
05bc6c1fbb | ||
|
|
a1dd9eec01 | ||
|
|
660df7c110 | ||
|
|
093501a400 | ||
|
|
7943deb924 | ||
|
|
490167e649 | ||
|
|
8635f6bb05 | ||
|
|
9e31d820e0 | ||
|
|
92353d859a | ||
|
|
bef8d69e59 | ||
|
|
ac46dd6703 | ||
|
|
b3ab78e063 | ||
|
|
95d2c6cb65 | ||
|
|
7017c7502b | ||
|
|
c14055ba8c | ||
|
|
04aa6c9680 | ||
|
|
397bbb2657 | ||
|
|
9a68282127 | ||
|
|
dcd02acc61 | ||
|
|
1025688e9b | ||
|
|
26eeb26a75 | ||
|
|
7f76325284 | ||
|
|
de9a921c49 | ||
|
|
a9ac9d0f79 | ||
|
|
a14b28de6a | ||
|
|
ccd7430b8f | ||
|
|
6791ea5770 | ||
|
|
2d5835b150 | ||
|
|
cec11ce8c3 | ||
|
|
972103841c | ||
|
|
89f6d2cd1c | ||
|
|
d13008ce0c | ||
|
|
abf384dd3c | ||
|
|
0abd4a893b | ||
|
|
d0710fb52b | ||
|
|
81b9bacb96 | ||
|
|
dc42a31711 | ||
|
|
27e3e65ea1 | ||
|
|
a001ab3f16 |
@@ -1,6 +1,9 @@
|
||||
SERVICE_PORT=1081
|
||||
VOLUME_BASE=/data/orion-visor-space/docker-volumes
|
||||
|
||||
SERVICE_PORT=1081
|
||||
SPRING_PROFILES_ACTIVE=prod
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
|
||||
MYSQL_HOST=mysql
|
||||
MYSQL_PORT=3306
|
||||
MYSQL_DATABASE=orion_visor
|
||||
@@ -11,5 +14,4 @@ MYSQL_ROOT_PASSWORD=Data@123456
|
||||
REDIS_HOST=redis
|
||||
REDIS_PASSWORD=Data@123456
|
||||
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
DEMO_MODE=false
|
||||
|
||||
11
README.md
11
README.md
@@ -64,6 +64,7 @@
|
||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||
* 📛 演示环境请不要随便删除数据!
|
||||
* 📧 如果演示环境不可用请联系我!
|
||||
* 📨 **作者已被毕(cai)业(yuan) 寻java高级内推 望京/5号/10号线 有坑位的联系我哦** 微信: `ljh1553488`
|
||||
|
||||
## 快速开始
|
||||
|
||||
@@ -86,11 +87,11 @@ docker compose up -d
|
||||
|
||||
## 技术栈
|
||||
|
||||
* SpringBoot 2.7.+
|
||||
* Mysql 8.0.+
|
||||
* Redis 6.0.+
|
||||
* Vue3 3.2.+
|
||||
* Arco Design 2.55.+
|
||||
* SpringBoot 2.7+
|
||||
* Mysql 8+
|
||||
* Redis 6+
|
||||
* Vue3 3+
|
||||
* Arco Design 2+
|
||||
|
||||
## 主要功能预览
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:latest
|
||||
privileged: true
|
||||
ports:
|
||||
- 1081:80
|
||||
- 9200:9200
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=prod
|
||||
- MYSQL_HOST=mysql
|
||||
- MYSQL_PORT=3306
|
||||
- MYSQL_DATABASE=orion_visor
|
||||
@@ -19,18 +21,18 @@ services:
|
||||
- /data/orion-visor-space/docker-volumes/service/root-orion:/root/orion
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
|
||||
interval: 3s
|
||||
timeout: 300s
|
||||
retries: 200
|
||||
start_period: 3s
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 15s
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- mysql
|
||||
- redis
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:latest
|
||||
privileged: true
|
||||
@@ -44,13 +46,15 @@ services:
|
||||
volumes:
|
||||
- /data/orion-visor-space/docker-volumes/mysql/var-lib-mysql:/var/lib/mysql
|
||||
- /data/orion-visor-space/docker-volumes/mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||
- /data/orion-visor-space/docker-volumes/mysql/etc-mysql:/etc/mysql
|
||||
healthcheck:
|
||||
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
start_period: 5s
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest
|
||||
privileged: true
|
||||
@@ -63,10 +67,13 @@ services:
|
||||
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 3s
|
||||
timeout: 60s
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
start_period: 5s
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
testing:
|
||||
build:
|
||||
context: ./docker/e2e
|
||||
@@ -75,5 +82,9 @@ services:
|
||||
depends_on:
|
||||
service:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- service
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
networks:
|
||||
orion-visor-net:
|
||||
driver: bridge
|
||||
@@ -1,11 +1,24 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
ui:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:latest
|
||||
ports:
|
||||
- ${SERVICE_PORT:-1081}:80
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
service:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:latest
|
||||
privileged: true
|
||||
ports:
|
||||
- ${SERVICE_PORT:-1081}:80
|
||||
- 9200:9200
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-prod}
|
||||
- MYSQL_HOST=${MYSQL_HOST:-mysql}
|
||||
- MYSQL_PORT=${MYSQL_PORT:-3306}
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
|
||||
@@ -17,20 +30,21 @@ services:
|
||||
- DEMO_MODE=${DEMO_MODE:-false}
|
||||
volumes:
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/service/root-orion:/root/orion
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
|
||||
interval: 15s
|
||||
timeout: 300s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
start_period: 30s
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- mysql
|
||||
- redis
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:latest
|
||||
privileged: true
|
||||
@@ -44,13 +58,16 @@ services:
|
||||
volumes:
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/mysql/var-lib-mysql:/var/lib/mysql
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/mysql/etc-mysql:/etc/mysql
|
||||
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
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest
|
||||
privileged: true
|
||||
@@ -61,18 +78,28 @@ services:
|
||||
volumes:
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/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
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
adminer:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:latest
|
||||
ports:
|
||||
- 8081:8080
|
||||
environment:
|
||||
- ADMINER_DEFAULT_SERVER=${MYSQL_HOST:-mysql}
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- mysql
|
||||
networks:
|
||||
- orion-visor-net
|
||||
|
||||
networks:
|
||||
orion-visor-net:
|
||||
driver: bridge
|
||||
@@ -1,5 +1,6 @@
|
||||
#/bin/bash
|
||||
version=2.3.1
|
||||
set -e
|
||||
version=2.3.6
|
||||
docker build -t orion-visor-adminer:${version} .
|
||||
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version}
|
||||
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:latest
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
|
||||
name: orion-visor
|
||||
api: |
|
||||
{{default "http://orion-visor-service:80" (env "SERVER")}}
|
||||
{{default "http://orion-visor-service:9200" (env "SERVER")}}
|
||||
items:
|
||||
- name: login
|
||||
request:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#/bin/bash
|
||||
version=2.3.1
|
||||
set -e
|
||||
version=2.3.6
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
|
||||
@@ -12,7 +12,7 @@ socket=/var/run/mysqld/mysqld.sock
|
||||
# 数据目录
|
||||
datadir=/var/lib/mysql
|
||||
# 不区分大小 0区分 1不区分
|
||||
lower_case_table_names=1
|
||||
lower_case_table_names=0
|
||||
# 服务器时区
|
||||
default-time_zone='+8:00'
|
||||
# 服务端字符集
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#/bin/bash
|
||||
version=2.3.1
|
||||
set -e
|
||||
version=2.3.6
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:latest
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:latest
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:latest
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:latest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#/bin/bash
|
||||
version=2.3.1
|
||||
set -e
|
||||
version=2.3.6
|
||||
docker build -t orion-visor-redis:${version} .
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version}
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM nginx:alpine
|
||||
FROM openjdk:8-jdk-alpine
|
||||
USER root
|
||||
WORKDIR /app
|
||||
# 系统时区
|
||||
@@ -7,18 +7,14 @@ ARG TZ=Asia/Shanghai
|
||||
RUN \
|
||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add curl && \
|
||||
apk add udev && \
|
||||
apk add tzdata && \
|
||||
apk add dmidecode && \
|
||||
apk add openjdk8
|
||||
apk add dmidecode
|
||||
# 设置时区
|
||||
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
||||
echo '${TZ}' > /etc/timezone
|
||||
# 删除原 nginx 配置
|
||||
RUN rm -rf /etc/nginx/conf.d/*
|
||||
# 复制包
|
||||
COPY ./orion-visor-launch.jar /app/app.jar
|
||||
COPY ./dist /usr/share/nginx/html
|
||||
COPY ./entrypoint.sh /app/entrypoint.sh
|
||||
COPY ./nginx.conf /etc/nginx/conf.d
|
||||
# 启动
|
||||
ENTRYPOINT [ "sh", "/app/entrypoint.sh" ]
|
||||
CMD ["java", "-jar", "/app/app.jar"]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#/bin/bash
|
||||
version=2.3.1
|
||||
set -e
|
||||
version=2.3.6
|
||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||
mv ../../orion-visor-ui/dist ./dist
|
||||
docker build --no-cache -t orion-visor-service:${version} .
|
||||
docker build -t orion-visor-service:${version} .
|
||||
rm -rf ./orion-visor-launch.jar
|
||||
rm -rf ./dist
|
||||
docker tag orion-visor-service:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:${version}
|
||||
docker tag orion-visor-service:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:latest
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd /app
|
||||
nohup java -jar app.jar --spring.profiles.active=prod 2>&1 &
|
||||
nginx -g 'daemon off;'
|
||||
18
docker/ui/Dockerfile
Normal file
18
docker/ui/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM nginx:alpine
|
||||
# 系统时区
|
||||
ARG TZ=Asia/Shanghai
|
||||
# 添加包
|
||||
RUN \
|
||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add tzdata
|
||||
# 设置时区
|
||||
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
||||
echo '${TZ}' > /etc/timezone
|
||||
# 删除原 nginx 配置
|
||||
RUN rm -rf /etc/nginx/conf.d/*
|
||||
# 复制包
|
||||
COPY ./dist /usr/share/nginx/html
|
||||
COPY ./nginx.conf /etc/nginx/conf.d
|
||||
# 启动
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
9
docker/ui/build.sh
Normal file
9
docker/ui/build.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#/bin/bash
|
||||
set -e
|
||||
version=2.3.6
|
||||
mv ../../orion-visor-ui/dist ./dist
|
||||
docker build -t orion-visor-ui:${version} .
|
||||
rm -rf ./orion-visor-launch.jar
|
||||
rm -rf ./dist
|
||||
docker tag orion-visor-ui:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:${version}
|
||||
docker tag orion-visor-ui:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:latest
|
||||
@@ -19,7 +19,7 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# web history 模式 404
|
||||
@@ -27,7 +27,7 @@ server {
|
||||
}
|
||||
|
||||
location /orion-visor/api {
|
||||
proxy_pass http://localhost:9200/orion-visor/api;
|
||||
proxy_pass http://service:9200/orion-visor/api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -35,7 +35,7 @@ server {
|
||||
}
|
||||
|
||||
location /orion-visor/keep-alive {
|
||||
proxy_pass http://localhost:9200/orion-visor/keep-alive;
|
||||
proxy_pass http://service:9200/orion-visor/keep-alive;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
@@ -20,21 +20,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.launch.configuration;
|
||||
package org.dromara.visor.common.configuration;
|
||||
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 应用配置类
|
||||
* spring 配置类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/6/20 10:34
|
||||
*/
|
||||
@Configuration
|
||||
public class LaunchApplicationConfiguration {
|
||||
public class SpringConfiguration {
|
||||
|
||||
/**
|
||||
* @return spring 容器工具类
|
||||
@@ -36,7 +36,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.3.1";
|
||||
String VERSION = "2.3.6";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
|
||||
@@ -31,14 +31,119 @@ package org.dromara.visor.common.constant;
|
||||
*/
|
||||
public interface ConfigKeys {
|
||||
|
||||
/**
|
||||
* SFTP 文件预览大小
|
||||
*/
|
||||
String SFTP_PREVIEW_SIZE = "sftp_previewSize";
|
||||
|
||||
/**
|
||||
* SFTP 重复文件备份
|
||||
*/
|
||||
String SFTP_UPLOAD_PRESENT_BACKUP = "sftp_uploadPresentBackup";
|
||||
|
||||
/**
|
||||
* SFTP 备份文件名称
|
||||
*/
|
||||
String SFTP_UPLOAD_BACKUP_FILE_NAME = "sftp_uploadBackupFileName";
|
||||
|
||||
/**
|
||||
* 加密公钥
|
||||
*/
|
||||
String ENCRYPT_PUBLIC_KEY = "encrypt.publicKey";
|
||||
String ENCRYPT_PUBLIC_KEY = "encrypt_publicKey";
|
||||
|
||||
/**
|
||||
* 加密私钥
|
||||
*/
|
||||
String ENCRYPT_PRIVATE_KEY = "encrypt.privateKey";
|
||||
String ENCRYPT_PRIVATE_KEY = "encrypt_privateKey";
|
||||
|
||||
/**
|
||||
* 日志前端显示行数
|
||||
*/
|
||||
String LOG_WEB_SCROLL_LINES = "log_webScrollLines";
|
||||
|
||||
/**
|
||||
* 日志加载偏移行
|
||||
*/
|
||||
String LOG_TRACKER_LOAD_LINES = "log_trackerLoadLines";
|
||||
|
||||
/**
|
||||
* 日志加载间隔毫秒
|
||||
*/
|
||||
String LOG_TRACKER_LOAD_INTERVAL = "log_trackerLoadInterval";
|
||||
|
||||
/**
|
||||
* 是否生成详细的执行日志
|
||||
*/
|
||||
String LOG_EXEC_DETAIL_LOG = "log_execDetailLog";
|
||||
|
||||
/**
|
||||
* 凭证有效期分
|
||||
*/
|
||||
String LOGIN_LOGIN_SESSION_TIME = "login_loginSessionTime";
|
||||
|
||||
/**
|
||||
* 允许多端登录
|
||||
*/
|
||||
String LOGIN_ALLOW_MULTI_DEVICE = "login_allowMultiDevice";
|
||||
|
||||
/**
|
||||
* 允许凭证续签
|
||||
*/
|
||||
String LOGIN_ALLOW_REFRESH = "login_allowRefresh";
|
||||
|
||||
/**
|
||||
* 凭证续签最大次数
|
||||
*/
|
||||
String LOGIN_MAX_REFRESH_COUNT = "login_maxRefreshCount";
|
||||
|
||||
/**
|
||||
* 凭证续签间隔分
|
||||
*/
|
||||
String LOGIN_REFRESH_INTERVAL = "login_refreshInterval";
|
||||
|
||||
/**
|
||||
* 登录失败锁定
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_LOCK = "login_loginFailedLock";
|
||||
|
||||
/**
|
||||
* 登录失败锁定阈值分
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_LOCK_THRESHOLD = "login_loginFailedLockThreshold";
|
||||
|
||||
/**
|
||||
* 登录失败锁定时间分
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_LOCK_TIME = "login_loginFailedLockTime";
|
||||
|
||||
/**
|
||||
* 登录失败发信
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_SEND = "login_loginFailedSend";
|
||||
|
||||
/**
|
||||
* 登录失败发信阈值
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_SEND_THRESHOLD = "login_loginFailedSendThreshold";
|
||||
|
||||
/**
|
||||
* 是否开启自动清理命令记录
|
||||
*/
|
||||
String AUTO_CLEAR_EXEC_LOG_ENABLED = "autoClear_execLogEnabled";
|
||||
|
||||
/**
|
||||
* 自动清理命令记录保留天数
|
||||
*/
|
||||
String AUTO_CLEAR_EXEC_LOG_KEEP_DAYS = "autoClear_execLogKeepDays";
|
||||
|
||||
/**
|
||||
* 是否开启自动清理终端连接记录
|
||||
*/
|
||||
String AUTO_CLEAR_TERMINAL_LOG_ENABLED = "autoClear_terminalLogEnabled";
|
||||
|
||||
/**
|
||||
* 自动清理终端连接记录保留天数
|
||||
*/
|
||||
String AUTO_CLEAR_TERMINAL_LOG_KEEP_DAYS = "autoClear_terminalLogKeepDays";
|
||||
|
||||
}
|
||||
|
||||
@@ -31,15 +31,15 @@ import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 公共页码请求
|
||||
* 基本查询请求
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/12 23:14
|
||||
*/
|
||||
@Data
|
||||
@Schema(name = "PageRequest", description = "公共页码请求")
|
||||
public class PageRequest {
|
||||
@Schema(name = "BaseQueryRequest", description = "基本查询请求")
|
||||
public class BaseQueryRequest implements IPageRequest, IOrderRequest {
|
||||
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@@ -53,4 +53,7 @@ public class PageRequest {
|
||||
@Schema(description = "大小")
|
||||
private Integer limit;
|
||||
|
||||
@Schema(description = "查询排序")
|
||||
private Integer order;
|
||||
|
||||
}
|
||||
@@ -20,31 +20,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
/**
|
||||
* 应用执行日志配置
|
||||
* 查询排序请求
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/4/25 13:36
|
||||
* @since 2025/3/17 22:04
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "app.exec-log")
|
||||
public class AppExecLogConfig {
|
||||
public interface IOrderRequest {
|
||||
|
||||
/**
|
||||
* 是否拼接 ansi 执行状态日志
|
||||
* 查询排序
|
||||
*
|
||||
* @return sort 0DESC 1ASC 其他不排序
|
||||
*/
|
||||
private Boolean appendAnsi;
|
||||
|
||||
public AppExecLogConfig() {
|
||||
this.appendAnsi = true;
|
||||
}
|
||||
Integer getOrder();
|
||||
|
||||
}
|
||||
@@ -20,29 +20,29 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.infra.handler.setting.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
/**
|
||||
* SFTP 系统设置模型
|
||||
* 页码请求
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/10/9 11:45
|
||||
* @since 2025/3/17 22:02
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SftpSystemSettingModel {
|
||||
public interface IPageRequest {
|
||||
|
||||
/**
|
||||
* 预览大小
|
||||
* 页码
|
||||
*
|
||||
* @return page
|
||||
*/
|
||||
private Integer previewSize;
|
||||
Integer getPage();
|
||||
|
||||
/**
|
||||
* 大小
|
||||
*
|
||||
* @return limit
|
||||
*/
|
||||
Integer getLimit();
|
||||
|
||||
}
|
||||
@@ -45,4 +45,11 @@ public interface SecurityHolder {
|
||||
*/
|
||||
Long getLoginUserId();
|
||||
|
||||
/**
|
||||
* 获取当前用户名
|
||||
*
|
||||
* @return username
|
||||
*/
|
||||
String getLoginUsername();
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.3.1</revision>
|
||||
<revision>2.3.6</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>
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.mybatis.core.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
@@ -41,10 +42,17 @@ import java.util.Date;
|
||||
* @since 2023/6/23 18:42
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
@@ -70,4 +78,4 @@ public class BaseDO implements Serializable {
|
||||
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.TINYINT)
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@
|
||||
package org.dromara.visor.framework.mybatis.core.generator;
|
||||
|
||||
import cn.orionsec.kit.lang.constant.Const;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.Systems;
|
||||
import cn.orionsec.kit.lang.utils.ansi.AnsiAppender;
|
||||
import cn.orionsec.kit.lang.utils.ansi.style.AnsiFont;
|
||||
import cn.orionsec.kit.lang.utils.ansi.style.color.AnsiForeground;
|
||||
@@ -32,6 +34,8 @@ import org.dromara.visor.framework.mybatis.core.generator.template.Table;
|
||||
import org.dromara.visor.framework.mybatis.core.generator.template.Template;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 代码生成器
|
||||
@@ -42,6 +46,8 @@ import java.io.File;
|
||||
*/
|
||||
public class CodeGenerators {
|
||||
|
||||
private static final Pattern ENV_VAR_PATTERN = Pattern.compile("\\$\\{([^:]+):([^}]+)\\}");
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 输出路径
|
||||
String outputDir = "D:/MP/";
|
||||
@@ -76,11 +82,6 @@ public class CodeGenerators {
|
||||
.disableUnitTest()
|
||||
.enableProviderApi()
|
||||
.vue("system", "message")
|
||||
.dict("messageClassify", "classify", "messageClassify")
|
||||
.comment("消息分类")
|
||||
.fields("NOTICE", "TODO")
|
||||
.labels("通知", "待办")
|
||||
.valueUseFields()
|
||||
.dict("messageType", "type", "messageType")
|
||||
.comment("消息类型")
|
||||
.fields("EXEC_FAILED", "UPLOAD_FAILED")
|
||||
@@ -94,9 +95,9 @@ public class CodeGenerators {
|
||||
// jdbc 配置 - 使用配置文件
|
||||
File yamlFile = new File("orion-visor-launch/src/main/resources/application-dev.yaml");
|
||||
YmlExt yaml = YmlExt.load(yamlFile);
|
||||
String url = yaml.getValue("spring.datasource.druid.url");
|
||||
String username = yaml.getValue("spring.datasource.druid.username");
|
||||
String password = yaml.getValue("spring.datasource.druid.password");
|
||||
String url = resolveConfigValue(yaml.getValue("spring.datasource.druid.url"));
|
||||
String username = resolveConfigValue(yaml.getValue("spring.datasource.druid.username"));
|
||||
String password = resolveConfigValue(yaml.getValue("spring.datasource.druid.password"));
|
||||
|
||||
// 执行
|
||||
runGenerator(outputDir, author,
|
||||
@@ -147,4 +148,31 @@ public class CodeGenerators {
|
||||
System.out.print(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析实际的配置
|
||||
*
|
||||
* @param value value
|
||||
* @return value
|
||||
*/
|
||||
private static String resolveConfigValue(String value) {
|
||||
if (Strings.isBlank(value)) {
|
||||
return value;
|
||||
}
|
||||
Matcher matcher = ENV_VAR_PATTERN.matcher(value);
|
||||
StringBuffer resultString = new StringBuffer();
|
||||
while (matcher.find()) {
|
||||
// 环境变量名
|
||||
String envVar = matcher.group(1);
|
||||
// 默认值
|
||||
String defaultValue = matcher.group(2);
|
||||
// 获取环境变量的值
|
||||
String envValue = Systems.getEnv(envVar, defaultValue);
|
||||
// 替换占位符
|
||||
matcher.appendReplacement(resultString, Matcher.quoteReplacement(envValue));
|
||||
}
|
||||
// 处理结尾的剩余部分
|
||||
matcher.appendTail(resultString);
|
||||
return resultString.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
package org.dromara.visor.framework.mybatis.core.query;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import cn.orionsec.kit.lang.define.wrapper.IPageRequest;
|
||||
import cn.orionsec.kit.lang.define.wrapper.PageRequest;
|
||||
import cn.orionsec.kit.lang.define.wrapper.Pager;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
@@ -33,11 +32,16 @@ import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.reflect.Classes;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.interfaces.Func;
|
||||
import com.baomidou.mybatisplus.core.conditions.interfaces.Join;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.entity.IOrderRequest;
|
||||
import org.dromara.visor.common.entity.IPageRequest;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.common.utils.SqlUtils;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
@@ -96,9 +100,9 @@ public class DataQuery<T> {
|
||||
return new DataQuery<>(dao, wrapper);
|
||||
}
|
||||
|
||||
public DataQuery<T> page(org.dromara.visor.common.entity.PageRequest page) {
|
||||
org.dromara.visor.common.entity.PageRequest pr = Valid.notNull(page, "page is null");
|
||||
this.page = new PageRequest(pr.getPage(), pr.getLimit());
|
||||
public DataQuery<T> page(IPageRequest request) {
|
||||
Valid.notNull(request, "page is null");
|
||||
this.page = new PageRequest(request.getPage(), request.getLimit());
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -130,15 +134,30 @@ public class DataQuery<T> {
|
||||
return then;
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(IPageRequest page) {
|
||||
return this.last(Pager.of(page).getSql());
|
||||
public DataQuery<T> order(IOrderRequest request, SFunction<T, ?> column) {
|
||||
BooleanBit sorted = BooleanBit.of(request.getOrder());
|
||||
if (sorted == null) {
|
||||
return this;
|
||||
}
|
||||
return this.order(sorted.booleanValue(), column);
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int limit) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public DataQuery<T> order(boolean asc, SFunction<T, ?> column) {
|
||||
// 设置排序
|
||||
if (wrapper instanceof Func) {
|
||||
((Func<? extends T, SFunction<? extends T, ?>>) wrapper).orderBy(true, asc, column);
|
||||
return this;
|
||||
} else {
|
||||
throw Exceptions.argument("wrapper not implements Func");
|
||||
}
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(Number limit) {
|
||||
return this.last(SqlUtils.limit(limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int offset, int limit) {
|
||||
public DataQuery<T> limit(Number offset, Number limit) {
|
||||
return this.last(SqlUtils.limit(offset, limit));
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class DomainFillUtils {
|
||||
*/
|
||||
public static void fillInsert(BaseDO baseDO) {
|
||||
Date now = new Date();
|
||||
String username = securityHolder.getLoginUsername();
|
||||
// 创建时间
|
||||
if (Objects.isNull(baseDO.getCreateTime())) {
|
||||
baseDO.setCreateTime(now);
|
||||
@@ -58,15 +59,13 @@ public class DomainFillUtils {
|
||||
if (Objects.isNull(baseDO.getUpdateTime())) {
|
||||
baseDO.setUpdateTime(now);
|
||||
}
|
||||
|
||||
Long userId = securityHolder.getLoginUserId();
|
||||
// 创建人
|
||||
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
|
||||
baseDO.setCreator(userId.toString());
|
||||
if (Objects.nonNull(username) && Objects.isNull(baseDO.getCreator())) {
|
||||
baseDO.setCreator(username);
|
||||
}
|
||||
// 更新人
|
||||
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getUpdater())) {
|
||||
baseDO.setUpdater(userId.toString());
|
||||
if (Objects.nonNull(username) && Objects.isNull(baseDO.getUpdater())) {
|
||||
baseDO.setUpdater(username);
|
||||
}
|
||||
// 逻辑删除字段
|
||||
if (Objects.isNull(baseDO.getDeleted())) {
|
||||
@@ -85,9 +84,9 @@ public class DomainFillUtils {
|
||||
baseDO.setUpdateTime(new Date());
|
||||
}
|
||||
// 更新人
|
||||
Long userId = securityHolder.getLoginUserId();
|
||||
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getUpdater())) {
|
||||
baseDO.setUpdater(userId.toString());
|
||||
String username = securityHolder.getLoginUsername();
|
||||
if (Objects.nonNull(username) && Objects.isNull(baseDO.getUpdater())) {
|
||||
baseDO.setUpdater(username);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.*;
|
||||
@@ -38,7 +39,7 @@ import java.math.*;
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -66,17 +67,8 @@ public class ${entity} {
|
||||
#if("$!field.comment" != "")
|
||||
@Schema(description = "${field.comment}")
|
||||
#end
|
||||
#if(${field.keyFlag})
|
||||
## 主键
|
||||
#if(${field.keyIdentityFlag})
|
||||
@TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
|
||||
#elseif(!$null.isNull(${idType}) && "$!idType" != "")
|
||||
@TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
|
||||
#elseif(${field.convert})
|
||||
@TableId("${field.annotationColumnName}")
|
||||
#end
|
||||
## 普通字段
|
||||
#elseif(${field.fill})
|
||||
#if(${field.fill})
|
||||
## ----- 存在字段填充设置 -----
|
||||
#if(${field.convert})
|
||||
@TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
|
||||
|
||||
@@ -25,11 +25,9 @@ package ${currentPackage};
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.*;
|
||||
import java.math.*;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 查询请求对象
|
||||
@@ -44,7 +42,7 @@ import java.math.*;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "${type}QueryRequest", description = "$!{table.comment} 查询请求对象")
|
||||
public class ${type}QueryRequest extends PageRequest {
|
||||
public class ${type}QueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "搜索")
|
||||
private String searchValue;
|
||||
|
||||
@@ -144,10 +144,11 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
@Override
|
||||
public List<${type}VO> get${type}List(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::to);
|
||||
return ${typeLower}DAO.of(wrapper)
|
||||
.order(request, ${type}DO::getId)
|
||||
.list(${type}Convert.MAPPER::to);
|
||||
}
|
||||
#if($meta.enableCache)
|
||||
|
||||
@@ -176,12 +177,12 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.page(request)
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.order(request, ${type}DO::getId)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ SELECT @TYPE_KEY_ID:= id FROM dict_key WHERE key_name = 'operatorLogType' AND de
|
||||
INSERT INTO dict_value
|
||||
(`key_id`, `key_name`, `value`, `label`, `extra`, `sort`, `create_time`, `update_time`, `creator`, `updater`, `deleted`)
|
||||
VALUES
|
||||
(@MODULE_KEY_ID, 'operatorLogModule', '${package.ModuleName}:${typeHyphen}', '$!{table.comment}', '{}', @MODULE_KEY_MAX_SORT + 10, now(), now(), '1', '1', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:create', '创建$!{table.comment}', '{}', 10, now(), now(), '1', '1', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:update', '更新$!{table.comment}', '{}', 20, now(), now(), '1', '1', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), '1', '1', 0);
|
||||
(@MODULE_KEY_ID, 'operatorLogModule', '${package.ModuleName}:${typeHyphen}', '$!{table.comment}', '{}', @MODULE_KEY_MAX_SORT + 10, now(), now(), 'admin', 'admin', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:create', '创建$!{table.comment}', '{}', 10, now(), now(), 'admin', 'admin', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:update', '更新$!{table.comment}', '{}', 20, now(), now(), 'admin', 'admin', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), 'admin', 'admin', 0);
|
||||
#end
|
||||
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
@@ -23,7 +23,7 @@ VALUES
|
||||
INSERT INTO dict_key
|
||||
(`key_name`, `value_type`, `extra_schema`, `description`, `create_time`, `update_time`, `creator`, `updater`, `deleted`)
|
||||
VALUES
|
||||
('$enumEntity.value.keyName', 'STRING', '$enumEntity.value.extraSchema', '$enumEntity.value.comment', now(), now(), '1', '1', 0);
|
||||
('$enumEntity.value.keyName', 'STRING', '$enumEntity.value.extraSchema', '$enumEntity.value.comment', now(), now(), 'admin', 'admin', 0);
|
||||
|
||||
-- 设置临时配置项id
|
||||
SELECT @TMP_KEY_ID:=LAST_INSERT_ID();
|
||||
@@ -35,7 +35,7 @@ VALUES
|
||||
#set($count = $enumEntity.value.fields.size() - 1)
|
||||
#foreach($index in [0..$count])
|
||||
#set($sort = $index * 10 + 10)
|
||||
(@TMP_KEY_ID, '$enumEntity.value.keyName', '$enumEntity.value.values.get($index)', '$enumEntity.value.labels.get($index)', #if($enumEntity.value.extraJson.size() > $index)'$enumEntity.value.extraJson.get($index)'#else'{}'#end, $sort, now(), now(), '1', '1', 0)#if($foreach.hasNext),#else;#end
|
||||
(@TMP_KEY_ID, '$enumEntity.value.keyName', '$enumEntity.value.values.get($index)', '$enumEntity.value.labels.get($index)', #if($enumEntity.value.extraJson.size() > $index)'$enumEntity.value.extraJson.get($index)'#else'{}'#end, $sort, now(), now(), 'admin', 'admin', 0)#if($foreach.hasNext),#else;#end
|
||||
#end
|
||||
|
||||
#end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
INSERT INTO system_menu
|
||||
(parent_id, name, type, sort, visible, status, cache, component, creator, updater, deleted)
|
||||
VALUES
|
||||
(0, '${table.comment}管理', 1, 10, 1, 1, 1, '${vue.moduleEntityFirstLower}Module', '1', '1', 0);
|
||||
(0, '${table.comment}管理', 1, 10, 1, 1, 1, '${vue.moduleEntityFirstLower}Module', 'admin', 'admin', 0);
|
||||
|
||||
-- 设置临时父菜单id
|
||||
SELECT @TMP_PARENT_ID:=LAST_INSERT_ID();
|
||||
@@ -13,7 +13,7 @@ SELECT @TMP_PARENT_ID:=LAST_INSERT_ID();
|
||||
INSERT INTO system_menu
|
||||
(parent_id, name, type, sort, visible, status, cache, component, creator, updater, deleted)
|
||||
VALUES
|
||||
(@TMP_PARENT_ID, '$table.comment', 2, 10, 1, 1, 1, '$vue.featureEntityFirstLower', '1', '1', 0);
|
||||
(@TMP_PARENT_ID, '$table.comment', 2, 10, 1, 1, 1, '$vue.featureEntityFirstLower', 'admin', 'admin', 0);
|
||||
|
||||
-- 设置临时子菜单id
|
||||
SELECT @TMP_SUB_ID:=LAST_INSERT_ID();
|
||||
@@ -22,7 +22,7 @@ SELECT @TMP_SUB_ID:=LAST_INSERT_ID();
|
||||
INSERT INTO system_menu
|
||||
(parent_id, name, permission, type, sort, creator, updater, deleted)
|
||||
VALUES
|
||||
(@TMP_SUB_ID, '查询$table.comment', '${package.ModuleName}:${typeHyphen}:query', 3, 10, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '创建$table.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '修改$table.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40, '1', '1', 0);
|
||||
(@TMP_SUB_ID, '查询$table.comment', '${package.ModuleName}:${typeHyphen}:query', 3, 10, 'admin', 'admin', 0),
|
||||
(@TMP_SUB_ID, '创建$table.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20, 'admin', 'admin', 0),
|
||||
(@TMP_SUB_ID, '修改$table.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30, 'admin', 'admin', 0),
|
||||
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40, 'admin', 'admin', 0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { TableData } from '@arco-design/web-vue';
|
||||
import type { DataGrid, OrderDirection, Pagination } from '@/types/global';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface ${vue.featureEntity}UpdateRequest extends ${vue.featureEntity}C
|
||||
/**
|
||||
* ${table.comment}查询请求
|
||||
*/
|
||||
export interface ${vue.featureEntity}QueryRequest extends Pagination {
|
||||
export interface ${vue.featureEntity}QueryRequest extends Pagination, OrderDirection {
|
||||
searchValue?: string;
|
||||
#foreach($field in ${table.fields})
|
||||
#if("$field.propertyType" == "String" || "$field.propertyType" == "Date")
|
||||
|
||||
@@ -8,7 +8,7 @@ const $vue.moduleConst: AppRouteRecordRaw = {
|
||||
children: [
|
||||
{
|
||||
name: '$vue.featureEntityFirstLower',
|
||||
path: '/$vue.feature',
|
||||
path: '/$vue.module/$vue.feature',
|
||||
component: () => import('@/views/$vue.module/$vue.feature/index.vue'),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
search-input-placeholder="输入搜索值"
|
||||
:create-card-position="false"
|
||||
:loading="loading"
|
||||
:field-config="fieldConfig"
|
||||
:field-config="cardFieldConfig"
|
||||
:list="list"
|
||||
:pagination="pagination"
|
||||
:card-layout-cols="cardColLayout"
|
||||
:filter-count="filterCount"
|
||||
:add-permission="['${package.ModuleName}:${typeHyphen}:create']"
|
||||
:query-order="queryOrder"
|
||||
:fields-hook="fieldsHook"
|
||||
@add="emits('openAdd')"
|
||||
@reset="reset"
|
||||
@search="fetchCardData"
|
||||
@@ -74,16 +76,12 @@
|
||||
<!-- 修改 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
||||
@click="emits('openUpdate', record)">
|
||||
<span class="more-doption normal">
|
||||
<icon-edit /> 修改
|
||||
</span>
|
||||
<span class="more-doption normal">修改</span>
|
||||
</a-doption>
|
||||
<!-- 删除 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
||||
@click="deleteRow(record.id)">
|
||||
<span class="more-doption error">
|
||||
<icon-delete /> 删除
|
||||
</span>
|
||||
<span class="more-doption error">删除</span>
|
||||
</a-doption>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
@@ -94,17 +92,13 @@
|
||||
<!-- 修改 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
||||
@click="emits('openUpdate', record)">
|
||||
<span class="more-doption normal">
|
||||
<icon-edit /> 修改
|
||||
</span>
|
||||
<span class="more-doption normal">修改</span>
|
||||
</a-doption>
|
||||
<!-- 删除 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
||||
class="span-red"
|
||||
@click="deleteRow(record.id)">
|
||||
<span class="more-doption error">
|
||||
<icon-delete /> 删除
|
||||
</span>
|
||||
<span class="more-doption error">删除</span>
|
||||
</a-doption>
|
||||
</template>
|
||||
</card-list>
|
||||
@@ -118,26 +112,29 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
|
||||
import { useCardPagination, useCardColLayout } from '@/hooks/card';
|
||||
import { useCardPagination, useCardColLayout, useCardFieldConfig } from '@/hooks/card';
|
||||
import { computed, reactive, ref, onMounted } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { objectTruthKeyCount, resetObject } from '@/utils';
|
||||
import fieldConfig from '../types/card.fields';
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
import { #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
||||
import { TableName, #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
||||
#else
|
||||
import {} from '../types/const';
|
||||
import { TableName } from '../types/const';
|
||||
#end
|
||||
import { delete${vue.featureEntity}, get${vue.featureEntity}Page } from '@/api/${vue.module}/${vue.feature}';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
import { useDictStore } from '@/store';
|
||||
#end
|
||||
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
|
||||
const cardColLayout = useCardColLayout();
|
||||
const pagination = useCardPagination();
|
||||
const queryOrder = useQueryOrder(TableName, ASC);
|
||||
const { cardFieldConfig, fieldsHook } = useCardFieldConfig(TableName, fieldConfig);
|
||||
const { loading, setLoading } = useLoading();
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
@@ -198,7 +195,7 @@
|
||||
const doFetchCardData = async (request: ${vue.featureEntity}QueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await get${vue.featureEntity}Page(request);
|
||||
const { data } = await get${vue.featureEntity}Page(queryOrder.markOrderly(request));
|
||||
list.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
|
||||
@@ -75,6 +75,11 @@
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
#end
|
||||
<!-- 调整 -->
|
||||
<table-adjust :columns="columns"
|
||||
:columns-hook="columnsHook"
|
||||
:query-order="queryOrder"
|
||||
@query="fetchTableData" />
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
@@ -87,7 +92,7 @@
|
||||
#end
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="tableColumns"
|
||||
#if($vue.enableRowSelection)
|
||||
:row-selection="rowSelection"
|
||||
#end
|
||||
@@ -146,25 +151,29 @@
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
import { #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
||||
import { TableName, #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
||||
#else
|
||||
import {} from '../types/const';
|
||||
import { TableName } from '../types/const';
|
||||
#end
|
||||
#if($vue.enableRowSelection)
|
||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
#else
|
||||
import { useTablePagination } from '@/hooks/table';
|
||||
import { useTablePagination, useTableColumns } from '@/hooks/table';
|
||||
#end
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
import { useDictStore } from '@/store';
|
||||
#end
|
||||
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
|
||||
const pagination = useTablePagination();
|
||||
#if($vue.enableRowSelection)
|
||||
const rowSelection = useRowSelection();
|
||||
#end
|
||||
const pagination = useTablePagination();
|
||||
const queryOrder = useQueryOrder(TableName, ASC);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
const { loading, setLoading } = useLoading();
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
@@ -227,7 +236,7 @@
|
||||
const doFetchTableData = async (request: ${vue.featureEntity}QueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await get${vue.featureEntity}Page(request);
|
||||
const { data } = await get${vue.featureEntity}Page(queryOrder.markOrderly(request));
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
|
||||
@@ -3,13 +3,14 @@ import { dateFormat } from '@/utils';
|
||||
|
||||
const fieldConfig = {
|
||||
rowGap: '10px',
|
||||
labelSpan: 8,
|
||||
labelSpan: 6,
|
||||
minHeight: '22px',
|
||||
fields: [
|
||||
{
|
||||
label: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
default: true,
|
||||
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
|
||||
label: '${field.comment}',
|
||||
dataIndex: '${field.propertyName}',
|
||||
@@ -21,6 +22,7 @@ const fieldConfig = {
|
||||
return record.${field.propertyName} && dateFormat(new Date(record.${field.propertyName}));
|
||||
},
|
||||
#end
|
||||
default: true,
|
||||
}, #end#end{
|
||||
label: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export const TABLE_NAME = '$table.name';
|
||||
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
#foreach($enumEntity in $dictMap.entrySet())
|
||||
// $enumEntity.value.comment
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { TableColumnData } from '@arco-design/web-vue';
|
||||
import { dateFormat } from '@/utils';
|
||||
|
||||
const columns = [
|
||||
@@ -9,6 +9,7 @@ const columns = [
|
||||
width: 68,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
default: true,
|
||||
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
|
||||
title: '${field.comment}',
|
||||
dataIndex: '${field.propertyName}',
|
||||
@@ -24,6 +25,7 @@ const columns = [
|
||||
return record.${field.propertyName} && dateFormat(new Date(record.${field.propertyName}));
|
||||
},
|
||||
#end
|
||||
default: true,
|
||||
}, #end#end{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
|
||||
@@ -45,4 +45,9 @@ public class SecurityHolderDelegate implements SecurityHolder {
|
||||
return SecurityUtils.getLoginUserId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLoginUsername() {
|
||||
return SecurityUtils.getLoginUsername();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,27 @@ public class StaticResourceAuthorizeRequestsCustomizer extends AuthorizeRequests
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// 静态资源可匿名访问
|
||||
registry.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll();
|
||||
registry.antMatchers(HttpMethod.GET,
|
||||
"/*.html",
|
||||
"/*.css",
|
||||
"/*.js",
|
||||
"/*.gz",
|
||||
"/*.ico",
|
||||
"/*.jpg",
|
||||
"/*.png",
|
||||
"/*.svg",
|
||||
"/*.json",
|
||||
"/*.webmanifest",
|
||||
"/**/*.html",
|
||||
"/**/*.css",
|
||||
"/**/*.js",
|
||||
"/**/*.gz",
|
||||
"/**/*.ico",
|
||||
"/**/*.jpg",
|
||||
"/**/*.png",
|
||||
"/**/*.svg",
|
||||
"/**/*.json"
|
||||
).permitAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +71,11 @@ public class OrionMockBeanTestConfiguration {
|
||||
public Long getLoginUserId() {
|
||||
return DEFAULT.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLoginUsername() {
|
||||
return DEFAULT.getUsername();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ package org.dromara.visor.framework.test.core.base;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||
import org.dromara.visor.common.configuration.SpringConfiguration;
|
||||
import org.dromara.visor.framework.datasource.configuration.OrionDataSourceAutoConfiguration;
|
||||
import org.dromara.visor.framework.mybatis.configuration.OrionMybatisAutoConfiguration;
|
||||
import org.dromara.visor.framework.redis.configuration.OrionRedisAutoConfiguration;
|
||||
@@ -57,6 +58,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
public class BaseUnitTest {
|
||||
|
||||
@Import({
|
||||
// spring
|
||||
SpringConfiguration.class,
|
||||
// mock
|
||||
OrionMockBeanTestConfiguration.class,
|
||||
OrionMockRedisTestConfiguration.class,
|
||||
@@ -74,7 +77,6 @@ public class BaseUnitTest {
|
||||
RedisAutoConfiguration.class,
|
||||
RedissonAutoConfiguration.class,
|
||||
})
|
||||
// TODO
|
||||
public static class Application {
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,11 @@ import java.util.Optional;
|
||||
* @version 1.0.0
|
||||
* @since 2023/6/19 16:55
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"org.dromara.visor.launch", "org.dromara.visor.module"})
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
"org.dromara.visor.launch",
|
||||
"org.dromara.visor.common",
|
||||
"org.dromara.visor.module"
|
||||
})
|
||||
public class LaunchApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://127.0.0.1:3306/orion_visor?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
username: root
|
||||
password: Data@123456
|
||||
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:orion_visor}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
username: ${MYSQL_USER:root}
|
||||
password: ${MYSQL_PASSWORD:Data@123456}
|
||||
initial-size: 0
|
||||
min-idle: 1
|
||||
max-active: 5
|
||||
stat-view-servlet:
|
||||
enabled: false
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: Data@123456
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:Data@123456}
|
||||
redisson:
|
||||
threads: 2
|
||||
netty-threads: 2
|
||||
|
||||
@@ -157,51 +157,6 @@ logging:
|
||||
level:
|
||||
org.dromara.visor.launch.controller.BootstrapController: INFO
|
||||
|
||||
# 应用配置
|
||||
app:
|
||||
# 认证配置
|
||||
authentication:
|
||||
# 是否允许多端登录
|
||||
allow-multi-device: true
|
||||
# 是否允许凭证续签
|
||||
allow-refresh: true
|
||||
# 凭证续签最大次数
|
||||
max-refresh-count: 3
|
||||
# 登录失败发送站内信阈值
|
||||
login-failed-send-threshold: 3
|
||||
# 登录失败锁定次数
|
||||
login-failed-lock-count: 5
|
||||
# 登录失败锁定时间 (分)
|
||||
login-failed-lock-time: 30
|
||||
# tracker 配置
|
||||
tracker:
|
||||
# 加载偏移量 (行)
|
||||
offset: 300
|
||||
# 延迟时间 (ms)
|
||||
delay: 100
|
||||
# 文件未找到等待次数
|
||||
wait-times: 100
|
||||
# sftp 配置
|
||||
sftp:
|
||||
# 上传文件时 文件存在是否备份
|
||||
upload-present-backup: true
|
||||
# 备份文件名称
|
||||
backup-file-name: bk_${fileName}_${timestamp}
|
||||
# 执行日志
|
||||
exec-log:
|
||||
# 是否拼接 ansi 执行状态日志
|
||||
append-ansi: true
|
||||
# 自动清理配置
|
||||
auto-clear:
|
||||
# 批量执行日志
|
||||
exec-log:
|
||||
enabled: false
|
||||
keep-period: 30
|
||||
# 终端连接日志
|
||||
terminal-connect-log:
|
||||
enabled: false
|
||||
keep-period: 30
|
||||
|
||||
# orion framework config
|
||||
orion:
|
||||
# 版本
|
||||
|
||||
@@ -39,19 +39,19 @@ import java.util.function.Function;
|
||||
*/
|
||||
public class ReplaceVersion {
|
||||
|
||||
private static final String TARGET_VERSION = "2.3.0";
|
||||
private static final String TARGET_VERSION = "2.3.5";
|
||||
|
||||
private static final String REPLACE_VERSION = "2.3.1";
|
||||
private static final String REPLACE_VERSION = "2.3.6";
|
||||
|
||||
private static final String PATH = new File("").getAbsolutePath();
|
||||
|
||||
private static final String[] DOCKER_FILES = new String[]{
|
||||
"docker/push.sh",
|
||||
"docker/adminer/build.sh",
|
||||
"docker/adminer/build.sh",
|
||||
"docker/mysql/build.sh",
|
||||
"docker/redis/build.sh",
|
||||
"docker/service/build.sh",
|
||||
"docker/ui/build.sh",
|
||||
"docker-compose.yml",
|
||||
"docker-compose-testing.yml"
|
||||
};
|
||||
|
||||
@@ -82,6 +82,10 @@
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -63,7 +63,7 @@ public class AssetAuthorizedDataServiceController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/current-host")
|
||||
@Operation(summary = "查询当前用户已授权的主机")
|
||||
public AuthorizedHostWrapperVO getCurrentAuthorizedHost(@RequestParam("type") String type) {
|
||||
public AuthorizedHostWrapperVO getCurrentAuthorizedHost(@RequestParam(value = "type", required = false) String type) {
|
||||
return assetAuthorizedDataService.getUserAuthorizedHost(SecurityUtils.getLoginUserId(), type);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.dromara.visor.module.asset.define.operator.ExecCommandLogOperatorType
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogStatusVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
|
||||
@@ -93,6 +92,14 @@ public class ExecCommandLogController {
|
||||
return execLogService.getExecLog(id, SOURCE);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-host")
|
||||
@Operation(summary = "查询执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
public ExecHostLogVO getExecCommandHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.getExecHostLog(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/host-list")
|
||||
@Operation(summary = "查询全部执行主机日志")
|
||||
@@ -164,12 +171,12 @@ public class ExecCommandLogController {
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
|
||||
@PostMapping("/tail")
|
||||
@GetMapping("/tail")
|
||||
@Operation(summary = "查看批量执行日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec-command-log:query', 'asset:exec-command:exec')")
|
||||
public String getExecCommandLogTailToken(@Validated @RequestBody ExecLogTailRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.getExecLogTailToken(request);
|
||||
public String getExecCommandLogTailToken(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLogTailToken(id);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecCommandLogOperatorType.DOWNLOAD)
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.dromara.visor.module.asset.define.operator.ExecJobLogOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogStatusVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
|
||||
@@ -92,6 +91,14 @@ public class ExecJobLogController {
|
||||
return execLogService.getExecLog(id, SOURCE);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-host")
|
||||
@Operation(summary = "查询执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
public ExecHostLogVO getExecJobHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.getExecHostLog(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/host-list")
|
||||
@Operation(summary = "查询全部执行主机日志")
|
||||
@@ -153,12 +160,12 @@ public class ExecJobLogController {
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
|
||||
@PostMapping("/tail")
|
||||
@GetMapping("/tail")
|
||||
@Operation(summary = "查看计划任务日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
public String getExecJobLogTailToken(@Validated @RequestBody ExecLogTailRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.getExecLogTailToken(request);
|
||||
public String getExecJobLogTailToken(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLogTailToken(id);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobLogOperatorType.DOWNLOAD)
|
||||
|
||||
@@ -85,7 +85,7 @@ public class HostGroupController {
|
||||
@OperatorLog(HostGroupOperatorType.RENAME)
|
||||
@PutMapping("/rename")
|
||||
@Operation(summary = "修改名称")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-group:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:host-group:update', 'asset:host:query')")
|
||||
public Integer updateHostGroupName(@Validated @RequestBody DataGroupRenameDTO request) {
|
||||
return hostGroupService.updateHostGroupName(request);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class HostGroupController {
|
||||
@GetMapping("/rel-list")
|
||||
@Operation(summary = "查询分组内主机")
|
||||
@Parameter(name = "groupId", description = "groupId", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-group:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:host-group:update', 'asset:host:query')")
|
||||
public Set<Long> queryHostGroupRel(@RequestParam("groupId") Long groupId) {
|
||||
return hostGroupService.queryHostGroupRel(groupId);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class TerminalConnectLogController {
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/session")
|
||||
@PostMapping("/sessions")
|
||||
@Operation(summary = "查询全部终端连接会话")
|
||||
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-session:management:query')")
|
||||
public List<TerminalConnectLogVO> getTerminalConnectSessions(@Validated @RequestBody TerminalConnectLogQueryRequest request) {
|
||||
|
||||
@@ -52,4 +52,20 @@ public interface ExecHostLogDAO extends IMapper<ExecHostLogDO> {
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 logId 查询
|
||||
*
|
||||
* @param id id
|
||||
* @param logId logId
|
||||
* @return row
|
||||
*/
|
||||
default ExecHostLogDO selectByIdAndLogId(Long id, Long logId) {
|
||||
return this.of()
|
||||
.createWrapper()
|
||||
.eq(ExecHostLogDO::getId, id)
|
||||
.eq(ExecHostLogDO::getLogId, logId)
|
||||
.then()
|
||||
.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,17 @@ public interface TerminalConnectLogDAO extends IMapper<TerminalConnectLogDO> {
|
||||
* @param limit limit
|
||||
* @return hostId
|
||||
*/
|
||||
List<Long> selectLatestConnectHostId(@Param("userId") Long userId, @Param("type") String type, @Param("limit") Integer limit);
|
||||
default List<Long> selectLatestConnectHostId(Long userId, String type, Integer limit) {
|
||||
return this.of()
|
||||
.createWrapper(true)
|
||||
.select(TerminalConnectLogDO::getHostId)
|
||||
.eq(TerminalConnectLogDO::getUserId, userId)
|
||||
.eq(TerminalConnectLogDO::getType, type)
|
||||
.orderByDesc(TerminalConnectLogDO::getId)
|
||||
.then()
|
||||
.limit(limit)
|
||||
.list(TerminalConnectLogDO::getHostId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询终端连接日志用户数量
|
||||
|
||||
@@ -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.module.asset.define.config;
|
||||
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
import org.dromara.visor.common.config.ConfigStore;
|
||||
import org.dromara.visor.common.constant.ConfigKeys;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 自动清理设置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/24 15:01
|
||||
*/
|
||||
@Component
|
||||
public class AppAutoClearConfig {
|
||||
|
||||
/**
|
||||
* 是否开启自动清理命令记录
|
||||
*/
|
||||
private final ConfigRef<Boolean> execLogEnabled;
|
||||
|
||||
/**
|
||||
* 自动清理命令记录保留天数
|
||||
*/
|
||||
private final ConfigRef<Integer> execLogKeepDays;
|
||||
|
||||
/**
|
||||
* 是否开启自动清理终端连接记录
|
||||
*/
|
||||
private final ConfigRef<Boolean> terminalLogEnabled;
|
||||
|
||||
/**
|
||||
* 自动清理终端连接记录保留天数
|
||||
*/
|
||||
private final ConfigRef<Integer> terminalLogKeepDays;
|
||||
|
||||
public AppAutoClearConfig(ConfigStore configStore) {
|
||||
this.execLogEnabled = configStore.bool(ConfigKeys.AUTO_CLEAR_EXEC_LOG_ENABLED);
|
||||
this.execLogKeepDays = configStore.int32(ConfigKeys.AUTO_CLEAR_EXEC_LOG_KEEP_DAYS);
|
||||
this.terminalLogEnabled = configStore.bool(ConfigKeys.AUTO_CLEAR_TERMINAL_LOG_ENABLED);
|
||||
this.terminalLogKeepDays = configStore.int32(ConfigKeys.AUTO_CLEAR_TERMINAL_LOG_KEEP_DAYS);
|
||||
}
|
||||
|
||||
public Boolean getExecLogEnabled() {
|
||||
return execLogEnabled.value;
|
||||
}
|
||||
|
||||
public Integer getExecLogKeepDays() {
|
||||
return execLogKeepDays.value;
|
||||
}
|
||||
|
||||
public Boolean getTerminalLogEnabled() {
|
||||
return terminalLogEnabled.value;
|
||||
}
|
||||
|
||||
public Integer getTerminalLogKeepDays() {
|
||||
return terminalLogKeepDays.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.config;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.visor.common.entity.AutoClearConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 批量执行日志自动清理配置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/24 15:01
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ConfigurationProperties(prefix = "app.auto-clear.exec-log")
|
||||
public class AppExecLogAutoClearConfig extends AutoClearConfig {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.asset.define.config;
|
||||
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
import org.dromara.visor.common.config.ConfigStore;
|
||||
import org.dromara.visor.common.constant.ConfigKeys;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 应用日志设置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/4/15 22:00
|
||||
*/
|
||||
@Component
|
||||
public class AppLogConfig {
|
||||
|
||||
/**
|
||||
* 日志加载偏移行
|
||||
*/
|
||||
private final ConfigRef<Integer> trackerLoadLines;
|
||||
|
||||
/**
|
||||
* 日志加载间隔毫秒
|
||||
*/
|
||||
private final ConfigRef<Integer> trackerLoadInterval;
|
||||
|
||||
/**
|
||||
* 是否生成详细的执行日志
|
||||
*/
|
||||
private final ConfigRef<Boolean> execDetailLog;
|
||||
|
||||
public AppLogConfig(ConfigStore configStore) {
|
||||
this.trackerLoadLines = configStore.int32(ConfigKeys.LOG_TRACKER_LOAD_LINES);
|
||||
this.trackerLoadInterval = configStore.int32(ConfigKeys.LOG_TRACKER_LOAD_INTERVAL);
|
||||
this.execDetailLog = configStore.bool(ConfigKeys.LOG_EXEC_DETAIL_LOG);
|
||||
}
|
||||
|
||||
public Integer getTrackerLoadLines() {
|
||||
return trackerLoadLines.value;
|
||||
}
|
||||
|
||||
public Integer getTrackerLoadInterval() {
|
||||
return trackerLoadInterval.value;
|
||||
}
|
||||
|
||||
public Boolean getExecDetailLog() {
|
||||
return execDetailLog.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,9 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
import org.dromara.visor.common.config.ConfigStore;
|
||||
import org.dromara.visor.common.constant.ConfigKeys;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -33,24 +34,40 @@ import org.springframework.stereotype.Component;
|
||||
* @version 1.0.0
|
||||
* @since 2024/4/15 22:00
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "app.sftp")
|
||||
public class AppSftpConfig {
|
||||
|
||||
/**
|
||||
* 上传文件时 文件存在是否备份
|
||||
* 文件预览大小
|
||||
*/
|
||||
private Boolean uploadPresentBackup;
|
||||
private final ConfigRef<Integer> previewSize;
|
||||
|
||||
/**
|
||||
* 重复文件备份
|
||||
*/
|
||||
private final ConfigRef<Boolean> uploadPresentBackup;
|
||||
|
||||
/**
|
||||
* 备份文件名称
|
||||
*/
|
||||
private String backupFileName;
|
||||
private final ConfigRef<String> uploadBackupFileName;
|
||||
|
||||
public AppSftpConfig() {
|
||||
this.uploadPresentBackup = true;
|
||||
this.backupFileName = "bk_${fileName}_${timestamp}";
|
||||
public AppSftpConfig(ConfigStore configStore) {
|
||||
this.previewSize = configStore.int32(ConfigKeys.SFTP_PREVIEW_SIZE);
|
||||
this.uploadPresentBackup = configStore.bool(ConfigKeys.SFTP_UPLOAD_PRESENT_BACKUP);
|
||||
this.uploadBackupFileName = configStore.string(ConfigKeys.SFTP_UPLOAD_BACKUP_FILE_NAME);
|
||||
}
|
||||
|
||||
public Integer getPreviewSize() {
|
||||
return previewSize.value;
|
||||
}
|
||||
|
||||
public Boolean getUploadPresentBackup() {
|
||||
return uploadPresentBackup.value;
|
||||
}
|
||||
|
||||
public String getUploadBackupFileName() {
|
||||
return uploadBackupFileName.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.config;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.visor.common.entity.AutoClearConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 终端连接日志自动清理配置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/24 15:01
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ConfigurationProperties(prefix = "app.auto-clear.terminal-connect-log")
|
||||
public class AppTerminalConnectLogAutoClearConfig extends AutoClearConfig {
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 应用 tracker 配置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/4/15 22:00
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "app.tracker")
|
||||
public class AppTrackerConfig {
|
||||
|
||||
/**
|
||||
* 加载偏移量 (行)
|
||||
*/
|
||||
private Integer offset;
|
||||
|
||||
/**
|
||||
* 延迟时间 (ms)
|
||||
*/
|
||||
private Integer delay;
|
||||
|
||||
/**
|
||||
* 文件未找到等待次数
|
||||
*/
|
||||
private Integer waitTimes;
|
||||
|
||||
public AppTrackerConfig() {
|
||||
this.offset = 300;
|
||||
this.delay = 100;
|
||||
this.waitTimes = 100;
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2024-1-22 15:28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class CommandSnippetDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,7 +42,7 @@ import java.util.Date;
|
||||
* @since 2024-3-11 14:05
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -50,10 +52,6 @@ public class ExecHostLogDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "执行日志id")
|
||||
@TableField("log_id")
|
||||
private Long logId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2024-3-28 12:03
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class ExecJobDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "任务名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2024-3-28 12:03
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class ExecJobHostDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "任务id")
|
||||
@TableField("job_id")
|
||||
private Long jobId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,7 +42,7 @@ import java.util.Date;
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -50,10 +52,6 @@ public class ExecLogDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "执行用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class ExecTemplateDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2024-4-22 12:13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class ExecTemplateHostDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板id")
|
||||
@TableField("template_id")
|
||||
private Long templateId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2023-9-11 14:16
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class HostDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "主机类型")
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2023-9-20 11:55
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class HostIdentityDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2023-9-20 11:55
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class HostKeyDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
@@ -38,7 +40,7 @@ import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
* @since 2024-4-23 23:15
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -48,10 +50,6 @@ public class PathBookmarkDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,7 +42,7 @@ import java.util.Date;
|
||||
* @since 2023-12-26 22:09
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -50,10 +52,6 @@ public class TerminalConnectLogDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
@@ -78,9 +76,9 @@ public class TerminalConnectLogDO extends BaseDO {
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "token")
|
||||
@TableField("token")
|
||||
private String token;
|
||||
@Schema(description = "sessionId")
|
||||
@TableField("session_id")
|
||||
private String sessionId;
|
||||
|
||||
@Schema(description = "状态")
|
||||
@TableField("status")
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,7 +42,7 @@ import java.util.Date;
|
||||
* @since 2024-5-7 22:15
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -50,10 +52,6 @@ public class UploadTaskDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,7 +42,7 @@ import java.util.Date;
|
||||
* @since 2024-5-8 10:31
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -50,10 +52,6 @@ public class UploadTaskFileDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@TableField("task_id")
|
||||
private Long taskId;
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 执行主机日志查看 缓存对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/3/18 16:34
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "ExecHostLogTailDTO", description = "执行主机日志查看 缓存对象")
|
||||
public class ExecHostLogTailDTO implements Serializable {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "hostId")
|
||||
private Long hostId;
|
||||
|
||||
@Schema(description = "文件路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "输出编码")
|
||||
private String charset;
|
||||
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行日志查看 缓存对象
|
||||
@@ -45,8 +44,8 @@ import java.util.List;
|
||||
@Schema(name = "ExecLogTailDTO", description = "执行日志查看 缓存对象")
|
||||
public class ExecLogTailDTO implements Serializable {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
@Schema(description = "execId")
|
||||
private Long execId;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
@@ -54,7 +53,4 @@ public class ExecLogTailDTO implements Serializable {
|
||||
@Schema(description = "token")
|
||||
private String token;
|
||||
|
||||
@Schema(description = "执行主机")
|
||||
private List<ExecHostLogTailDTO> hosts;
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ public class TerminalConnectDTO {
|
||||
@Schema(description = "hostName")
|
||||
private String hostName;
|
||||
|
||||
@Schema(description = "主机编码")
|
||||
private String hostCode;
|
||||
|
||||
@Schema(description = "主机地址")
|
||||
private String hostAddress;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@@ -41,7 +41,7 @@ import javax.validation.constraints.Size;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "ExecJobQueryRequest", description = "计划任务 查询请求对象")
|
||||
public class ExecJobQueryRequest extends PageRequest {
|
||||
public class ExecJobQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -41,7 +41,7 @@ import javax.validation.constraints.NotNull;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "ExecJobUpdateExecUserRequest", description = "修改计划任务执行用户 查询请求对象")
|
||||
public class ExecJobUpdateExecUserRequest extends PageRequest {
|
||||
public class ExecJobUpdateExecUserRequest extends BaseQueryRequest {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.entity.request.exec;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "ExecLogQueryRequest", description = "批量执行日志 查询请求对象")
|
||||
public class ExecLogQueryRequest extends PageRequest {
|
||||
public class ExecLogQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行日志查看 请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/3/11 11:46
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "ExecLogTailRequest", description = "执行日志查看 请求对象")
|
||||
public class ExecLogTailRequest {
|
||||
|
||||
@Schema(description = "执行来源")
|
||||
private String source;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "执行id")
|
||||
private Long execId;
|
||||
|
||||
@Schema(description = "执行主机id")
|
||||
private List<Long> hostExecIdList;
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@@ -41,7 +41,7 @@ import javax.validation.constraints.Size;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "ExecTemplateQueryRequest", description = "执行模板 查询请求对象")
|
||||
public class ExecTemplateQueryRequest extends PageRequest {
|
||||
public class ExecTemplateQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@@ -28,10 +28,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -78,6 +75,7 @@ public class HostCreateRequest implements Serializable {
|
||||
@Schema(description = "主机端口")
|
||||
private Integer port;
|
||||
|
||||
@NotEmpty
|
||||
@Schema(description = "主机分组")
|
||||
private List<Long> groupIdList;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.entity.request.host;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@@ -41,7 +41,7 @@ import javax.validation.constraints.Size;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "HostIdentityQueryRequest", description = "主机身份 查询请求对象")
|
||||
public class HostIdentityQueryRequest extends PageRequest {
|
||||
public class HostIdentityQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "搜索")
|
||||
private String searchValue;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.entity.request.host;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@@ -41,7 +41,7 @@ import javax.validation.constraints.Size;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "HostKeyQueryRequest", description = "主机密钥 查询请求对象")
|
||||
public class HostKeyQueryRequest extends PageRequest {
|
||||
public class HostKeyQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "搜索")
|
||||
private String searchValue;
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.dromara.visor.module.asset.entity.request.host;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
@@ -42,7 +42,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "HostQueryRequest", description = "主机 查询请求对象")
|
||||
public class HostQueryRequest extends PageRequest {
|
||||
public class HostQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "搜索")
|
||||
private String searchValue;
|
||||
|
||||
@@ -76,6 +76,7 @@ public class HostUpdateRequest implements Serializable {
|
||||
@Schema(description = "主机端口")
|
||||
private Integer port;
|
||||
|
||||
@NotEmpty
|
||||
@Schema(description = "主机分组")
|
||||
private List<Long> groupIdList;
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ public class TerminalConnectLogCreateRequest {
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
@Size(max = 128)
|
||||
@Schema(description = "token")
|
||||
private String token;
|
||||
@Size(max = 64)
|
||||
@Schema(description = "sessionId")
|
||||
private String sessionId;
|
||||
|
||||
@Schema(description = "拓展信息")
|
||||
private Map<String, Object> extra;
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.entity.request.host;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
import org.dromara.visor.common.validator.group.Id;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -46,7 +46,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalConnectLogQueryRequest", description = "终端连接日志 查询请求对象")
|
||||
public class TerminalConnectLogQueryRequest extends PageRequest {
|
||||
public class TerminalConnectLogQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@NotNull(groups = Id.class)
|
||||
@Schema(description = "id")
|
||||
@@ -69,9 +69,9 @@ public class TerminalConnectLogQueryRequest extends PageRequest {
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Size(max = 128)
|
||||
@Schema(description = "token")
|
||||
private String token;
|
||||
@Size(max = 64)
|
||||
@Schema(description = "sessionId")
|
||||
private String sessionId;
|
||||
|
||||
@Size(max = 16)
|
||||
@Schema(description = "状态")
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.entity.request.host;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
@@ -43,7 +43,7 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalSftpLogQueryRequest", description = "SFTP 操作日志 查询请求对象")
|
||||
public class TerminalSftpLogQueryRequest extends PageRequest {
|
||||
public class TerminalSftpLogQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.entity.request.upload;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.PageRequest;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
@@ -43,7 +43,7 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "UploadTaskQueryRequest", description = "上传任务 查询请求对象")
|
||||
public class UploadTaskQueryRequest extends PageRequest {
|
||||
public class UploadTaskQueryRequest extends BaseQueryRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@@ -29,7 +29,6 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 计划任务主机 视图响应对象
|
||||
@@ -56,16 +55,4 @@ public class ExecJobHostVO implements Serializable {
|
||||
@Schema(description = "主机id")
|
||||
private Long hostId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,12 @@ public class ExecJobVO implements Serializable {
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "执行主机")
|
||||
private List<Long> hostIdList;
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ public class TerminalConnectLogVO implements Serializable {
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "sessionId")
|
||||
private String sessionId;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ package org.dromara.visor.module.asset.handler.host.exec.command;
|
||||
|
||||
import org.dromara.visor.module.asset.define.AssetThreadPools;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.handler.ExecTaskHandler;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量执行命令执行器
|
||||
@@ -38,10 +39,11 @@ public class ExecTaskExecutors {
|
||||
/**
|
||||
* 执行命令
|
||||
*
|
||||
* @param command command
|
||||
* @param id id
|
||||
* @param execHostIdList execHostIdList
|
||||
*/
|
||||
public static void start(ExecCommandDTO command) {
|
||||
AssetThreadPools.EXEC_TASK.execute(new ExecTaskHandler(command));
|
||||
public static void start(Long id, List<Long> execHostIdList) {
|
||||
AssetThreadPools.EXEC_TASK.execute(new ExecTaskHandler(id, execHostIdList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,12 +25,13 @@ package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
import cn.orionsec.kit.lang.exception.AuthenticationException;
|
||||
import cn.orionsec.kit.lang.exception.ConnectionRuntimeException;
|
||||
import cn.orionsec.kit.lang.exception.SftpException;
|
||||
import cn.orionsec.kit.lang.id.UUIds;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutChecker;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutEndpoint;
|
||||
import cn.orionsec.kit.lang.utils.Booleans;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.ansi.AnsiAppender;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||
import cn.orionsec.kit.net.host.SessionStore;
|
||||
import cn.orionsec.kit.net.host.sftp.SftpExecutor;
|
||||
@@ -40,22 +41,29 @@ import com.alibaba.fastjson.JSON;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.constant.FileConst;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.common.enums.EndpointDefine;
|
||||
import org.dromara.visor.common.interfaces.FileClient;
|
||||
import org.dromara.visor.common.utils.PathUtils;
|
||||
import org.dromara.visor.common.utils.Valid;
|
||||
import org.dromara.visor.module.asset.dao.ExecHostLogDAO;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO;
|
||||
import org.dromara.visor.module.asset.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||
import org.dromara.visor.module.asset.enums.HostOsTypeEnum;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.log.manager.ExecLogManager;
|
||||
import org.dromara.visor.module.asset.handler.host.jsch.SessionStores;
|
||||
import org.dromara.visor.module.asset.service.TerminalService;
|
||||
import org.dromara.visor.module.asset.utils.ExecUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* 命令执行器 基类
|
||||
@@ -75,16 +83,21 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
|
||||
private static final ExecHostLogDAO execHostLogDAO = SpringHolder.getBean(ExecHostLogDAO.class);
|
||||
|
||||
protected final ExecCommandDTO execCommand;
|
||||
@Getter
|
||||
protected final Long id;
|
||||
|
||||
protected final ExecCommandHostDTO execHostCommand;
|
||||
protected final Map<String, Object> builtParams;
|
||||
|
||||
private final TimeoutChecker<TimeoutEndpoint> timeoutChecker;
|
||||
protected final TimeoutChecker<TimeoutEndpoint> timeoutChecker;
|
||||
|
||||
protected final ExecLogDO execLog;
|
||||
|
||||
protected ExecHostLogDO execHostLog;
|
||||
|
||||
@Getter
|
||||
protected ExecHostStatusEnum status;
|
||||
|
||||
protected ExecHostLogDO updateRecord;
|
||||
private TerminalConnectDTO connect;
|
||||
|
||||
private OutputStream logOutputStream;
|
||||
|
||||
@@ -99,24 +112,28 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
|
||||
private volatile boolean interrupted;
|
||||
|
||||
public BaseExecCommandHandler(ExecCommandDTO execCommand,
|
||||
ExecCommandHostDTO execHostCommand,
|
||||
public BaseExecCommandHandler(Long id,
|
||||
ExecLogDO execLog,
|
||||
Map<String, Object> builtParams,
|
||||
TimeoutChecker<TimeoutEndpoint> timeoutChecker) {
|
||||
this.status = ExecHostStatusEnum.WAITING;
|
||||
this.execCommand = execCommand;
|
||||
this.execHostCommand = execHostCommand;
|
||||
this.id = id;
|
||||
this.execLog = execLog;
|
||||
this.builtParams = builtParams;
|
||||
this.timeoutChecker = timeoutChecker;
|
||||
this.updateRecord = new ExecHostLogDO();
|
||||
this.status = ExecHostStatusEnum.WAITING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Long id = execHostCommand.getHostLogId();
|
||||
Exception ex = null;
|
||||
log.info("ExecCommandHandler run start id: {}, info: {}", id, JSON.toJSONString(execHostCommand));
|
||||
// 更新状态
|
||||
this.updateStatus(ExecHostStatusEnum.RUNNING, null);
|
||||
log.info("ExecCommandHandler run start id: {}", id);
|
||||
// 初始化数据以及修改状态
|
||||
if (!this.initData()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 初始化日志
|
||||
this.initLogOutputStream();
|
||||
// 执行命令
|
||||
this.execCommand();
|
||||
log.info("ExecCommandHandler run complete id: {}", id);
|
||||
@@ -135,13 +152,41 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化日志输出流
|
||||
* 初始化数据
|
||||
*
|
||||
* @throws Exception Exception
|
||||
* @return pass
|
||||
*/
|
||||
protected void initLogOutputStream() throws Exception {
|
||||
// 打开日志流
|
||||
this.logOutputStream = fileClient.getContentOutputStream(execHostCommand.getLogPath());
|
||||
private boolean initData() {
|
||||
Exception ex = null;
|
||||
try {
|
||||
// 查询任务
|
||||
this.execHostLog = execHostLogDAO.selectById(id);
|
||||
Valid.notNull(this.execHostLog, ErrorMessage.TASK_ABSENT);
|
||||
// 检查任务状态
|
||||
this.status = ExecHostStatusEnum.of(execHostLog.getStatus());
|
||||
Valid.eq(this.status, ExecHostStatusEnum.WAITING, ErrorMessage.TASK_ABSENT, ErrorMessage.ILLEGAL_STATUS);
|
||||
// 获取主机会话
|
||||
this.connect = terminalService.getTerminalConnectInfo(execHostLog.getHostId(), execLog.getUserId());
|
||||
// 设置日志路径
|
||||
this.setLogPath();
|
||||
// 设置脚本路径
|
||||
this.setScriptPath();
|
||||
// 设置执行的命令以及参数
|
||||
this.setExecCommand();
|
||||
} catch (Exception e) {
|
||||
log.error("BaseExecCommandHandler.initData error id: {}", id, e);
|
||||
ex = e;
|
||||
}
|
||||
boolean passed = ex == null;
|
||||
// 更新状态
|
||||
this.updateStatus(passed ? ExecHostStatusEnum.RUNNING : ExecHostStatusEnum.FAILED, ex, (s) -> {
|
||||
// 修改其他参数
|
||||
s.setCommand(execHostLog.getCommand());
|
||||
s.setParameter(execHostLog.getParameter());
|
||||
s.setLogPath(execHostLog.getLogPath());
|
||||
s.setScriptPath(execHostLog.getScriptPath());
|
||||
});
|
||||
return passed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,29 +195,36 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
protected void execCommand() throws Exception {
|
||||
// 初始化日志
|
||||
this.initLogOutputStream();
|
||||
// 打开会话
|
||||
TerminalConnectDTO connect = terminalService.getTerminalConnectInfo(execHostCommand.getHostId(), execCommand.getUserId());
|
||||
this.sessionStore = SessionStores.openSessionStore(connect);
|
||||
if (Booleans.isTrue(execCommand.getScriptExec())) {
|
||||
if (BooleanBit.toBoolean(execLog.getScriptExec())) {
|
||||
// 上传脚本文件
|
||||
this.uploadScriptFile();
|
||||
// 执行脚本文件
|
||||
this.executor = sessionStore.getCommandExecutor(execHostCommand.getScriptPath());
|
||||
this.executor = sessionStore.getCommandExecutor(execHostLog.getScriptPath());
|
||||
} else {
|
||||
// 执行命令
|
||||
byte[] command = Strings.replaceCRLF(execHostCommand.getCommand()).getBytes(execHostCommand.getCharset());
|
||||
byte[] command = execHostLog.getCommand().getBytes(connect.getCharset());
|
||||
this.executor = sessionStore.getCommandExecutor(command);
|
||||
}
|
||||
// 执行命令
|
||||
executor.timeout(execCommand.getTimeout(), TimeUnit.SECONDS, timeoutChecker);
|
||||
executor.timeout(execLog.getTimeout(), TimeUnit.SECONDS, timeoutChecker);
|
||||
executor.merge();
|
||||
executor.transfer(logOutputStream);
|
||||
executor.connect();
|
||||
executor.exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化日志输出流
|
||||
*
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
protected void initLogOutputStream() throws Exception {
|
||||
// 打开日志流
|
||||
this.logOutputStream = fileClient.getContentOutputStream(execHostLog.getLogPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传脚本文件
|
||||
*/
|
||||
@@ -180,14 +232,14 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
SftpExecutor sftpExecutor = null;
|
||||
try {
|
||||
// 打开 sftp
|
||||
sftpExecutor = sessionStore.getSftpExecutor(execHostCommand.getFileNameCharset());
|
||||
sftpExecutor = sessionStore.getSftpExecutor(connect.getFileNameCharset());
|
||||
sftpExecutor.connect();
|
||||
// 文件上传必须要以 / 开头
|
||||
String scriptPath = PathUtils.prependSeparator(execHostCommand.getScriptPath());
|
||||
String scriptPath = PathUtils.prependSeparator(execHostLog.getScriptPath());
|
||||
// 创建文件
|
||||
sftpExecutor.touch(scriptPath);
|
||||
// 写入命令
|
||||
byte[] command = Strings.replaceCRLF(execHostCommand.getCommand()).getBytes(execHostCommand.getFileContentCharset());
|
||||
byte[] command = execHostLog.getCommand().getBytes(connect.getFileContentCharset());
|
||||
sftpExecutor.write(scriptPath, command);
|
||||
// 修改权限
|
||||
sftpExecutor.changeMode(scriptPath, 777);
|
||||
@@ -207,16 +259,16 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
// 执行回调
|
||||
if (this.interrupted) {
|
||||
// 中断执行
|
||||
this.updateStatus(ExecHostStatusEnum.INTERRUPTED, null);
|
||||
this.updateStatus(ExecHostStatusEnum.INTERRUPTED, null, null);
|
||||
} else if (e != null) {
|
||||
// 执行失败
|
||||
this.updateStatus(ExecHostStatusEnum.FAILED, e);
|
||||
this.updateStatus(ExecHostStatusEnum.FAILED, e, null);
|
||||
} else if (executor.isTimeout()) {
|
||||
// 更新执行超时
|
||||
this.updateStatus(ExecHostStatusEnum.TIMEOUT, null);
|
||||
this.updateStatus(ExecHostStatusEnum.TIMEOUT, null, null);
|
||||
} else {
|
||||
// 更新执行完成
|
||||
this.updateStatus(ExecHostStatusEnum.COMPLETED, null);
|
||||
this.updateStatus(ExecHostStatusEnum.COMPLETED, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,33 +291,45 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
*
|
||||
* @param status status
|
||||
* @param ex ex
|
||||
* @param filler filler
|
||||
*/
|
||||
private void updateStatus(ExecHostStatusEnum status, Exception ex) {
|
||||
private void updateStatus(ExecHostStatusEnum status, Exception ex, Consumer<ExecHostLogDO> filler) {
|
||||
this.status = status;
|
||||
Long id = execHostCommand.getHostLogId();
|
||||
String statusName = status.name();
|
||||
execHostLog.setStatus(statusName);
|
||||
log.info("BaseExecCommandHandler.updateStatus start id: {}, status: {}", id, statusName);
|
||||
try {
|
||||
updateRecord.setId(id);
|
||||
updateRecord.setStatus(statusName);
|
||||
if (ExecHostStatusEnum.RUNNING.equals(status)) {
|
||||
// 运行中
|
||||
updateRecord.setStartTime(new Date());
|
||||
execHostLog.setStartTime(new Date());
|
||||
} else if (ExecHostStatusEnum.COMPLETED.equals(status)) {
|
||||
// 完成
|
||||
updateRecord.setFinishTime(new Date());
|
||||
updateRecord.setExitCode(executor.getExitCode());
|
||||
execHostLog.setFinishTime(new Date());
|
||||
execHostLog.setExitCode(executor.getExitCode());
|
||||
this.exitCode = executor.getExitCode();
|
||||
} else if (ExecHostStatusEnum.FAILED.equals(status)) {
|
||||
// 失败
|
||||
updateRecord.setFinishTime(new Date());
|
||||
updateRecord.setErrorMessage(this.getErrorMessage(ex));
|
||||
execHostLog.setFinishTime(new Date());
|
||||
execHostLog.setErrorMessage(this.getErrorMessage(ex));
|
||||
} else if (ExecHostStatusEnum.TIMEOUT.equals(status)) {
|
||||
// 超时
|
||||
updateRecord.setFinishTime(new Date());
|
||||
execHostLog.setFinishTime(new Date());
|
||||
} else if (ExecHostStatusEnum.INTERRUPTED.equals(status)) {
|
||||
// 中断
|
||||
updateRecord.setFinishTime(new Date());
|
||||
execHostLog.setFinishTime(new Date());
|
||||
}
|
||||
// 选择性更新
|
||||
ExecHostLogDO updateRecord = ExecHostLogDO.builder()
|
||||
.id(execHostLog.getId())
|
||||
.status(execHostLog.getStatus())
|
||||
.exitCode(execHostLog.getExitCode())
|
||||
.startTime(execHostLog.getStartTime())
|
||||
.finishTime(execHostLog.getFinishTime())
|
||||
.errorMessage(execHostLog.getErrorMessage())
|
||||
.build();
|
||||
// 填充参数
|
||||
if (filler != null) {
|
||||
filler.accept(updateRecord);
|
||||
}
|
||||
int effect = execHostLogDAO.updateById(updateRecord);
|
||||
log.info("BaseExecCommandHandler.updateStatus finish id: {}, effect: {}", id, effect);
|
||||
@@ -281,8 +345,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
|
||||
@Override
|
||||
public void interrupt() {
|
||||
log.info("BaseExecCommandHandler.interrupt id: {}, interrupted: {}, closed: {}",
|
||||
execHostCommand.getHostLogId(), interrupted, closed);
|
||||
log.info("BaseExecCommandHandler.interrupt id: {}, interrupted: {}, closed: {}", id, interrupted, closed);
|
||||
if (this.interrupted || this.closed) {
|
||||
return;
|
||||
}
|
||||
@@ -294,8 +357,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
log.info("BaseExecCommandHandler.closed id: {}, closed: {}",
|
||||
execHostCommand.getHostLogId(), closed);
|
||||
log.info("BaseExecCommandHandler.closed id: {}, closed: {}", id, closed);
|
||||
if (this.closed) {
|
||||
return;
|
||||
}
|
||||
@@ -303,7 +365,59 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
Streams.close(logOutputStream);
|
||||
Streams.close(executor);
|
||||
Streams.close(sessionStore);
|
||||
execLogManager.asyncCloseTailFile(execHostCommand.getLogPath());
|
||||
execLogManager.asyncCloseTailFile(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置日志路径
|
||||
*/
|
||||
private void setLogPath() {
|
||||
// 构建日志路径
|
||||
String logPath = fileClient.getReturnPath(EndpointDefine.EXEC_LOG.format(execHostLog.getLogId(), id));
|
||||
execHostLog.setLogPath(logPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置脚本路径
|
||||
*/
|
||||
private void setScriptPath() {
|
||||
String scriptPath = null;
|
||||
// 获取脚本路径
|
||||
if (BooleanBit.toBoolean(execLog.getScriptExec())) {
|
||||
HostOsTypeEnum os = HostOsTypeEnum.of(connect.getOsType());
|
||||
String name = FileConst.EXEC
|
||||
+ "/" + execHostLog.getLogId()
|
||||
+ "/" + id
|
||||
+ os.getScriptSuffix();
|
||||
scriptPath = PathUtils.buildAppPath(HostOsTypeEnum.WINDOWS.equals(os), connect.getUsername(), FileConst.SCRIPT, name);
|
||||
}
|
||||
execHostLog.setScriptPath(scriptPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置实际执行的命令以及参数
|
||||
*/
|
||||
private void setExecCommand() {
|
||||
String uuid = UUIds.random();
|
||||
// 参数列表
|
||||
Map<String, Object> params = Maps.newMap(builtParams);
|
||||
params.put("execHostId", id);
|
||||
params.put("hostId", connect.getHostId());
|
||||
params.put("hostName", connect.getHostName());
|
||||
params.put("hostCode", connect.getHostCode());
|
||||
params.put("hostAddress", connect.getHostAddress());
|
||||
params.put("hostPort", connect.getHostPort());
|
||||
params.put("hostUsername", connect.getUsername());
|
||||
params.put("hostUuid", uuid);
|
||||
params.put("hostUuidShort", uuid.replace("-", Strings.EMPTY));
|
||||
params.put("osType", connect.getOsType());
|
||||
params.put("charset", connect.getCharset());
|
||||
params.put("scriptPath", execHostLog.getScriptPath());
|
||||
// 获取实际命令
|
||||
String paramsJson = JSON.toJSONString(params);
|
||||
String command = ExecUtils.format(execLog.getCommand(), paramsJson);
|
||||
execHostLog.setCommand(command);
|
||||
execHostLog.setParameter(paramsJson);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -336,9 +450,4 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
return Strings.retain(message, 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getHostId() {
|
||||
return execHostCommand.getHostId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,15 +24,16 @@ package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutChecker;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutEndpoint;
|
||||
import cn.orionsec.kit.lang.utils.Booleans;
|
||||
import cn.orionsec.kit.lang.utils.ansi.AnsiAppender;
|
||||
import cn.orionsec.kit.lang.utils.ansi.style.color.AnsiForeground;
|
||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import cn.orionsec.kit.net.host.ssh.ExitCode;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 命令执行器 ansi 日志输出
|
||||
@@ -41,10 +42,13 @@ import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecComman
|
||||
* @version 1.0.0
|
||||
* @since 2024/4/25 18:19
|
||||
*/
|
||||
public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
|
||||
public class ExecCommandDetailHandler extends BaseExecCommandHandler {
|
||||
|
||||
public ExecCommandAnsiHandler(ExecCommandDTO execCommand, ExecCommandHostDTO execHostCommand, TimeoutChecker<TimeoutEndpoint> timeoutChecker) {
|
||||
super(execCommand, execHostCommand, timeoutChecker);
|
||||
public ExecCommandDetailHandler(Long id,
|
||||
ExecLogDO execLog,
|
||||
Map<String, Object> builtParams,
|
||||
TimeoutChecker<TimeoutEndpoint> timeoutChecker) {
|
||||
super(id, execLog, builtParams, timeoutChecker);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,52 +60,52 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
|
||||
.append(this.getCurrentTime())
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "执行记录: ")
|
||||
.append(execCommand.getLogId())
|
||||
.append(execLog.getId())
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "执行描述: ")
|
||||
.append(execCommand.getDescription())
|
||||
.append(execLog.getDescription())
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "执行用户: ")
|
||||
.append(execCommand.getUsername());
|
||||
.append(execLog.getUsername());
|
||||
// 非系统用户执行添加 userId
|
||||
if (Const.SYSTEM_USER_ID.equals(execCommand.getUserId())) {
|
||||
if (Const.SYSTEM_USER_ID.equals(execLog.getUserId())) {
|
||||
appender.newLine();
|
||||
} else {
|
||||
appender.append(" (")
|
||||
.append(execCommand.getUserId())
|
||||
.append(execLog.getUserId())
|
||||
.append(")")
|
||||
.newLine();
|
||||
}
|
||||
// 执行序列
|
||||
if (execCommand.getExecSeq() != null) {
|
||||
if (execLog.getExecSeq() != null) {
|
||||
appender.append(AnsiForeground.BRIGHT_BLUE, "执行序列: ")
|
||||
.append('#')
|
||||
.append(execCommand.getExecSeq())
|
||||
.append(execLog.getExecSeq())
|
||||
.newLine();
|
||||
}
|
||||
appender.append(AnsiForeground.BRIGHT_BLUE, "执行主机: ")
|
||||
.append(execHostCommand.getHostName())
|
||||
.append(execHostLog.getHostName())
|
||||
.append(" (")
|
||||
.append(execHostCommand.getHostId())
|
||||
.append(execHostLog.getHostId())
|
||||
.append(")")
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "主机地址: ")
|
||||
.append(execHostCommand.getHostAddress())
|
||||
.append(execHostLog.getHostAddress())
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "超时时间: ")
|
||||
.append(execCommand.getTimeout())
|
||||
.append(execLog.getTimeout())
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "脚本执行: ")
|
||||
.append(execCommand.getScriptExec())
|
||||
.append(execLog.getScriptExec())
|
||||
.newLine()
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_GREEN, "> 执行命令 ")
|
||||
.newLine()
|
||||
.append(execHostCommand.getCommand())
|
||||
.append(execHostLog.getCommand())
|
||||
.newLine()
|
||||
.newLine();
|
||||
// 非脚本执行拼接开始执行日志
|
||||
if (!Booleans.isTrue(execCommand.getScriptExec())) {
|
||||
if (!BooleanBit.toBoolean(execLog.getScriptExec())) {
|
||||
appender.append(AnsiForeground.BRIGHT_GREEN, "> 开始执行命令 ")
|
||||
.append(this.getCurrentTime())
|
||||
.newLine();
|
||||
@@ -119,7 +123,7 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
|
||||
.append(this.getCurrentTime())
|
||||
.newLine()
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "文件路径: ")
|
||||
.append(execHostCommand.getScriptPath())
|
||||
.append(execHostLog.getScriptPath())
|
||||
.newLine();
|
||||
this.appendLog(startAppender);
|
||||
// 上传脚本文件
|
||||
@@ -170,9 +174,9 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
|
||||
appender.append(AnsiForeground.BRIGHT_YELLOW, "< 命令执行超时 ")
|
||||
.append(this.getCurrentTime())
|
||||
.newLine();
|
||||
} else {
|
||||
long ms = updateRecord.getFinishTime().getTime() - updateRecord.getStartTime().getTime();
|
||||
Integer exitCode = updateRecord.getExitCode();
|
||||
} else if (this.status == ExecHostStatusEnum.COMPLETED) {
|
||||
long ms = execHostLog.getFinishTime().getTime() - execHostLog.getStartTime().getTime();
|
||||
Integer exitCode = execHostLog.getExitCode();
|
||||
// 执行完成
|
||||
appender.append(AnsiForeground.BRIGHT_GREEN, "< 命令执行完成 ")
|
||||
.append(this.getCurrentTime())
|
||||
@@ -25,8 +25,9 @@ package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutChecker;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutEndpoint;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 命令执行器 原始日志输出
|
||||
@@ -38,8 +39,11 @@ import org.dromara.visor.module.asset.handler.host.exec.command.model.ExecComman
|
||||
@Slf4j
|
||||
public class ExecCommandOriginHandler extends BaseExecCommandHandler {
|
||||
|
||||
public ExecCommandOriginHandler(ExecCommandDTO execCommand, ExecCommandHostDTO execHostCommand, TimeoutChecker<TimeoutEndpoint> timeoutChecker) {
|
||||
super(execCommand, execHostCommand, timeoutChecker);
|
||||
public ExecCommandOriginHandler(Long id,
|
||||
ExecLogDO execLog,
|
||||
Map<String, Object> builtParams,
|
||||
TimeoutChecker<TimeoutEndpoint> timeoutChecker) {
|
||||
super(id, execLog, builtParams, timeoutChecker);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user