Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f73fa14bfd | ||
|
|
fd88c725d3 | ||
|
|
3a16f9d9ab | ||
|
|
de9b89d805 | ||
|
|
a05c387ba1 | ||
|
|
3cb6e5a2d4 | ||
|
|
104a9a0aa3 | ||
|
|
d7b747eac4 | ||
|
|
d2949c11f3 | ||
|
|
cd05f71173 | ||
|
|
e0dca73369 | ||
|
|
b8599a6693 | ||
|
|
a0adb415fa | ||
|
|
6c60756e54 | ||
|
|
ee9f51ce7d | ||
|
|
924b46b41a | ||
|
|
1fca5a1912 | ||
|
|
120eb1ee69 | ||
|
|
252c538571 | ||
|
|
1eec373b7e | ||
|
|
aa9b96a9c1 | ||
|
|
059fb30aa4 | ||
|
|
2afaf7ad34 | ||
|
|
076a0956c5 | ||
|
|
4a91ec47bf | ||
|
|
1066b43b3d | ||
|
|
3f78125c43 | ||
|
|
144a44673b | ||
|
|
777f7b3758 | ||
|
|
947fa0fea3 | ||
|
|
7109e89fb4 | ||
|
|
70e7b1d544 | ||
|
|
613f86155c | ||
|
|
8d0b58e48f | ||
|
|
8cea9dc977 | ||
|
|
471acfdf00 | ||
|
|
8ed42131d0 | ||
|
|
18c605354a | ||
|
|
8c04411458 | ||
|
|
9a8d1d05cd | ||
|
|
1cbaf9c424 | ||
|
|
537c2fc108 | ||
|
|
122b568cf5 | ||
|
|
8b97c02d15 | ||
|
|
dcfb016ce5 | ||
|
|
c842de9e23 | ||
|
|
1b2753a2b7 | ||
|
|
29b44b8b77 | ||
|
|
7290b1364c | ||
|
|
3851ead8bb | ||
|
|
305312cc26 | ||
|
|
b4217555d2 | ||
|
|
87b8e405f5 | ||
|
|
3513196a78 | ||
|
|
0240a12321 | ||
|
|
3a8eac4d4a | ||
|
|
4bd2de4ce2 | ||
|
|
b7608fccb3 | ||
|
|
bb925d354d | ||
|
|
3a476d41d2 | ||
|
|
1927b10bcc | ||
|
|
0664eff151 | ||
|
|
a71456b209 | ||
|
|
48d308b1a8 | ||
|
|
f75d097d8a | ||
|
|
0d46d81c4e | ||
|
|
c20c83245f | ||
|
|
849e010bc3 | ||
|
|
95c299eea4 | ||
|
|
ad3edd4ccd | ||
|
|
81b7b3505e | ||
|
|
1522a6f3ad | ||
|
|
04bae45955 | ||
|
|
873e910eb1 | ||
|
|
a7f86bf62a | ||
|
|
7ba278d210 | ||
|
|
e9ac9b9f13 | ||
|
|
d34843f90c | ||
|
|
374d0bdd9c | ||
|
|
5d3dc83bab | ||
|
|
05d0f75cdc | ||
|
|
711a4a6bab | ||
|
|
08895ba170 | ||
|
|
c2c8b108ac |
15
.env.example
Normal file
15
.env.example
Normal file
@@ -0,0 +1,15 @@
|
||||
SERVICE_PORT=1081
|
||||
VOLUME_BASE=/data/orion-visor-space/docker-volumes
|
||||
|
||||
MYSQL_HOST=mysql
|
||||
MYSQL_PORT=3306
|
||||
MYSQL_DATABASE=orion_visor
|
||||
MYSQL_USER=orion
|
||||
MYSQL_PASSWORD=Data@123456
|
||||
MYSQL_ROOT_PASSWORD=Data@123456
|
||||
|
||||
REDIS_HOST=redis
|
||||
REDIS_PASSWORD=Data@123456
|
||||
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
DEMO_MODE=false
|
||||
3
.github/workflows/e2e.yaml
vendored
3
.github/workflows/e2e.yaml
vendored
@@ -4,9 +4,8 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
concurrency:
|
||||
concurrency:
|
||||
group: ${{github.workflow}} - ${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,3 +33,4 @@ build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
.env
|
||||
|
||||
7
NOTICE
Normal file
7
NOTICE
Normal file
@@ -0,0 +1,7 @@
|
||||
* 在使用本项目前,请您仔细阅读免责声明,确保您已充分理解其中的内容
|
||||
|
||||
* 本项目采用 APACHE LICENSE 2.0 开源协议,如您需要源码的开发方式,需要遵循以下几点
|
||||
|
||||
1. 禁止修改或删除 LICENSE 文件。
|
||||
2. 不可二次开发或参与同类竞品的开发。
|
||||
3. 本项目可免费商业使用,商业使用请保留项目源码、出处、描述文件和作者声明等。
|
||||
20
README.md
20
README.md
@@ -19,12 +19,12 @@
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitee.com/dromara/orion-visor/stargazers">
|
||||
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
||||
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=gvp" alt="star" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitee.com/dromara/orion-visor/members">
|
||||
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
||||
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=gvp" alt="fork" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
@@ -51,9 +51,9 @@
|
||||
|
||||
## 演示环境
|
||||
|
||||
* 🔗 演示地址: http://101.43.254.243:1081/
|
||||
* 🔗 演示地址: https://dv.orionsec.cn/
|
||||
* 🔏 演示账号: admin/admin
|
||||
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor)
|
||||
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor/overview)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||
* 📛 演示环境请不要随便删除数据!
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
```bash
|
||||
# clone
|
||||
git clone https://github.com/dromara/orion-visor
|
||||
git clone --depth=1 https://github.com/dromara/orion-visor
|
||||
cd orion-visor
|
||||
# 启动
|
||||
docker compose up -d
|
||||
@@ -72,11 +72,11 @@ docker compose up -d
|
||||
|
||||
## 项目文档
|
||||
|
||||
* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/)
|
||||
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html)
|
||||
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html)
|
||||
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html)
|
||||
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html)
|
||||
* [文档地址](https://visor.orionsec.cn/)
|
||||
* [安装文档](https://visor.orionsec.cn/quickstart/docker.html)
|
||||
* [更新日志](https://visor.orionsec.cn/update/change-log.html)
|
||||
* [操作手册](https://visor.orionsec.cn/operator/asset.html)
|
||||
* [常见问题](https://visor.orionsec.cn/support/faq.html)
|
||||
|
||||
## 技术栈
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
orion-visor-service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.10
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 1081:80
|
||||
environment:
|
||||
- MYSQL_HOST=orion-visor-mysql
|
||||
- MYSQL_HOST=mysql
|
||||
- MYSQL_PORT=3306
|
||||
- MYSQL_DATABASE=orion_visor
|
||||
- MYSQL_USER=root
|
||||
- MYSQL_PASSWORD=Data@123456
|
||||
- REDIS_HOST=orion-visor-redis
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PASSWORD=Data@123456
|
||||
- SECRET_KEY=uQeacXV8b3isvKLK
|
||||
- DEMO_MODE=false
|
||||
@@ -24,15 +24,15 @@ services:
|
||||
retries: 200
|
||||
start_period: 3s
|
||||
depends_on:
|
||||
orion-visor-mysql:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
orion-visor-redis:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- orion-visor-mysql
|
||||
- orion-visor-redis
|
||||
orion-visor-mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.10
|
||||
- mysql
|
||||
- redis
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
@@ -51,8 +51,8 @@ services:
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
orion-visor-redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.10
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
@@ -71,9 +71,9 @@ services:
|
||||
build:
|
||||
context: ./docker/e2e
|
||||
environment:
|
||||
SERVER: http://orion-visor-service:80
|
||||
SERVER: http://service:80
|
||||
depends_on:
|
||||
orion-visor-service:
|
||||
service:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- orion-visor-service
|
||||
- service
|
||||
|
||||
@@ -1,73 +1,78 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
orion-visor-service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.10
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 1081:80
|
||||
- ${SERVICE_PORT:-1081}:80
|
||||
environment:
|
||||
- MYSQL_HOST=orion-visor-mysql
|
||||
- MYSQL_PORT=3306
|
||||
- MYSQL_DATABASE=orion_visor
|
||||
- MYSQL_USER=root
|
||||
- MYSQL_PASSWORD=Data@123456
|
||||
- REDIS_HOST=orion-visor-redis
|
||||
- REDIS_PASSWORD=Data@123456
|
||||
- SECRET_KEY=uQeacXV8b3isvKLK
|
||||
- DEMO_MODE=false
|
||||
- MYSQL_HOST=${MYSQL_HOST:-mysql}
|
||||
- MYSQL_PORT=${MYSQL_PORT:-3306}
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
|
||||
- MYSQL_USER=${MYSQL_USER:-root}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-Data@123456}
|
||||
- REDIS_HOST=${REDIS_HOST:-redis}
|
||||
- REDIS_PASSWORD=${REDIS_PASSWORD:-Data@123456}
|
||||
- SECRET_KEY=${SECRET_KEY:-uQeacXV8b3isvKLK}
|
||||
- DEMO_MODE=${DEMO_MODE:-false}
|
||||
volumes:
|
||||
- /data/orion-visor-space/docker-volumes/service/root-orion:/root/orion
|
||||
- ${VOLUME_BASE:-/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
|
||||
interval: 15s
|
||||
timeout: 300s
|
||||
retries: 200
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
depends_on:
|
||||
orion-visor-mysql:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
orion-visor-redis:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- orion-visor-mysql
|
||||
- orion-visor-redis
|
||||
orion-visor-mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.10
|
||||
- mysql
|
||||
- redis
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
environment:
|
||||
- MYSQL_DATABASE=orion_visor
|
||||
- MYSQL_USER=orion
|
||||
- MYSQL_PASSWORD=Data@123456
|
||||
- MYSQL_ROOT_PASSWORD=Data@123456
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
|
||||
- MYSQL_USER=${MYSQL_USER:-orion}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-Data@123456}
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-Data@123456}
|
||||
volumes:
|
||||
- /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
|
||||
- ${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
|
||||
healthcheck:
|
||||
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
|
||||
interval: 3s
|
||||
interval: 15s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
orion-visor-redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.10
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
environment:
|
||||
- REDIS_PASSWORD=Data@123456
|
||||
- REDIS_PASSWORD=${REDIS_PASSWORD:-Data@123456}
|
||||
volumes:
|
||||
- /data/orion-visor-space/docker-volumes/redis/data:/data
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/redis/data:/data
|
||||
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 3s
|
||||
interval: 15s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
orion-visor-adminer:
|
||||
image: adminer
|
||||
adminer:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.5
|
||||
ports:
|
||||
- 8081:8080
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- mysql
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
docker compose down
|
||||
# demo 启动
|
||||
if [ "$1" == "demo" ]; then
|
||||
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
||||
sed -i 's/\${DEMO_MODE:-false}/true/g' docker-compose.yml
|
||||
fi
|
||||
docker compose up -d
|
||||
docker compose up -d --remove-orphans
|
||||
|
||||
1
docker/adminer/Dockerfile
Normal file
1
docker/adminer/Dockerfile
Normal file
@@ -0,0 +1 @@
|
||||
FROM adminer:latest
|
||||
4
docker/adminer/build.sh
Normal file
4
docker/adminer/build.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#/bin/bash
|
||||
version=2.1.5
|
||||
docker build -t orion-visor-adminer:${version} .
|
||||
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
|
||||
@@ -17,7 +17,7 @@ items:
|
||||
code: 200
|
||||
- name: userPermission
|
||||
request:
|
||||
api: /orion-visor/api/infra/permission/user
|
||||
api: /orion-visor/api/infra/user-permission/user
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
expect:
|
||||
@@ -26,7 +26,7 @@ items:
|
||||
msg: "success"
|
||||
- name: menu
|
||||
request:
|
||||
api: /orion-visor/api/infra/permission/menu
|
||||
api: /orion-visor/api/infra/user-permission/menu
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
expect:
|
||||
@@ -36,22 +36,14 @@ items:
|
||||
- name: haveUnRead
|
||||
request:
|
||||
api: /orion-visor/api/infra/system-message/has-unread
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
- name: queryOperatorLog
|
||||
request:
|
||||
api: /orion-visor/api/infra/mine/query-operator-log
|
||||
method: POST
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
- name: hostList
|
||||
request:
|
||||
api: /orion-visor/api/infra/tag/list?type=HOST
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
- name: queryHost
|
||||
request:
|
||||
api: /orion-visor/api/asset/host/query
|
||||
method: POST
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#/bin/bash
|
||||
version=2.0.10
|
||||
version=2.1.5
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
docker tag orion-visor-mysql:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
|
||||
|
||||
6
docker/push.sh
Normal file
6
docker/push.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#/bin/bash
|
||||
version=2.1.5
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}
|
||||
@@ -1,5 +1,4 @@
|
||||
#/bin/bash
|
||||
version=2.0.10
|
||||
version=2.1.5
|
||||
docker build -t orion-visor-redis:${version} .
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#/bin/bash
|
||||
version=2.0.10
|
||||
version=2.1.5
|
||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||
mv ../../orion-visor-ui/dist ./dist
|
||||
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/lijiahangmax/orion-visor-service:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}
|
||||
|
||||
@@ -29,7 +29,7 @@ server {
|
||||
location /orion-visor/api {
|
||||
proxy_pass http://localhost:9200/orion-visor/api;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitee.com/lijiahangmax/orion-visor/stargazers">
|
||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=gvp" alt="star" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitee.com/lijiahangmax/orion-visor/members">
|
||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=gvp" alt="fork" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
|
||||
@@ -21,22 +21,35 @@ Dashboard 修改)
|
||||
|
||||
```shell
|
||||
# github
|
||||
git clone https://github.com/lijiahangmax/orion-visor
|
||||
git clone --depth=1 https://github.com/lijiahangmax/orion-visor
|
||||
# gitee
|
||||
git clone https://gitee.com/lijiahangmax/orion-visor
|
||||
git clone --depth=1 https://gitee.com/lijiahangmax/orion-visor
|
||||
```
|
||||
|
||||
### 构建镜像
|
||||
### 拉取镜像
|
||||
|
||||
```
|
||||
# 进入仓库目录
|
||||
cd orion-visor
|
||||
# 修改 docker-compose.yml (建议修改)
|
||||
# MYSQL_USER mysql 用户名
|
||||
# MYSQL_PASSWORD mysql 用户密码
|
||||
# MYSQL_ROOT_PASSWORD mysql root 密码
|
||||
# REDIS_PASSWORD redis 密码
|
||||
# SECRET_KEY 加密密钥
|
||||
# 创建名为 .env 的 .env.example 副本
|
||||
cp .env.example .env
|
||||
# 将其中的值删除以保持默认或将其修改为你喜欢的值
|
||||
# SERVICE_PORT 你希望服务监听的端口
|
||||
# VOLUME_BASE 你希望数据持久化保存的目录, 如果不提前创建将以 docker 进程宿主身份创建(通常是 root)
|
||||
|
||||
# MYSQL_HOST mysql 服务所在的主机, 如果你没有现有的 MySQL 请保持值为 mysql, 如果你有自部署的请在 docker-compose.yml 中移除 services.mysql 以节约性能
|
||||
# MYSQL_PORT mysql 监听的端口
|
||||
# MYSQL_DATABASE mysql 数据库
|
||||
# MYSQL_USER mysql 用户名
|
||||
# MYSQL_PASSWORD mysql 用户密码
|
||||
# MYSQL_ROOT_PASSWORD mysql root 密码
|
||||
|
||||
# REDIS_HOST redis 服务所在的主机, 如果你没有现有的 Redis 请保持值为 redis, 如果你有自部署的请在 docker-compose.yml 中移除 services.redis 以节约性能
|
||||
# REDIS_PASSWORD redis 密码
|
||||
|
||||
# SECRET_KEY 加密密钥
|
||||
# 拉取远程镜像
|
||||
docker compose pull
|
||||
```
|
||||
|
||||
### 启动
|
||||
@@ -45,7 +58,7 @@ cd orion-visor
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### 修改加密方式
|
||||
### 修改 MySQL 账户的加密方式
|
||||
|
||||
```
|
||||
访问 adminer: http://localhost:8081
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.0.10</revision>
|
||||
<revision>2.1.5</revision>
|
||||
<spring.boot.version>2.7.17</spring.boot.version>
|
||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||
<orion.kit.version>1.0.7</orion.kit.version>
|
||||
<orion.kit.version>1.0.8</orion.kit.version>
|
||||
<aspectj.version>1.9.7</aspectj.version>
|
||||
<lombok.version>1.18.26</lombok.version>
|
||||
<springdoc.version>1.6.15</springdoc.version>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.orion.visor.framework.common.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 保留
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/6 15:26
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Keep {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.0.10";
|
||||
String VERSION = "2.1.5";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
|
||||
@@ -29,4 +29,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
|
||||
|
||||
String SYSTEM_USERNAME = "system";
|
||||
|
||||
int BATCH_COUNT = 500;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.orion.visor.framework.common.constant;
|
||||
|
||||
import com.orion.lang.exception.ApplicationException;
|
||||
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*
|
||||
@@ -61,6 +64,10 @@ public interface ErrorMessage {
|
||||
|
||||
String GROUP_ABSENT = "分组不存在";
|
||||
|
||||
String HOST_TYPE_ERROR = "主机类型错误";
|
||||
|
||||
String HOST_NOT_ENABLED = "主机未启用";
|
||||
|
||||
String UNABLE_OPERATE_ADMIN_ROLE = "无法操作管理员账号";
|
||||
|
||||
String UNSUPPORTED_CHARSET = "不支持的编码 [{}]";
|
||||
@@ -93,6 +100,14 @@ public interface ErrorMessage {
|
||||
|
||||
String TASK_ABSENT = "任务不存在";
|
||||
|
||||
String CONNECT_ERROR = "连接失败";
|
||||
|
||||
String AUTH_ERROR = "认证失败";
|
||||
|
||||
String SCRIPT_UPLOAD_ERROR = "脚本上传失败";
|
||||
|
||||
String EXEC_ERROR = "执行失败";
|
||||
|
||||
String ILLEGAL_STATUS = "当前状态不支持此操作";
|
||||
|
||||
String CHECK_AUTHORIZED_HOST = "请选择已授权的主机";
|
||||
@@ -105,4 +120,43 @@ public interface ErrorMessage {
|
||||
|
||||
String CLIENT_ABORT = "手动中断";
|
||||
|
||||
String UNABLE_DOWNLOAD_FOLDER = "无法下载文件夹";
|
||||
|
||||
/**
|
||||
* 是否为业务异常
|
||||
*
|
||||
* @param ex ex
|
||||
* @return biz exception
|
||||
*/
|
||||
static boolean isBizException(Exception ex) {
|
||||
if (ex == null) {
|
||||
return false;
|
||||
}
|
||||
return ex instanceof InvalidArgumentException
|
||||
|| ex instanceof IllegalArgumentException
|
||||
|| ex instanceof ApplicationException;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取错误信息
|
||||
*
|
||||
* @param ex ex
|
||||
* @param defaultMsg defaultMsg
|
||||
* @return message
|
||||
*/
|
||||
static String getErrorMessage(Exception ex, String defaultMsg) {
|
||||
if (ex == null) {
|
||||
return null;
|
||||
}
|
||||
String message = ex.getMessage();
|
||||
if (message == null) {
|
||||
return defaultMsg;
|
||||
}
|
||||
// 业务异常
|
||||
if (isBizException(ex)) {
|
||||
return message;
|
||||
}
|
||||
return defaultMsg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,4 +43,6 @@ public interface ExtraFieldConst extends FieldConst {
|
||||
|
||||
String LOG_ID = "logId";
|
||||
|
||||
String DARK = "dark";
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface FieldConst {
|
||||
|
||||
String INFO = "info";
|
||||
|
||||
String EXTRA = "extra";
|
||||
|
||||
String REL_ID = "relId";
|
||||
|
||||
String BEFORE = "before";
|
||||
@@ -59,10 +61,24 @@ public interface FieldConst {
|
||||
|
||||
String TIME = "time";
|
||||
|
||||
String ISSUE = "issue";
|
||||
|
||||
String EXPIRE = "expire";
|
||||
|
||||
String LOCATION = "location";
|
||||
|
||||
String USER_AGENT = "userAgent";
|
||||
|
||||
String ERROR_MESSAGE = "errorMessage";
|
||||
|
||||
String UUID = "uuid";
|
||||
|
||||
String REDIRECT = "redirect";
|
||||
|
||||
String SCHEMA = "schema";
|
||||
|
||||
String FILTER = "filter";
|
||||
|
||||
String ALL = "all";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orion.visor.framework.common.entity;
|
||||
|
||||
/**
|
||||
* 数据清理请求 定义
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/29 11:26
|
||||
*/
|
||||
public interface DataClearRequest {
|
||||
|
||||
/**
|
||||
* 获取清理数量限制
|
||||
*
|
||||
* @return 清理限制
|
||||
*/
|
||||
Integer getLimit();
|
||||
|
||||
/**
|
||||
* 设置清理数量限制
|
||||
*
|
||||
* @param limit limit
|
||||
*/
|
||||
void setLimit(Integer limit);
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.orion.visor.framework.common.entity;
|
||||
|
||||
import com.orion.lang.define.wrapper.IPageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 公共页码请求
|
||||
@@ -15,14 +17,18 @@ import org.hibernate.validator.constraints.Range;
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "公共页码请求")
|
||||
public class PageRequest implements IPageRequest {
|
||||
public class PageRequest {
|
||||
|
||||
@Range(min = 1, max = 10000, groups = Page.class)
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 10000, groups = Page.class)
|
||||
@Schema(description = "页码")
|
||||
private int page;
|
||||
private Integer page;
|
||||
|
||||
@Range(min = 1, max = 100, groups = Page.class)
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 200, groups = Page.class)
|
||||
@Schema(description = "大小")
|
||||
private int limit;
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orion.visor.framework.common.meta;
|
||||
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
import com.orion.lang.id.UUIds;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
/**
|
||||
* traceId 持有者
|
||||
@@ -23,16 +25,74 @@ public class TraceIdHolder {
|
||||
*/
|
||||
private static final ThreadLocal<String> HOLDER = new TransmittableThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 获取 traceId
|
||||
*
|
||||
* @return traceId
|
||||
*/
|
||||
public static String get() {
|
||||
return HOLDER.get();
|
||||
}
|
||||
|
||||
public static void set(String traceId) {
|
||||
HOLDER.set(traceId);
|
||||
/**
|
||||
* 设置 traceId
|
||||
*/
|
||||
public static void set() {
|
||||
set(createTraceId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 traceId
|
||||
*
|
||||
* @param traceId traceId
|
||||
*/
|
||||
public static void set(String traceId) {
|
||||
// 设置应用上下文
|
||||
HOLDER.set(traceId);
|
||||
// 设置日志上下文
|
||||
setMdc(traceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 traceId
|
||||
*/
|
||||
public static void remove() {
|
||||
// 移除应用上下文
|
||||
HOLDER.remove();
|
||||
// 移除日志上下文
|
||||
removeMdc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从应用上下文 设置到日志上下文
|
||||
*/
|
||||
public static void setMdc() {
|
||||
setMdc(HOLDER.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置到日志上下文
|
||||
*
|
||||
* @param traceId traceId
|
||||
*/
|
||||
public static void setMdc(String traceId) {
|
||||
MDC.put(TRACE_ID_MDC, traceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除日志上下文
|
||||
*/
|
||||
public static void removeMdc() {
|
||||
MDC.remove(TRACE_ID_MDC);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 traceId
|
||||
*
|
||||
* @return traceId
|
||||
*/
|
||||
public static String createTraceId() {
|
||||
return UUIds.random32();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ public class IpUtils {
|
||||
* @return addr
|
||||
*/
|
||||
public static String getRemoteAddr(HttpServletRequest request) {
|
||||
// 获取实际地址
|
||||
String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
|
||||
if (!Strings.isBlank(realIp)) {
|
||||
return realIp;
|
||||
}
|
||||
// 获取实际地址 X_REAL_IP 在多代理情况下会有问题
|
||||
// String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
|
||||
// if (!Strings.isBlank(realIp)) {
|
||||
// return realIp;
|
||||
// }
|
||||
// 获取请求地址
|
||||
return Servlets.getRemoteAddr(request);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.orion.visor.framework.common.utils;
|
||||
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
|
||||
/**
|
||||
* sql 工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/26 16:03
|
||||
*/
|
||||
public class SqlUtils {
|
||||
|
||||
private SqlUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* limit n
|
||||
*
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(Number limit) {
|
||||
return Const.LIMIT + Const.SPACE + limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* limit offset limit
|
||||
*
|
||||
* @param offset offset
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(Number offset, Number limit) {
|
||||
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Validator;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -31,6 +32,10 @@ public class Valid extends com.orion.lang.utils.Valid {
|
||||
return notBlank(s, ErrorMessage.PARAM_MISSING);
|
||||
}
|
||||
|
||||
public static <T extends Map<?, ?>> T notEmpty(T map) {
|
||||
return notEmpty(map, ErrorMessage.PARAM_MISSING);
|
||||
}
|
||||
|
||||
public static <T extends Collection<?>> T notEmpty(T object) {
|
||||
return notEmpty(object, ErrorMessage.PARAM_MISSING);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 批量验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Batch extends Default {
|
||||
public interface Batch {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 清理验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Clear {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Export {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Id extends Default {
|
||||
public interface Id {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Import {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Page extends Default {
|
||||
public interface Page {
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* quartz 配置
|
||||
@@ -22,27 +19,6 @@ import javax.sql.DataSource;
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_JOB_QUARTZ)
|
||||
public class OrionQuartzAutoConfiguration {
|
||||
|
||||
/**
|
||||
* @return 任务工厂
|
||||
*/
|
||||
@Bean
|
||||
public SpringBeanJobFactory jobFactory() {
|
||||
return new SpringBeanJobFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataSource dataSource
|
||||
* @param jobFactory jobFactory
|
||||
* @return 调度器工厂
|
||||
*/
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource, SpringBeanJobFactory jobFactory) {
|
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
factory.setDataSource(dataSource);
|
||||
factory.setJobFactory(jobFactory);
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schedulerFactoryBean 调度器工厂
|
||||
* @return 调度器
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 不执行统一日志打印
|
||||
* <p>
|
||||
* 如果设置在方法上,则忽略该方法的日志打印
|
||||
* 如果设置到参数上,则忽略该参数的日志打印
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
@@ -310,8 +310,6 @@ public class CodeGenerator implements Executable {
|
||||
new String[]{"/templates/orion-server-module-entity-request-update.java.vm", "${type}UpdateRequest.java", "entity.request.${bizPackage}"},
|
||||
// query request 文件
|
||||
new String[]{"/templates/orion-server-module-entity-request-query.java.vm", "${type}QueryRequest.java", "entity.request.${bizPackage}"},
|
||||
// export 文件
|
||||
new String[]{"/templates/orion-server-module-entity-export.java.vm", "${type}Export.java", "entity.export"},
|
||||
// convert 文件
|
||||
new String[]{"/templates/orion-server-module-convert.java.vm", "${type}Convert.java", "convert"},
|
||||
// cache dto 文件
|
||||
|
||||
@@ -113,7 +113,6 @@ public class CodeGeneratorEngine extends VelocityTemplateEngine {
|
||||
apiComment.put("deleteById", "删除" + comment);
|
||||
apiComment.put("deleteAll", "根据条件删除" + comment);
|
||||
apiComment.put("batchDelete", "批量删除" + comment);
|
||||
apiComment.put("export", "导出" + comment);
|
||||
objectMap.put("apiComment", apiComment);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,18 @@ public class CustomFileFilter {
|
||||
public List<CustomFile> doFilter() {
|
||||
// 生成文件副本
|
||||
List<CustomFile> files = originCustomerFile.stream().map(s ->
|
||||
new CustomFile.Builder()
|
||||
.enableFileOverride()
|
||||
.templatePath(s.getTemplatePath())
|
||||
.filePath(s.getFilePath())
|
||||
.fileName(s.getFileName())
|
||||
.packageName(s.getPackageName())
|
||||
.build())
|
||||
new CustomFile.Builder()
|
||||
.enableFileOverride()
|
||||
.templatePath(s.getTemplatePath())
|
||||
.filePath(s.getFilePath())
|
||||
.fileName(s.getFileName())
|
||||
.packageName(s.getPackageName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
// 不生成 api http 文件
|
||||
if (!table.isEnableApiHttp()) {
|
||||
files.removeIf(file -> isApiHttpFile(file.getTemplatePath()));
|
||||
}
|
||||
// 不生成对外 api 文件
|
||||
if (!table.isEnableProviderApi()) {
|
||||
files.removeIf(file -> isServerProviderFile(file.getTemplatePath()));
|
||||
@@ -139,13 +143,13 @@ public class CustomFileFilter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为导出文件
|
||||
* 是否为 api http 文件
|
||||
*
|
||||
* @param templatePath templatePath
|
||||
* @return 是否为导出文件
|
||||
*/
|
||||
public static boolean isExportFile(String templatePath) {
|
||||
return templatePath.contains("orion-server-module-entity-export");
|
||||
public static boolean isApiHttpFile(String templatePath) {
|
||||
return templatePath.contains("orion-server-module-controller.http");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.framework.mybatis.core.generator.core;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableField;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.FieldConst;
|
||||
@@ -47,7 +48,7 @@ public class DictParser {
|
||||
.stream()
|
||||
.filter(s -> variable.equals(s.getName()) || variable.equals(s.getPropertyName()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new RuntimeException("未查询到字典映射字段 " + variable));
|
||||
.orElseThrow(() -> Exceptions.runtime("未查询到字典映射字段 " + variable));
|
||||
// 设置字段名称
|
||||
if (meta.getField() == null) {
|
||||
meta.setField(Strings.firstUpper(tableField.getPropertyName()));
|
||||
|
||||
@@ -63,6 +63,16 @@ public class ServerTemplate extends Template {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否生成 api http 文件
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
public ServerTemplate enableApiHttp() {
|
||||
table.enableApiHttp = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否生成对外 api
|
||||
*
|
||||
|
||||
@@ -33,6 +33,11 @@ public class Table {
|
||||
*/
|
||||
protected String bizPackage;
|
||||
|
||||
/**
|
||||
* 是否生成 api http 文件
|
||||
*/
|
||||
protected boolean enableApiHttp;
|
||||
|
||||
/**
|
||||
* 是否生成对外 api
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.framework.mybatis.core.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.mybatis.core.query.Conditions;
|
||||
import com.orion.visor.framework.mybatis.core.query.DataQuery;
|
||||
|
||||
@@ -61,7 +62,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
default boolean insertBatch(Collection<T> entities) {
|
||||
return Db.saveBatch(entities);
|
||||
return this.insertBatch(entities, Const.BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +83,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
default boolean updateBatch(Collection<T> entities) {
|
||||
return Db.updateBatchById(entities);
|
||||
return this.updateBatch(entities, Const.BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +114,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
default boolean insertOrUpdateBatch(Collection<T> entities) {
|
||||
return Db.saveOrUpdateBatch(entities);
|
||||
return this.insertOrUpdateBatch(entities, Const.BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.reflect.Classes;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -36,7 +37,7 @@ public class DataQuery<T> {
|
||||
|
||||
private final BaseMapper<T> dao;
|
||||
|
||||
private IPageRequest page;
|
||||
private PageRequest page;
|
||||
|
||||
private Wrapper<T> wrapper;
|
||||
|
||||
@@ -73,8 +74,9 @@ public class DataQuery<T> {
|
||||
return new DataQuery<>(dao, wrapper);
|
||||
}
|
||||
|
||||
public DataQuery<T> page(IPageRequest page) {
|
||||
this.page = Valid.notNull(page, "page is null");
|
||||
public DataQuery<T> page(com.orion.visor.framework.common.entity.PageRequest page) {
|
||||
com.orion.visor.framework.common.entity.PageRequest pr = Valid.notNull(page, "page is null");
|
||||
this.page = new PageRequest(pr.getPage(), pr.getLimit());
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -111,11 +113,11 @@ public class DataQuery<T> {
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + limit);
|
||||
return this.last(SqlUtils.limit(limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int offset, int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit);
|
||||
return this.last(SqlUtils.limit(offset, limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> only() {
|
||||
@@ -199,6 +201,18 @@ public class DataQuery<T> {
|
||||
return dao.selectCount(wrapper);
|
||||
}
|
||||
|
||||
public Long countMax(Number max) {
|
||||
Long count = dao.selectCount(wrapper);
|
||||
if (max == null) {
|
||||
return count;
|
||||
}
|
||||
long maxValue = max.longValue();
|
||||
if (maxValue <= 0L) {
|
||||
return count;
|
||||
}
|
||||
return Math.min(count, maxValue);
|
||||
}
|
||||
|
||||
public boolean absent() {
|
||||
return dao.selectCount(wrapper) == 0;
|
||||
}
|
||||
@@ -210,14 +224,23 @@ public class DataQuery<T> {
|
||||
// -------------------- data grid --------------------
|
||||
|
||||
public DataGrid<T> dataGrid() {
|
||||
return this.dataGrid(Function.identity());
|
||||
return this.dataGrid(this.wrapper, Function.identity());
|
||||
}
|
||||
|
||||
public DataGrid<T> dataGrid(Wrapper<T> countWrapper) {
|
||||
return this.dataGrid(countWrapper, Function.identity());
|
||||
}
|
||||
|
||||
public <R> DataGrid<R> dataGrid(Function<T, R> mapper) {
|
||||
Valid.notNull(mapper, "convert function is null");
|
||||
return this.dataGrid(this.wrapper, mapper);
|
||||
}
|
||||
|
||||
public <R> DataGrid<R> dataGrid(Wrapper<T> countWrapper, Function<T, R> mapper) {
|
||||
Valid.notNull(page, "page is null");
|
||||
Valid.notNull(wrapper, "wrapper is null");
|
||||
Long count = dao.selectCount(wrapper);
|
||||
Valid.notNull(countWrapper, "count wrapper is null");
|
||||
Valid.notNull(mapper, "convert function is null");
|
||||
Long count = dao.selectCount(countWrapper);
|
||||
Pager<R> pager = new Pager<>(page);
|
||||
pager.setTotal(count.intValue());
|
||||
boolean next = pager.hasMoreData();
|
||||
|
||||
@@ -60,6 +60,18 @@ Authorization: {{token}}
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.queryCount}
|
||||
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/count
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
#foreach($field in ${table.fields})
|
||||
"${field.propertyName}": ""#if($foreach.hasNext),#end
|
||||
#end
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.deleteById}
|
||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/${package.ModuleName}/${typeHyphen}")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
#if(${superControllerClass})
|
||||
public class ${table.controllerName} extends ${superControllerClass} {
|
||||
#else
|
||||
@@ -114,6 +113,13 @@ public class ${table.controllerName} {
|
||||
return ${typeLower}Service.get${type}Page(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "${apiComment.queryCount}")
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||
public Long get${type}Count(@Validated @RequestBody ${type}QueryRequest request) {
|
||||
return ${typeLower}Service.get${type}Count(request);
|
||||
}
|
||||
|
||||
#if($meta.enableDemoApi)
|
||||
@DemoDisableApi
|
||||
#end
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.office.excel.annotation.ExportField;
|
||||
import com.orion.office.excel.annotation.ExportSheet;
|
||||
import com.orion.office.excel.annotation.ExportTitle;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.math.*;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 导出对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${version}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ExportTitle(title = ${type}Export.TITLE)
|
||||
@ExportSheet(name = "$!{table.comment}", filterHeader = true, freezeHeader = true, indexToSort = true)
|
||||
@Schema(name = "${type}Export", description = "$!{table.comment}导出对象")
|
||||
public class ${type}Export implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String TITLE = "$!{table.comment}导出";
|
||||
#foreach($field in ${table.fields})
|
||||
|
||||
#if("$!field.comment" != "")
|
||||
@Schema(description = "${field.comment}")
|
||||
#end
|
||||
#if("$field.propertyType" == "Date")
|
||||
@ExportField(index = ${foreach.index}, header = "${field.comment}", width = 16, format = Dates.YMD_HMS)
|
||||
#else
|
||||
@ExportField(index = ${foreach.index}, header = "${field.comment}", width = 16)
|
||||
#end
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
#end
|
||||
|
||||
@ExportField(index = $table.fields.size(), header = "创建时间", width = 16, format = Dates.YMD_HMS)
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
#set($updateTimeIndex=$table.fields.size() + 1)
|
||||
@Schema(description = "修改时间")
|
||||
@ExportField(index = $updateTimeIndex, header = "修改时间", width = 16, format = Dates.YMD_HMS)
|
||||
private Date updateTime;
|
||||
|
||||
#set($creatorIndex=$table.fields.size() + 2)
|
||||
@Schema(description = "创建人")
|
||||
@ExportField(index = $creatorIndex, header = "创建人", width = 16)
|
||||
private String creator;
|
||||
|
||||
#set($updaterIndex=$table.fields.size() + 3)
|
||||
@Schema(description = "修改人")
|
||||
@ExportField(index = $updaterIndex, header = "修改人", width = 16)
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -122,7 +122,8 @@ 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);
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::to);
|
||||
}
|
||||
@@ -148,24 +149,28 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
.sorted(Comparator.comparing(${type}VO::getId).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.page(request)
|
||||
.wrapper(wrapper)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long get${type}Count(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,13 +240,8 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
|
||||
String searchValue = request.getSearchValue();
|
||||
return ${typeLower}DAO.wrapper()
|
||||
#foreach($field in ${table.fields})
|
||||
@@ -251,8 +251,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end
|
||||
#end
|
||||
)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ${package.Service};
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
@@ -116,4 +117,12 @@ public interface ${table.serviceName} {
|
||||
*/
|
||||
Integer delete${type}(${type}QueryRequest request);
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,3 @@ VALUES
|
||||
(@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);
|
||||
#if(false)
|
||||
(@TMP_SUB_ID, '导出$table.comment', '${package.ModuleName}:${typeHyphen}:export', 3, 50, '1', '1', 0),
|
||||
(@TMP_SUB_ID, '导入$table.comment', '${package.ModuleName}:${typeHyphen}:import', 3, 60, '1', '1', 0);
|
||||
#end
|
||||
|
||||
@@ -115,6 +115,13 @@ export function get${vue.featureEntity}Page(request: ${vue.featureEntity}QueryRe
|
||||
return axios.post<DataGrid<${vue.featureEntity}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.queryCount
|
||||
*/
|
||||
export function get${vue.featureEntity}Count(request: ${vue.featureEntity}QueryRequest) {
|
||||
return axios.post<number>('/${package.ModuleName}/${typeHyphen}/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.deleteById
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<card-list v-model:searchValue="formModel.searchValue"
|
||||
search-input-placeholder="输入搜索值"
|
||||
create-card-position="head"
|
||||
:create-card-position="false"
|
||||
:loading="loading"
|
||||
:fieldConfig="fieldConfig"
|
||||
:field-config="fieldConfig"
|
||||
:list="list"
|
||||
:pagination="pagination"
|
||||
:card-layout-cols="cardColLayout"
|
||||
@@ -68,21 +68,22 @@
|
||||
<template #extra="{ record }">
|
||||
<a-space>
|
||||
<!-- 更多操作 -->
|
||||
<a-dropdown trigger="hover">
|
||||
<a-dropdown trigger="hover" :popup-max-height="false">
|
||||
<icon-more class="card-extra-icon" />
|
||||
<template #content>
|
||||
<!-- 修改 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
||||
@click="emits('openUpdate', record)">
|
||||
<icon-edit />
|
||||
修改
|
||||
<span class="more-doption normal">
|
||||
<icon-edit /> 修改
|
||||
</span>
|
||||
</a-doption>
|
||||
<!-- 删除 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
||||
class="span-red"
|
||||
@click="deleteRow(record.id)">
|
||||
<icon-delete />
|
||||
删除
|
||||
<span class="more-doption error">
|
||||
<icon-delete /> 删除
|
||||
</span>
|
||||
</a-doption>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
@@ -93,15 +94,17 @@
|
||||
<!-- 修改 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
||||
@click="emits('openUpdate', record)">
|
||||
<icon-edit />
|
||||
修改
|
||||
<span class="more-doption normal">
|
||||
<icon-edit /> 修改
|
||||
</span>
|
||||
</a-doption>
|
||||
<!-- 删除 -->
|
||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
||||
class="span-red"
|
||||
@click="deleteRow(record.id)">
|
||||
<icon-delete />
|
||||
删除
|
||||
<span class="more-doption error">
|
||||
<icon-delete /> 删除
|
||||
</span>
|
||||
</a-doption>
|
||||
</template>
|
||||
</card-list>
|
||||
@@ -115,7 +118,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
|
||||
import { usePagination, useColLayout } from '@/types/card';
|
||||
import { useCardPagination, useCardColLayout } from '@/hooks/card';
|
||||
import { computed, reactive, ref, onMounted } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { objectTruthKeyCount, resetObject } from '@/utils';
|
||||
@@ -133,8 +136,8 @@
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
|
||||
const cardColLayout = useColLayout();
|
||||
const pagination = usePagination();
|
||||
const cardColLayout = useCardColLayout();
|
||||
const pagination = useCardPagination();
|
||||
const { loading, setLoading } = useLoading();
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<a-modal v-model:visible="visible"
|
||||
body-class="modal-form-large"
|
||||
modal-class="modal-form-large"
|
||||
title-align="start"
|
||||
:title="title"
|
||||
:top="80"
|
||||
|
||||
@@ -94,8 +94,8 @@
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)">
|
||||
@page-change="(page: number) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size: number) => fetchTableData(1, size)">
|
||||
#foreach($field in ${table.fields})
|
||||
#if(${dictMap.containsKey(${field.propertyName})})
|
||||
<!-- $field.comment -->
|
||||
@@ -151,9 +151,9 @@
|
||||
import {} from '../types/const';
|
||||
#end
|
||||
#if($vue.enableRowSelection)
|
||||
import { usePagination, useRowSelection } from '@/types/table';
|
||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
||||
#else
|
||||
import { usePagination } from '@/types/table';
|
||||
import { useTablePagination } from '@/hooks/table';
|
||||
#end
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
import { useDictStore } from '@/store';
|
||||
@@ -161,7 +161,7 @@
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||
|
||||
const pagination = usePagination();
|
||||
const pagination = useTablePagination();
|
||||
#if($vue.enableRowSelection)
|
||||
const rowSelection = useRowSelection();
|
||||
#end
|
||||
|
||||
@@ -6,7 +6,7 @@ const columns = [
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 100,
|
||||
width: 68,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
|
||||
@@ -15,6 +15,7 @@ const columns = [
|
||||
slotName: '${field.propertyName}',
|
||||
align: 'left',
|
||||
#if(${field.propertyType} == 'String')
|
||||
minWidth: 238,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
#elseif(${field.propertyType} == 'Date')
|
||||
|
||||
@@ -98,6 +98,13 @@ public class SecurityUtils {
|
||||
return loginUser != null ? loginUser.getTimestamp() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空用户上下文
|
||||
*/
|
||||
public static void clearAuthentication() {
|
||||
SecurityContextHolder.getContext().setAuthentication(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前用户
|
||||
*
|
||||
@@ -107,7 +114,9 @@ public class SecurityUtils {
|
||||
public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) {
|
||||
// 创建 authentication
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginUser, null, Collections.emptyList());
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
if (request != null) {
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
}
|
||||
// 设置上下文
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.orion.visor.framework.web.core.filter;
|
||||
|
||||
import com.orion.lang.id.UUIds;
|
||||
import com.orion.visor.framework.common.meta.TraceIdHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
@@ -23,21 +21,17 @@ public class TraceIdFilter extends OncePerRequestFilter {
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
try {
|
||||
// 获 traceId
|
||||
String traceId = UUIds.random32();
|
||||
// 设置应用上下文
|
||||
// 获取 traceId
|
||||
String traceId = TraceIdHolder.createTraceId();
|
||||
// 设置 traceId 上下文
|
||||
TraceIdHolder.set(traceId);
|
||||
// 设置日志上下文
|
||||
MDC.put(TraceIdHolder.TRACE_ID_MDC, traceId);
|
||||
// 设置响应头
|
||||
response.setHeader(TraceIdHolder.TRACE_ID_HEADER, traceId);
|
||||
// 执行请求
|
||||
filterChain.doFilter(request, response);
|
||||
} finally {
|
||||
// 清理应用上下文
|
||||
// 清空 traceId 上下文
|
||||
TraceIdHolder.remove();
|
||||
// 清理日志上下文
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ management:
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
# 日志打印
|
||||
# sql 日志打印
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
@@ -82,13 +82,13 @@ spring:
|
||||
instanceName: quartzScheduler
|
||||
jobStore:
|
||||
# 持久化配置
|
||||
class: org.quartz.impl.jdbcjobstore.JobStoreTX
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
useProperties: false
|
||||
tablePrefix: QRTZ_
|
||||
misfireThreshold: 60000
|
||||
clusterCheckinInterval: 5000
|
||||
isClustered: true
|
||||
isClustered: false
|
||||
# 连接池
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
@@ -167,6 +167,8 @@ app:
|
||||
allow-refresh: true
|
||||
# 凭证续签最大次数
|
||||
max-refresh-count: 3
|
||||
# 登录失败发送站内信阈值
|
||||
login-failed-send-threshold: 3
|
||||
# 登录失败锁定次数
|
||||
login-failed-lock-count: 5
|
||||
# 登录失败锁定时间 (分)
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.orion.visor.module.asset.handler.host.terminal.TerminalMessageDispatc
|
||||
import com.orion.visor.module.asset.handler.host.transfer.TransferMessageDispatcher;
|
||||
import com.orion.visor.module.asset.interceptor.ExecLogTailInterceptor;
|
||||
import com.orion.visor.module.asset.interceptor.TerminalAccessInterceptor;
|
||||
import com.orion.visor.module.asset.interceptor.TerminalTransferInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
||||
@@ -28,6 +29,9 @@ public class AssetWebSocketConfiguration implements WebSocketConfigurer {
|
||||
@Resource
|
||||
private TerminalAccessInterceptor terminalAccessInterceptor;
|
||||
|
||||
@Resource
|
||||
private TerminalTransferInterceptor terminalTransferInterceptor;
|
||||
|
||||
@Resource
|
||||
private ExecLogTailInterceptor execLogTailInterceptor;
|
||||
|
||||
@@ -42,13 +46,13 @@ public class AssetWebSocketConfiguration implements WebSocketConfigurer {
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
// 终端
|
||||
// 终端会话
|
||||
registry.addHandler(terminalMessageDispatcher, prefix + "/host/terminal/{accessToken}")
|
||||
.addInterceptors(terminalAccessInterceptor)
|
||||
.setAllowedOrigins("*");
|
||||
// 文件传输
|
||||
registry.addHandler(transferMessageDispatcher, prefix + "/host/transfer/{accessToken}")
|
||||
.addInterceptors(terminalAccessInterceptor)
|
||||
registry.addHandler(transferMessageDispatcher, prefix + "/host/transfer/{transferToken}")
|
||||
.addInterceptors(terminalTransferInterceptor)
|
||||
.setAllowedOrigins("*");
|
||||
// 执行日志
|
||||
registry.addHandler(execLogTailHandler, prefix + "/exec/log/{token}")
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
### 查询当前用户已授权的主机
|
||||
GET {{baseUrl}}/asset/authorized-data/current-host
|
||||
Authorization: {{token}}
|
||||
|
||||
### 查询当前用户已授权的主机密钥
|
||||
GET {{baseUrl}}/asset/authorized-data/current-host-key
|
||||
Authorization: {{token}}
|
||||
|
||||
### 查询当前用户已授权的主机身份
|
||||
GET {{baseUrl}}/asset/authorized-data/current-host-identity
|
||||
Authorization: {{token}}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
### 主机分组授权
|
||||
PUT {{baseUrl}}/asset/data-grant/grant-host-group
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"userId": 10,
|
||||
"idList": [
|
||||
3,
|
||||
5
|
||||
]
|
||||
}
|
||||
|
||||
### 获取已授权的主机分组
|
||||
GET {{baseUrl}}/asset/data-grant/get-host-group?userId=10
|
||||
Authorization: {{token}}
|
||||
|
||||
### 主机密钥授权
|
||||
PUT {{baseUrl}}/asset/data-grant/grant-host-key
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"userId": 10,
|
||||
"idList": [
|
||||
2,
|
||||
3
|
||||
]
|
||||
}
|
||||
|
||||
### 获取已授权的主机密钥
|
||||
GET {{baseUrl}}/asset/data-grant/get-host-key?userId=10
|
||||
Authorization: {{token}}
|
||||
|
||||
### 主机身份授权
|
||||
PUT {{baseUrl}}/asset/data-grant/grant-host-identity
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"userId": 10,
|
||||
"idList": [
|
||||
3,
|
||||
5
|
||||
]
|
||||
}
|
||||
|
||||
### 获取已授权的主机身份
|
||||
GET {{baseUrl}}/asset/data-grant/get-host-identity?userId=10
|
||||
Authorization: {{token}}
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostGroupOperatorType;
|
||||
import com.orion.visor.module.asset.define.operator.HostIdentityOperatorType;
|
||||
@@ -43,6 +44,7 @@ public class AssetDataGrantServiceController {
|
||||
@Resource
|
||||
private AssetAuthorizedDataService assetAuthorizedDataService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostGroupOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-group")
|
||||
@Operation(summary = "主机分组授权")
|
||||
@@ -60,6 +62,7 @@ public class AssetDataGrantServiceController {
|
||||
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_GROUP, request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostKeyOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-key")
|
||||
@Operation(summary = "主机密钥授权")
|
||||
@@ -77,6 +80,7 @@ public class AssetDataGrantServiceController {
|
||||
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_KEY, request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostIdentityOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-identity")
|
||||
@Operation(summary = "主机身份授权")
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
### 创建命令片段
|
||||
POST {{baseUrl}}/asset/command-snippet/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"groupId": "",
|
||||
"name": "",
|
||||
"command": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新命令片段
|
||||
PUT {{baseUrl}}/asset/command-snippet/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"groupId": "",
|
||||
"name": "",
|
||||
"command": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询全部命令片段
|
||||
GET {{baseUrl}}/asset/command-snippet/list
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 删除命令片段
|
||||
DELETE {{baseUrl}}/asset/command-snippet/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -29,7 +29,6 @@ import javax.annotation.Resource;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/command-snippet")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class CommandSnippetController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
### 创建命令片段分组
|
||||
POST {{baseUrl}}/asset/command-snippet-group/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新命令片段分组
|
||||
PUT {{baseUrl}}/asset/command-snippet-group/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询全部命令片段分组
|
||||
GET {{baseUrl}}/asset/command-snippet-group/list
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 删除命令片段分组
|
||||
DELETE {{baseUrl}}/asset/command-snippet-group/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -31,7 +31,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/command-snippet-group")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class CommandSnippetGroupController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
### 批量执行命令
|
||||
POST {{baseUrl}}/asset/exec-command/exec
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"description": 1,
|
||||
"timeout": 10,
|
||||
"scriptExec": 0,
|
||||
"command": "echo 这是日志@{{ hostAddress }}\nsleep 1\necho @{{ hostName }}",
|
||||
"parameterSchema": "[]",
|
||||
"hostIdList": [1]
|
||||
}
|
||||
|
||||
### 批量执行命令
|
||||
POST {{baseUrl}}/asset/exec-command/re-exec
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"logId": 1
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
@@ -33,7 +33,6 @@ import javax.annotation.Resource;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-command")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecCommandController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
### 查询批量执行日志
|
||||
GET {{baseUrl}}/asset/exec-command-log/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询批量执行日志
|
||||
POST {{baseUrl}}/asset/exec-command-log/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"userId": "",
|
||||
"username": "",
|
||||
"description": "",
|
||||
"command": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除批量执行日志
|
||||
DELETE {{baseUrl}}/asset/exec-command-log/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 批量删除批量执行日志
|
||||
DELETE {{baseUrl}}/asset/exec-command-log/batch-delete?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 查看执行日志
|
||||
POST {{baseUrl}}/asset/exec-command-log/tail
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"execId": 56
|
||||
}
|
||||
|
||||
|
||||
### 下载批量执行日志文件
|
||||
GET {{baseUrl}}/asset/exec-command-log/download?id=83
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 中断批量执行命令
|
||||
POST {{baseUrl}}/asset/exec-command-log/interrupt
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"logId": 7
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
@@ -10,6 +10,7 @@ import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecCommandLogOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
@@ -43,7 +44,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-command-log")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecCommandLogController {
|
||||
|
||||
private static final String SOURCE = ExecSourceEnum.BATCH.name();
|
||||
@@ -98,6 +98,14 @@ public class ExecCommandLogController {
|
||||
return execLogService.getExecHistory(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询批量执行日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
public Long getExecCommandLogCount(@Validated @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecCommandLogOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除批量执行日志")
|
||||
@@ -125,19 +133,11 @@ public class ExecCommandLogController {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询批量执行日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:management:clear')")
|
||||
public Long getExecCommandLogCount(@RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecCommandLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空批量执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:management:clear')")
|
||||
public Integer clearExecCommandLog(@RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecCommandLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
@@ -179,4 +179,3 @@ public class ExecCommandLogController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
### 创建计划任务
|
||||
POST {{baseUrl}}/asset/exec-job/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "测试 1",
|
||||
"expression": "0 */3 * * * ?",
|
||||
"timeout": 0,
|
||||
"scriptExec": 0,
|
||||
"command": "echo 123",
|
||||
"parameterSchema": "[]",
|
||||
"hostIdList": [
|
||||
1
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
### 更新计划任务
|
||||
PUT {{baseUrl}}/asset/exec-job/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": 5,
|
||||
"name": "测试 1",
|
||||
"expression": "0 */10 * * * ?",
|
||||
"timeout": 0,
|
||||
"scriptExec": 0,
|
||||
"command": "echo 123",
|
||||
"parameterSchema": "[]",
|
||||
"hostIdList": [
|
||||
1
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
### 更新计划任务状态
|
||||
PUT {{baseUrl}}/asset/exec-job/update-status
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": 5,
|
||||
"status": 0
|
||||
}
|
||||
|
||||
|
||||
### 查询计划任务
|
||||
GET {{baseUrl}}/asset/exec-job/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询计划任务
|
||||
POST {{baseUrl}}/asset/exec-job/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"name": "",
|
||||
"command": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除计划任务
|
||||
DELETE {{baseUrl}}/asset/exec-job/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecJobOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.*;
|
||||
@@ -34,12 +35,12 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-job")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecJobController {
|
||||
|
||||
@Resource
|
||||
private ExecJobService execJobService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建计划任务")
|
||||
@@ -48,6 +49,7 @@ public class ExecJobController {
|
||||
return execJobService.createExecJob(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新计划任务")
|
||||
@@ -56,6 +58,7 @@ public class ExecJobController {
|
||||
return execJobService.updateExecJobById(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE_STATUS)
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新计划任务状态")
|
||||
@@ -89,6 +92,7 @@ public class ExecJobController {
|
||||
return execJobService.getExecJobPage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除计划任务")
|
||||
@@ -98,6 +102,7 @@ public class ExecJobController {
|
||||
return execJobService.deleteExecJobById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除计划任务")
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
### 查询计划任务日志
|
||||
GET {{baseUrl}}/asset/exec-job-log/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询计划任务日志
|
||||
POST {{baseUrl}}/asset/exec-job-log/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"userId": "",
|
||||
"username": "",
|
||||
"description": "",
|
||||
"command": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除计划任务日志
|
||||
DELETE {{baseUrl}}/asset/exec-job-log/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 批量删除计划任务日志
|
||||
DELETE {{baseUrl}}/asset/exec-job-log/batch-delete?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 查看计划任务日志
|
||||
POST {{baseUrl}}/asset/exec-job-log/tail
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"execId": 56
|
||||
}
|
||||
|
||||
|
||||
### 下载计划任务日志文件
|
||||
GET {{baseUrl}}/asset/exec-job-log/download?id=83
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 中断计划任务命令
|
||||
POST {{baseUrl}}/asset/exec-command-log/interrupt
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"logId": 7
|
||||
}
|
||||
|
||||
###
|
||||
@@ -9,6 +9,7 @@ import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecJobLogOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
@@ -42,7 +43,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-job-log")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecJobLogController {
|
||||
|
||||
private static final String SOURCE = ExecSourceEnum.JOB.name();
|
||||
@@ -87,6 +87,14 @@ public class ExecJobLogController {
|
||||
return execLogService.getExecLogStatus(idList, SOURCE);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询计划任务日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
public Long getExecJobLogCount(@Validated @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobLogOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除计划任务日志")
|
||||
@@ -114,19 +122,11 @@ public class ExecJobLogController {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询计划任务日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:management:clear')")
|
||||
public Long getExecJobLogCount(@RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:management:clear')")
|
||||
public Integer clearExecJobLog(@RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecJobLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
@@ -168,4 +168,3 @@ public class ExecJobLogController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
### 创建执行模板
|
||||
POST {{baseUrl}}/asset/exec-template/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"command": "",
|
||||
"timeout": 0,
|
||||
"scriptExec": 0,
|
||||
"parameterSchema": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新执行模板
|
||||
PUT {{baseUrl}}/asset/exec-template/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"command": "",
|
||||
"timeout": 0,
|
||||
"scriptExec": 0,
|
||||
"parameterSchema": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询执行模板
|
||||
GET {{baseUrl}}/asset/exec-template/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 查询全部执行模板
|
||||
GET {{baseUrl}}/asset/exec-template/list
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询执行模板
|
||||
POST {{baseUrl}}/asset/exec-template/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"name": "",
|
||||
"command": "",
|
||||
"timeout": 0,
|
||||
"scriptExec": 0,
|
||||
"parameterSchema": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除执行模板
|
||||
DELETE {{baseUrl}}/asset/exec-template/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecTemplateOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
@@ -36,12 +37,12 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-template")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class ExecTemplateController {
|
||||
|
||||
@Resource
|
||||
private ExecTemplateService execTemplateService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建执行模板")
|
||||
@@ -50,6 +51,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.createExecTemplate(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新执行模板")
|
||||
@@ -84,6 +86,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.getExecTemplatePage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除执行模板")
|
||||
@@ -93,6 +96,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.deleteExecTemplateById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除执行模板")
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
### 查询主机配置
|
||||
GET {{baseUrl}}/asset/host-config/get?hostId=1&type=SSH
|
||||
Authorization: {{token}}
|
||||
|
||||
### 查询全部主机配置
|
||||
GET {{baseUrl}}/asset/host-config/list?hostId=1
|
||||
Authorization: {{token}}
|
||||
|
||||
### 通过 id 更新主机配置
|
||||
PUT {{baseUrl}}/asset/host-config/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"config": "",
|
||||
"version": ""
|
||||
}
|
||||
|
||||
### 通过 id 更新主机配置状态
|
||||
PUT {{baseUrl}}/asset/host-config/update-status
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"status": "",
|
||||
"version": ""
|
||||
}
|
||||
|
||||
###
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConfigUpdateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConfigUpdateStatusRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConfigVO;
|
||||
import com.orion.visor.module.asset.service.HostConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主机配置 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-9-11 14:16
|
||||
*/
|
||||
@Tag(name = "asset - 主机配置服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-config")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostConfigController {
|
||||
|
||||
@Resource
|
||||
private HostConfigService hostConfigService;
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询主机配置")
|
||||
@Parameter(name = "hostId", description = "hostId", required = true)
|
||||
@Parameter(name = "type", description = "配置类型", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public HostConfigVO getHostConfig(@RequestParam("hostId") Long hostId,
|
||||
@RequestParam(name = "type") String type) {
|
||||
return hostConfigService.getHostConfig(hostId, type);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询全部主机配置")
|
||||
@Parameter(name = "hostId", description = "hostId", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public List<HostConfigVO> getHostConfigList(@RequestParam("hostId") Long hostId) {
|
||||
return hostConfigService.getHostConfigList(hostId);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.UPDATE_CONFIG)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新主机配置")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
|
||||
public Integer updateHostConfig(@Validated @RequestBody HostConfigUpdateRequest request) {
|
||||
return hostConfigService.updateHostConfig(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.UPDATE_CONFIG_STATUS)
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新主机配置状态/动态初始化配置")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
|
||||
public Integer updateHostConfigStatus(@Validated @RequestBody HostConfigUpdateStatusRequest request) {
|
||||
return hostConfigService.updateHostConfigStatus(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
### 分页查询主机连接日志
|
||||
POST {{baseUrl}}/asset/host-connect-log/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"userId": "",
|
||||
"hostId": "",
|
||||
"type": "",
|
||||
"token": "",
|
||||
"status": "",
|
||||
"startTimeRange": [
|
||||
"",
|
||||
""
|
||||
]
|
||||
}
|
||||
|
||||
### 查询用户最近连接的 ssh 主机
|
||||
POST {{baseUrl}}/asset/host-connect-log/latest-connect
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"limit": 10,
|
||||
"type": "SSH"
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
@@ -9,6 +9,7 @@ import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostConnectLogOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConnectLogVO;
|
||||
import com.orion.visor.module.asset.service.HostConnectLogService;
|
||||
@@ -36,7 +37,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-connect-log")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostConnectLogController {
|
||||
|
||||
@Resource
|
||||
@@ -50,6 +50,13 @@ public class HostConnectLogController {
|
||||
return hostConnectLogService.getHostConnectLogPage(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询主机连接日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:query')")
|
||||
public Long getHostConnectLogCount(@Validated @RequestBody HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogService.getHostConnectLogCount(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/session")
|
||||
@Operation(summary = "查询全部主机连接会话")
|
||||
@@ -74,18 +81,11 @@ public class HostConnectLogController {
|
||||
return hostConnectLogService.deleteHostConnectLog(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询主机连接日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:clear')")
|
||||
public Long getHostConnectLogCount(@RequestBody HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogService.getHostConnectLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostConnectLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空主机连接日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:clear')")
|
||||
public Integer clearHostConnectLog(@RequestBody HostConnectLogQueryRequest request) {
|
||||
public Integer clearHostConnectLog(@Validated @RequestBody HostConnectLogClearRequest request) {
|
||||
return hostConnectLogService.clearHostConnectLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
### 创建主机
|
||||
POST {{baseUrl}}/asset/host/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"code": "",
|
||||
"address": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新主机
|
||||
PUT {{baseUrl}}/asset/host/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"code": "",
|
||||
"address": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询主机
|
||||
GET {{baseUrl}}/asset/host/get?id=1&extra=true&config=true
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 查询主机
|
||||
GET {{baseUrl}}/asset/host/list
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询主机
|
||||
POST {{baseUrl}}/asset/host/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"name": "",
|
||||
"code": "",
|
||||
"address": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除主机
|
||||
DELETE {{baseUrl}}/asset/host/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -8,9 +8,8 @@ import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostCreateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostUpdateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.*;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConfigVO;
|
||||
import com.orion.visor.module.asset.entity.vo.HostVO;
|
||||
import com.orion.visor.module.asset.service.HostService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -37,7 +36,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostController {
|
||||
|
||||
@Resource
|
||||
@@ -61,6 +59,24 @@ public class HostController {
|
||||
return hostService.updateHostById(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.UPDATE_STATUS)
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新主机状态")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update-status')")
|
||||
public Integer updateHostStatus(@Validated @RequestBody HostUpdateStatusRequest request) {
|
||||
return hostService.updateHostStatus(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.UPDATE_CONFIG)
|
||||
@PutMapping("/update-config")
|
||||
@Operation(summary = "更新主机配置")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
|
||||
public Integer updateHostConfig(@Validated @RequestBody HostUpdateConfigRequest request) {
|
||||
return hostService.updateHostConfig(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "通过 id 查询主机")
|
||||
@@ -70,12 +86,22 @@ public class HostController {
|
||||
return hostService.getHostById(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-config")
|
||||
@Operation(summary = "查询主机配置")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public HostConfigVO getHostConfig(@RequestParam("id") Long id) {
|
||||
return hostService.getHostConfig(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询主机")
|
||||
@Parameter(name = "type", description = "type")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public List<HostVO> getHostList() {
|
||||
return hostService.getHostListByCache();
|
||||
public List<HostVO> getHostList(@RequestParam(value = "type", required = false) String type) {
|
||||
return hostService.getHostList(type);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@@ -86,6 +112,14 @@ public class HostController {
|
||||
return hostService.getHostPage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询主机数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public Long getHostExportCount(@Validated @RequestBody HostQueryRequest request) {
|
||||
return hostService.getHostCount(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
### 获取主机拓展信息
|
||||
GET {{baseUrl}}/asset/host-extra/get?hostId=1&item=ssh
|
||||
Authorization: {{token}}
|
||||
|
||||
### 获取多个主机拓展信息
|
||||
POST {{baseUrl}}/asset/host-extra/list
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"hostId": 1,
|
||||
"items": [
|
||||
"ssh"
|
||||
]
|
||||
}
|
||||
|
||||
### 修改主机拓展信息
|
||||
PUT {{baseUrl}}/asset/host-extra/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"hostId": 1,
|
||||
"item": "ssh",
|
||||
"extra": "{\"authType\":\"DEFAULT\"}"
|
||||
}
|
||||
|
||||
###
|
||||
@@ -29,7 +29,6 @@ import java.util.Map;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-extra")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostExtraController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
### 创建主机分组
|
||||
POST {{baseUrl}}/asset/host-group/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"parentId": -1,
|
||||
"name": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询主机分组
|
||||
GET {{baseUrl}}/asset/host-group/tree
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 修改名称
|
||||
PUT {{baseUrl}}/asset/host-group/rename
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": ""
|
||||
}
|
||||
|
||||
|
||||
### 移动位置
|
||||
PUT {{baseUrl}}/asset/host-group/move
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"targetId": "",
|
||||
"position": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除主机分组
|
||||
DELETE {{baseUrl}}/asset/host-group/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
###
|
||||
@@ -37,7 +37,6 @@ import java.util.Set;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-group")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostGroupController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
### 创建主机身份
|
||||
POST {{baseUrl}}/asset/host-identity/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"keyId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新主机身份
|
||||
PUT {{baseUrl}}/asset/host-identity/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"keyId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询主机身份
|
||||
GET {{baseUrl}}/asset/host-identity/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量查询主机身份
|
||||
GET {{baseUrl}}/asset/host-identity/list
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询主机身份
|
||||
POST {{baseUrl}}/asset/host-identity/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"name": "",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"keyId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除主机身份
|
||||
DELETE {{baseUrl}}/asset/host-identity/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
@@ -37,7 +37,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-identity")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostIdentityController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
### 创建主机密钥
|
||||
POST {{baseUrl}}/asset/host-key/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"publicKey": "",
|
||||
"privateKey": "",
|
||||
"password": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新主机密钥
|
||||
PUT {{baseUrl}}/asset/host-key/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"publicKey": "",
|
||||
"privateKey": "",
|
||||
"password": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询主机密钥
|
||||
GET {{baseUrl}}/asset/host-key/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
### 查询主机密钥
|
||||
POST {{baseUrl}}/asset/host-key/list
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"publicKey": "",
|
||||
"privateKey": "",
|
||||
"password": ""
|
||||
}
|
||||
|
||||
|
||||
### 分页查询主机密钥
|
||||
POST {{baseUrl}}/asset/host-key/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"name": "",
|
||||
"publicKey": "",
|
||||
"privateKey": "",
|
||||
"password": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除主机密钥
|
||||
DELETE {{baseUrl}}/asset/host-key/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
###
|
||||
@@ -37,7 +37,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-key")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostKeyController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
### 分页查询 SFTP 操作日志
|
||||
POST {{baseUrl}}/asset/host-sftp/query-log
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10
|
||||
}
|
||||
|
||||
|
||||
### 删除 SFTP 操作日志
|
||||
DELETE {{baseUrl}}/asset/host-sftp/delete-log?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 下载文件
|
||||
GET {{baseUrl}}/asset/host-sftp/download?channelId=123&transferToken=123
|
||||
|
||||
|
||||
###
|
||||
@@ -38,7 +38,6 @@ import java.util.List;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-sftp")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostSftpLogController {
|
||||
|
||||
@Resource
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
### 获取主机终端主题
|
||||
GET {{baseUrl}}/asset/host-terminal/themes
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 获取主机终端连接 token
|
||||
GET {{baseUrl}}/asset/host-terminal/access
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.entity.vo.HostTerminalThemeVO;
|
||||
import com.orion.visor.module.asset.service.HostTerminalService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主机终端 api
|
||||
@@ -29,7 +30,6 @@ import javax.annotation.Resource;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/host-terminal")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HostTerminalController {
|
||||
|
||||
@Resource
|
||||
@@ -38,7 +38,7 @@ public class HostTerminalController {
|
||||
@IgnoreLog(IgnoreLogMode.ALL)
|
||||
@GetMapping("/themes")
|
||||
@Operation(summary = "获取主机终端主题")
|
||||
public JSONArray getTerminalThemes() {
|
||||
public List<HostTerminalThemeVO> getTerminalThemes() {
|
||||
return hostTerminalService.getTerminalThemes();
|
||||
}
|
||||
|
||||
@@ -49,5 +49,12 @@ public class HostTerminalController {
|
||||
return hostTerminalService.getTerminalAccessToken();
|
||||
}
|
||||
|
||||
@GetMapping("/transfer")
|
||||
@Operation(summary = "获取主机终端 transferToken")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-terminal:access')")
|
||||
public String getTerminalTransferToken() {
|
||||
return hostTerminalService.getTerminalTransferToken();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
### 创建路径标签
|
||||
POST {{baseUrl}}/asset/path-bookmark/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"path": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新路径标签
|
||||
PUT {{baseUrl}}/asset/path-bookmark/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"path": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询全部路径标签
|
||||
GET {{baseUrl}}/asset/path-bookmark/list
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 删除路径标签
|
||||
DELETE {{baseUrl}}/asset/path-bookmark/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -27,7 +27,6 @@ import javax.annotation.Resource;
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/path-bookmark")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class PathBookmarkController {
|
||||
|
||||
@Resource
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user