Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
318e9f30b8 | ||
|
|
39a1001510 | ||
|
|
5e7b7ebfa7 | ||
|
|
8d85cdf173 | ||
|
|
79d95d1997 | ||
|
|
1eb07d0b24 | ||
|
|
601564b573 | ||
|
|
41384fab17 | ||
|
|
f0a122d862 | ||
|
|
b08d75be62 | ||
|
|
02f5bef6b4 | ||
|
|
ef10c8b8b6 | ||
|
|
6c4e9cd5c6 | ||
|
|
8dec40553d | ||
|
|
9ae5a6c627 | ||
|
|
2ec1678f01 | ||
|
|
f9e436e885 | ||
|
|
2a49e7670d | ||
|
|
95d8988f11 | ||
|
|
e04a972df5 | ||
|
|
1ca9311625 | ||
|
|
630a1fd3cd | ||
|
|
0f6d84dab2 | ||
|
|
f64eb395a8 | ||
|
|
2e69c67de0 | ||
|
|
7747b4e52e | ||
|
|
830622aafb | ||
|
|
2919950c5b | ||
|
|
d56cfbba82 | ||
|
|
cfe1924f11 | ||
|
|
dfd2ec45f4 |
21
.github/workflows/e2e.yaml
vendored
Normal file
21
.github/workflows/e2e.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: E2E
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{github.workflow}} - ${{github.ref}}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
testing:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: E2E Testing
|
||||||
|
run: |
|
||||||
|
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
|
||||||
|
sudo chmod u+x /usr/local/bin/docker-compose
|
||||||
|
docker compose -f docker-compose-testing.yml up --build testing --exit-code-from testing --remove-orphans
|
||||||
7
NOTICE
Normal file
7
NOTICE
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
* 在使用本项目前,请您仔细阅读免责声明,确保您已充分理解其中的内容
|
||||||
|
|
||||||
|
* 本项目采用 APACHE LICENSE 2.0 开源协议,如您需要源码的开发方式,需要遵循以下几点
|
||||||
|
|
||||||
|
1. 禁止修改或删除 LICENSE 文件。
|
||||||
|
2. 不可二次开发或参与同类竞品的开发。
|
||||||
|
3. 本项目可免费商业使用,商业使用请保留项目源码、出处、描述文件和作者声明等。
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
* 🔗 演示地址: http://101.43.254.243:1081/
|
* 🔗 演示地址: http://101.43.254.243:1081/
|
||||||
* 🔏 演示账号: admin/admin
|
* 🔏 演示账号: 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/qq_41011894/orion-visor/overview)
|
||||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||||
* 📛 演示环境请不要随便删除数据!
|
* 📛 演示环境请不要随便删除数据!
|
||||||
|
|||||||
79
docker-compose-testing.yml
Normal file
79
docker-compose-testing.yml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
version: '3.3'
|
||||||
|
services:
|
||||||
|
orion-visor-service:
|
||||||
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.0
|
||||||
|
privileged: true
|
||||||
|
ports:
|
||||||
|
- 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
|
||||||
|
volumes:
|
||||||
|
- /data/orion-visor-space/docker-volumes/service/root-orion:/root/orion
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
|
||||||
|
interval: 3s
|
||||||
|
timeout: 300s
|
||||||
|
retries: 200
|
||||||
|
start_period: 3s
|
||||||
|
depends_on:
|
||||||
|
orion-visor-mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
orion-visor-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.1.0
|
||||||
|
privileged: true
|
||||||
|
ports:
|
||||||
|
- 3307:3306
|
||||||
|
environment:
|
||||||
|
- MYSQL_DATABASE=orion_visor
|
||||||
|
- MYSQL_USER=orion
|
||||||
|
- MYSQL_PASSWORD=Data@123456
|
||||||
|
- 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
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
|
||||||
|
interval: 3s
|
||||||
|
timeout: 60s
|
||||||
|
retries: 10
|
||||||
|
start_period: 3s
|
||||||
|
orion-visor-redis:
|
||||||
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.0
|
||||||
|
privileged: true
|
||||||
|
ports:
|
||||||
|
- 6380:6379
|
||||||
|
environment:
|
||||||
|
- REDIS_PASSWORD=Data@123456
|
||||||
|
volumes:
|
||||||
|
- /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
|
||||||
|
timeout: 60s
|
||||||
|
retries: 10
|
||||||
|
start_period: 3s
|
||||||
|
testing:
|
||||||
|
build:
|
||||||
|
context: ./docker/e2e
|
||||||
|
environment:
|
||||||
|
SERVER: http://orion-visor-service:80
|
||||||
|
depends_on:
|
||||||
|
orion-visor-service:
|
||||||
|
condition: service_healthy
|
||||||
|
links:
|
||||||
|
- orion-visor-service
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
version: '3.3'
|
version: '3.3'
|
||||||
services:
|
services:
|
||||||
orion-visor-service:
|
orion-visor-service:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.8
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.0
|
||||||
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 1081:80
|
- 1081:80
|
||||||
environment:
|
environment:
|
||||||
@@ -15,12 +16,23 @@ services:
|
|||||||
- SECRET_KEY=uQeacXV8b3isvKLK
|
- SECRET_KEY=uQeacXV8b3isvKLK
|
||||||
- DEMO_MODE=false
|
- DEMO_MODE=false
|
||||||
volumes:
|
volumes:
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-service/root-orion:/root/orion
|
- /data/orion-visor-space/docker-volumes/service/root-orion:/root/orion
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
|
||||||
|
interval: 3s
|
||||||
|
timeout: 300s
|
||||||
|
retries: 200
|
||||||
|
start_period: 3s
|
||||||
depends_on:
|
depends_on:
|
||||||
|
orion-visor-mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
orion-visor-redis:
|
||||||
|
condition: service_healthy
|
||||||
|
links:
|
||||||
- orion-visor-mysql
|
- orion-visor-mysql
|
||||||
- orion-visor-redis
|
- orion-visor-redis
|
||||||
orion-visor-mysql:
|
orion-visor-mysql:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.8
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.0
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 3307:3306
|
- 3307:3306
|
||||||
@@ -30,19 +42,31 @@ services:
|
|||||||
- MYSQL_PASSWORD=Data@123456
|
- MYSQL_PASSWORD=Data@123456
|
||||||
- MYSQL_ROOT_PASSWORD=Data@123456
|
- MYSQL_ROOT_PASSWORD=Data@123456
|
||||||
volumes:
|
volumes:
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql:/var/lib/mysql
|
- /data/orion-visor-space/docker-volumes/mysql/var-lib-mysql:/var/lib/mysql
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
|
- /data/orion-visor-space/docker-volumes/mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
|
- /data/orion-visor-space/docker-volumes/mysql/etc-mysql:/etc/mysql
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
|
||||||
|
interval: 3s
|
||||||
|
timeout: 60s
|
||||||
|
retries: 10
|
||||||
|
start_period: 3s
|
||||||
orion-visor-redis:
|
orion-visor-redis:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.8
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.0
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 6380:6379
|
- 6380:6379
|
||||||
environment:
|
environment:
|
||||||
- REDIS_PASSWORD=Data@123456
|
- REDIS_PASSWORD=Data@123456
|
||||||
volumes:
|
volumes:
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-redis/data:/data
|
- /data/orion-visor-space/docker-volumes/redis/data:/data
|
||||||
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
|
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||||
|
interval: 3s
|
||||||
|
timeout: 60s
|
||||||
|
retries: 10
|
||||||
|
start_period: 3s
|
||||||
orion-visor-adminer:
|
orion-visor-adminer:
|
||||||
image: adminer
|
image: adminer
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ docker compose down
|
|||||||
if [ "$1" == "demo" ]; then
|
if [ "$1" == "demo" ]; then
|
||||||
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
||||||
fi
|
fi
|
||||||
docker compose up -d
|
docker compose up -d --remove-orphans
|
||||||
|
|||||||
7
docker/e2e/Dockerfile
Normal file
7
docker/e2e/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FROM ghcr.io/linuxsuren/api-testing:v0.0.17
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
COPY . .
|
||||||
|
RUN chmod 777 *
|
||||||
|
|
||||||
|
CMD [ "/workspace/entrypoint.sh" ]
|
||||||
3
docker/e2e/entrypoint.sh
Normal file
3
docker/e2e/entrypoint.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
atest run -p testsuite.yaml --report md
|
||||||
49
docker/e2e/testsuite.yaml
Normal file
49
docker/e2e/testsuite.yaml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#!api-testing
|
||||||
|
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
|
||||||
|
name: orion-visor
|
||||||
|
api: |
|
||||||
|
{{default "http://orion-visor-service:80" (env "SERVER")}}
|
||||||
|
items:
|
||||||
|
- name: login
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/infra/auth/login
|
||||||
|
method: POST
|
||||||
|
header:
|
||||||
|
Content-type: application/json
|
||||||
|
body: |
|
||||||
|
{"username":"admin","password":"21232f297a57a5a743894a0e4a801fc3"}
|
||||||
|
expect:
|
||||||
|
bodyFieldsExpect:
|
||||||
|
code: 200
|
||||||
|
- name: userPermission
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/infra/permission/user
|
||||||
|
header:
|
||||||
|
Authorization: Bearer {{.login.data.token}}
|
||||||
|
expect:
|
||||||
|
bodyFieldsExpect:
|
||||||
|
code: 200
|
||||||
|
msg: "success"
|
||||||
|
- name: menu
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/infra/permission/menu
|
||||||
|
header:
|
||||||
|
Authorization: Bearer {{.login.data.token}}
|
||||||
|
expect:
|
||||||
|
bodyFieldsExpect:
|
||||||
|
code: 200
|
||||||
|
msg: "success"
|
||||||
|
- name: haveUnRead
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/infra/system-message/has-unread
|
||||||
|
- name: queryOperatorLog
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/infra/mine/query-operator-log
|
||||||
|
method: POST
|
||||||
|
- name: hostList
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/infra/tag/list?type=HOST
|
||||||
|
- name: queryHost
|
||||||
|
request:
|
||||||
|
api: /orion-visor/api/asset/host/query
|
||||||
|
method: POST
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.8
|
version=2.1.0
|
||||||
cp -r ../../sql ./sql
|
cp -r ../../sql ./sql
|
||||||
docker build -t orion-visor-mysql:${version} .
|
docker build -t orion-visor-mysql:${version} .
|
||||||
rm -rf ./sql
|
rm -rf ./sql
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.8
|
version=2.1.0
|
||||||
docker build -t orion-visor-redis:${version} .
|
docker build -t orion-visor-redis:${version} .
|
||||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/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}
|
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||||
@@ -8,6 +8,7 @@ RUN \
|
|||||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||||
apk update && \
|
apk update && \
|
||||||
apk add tzdata && \
|
apk add tzdata && \
|
||||||
|
apk add dmidecode && \
|
||||||
apk add openjdk8
|
apk add openjdk8
|
||||||
# 设置时区
|
# 设置时区
|
||||||
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.8
|
version=2.1.0
|
||||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||||
mv ../../orion-visor-ui/dist ./dist
|
mv ../../orion-visor-ui/dist ./dist
|
||||||
docker build -t orion-visor-service:${version} .
|
docker build -t orion-visor-service:${version} .
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<url>https://github.com/dromara/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.0.8</revision>
|
<revision>2.1.0</revision>
|
||||||
<spring.boot.version>2.7.17</spring.boot.version>
|
<spring.boot.version>2.7.17</spring.boot.version>
|
||||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||||
|
|||||||
@@ -14,9 +14,12 @@ public interface AppConst extends OrionConst {
|
|||||||
/**
|
/**
|
||||||
* 同 ${orion.version} 迭代时候需要手动更改
|
* 同 ${orion.version} 迭代时候需要手动更改
|
||||||
*/
|
*/
|
||||||
String VERSION = "2.0.8";
|
String VERSION = "2.1.0";
|
||||||
|
|
||||||
String ORION_VISOR = "orion-visor";
|
/**
|
||||||
|
* 同 ${spring.application.name}
|
||||||
|
*/
|
||||||
|
String APP_NAME = "orion-visor";
|
||||||
|
|
||||||
String GITHUB = "https://github.com/dromara/orion-visor";
|
String GITHUB = "https://github.com/dromara/orion-visor";
|
||||||
|
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ public interface CnConst {
|
|||||||
|
|
||||||
String CN_ROLE = "角色";
|
String CN_ROLE = "角色";
|
||||||
|
|
||||||
|
String CN_UNKNOWN = "未知";
|
||||||
|
|
||||||
|
String CN_INTRANET_IP = "内网IP";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
|
|||||||
|
|
||||||
int MD5_LEN = 32;
|
int MD5_LEN = 32;
|
||||||
|
|
||||||
String UNKNOWN = "未知";
|
|
||||||
|
|
||||||
String INTRANET_IP = "内网IP";
|
|
||||||
|
|
||||||
Long ROOT_PARENT_ID = 0L;
|
Long ROOT_PARENT_ID = 0L;
|
||||||
|
|
||||||
Integer DEFAULT_SORT = 10;
|
Integer DEFAULT_SORT = 10;
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ public interface ErrorMessage {
|
|||||||
|
|
||||||
String GROUP_ABSENT = "分组不存在";
|
String GROUP_ABSENT = "分组不存在";
|
||||||
|
|
||||||
|
String HOST_TYPE_ERROR = "主机类型错误";
|
||||||
|
|
||||||
|
String HOST_NOT_ENABLED = "主机未启用";
|
||||||
|
|
||||||
String UNABLE_OPERATE_ADMIN_ROLE = "无法操作管理员账号";
|
String UNABLE_OPERATE_ADMIN_ROLE = "无法操作管理员账号";
|
||||||
|
|
||||||
String UNSUPPORTED_CHARSET = "不支持的编码 [{}]";
|
String UNSUPPORTED_CHARSET = "不支持的编码 [{}]";
|
||||||
@@ -83,8 +87,12 @@ public interface ErrorMessage {
|
|||||||
|
|
||||||
String UNKNOWN_TYPE = "未知类型";
|
String UNKNOWN_TYPE = "未知类型";
|
||||||
|
|
||||||
|
String ERROR_TYPE = "错误的类型";
|
||||||
|
|
||||||
String FILE_ABSENT = "文件不存在";
|
String FILE_ABSENT = "文件不存在";
|
||||||
|
|
||||||
|
String FILE_ABSENT_CLEAR = "文件不存在 (可能已被清理)";
|
||||||
|
|
||||||
String LOG_ABSENT = "日志不存在";
|
String LOG_ABSENT = "日志不存在";
|
||||||
|
|
||||||
String TASK_ABSENT = "任务不存在";
|
String TASK_ABSENT = "任务不存在";
|
||||||
@@ -95,6 +103,8 @@ public interface ErrorMessage {
|
|||||||
|
|
||||||
String FILE_READ_ERROR = "文件读取失败";
|
String FILE_READ_ERROR = "文件读取失败";
|
||||||
|
|
||||||
|
String FILE_READ_ERROR_CLEAR = "文件读取失败 (可能已被清理)";
|
||||||
|
|
||||||
String PLEASE_CHECK_HOST_SSH = "请检查主机 {} 是否存在/权限/SSH配置";
|
String PLEASE_CHECK_HOST_SSH = "请检查主机 {} 是否存在/权限/SSH配置";
|
||||||
|
|
||||||
String CLIENT_ABORT = "手动中断";
|
String CLIENT_ABORT = "手动中断";
|
||||||
|
|||||||
@@ -43,4 +43,6 @@ public interface ExtraFieldConst extends FieldConst {
|
|||||||
|
|
||||||
String LOG_ID = "logId";
|
String LOG_ID = "logId";
|
||||||
|
|
||||||
|
String DARK = "dark";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public interface FieldConst {
|
|||||||
|
|
||||||
String INFO = "info";
|
String INFO = "info";
|
||||||
|
|
||||||
|
String EXTRA = "extra";
|
||||||
|
|
||||||
String REL_ID = "relId";
|
String REL_ID = "relId";
|
||||||
|
|
||||||
String BEFORE = "before";
|
String BEFORE = "before";
|
||||||
@@ -59,10 +61,24 @@ public interface FieldConst {
|
|||||||
|
|
||||||
String TIME = "time";
|
String TIME = "time";
|
||||||
|
|
||||||
|
String ISSUE = "issue";
|
||||||
|
|
||||||
|
String EXPIRE = "expire";
|
||||||
|
|
||||||
String LOCATION = "location";
|
String LOCATION = "location";
|
||||||
|
|
||||||
String USER_AGENT = "userAgent";
|
String USER_AGENT = "userAgent";
|
||||||
|
|
||||||
String ERROR_MESSAGE = "errorMessage";
|
String ERROR_MESSAGE = "errorMessage";
|
||||||
|
|
||||||
|
String UUID = "uuid";
|
||||||
|
|
||||||
|
String REDIRECT = "redirect";
|
||||||
|
|
||||||
|
String SCHEMA = "schema";
|
||||||
|
|
||||||
|
String FILTER = "filter";
|
||||||
|
|
||||||
|
String ALL = "all";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.orion.visor.framework.common.constant;
|
package com.orion.visor.framework.common.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路径常量
|
* 文件常量
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author Jiahang Li
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2024/4/17 10:35
|
* @since 2024/4/17 10:35
|
||||||
*/
|
*/
|
||||||
public interface PathConst {
|
public interface FileConst {
|
||||||
|
|
||||||
String ERROR_LOG = "error.log";
|
String ERROR_LOG = "error.log";
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.orion.visor.framework.common.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动清理配置
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/24 15:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AutoClearConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启
|
||||||
|
*/
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留周期 (天)
|
||||||
|
*/
|
||||||
|
private Integer keepPeriod;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.orion.visor.framework.common.enums;
|
||||||
|
|
||||||
|
import com.orion.lang.utils.Strings;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端点定义
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/21 19:15
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum EndpointDefine {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传临时分区
|
||||||
|
*/
|
||||||
|
UPLOAD_SWAP("/upload/swap/{}"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量执行日志
|
||||||
|
*/
|
||||||
|
EXEC_LOG("/exec/{}/{}.log"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端点
|
||||||
|
*/
|
||||||
|
private final String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化
|
||||||
|
*
|
||||||
|
* @param params params
|
||||||
|
* @return path
|
||||||
|
*/
|
||||||
|
public String format(Object... params) {
|
||||||
|
return Strings.format(this.endpoint, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,8 +2,12 @@ package com.orion.visor.framework.common.utils;
|
|||||||
|
|
||||||
import com.orion.ext.location.Region;
|
import com.orion.ext.location.Region;
|
||||||
import com.orion.ext.location.region.LocationRegions;
|
import com.orion.ext.location.region.LocationRegions;
|
||||||
|
import com.orion.lang.constant.StandardHttpHeader;
|
||||||
|
import com.orion.lang.utils.Strings;
|
||||||
import com.orion.visor.framework.common.constant.Const;
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
|
import com.orion.web.servlet.web.Servlets;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -21,6 +25,22 @@ public class IpUtils {
|
|||||||
private IpUtils() {
|
private IpUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求地址
|
||||||
|
*
|
||||||
|
* @param request request
|
||||||
|
* @return addr
|
||||||
|
*/
|
||||||
|
public static String getRemoteAddr(HttpServletRequest request) {
|
||||||
|
// 获取实际地址
|
||||||
|
String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
|
||||||
|
if (!Strings.isBlank(realIp)) {
|
||||||
|
return realIp;
|
||||||
|
}
|
||||||
|
// 获取请求地址
|
||||||
|
return Servlets.getRemoteAddr(request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 ip 位置
|
* 获取 ip 位置
|
||||||
*
|
*
|
||||||
@@ -29,7 +49,7 @@ public class IpUtils {
|
|||||||
*/
|
*/
|
||||||
public static String getLocation(String ip) {
|
public static String getLocation(String ip) {
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
// 查询缓存
|
// 查询缓存
|
||||||
return CACHE.computeIfAbsent(ip, IpUtils::queryLocation);
|
return CACHE.computeIfAbsent(ip, IpUtils::queryLocation);
|
||||||
@@ -43,21 +63,21 @@ public class IpUtils {
|
|||||||
*/
|
*/
|
||||||
private static String queryLocation(String ip) {
|
private static String queryLocation(String ip) {
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
Region region;
|
Region region;
|
||||||
try {
|
try {
|
||||||
region = LocationRegions.getRegion(ip, 3);
|
region = LocationRegions.getRegion(ip, 3);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
String net = region.getNet();
|
String net = region.getNet();
|
||||||
String province = region.getProvince();
|
String province = region.getProvince();
|
||||||
if (net.equals(Const.INTRANET_IP)) {
|
if (net.equals(Const.CN_INTRANET_IP)) {
|
||||||
return net;
|
return net;
|
||||||
}
|
}
|
||||||
if (province.equals(Const.UNKNOWN)) {
|
if (province.equals(Const.CN_UNKNOWN)) {
|
||||||
return province;
|
return province;
|
||||||
}
|
}
|
||||||
StringBuilder location = new StringBuilder()
|
StringBuilder location = new StringBuilder()
|
||||||
@@ -69,7 +89,7 @@ public class IpUtils {
|
|||||||
location.append(" (").append(net).append(')');
|
location.append(" (").append(net).append(')');
|
||||||
return location.toString();
|
return location.toString();
|
||||||
}
|
}
|
||||||
return Const.UNKNOWN;
|
return Const.CN_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.orion.visor.framework.common.utils;
|
||||||
|
|
||||||
|
import com.orion.lang.utils.Arrays1;
|
||||||
|
import com.orion.lang.utils.crypto.Caesars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 混淆工具类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/17 18:27
|
||||||
|
*/
|
||||||
|
public class Mixes {
|
||||||
|
|
||||||
|
private Mixes() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 混淆
|
||||||
|
* <p>
|
||||||
|
* 此方法不可修改
|
||||||
|
*
|
||||||
|
* @param str str
|
||||||
|
* @return str
|
||||||
|
*/
|
||||||
|
public static String obfuscate(String str) {
|
||||||
|
char[] chars = str.toCharArray();
|
||||||
|
Arrays1.reverse(chars);
|
||||||
|
for (int i = 0; i < chars.length; i += 2) {
|
||||||
|
char temp = chars[i];
|
||||||
|
chars[i] = chars[i + 1];
|
||||||
|
chars[i + 1] = temp;
|
||||||
|
}
|
||||||
|
String res = new String(chars);
|
||||||
|
return new Caesars().encrypt(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ public class PathUtils {
|
|||||||
public static String getAppPath(boolean isWindows, String username) {
|
public static String getAppPath(boolean isWindows, String username) {
|
||||||
return getHomePath(isWindows, username)
|
return getHomePath(isWindows, username)
|
||||||
+ "/" + AppConst.ORION
|
+ "/" + AppConst.ORION
|
||||||
+ "/" + AppConst.ORION_VISOR;
|
+ "/" + AppConst.APP_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class Requests {
|
|||||||
.map(s -> (ServletRequestAttributes) s)
|
.map(s -> (ServletRequestAttributes) s)
|
||||||
.map(ServletRequestAttributes::getRequest)
|
.map(ServletRequestAttributes::getRequest)
|
||||||
.ifPresent(request -> {
|
.ifPresent(request -> {
|
||||||
String address = Servlets.getRemoteAddr(request);
|
String address = IpUtils.getRemoteAddr(request);
|
||||||
identity.setAddress(address);
|
identity.setAddress(address);
|
||||||
identity.setLocation(IpUtils.getLocation(address));
|
identity.setLocation(IpUtils.getLocation(address));
|
||||||
identity.setUserAgent(Servlets.getUserAgent(request));
|
identity.setUserAgent(Servlets.getUserAgent(request));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
{
|
{
|
||||||
"name": "orion.async.executor.core-pool-size",
|
"name": "orion.async.executor.core-pool-size",
|
||||||
"type": "java.lang.Integer",
|
"type": "java.lang.Integer",
|
||||||
"description": "核心线程数量",
|
"description": "核心线程数量.",
|
||||||
"defaultValue": "8"
|
"defaultValue": "8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
|||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
AnsiAppender appender = AnsiAppender.create()
|
AnsiAppender appender = AnsiAppender.create()
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n");
|
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor v" + version + " 服务已启动(" + env + ") ::\n");
|
||||||
// swagger 地址
|
// swagger 地址
|
||||||
if (apiDocsEnabled) {
|
if (apiDocsEnabled) {
|
||||||
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.orion.visor.framework.log.configuration.config;
|
package com.orion.visor.framework.log.configuration.config;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.utils.ConfigUtils;
|
import com.orion.visor.framework.common.utils.ConfigUtils;
|
||||||
|
import com.orion.visor.framework.log.core.enums.LogPrinterMode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
@@ -17,6 +18,11 @@ import java.util.List;
|
|||||||
@ConfigurationProperties("orion.logging.printer")
|
@ConfigurationProperties("orion.logging.printer")
|
||||||
public class LogPrinterConfig {
|
public class LogPrinterConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private LogPrinterMode mode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段配置
|
* 字段配置
|
||||||
*/
|
*/
|
||||||
@@ -32,12 +38,31 @@ public class LogPrinterConfig {
|
|||||||
*/
|
*/
|
||||||
private String expression;
|
private String expression;
|
||||||
|
|
||||||
public void setField(LogPrinterFieldConfig field) {
|
|
||||||
this.field = field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeaders(List<String> headers) {
|
public void setHeaders(List<String> headers) {
|
||||||
this.headers = ConfigUtils.parseStringList(headers, String::toLowerCase);
|
this.headers = ConfigUtils.parseStringList(headers, String::toLowerCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class LogPrinterFieldConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略的字段
|
||||||
|
*/
|
||||||
|
private List<String> ignore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 脱敏的字段
|
||||||
|
*/
|
||||||
|
private List<String> desensitize;
|
||||||
|
|
||||||
|
public void setIgnore(List<String> ignore) {
|
||||||
|
this.ignore = ConfigUtils.parseStringList(ignore);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesensitize(List<String> desensitize) {
|
||||||
|
this.desensitize = ConfigUtils.parseStringList(desensitize);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.orion.visor.framework.log.configuration.config;
|
|
||||||
|
|
||||||
import com.orion.visor.framework.common.utils.ConfigUtils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志打印字段配置
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/6/28 22:36
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class LogPrinterFieldConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 忽略的字段
|
|
||||||
*/
|
|
||||||
private List<String> ignore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 脱敏的字段
|
|
||||||
*/
|
|
||||||
private List<String> desensitize;
|
|
||||||
|
|
||||||
public void setIgnore(List<String> ignore) {
|
|
||||||
this.ignore = ConfigUtils.parseStringList(ignore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDesensitize(List<String> desensitize) {
|
|
||||||
this.desensitize = ConfigUtils.parseStringList(desensitize);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ package com.orion.visor.framework.log.core.interceptor;
|
|||||||
import com.orion.lang.utils.Exceptions;
|
import com.orion.lang.utils.Exceptions;
|
||||||
import com.orion.lang.utils.Strings;
|
import com.orion.lang.utils.Strings;
|
||||||
import com.orion.lang.utils.time.Dates;
|
import com.orion.lang.utils.time.Dates;
|
||||||
|
import com.orion.visor.framework.common.utils.IpUtils;
|
||||||
import com.orion.visor.framework.common.utils.SwaggerUtils;
|
import com.orion.visor.framework.common.utils.SwaggerUtils;
|
||||||
import com.orion.visor.framework.log.configuration.config.LogPrinterConfig;
|
import com.orion.visor.framework.log.configuration.config.LogPrinterConfig;
|
||||||
import com.orion.web.servlet.web.Servlets;
|
import com.orion.web.servlet.web.Servlets;
|
||||||
@@ -60,7 +61,7 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
|||||||
// http
|
// http
|
||||||
if (request != null) {
|
if (request != null) {
|
||||||
// remoteAddr
|
// remoteAddr
|
||||||
requestLog.append("\tremoteAddr: ").append(Servlets.getRemoteAddr(request)).append('\n');
|
requestLog.append("\tremoteAddr: ").append(IpUtils.getRemoteAddr(request)).append('\n');
|
||||||
// header
|
// header
|
||||||
Servlets.getHeaderMap(request).forEach((hk, hv) -> {
|
Servlets.getHeaderMap(request).forEach((hk, hv) -> {
|
||||||
if (headerFilter.test(hk.toLowerCase())) {
|
if (headerFilter.test(hk.toLowerCase())) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.orion.lang.utils.Exceptions;
|
import com.orion.lang.utils.Exceptions;
|
||||||
import com.orion.lang.utils.Strings;
|
import com.orion.lang.utils.Strings;
|
||||||
import com.orion.lang.utils.time.Dates;
|
import com.orion.lang.utils.time.Dates;
|
||||||
|
import com.orion.visor.framework.common.utils.IpUtils;
|
||||||
import com.orion.visor.framework.common.utils.SwaggerUtils;
|
import com.orion.visor.framework.common.utils.SwaggerUtils;
|
||||||
import com.orion.visor.framework.log.configuration.config.LogPrinterConfig;
|
import com.orion.visor.framework.log.configuration.config.LogPrinterConfig;
|
||||||
import com.orion.visor.framework.log.core.enums.LogFieldConst;
|
import com.orion.visor.framework.log.core.enums.LogFieldConst;
|
||||||
@@ -61,7 +62,7 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
|||||||
// http
|
// http
|
||||||
if (request != null) {
|
if (request != null) {
|
||||||
// remoteAddr
|
// remoteAddr
|
||||||
fields.put(REMOTE_ADDR, Servlets.getRemoteAddr(request));
|
fields.put(REMOTE_ADDR, IpUtils.getRemoteAddr(request));
|
||||||
// header
|
// header
|
||||||
Map<String, Object> headers = new LinkedHashMap<>();
|
Map<String, Object> headers = new LinkedHashMap<>();
|
||||||
Servlets.getHeaderMap(request).forEach((hk, hv) -> {
|
Servlets.getHeaderMap(request).forEach((hk, hv) -> {
|
||||||
|
|||||||
@@ -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}"},
|
new String[]{"/templates/orion-server-module-entity-request-update.java.vm", "${type}UpdateRequest.java", "entity.request.${bizPackage}"},
|
||||||
// query request 文件
|
// query request 文件
|
||||||
new String[]{"/templates/orion-server-module-entity-request-query.java.vm", "${type}QueryRequest.java", "entity.request.${bizPackage}"},
|
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 文件
|
// convert 文件
|
||||||
new String[]{"/templates/orion-server-module-convert.java.vm", "${type}Convert.java", "convert"},
|
new String[]{"/templates/orion-server-module-convert.java.vm", "${type}Convert.java", "convert"},
|
||||||
// cache dto 文件
|
// cache dto 文件
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ public class CodeGeneratorEngine extends VelocityTemplateEngine {
|
|||||||
apiComment.put("deleteById", "删除" + comment);
|
apiComment.put("deleteById", "删除" + comment);
|
||||||
apiComment.put("deleteAll", "根据条件删除" + comment);
|
apiComment.put("deleteAll", "根据条件删除" + comment);
|
||||||
apiComment.put("batchDelete", "批量删除" + comment);
|
apiComment.put("batchDelete", "批量删除" + comment);
|
||||||
apiComment.put("export", "导出" + comment);
|
|
||||||
objectMap.put("apiComment", apiComment);
|
objectMap.put("apiComment", apiComment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,18 @@ public class CustomFileFilter {
|
|||||||
public List<CustomFile> doFilter() {
|
public List<CustomFile> doFilter() {
|
||||||
// 生成文件副本
|
// 生成文件副本
|
||||||
List<CustomFile> files = originCustomerFile.stream().map(s ->
|
List<CustomFile> files = originCustomerFile.stream().map(s ->
|
||||||
new CustomFile.Builder()
|
new CustomFile.Builder()
|
||||||
.enableFileOverride()
|
.enableFileOverride()
|
||||||
.templatePath(s.getTemplatePath())
|
.templatePath(s.getTemplatePath())
|
||||||
.filePath(s.getFilePath())
|
.filePath(s.getFilePath())
|
||||||
.fileName(s.getFileName())
|
.fileName(s.getFileName())
|
||||||
.packageName(s.getPackageName())
|
.packageName(s.getPackageName())
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
// 不生成 api http 文件
|
||||||
|
if (!table.isEnableApiHttp()) {
|
||||||
|
files.removeIf(file -> isApiHttpFile(file.getTemplatePath()));
|
||||||
|
}
|
||||||
// 不生成对外 api 文件
|
// 不生成对外 api 文件
|
||||||
if (!table.isEnableProviderApi()) {
|
if (!table.isEnableProviderApi()) {
|
||||||
files.removeIf(file -> isServerProviderFile(file.getTemplatePath()));
|
files.removeIf(file -> isServerProviderFile(file.getTemplatePath()));
|
||||||
@@ -139,13 +143,13 @@ public class CustomFileFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为导出文件
|
* 是否为 api http 文件
|
||||||
*
|
*
|
||||||
* @param templatePath templatePath
|
* @param templatePath templatePath
|
||||||
* @return 是否为导出文件
|
* @return 是否为导出文件
|
||||||
*/
|
*/
|
||||||
public static boolean isExportFile(String templatePath) {
|
public static boolean isApiHttpFile(String templatePath) {
|
||||||
return templatePath.contains("orion-server-module-entity-export");
|
return templatePath.contains("orion-server-module-controller.http");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,6 +63,16 @@ public class ServerTemplate extends Template {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否生成 api http 文件
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public ServerTemplate enableApiHttp() {
|
||||||
|
table.enableApiHttp = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否生成对外 api
|
* 是否生成对外 api
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ public class Table {
|
|||||||
*/
|
*/
|
||||||
protected String bizPackage;
|
protected String bizPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否生成 api http 文件
|
||||||
|
*/
|
||||||
|
protected boolean enableApiHttp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否生成对外 api
|
* 是否生成对外 api
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -210,14 +210,23 @@ public class DataQuery<T> {
|
|||||||
// -------------------- data grid --------------------
|
// -------------------- data grid --------------------
|
||||||
|
|
||||||
public DataGrid<T> dataGrid() {
|
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) {
|
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(page, "page is null");
|
||||||
Valid.notNull(wrapper, "wrapper 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<R> pager = new Pager<>(page);
|
||||||
pager.setTotal(count.intValue());
|
pager.setTotal(count.intValue());
|
||||||
boolean next = pager.hasMoreData();
|
boolean next = pager.hasMoreData();
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/${package.ModuleName}/${typeHyphen}")
|
@RequestMapping("/${package.ModuleName}/${typeHyphen}")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
#if(${superControllerClass})
|
#if(${superControllerClass})
|
||||||
public class ${table.controllerName} extends ${superControllerClass} {
|
public class ${table.controllerName} extends ${superControllerClass} {
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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}: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}:update', 3, 30, '1', '1', 0),
|
||||||
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40, '1', '1', 0);
|
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}: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
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
search-input-placeholder="输入搜索值"
|
search-input-placeholder="输入搜索值"
|
||||||
create-card-position="head"
|
create-card-position="head"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:fieldConfig="fieldConfig"
|
:field-config="fieldConfig"
|
||||||
:list="list"
|
:list="list"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:card-layout-cols="cardColLayout"
|
:card-layout-cols="cardColLayout"
|
||||||
@@ -74,15 +74,16 @@
|
|||||||
<!-- 修改 -->
|
<!-- 修改 -->
|
||||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
||||||
@click="emits('openUpdate', record)">
|
@click="emits('openUpdate', record)">
|
||||||
<icon-edit />
|
<span class="more-doption normal">
|
||||||
修改
|
<icon-edit /> 修改
|
||||||
|
</span>
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 删除 -->
|
<!-- 删除 -->
|
||||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
||||||
class="span-red"
|
|
||||||
@click="deleteRow(record.id)">
|
@click="deleteRow(record.id)">
|
||||||
<icon-delete />
|
<span class="more-doption error">
|
||||||
删除
|
<icon-delete /> 删除
|
||||||
|
</span>
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -93,15 +94,17 @@
|
|||||||
<!-- 修改 -->
|
<!-- 修改 -->
|
||||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:update']"
|
||||||
@click="emits('openUpdate', record)">
|
@click="emits('openUpdate', record)">
|
||||||
<icon-edit />
|
<span class="more-doption normal">
|
||||||
修改
|
<icon-edit /> 修改
|
||||||
|
</span>
|
||||||
</a-doption>
|
</a-doption>
|
||||||
<!-- 删除 -->
|
<!-- 删除 -->
|
||||||
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
<a-doption v-permission="['${package.ModuleName}:${typeHyphen}:delete']"
|
||||||
class="span-red"
|
class="span-red"
|
||||||
@click="deleteRow(record.id)">
|
@click="deleteRow(record.id)">
|
||||||
<icon-delete />
|
<span class="more-doption error">
|
||||||
删除
|
<icon-delete /> 删除
|
||||||
|
</span>
|
||||||
</a-doption>
|
</a-doption>
|
||||||
</template>
|
</template>
|
||||||
</card-list>
|
</card-list>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal v-model:visible="visible"
|
<a-modal v-model:visible="visible"
|
||||||
body-class="modal-form-large"
|
modal-class="modal-form-large"
|
||||||
title-align="start"
|
title-align="start"
|
||||||
:title="title"
|
:title="title"
|
||||||
:top="80"
|
:top="80"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const columns = [
|
|||||||
title: 'id',
|
title: 'id',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
slotName: 'id',
|
slotName: 'id',
|
||||||
width: 100,
|
width: 68,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
|
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
|
||||||
@@ -15,6 +15,7 @@ const columns = [
|
|||||||
slotName: '${field.propertyName}',
|
slotName: '${field.propertyName}',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
#if(${field.propertyType} == 'String')
|
#if(${field.propertyType} == 'String')
|
||||||
|
minWidth: 238,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true,
|
tooltip: true,
|
||||||
#elseif(${field.propertyType} == 'Date')
|
#elseif(${field.propertyType} == 'Date')
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package com.orion.visor.framework.security.configuration;
|
|||||||
|
|
||||||
import com.orion.visor.framework.common.constant.AutoConfigureOrderConst;
|
import com.orion.visor.framework.common.constant.AutoConfigureOrderConst;
|
||||||
import com.orion.visor.framework.common.crypto.ValueCrypto;
|
import com.orion.visor.framework.common.crypto.ValueCrypto;
|
||||||
import com.orion.visor.framework.security.configuration.config.CryptoConfig;
|
import com.orion.visor.framework.security.configuration.config.AesCryptoConfig;
|
||||||
import com.orion.visor.framework.security.core.crypto.PrimaryValueCrypto;
|
import com.orion.visor.framework.security.core.crypto.PrimaryValueCrypto;
|
||||||
import com.orion.visor.framework.security.core.crypto.aes.AesCryptoProcessor;
|
import com.orion.visor.framework.security.core.crypto.processor.AesCryptoProcessor;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@@ -12,8 +12,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目加密解密配置
|
* 项目加密解密配置
|
||||||
*
|
*
|
||||||
@@ -22,13 +20,10 @@ import javax.annotation.Resource;
|
|||||||
* @since 2023/7/7 23:59
|
* @since 2023/7/7 23:59
|
||||||
*/
|
*/
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@EnableConfigurationProperties(CryptoConfig.class)
|
@EnableConfigurationProperties({AesCryptoConfig.class})
|
||||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SECURITY_CRYPTO)
|
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SECURITY_CRYPTO)
|
||||||
public class OrionCryptoAutoConfiguration {
|
public class OrionCryptoAutoConfiguration {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CryptoConfig config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 默认加密器
|
* @return 默认加密器
|
||||||
*/
|
*/
|
||||||
@@ -43,8 +38,8 @@ public class OrionCryptoAutoConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean(initMethod = "init")
|
@Bean(initMethod = "init")
|
||||||
@ConditionalOnProperty(value = "orion.crypto.aes.enabled", havingValue = "true")
|
@ConditionalOnProperty(value = "orion.crypto.aes.enabled", havingValue = "true")
|
||||||
public ValueCrypto aesValueCrypto() {
|
public ValueCrypto aesValueCrypto(AesCryptoConfig config) {
|
||||||
return new AesCryptoProcessor(config.getAes());
|
return new AesCryptoProcessor(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.orion.visor.framework.security.core.crypto.aes;
|
package com.orion.visor.framework.security.configuration.config;
|
||||||
|
|
||||||
import com.orion.lang.utils.crypto.CryptoConst;
|
import com.orion.lang.utils.crypto.CryptoConst;
|
||||||
import com.orion.lang.utils.crypto.enums.PaddingMode;
|
import com.orion.lang.utils.crypto.enums.PaddingMode;
|
||||||
@@ -6,6 +6,7 @@ import com.orion.lang.utils.crypto.enums.WorkingMode;
|
|||||||
import com.orion.visor.framework.security.core.crypto.CryptoConfig;
|
import com.orion.visor.framework.security.core.crypto.CryptoConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aes 加密器配置
|
* aes 加密器配置
|
||||||
@@ -16,6 +17,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ConfigurationProperties("orion.crypto.aes")
|
||||||
public class AesCryptoConfig extends CryptoConfig {
|
public class AesCryptoConfig extends CryptoConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.orion.visor.framework.security.configuration.config;
|
|
||||||
|
|
||||||
import com.orion.visor.framework.security.core.crypto.aes.AesCryptoConfig;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加密配置
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/7/8 0:01
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ConfigurationProperties("orion.crypto")
|
|
||||||
public class CryptoConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* aes 加密器配置
|
|
||||||
*/
|
|
||||||
private AesCryptoConfig aes;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.orion.visor.framework.security.core.crypto.aes;
|
package com.orion.visor.framework.security.core.crypto.processor;
|
||||||
|
|
||||||
import com.orion.lang.utils.Strings;
|
import com.orion.lang.utils.Strings;
|
||||||
import com.orion.lang.utils.crypto.Keys;
|
import com.orion.lang.utils.crypto.Keys;
|
||||||
@@ -6,6 +6,7 @@ import com.orion.lang.utils.crypto.enums.CipherAlgorithm;
|
|||||||
import com.orion.lang.utils.crypto.enums.WorkingMode;
|
import com.orion.lang.utils.crypto.enums.WorkingMode;
|
||||||
import com.orion.lang.utils.crypto.symmetric.SymmetricBuilder;
|
import com.orion.lang.utils.crypto.symmetric.SymmetricBuilder;
|
||||||
import com.orion.lang.utils.crypto.symmetric.SymmetricCrypto;
|
import com.orion.lang.utils.crypto.symmetric.SymmetricCrypto;
|
||||||
|
import com.orion.visor.framework.security.configuration.config.AesCryptoConfig;
|
||||||
import com.orion.visor.framework.security.core.crypto.CryptoProcessor;
|
import com.orion.visor.framework.security.core.crypto.CryptoProcessor;
|
||||||
|
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
@@ -5,15 +5,10 @@
|
|||||||
"type": "com.orion.visor.framework.security.configuration.config.SecurityConfig",
|
"type": "com.orion.visor.framework.security.configuration.config.SecurityConfig",
|
||||||
"sourceType": "com.orion.visor.framework.security.configuration.config.SecurityConfig"
|
"sourceType": "com.orion.visor.framework.security.configuration.config.SecurityConfig"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "orion.crypto",
|
|
||||||
"type": "com.orion.visor.framework.security.configuration.config.CryptoConfig",
|
|
||||||
"sourceType": "com.orion.visor.framework.security.configuration.config.CryptoConfig"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "orion.crypto.aes",
|
"name": "orion.crypto.aes",
|
||||||
"type": "com.orion.visor.framework.security.core.crypto.aes.AesCryptoConfig",
|
"type": "com.orion.visor.framework.security.configuration.config.AesCryptoConfig",
|
||||||
"sourceType": "com.orion.visor.framework.security.core.crypto.aes.AesCryptoConfig"
|
"sourceType": "com.orion.visor.framework.security.configuration.config.AesCryptoConfig"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"properties": [
|
"properties": [
|
||||||
@@ -2,7 +2,8 @@ package com.orion.visor.framework.storage.configuration;
|
|||||||
|
|
||||||
import com.orion.visor.framework.common.constant.AutoConfigureOrderConst;
|
import com.orion.visor.framework.common.constant.AutoConfigureOrderConst;
|
||||||
import com.orion.visor.framework.common.file.FileClient;
|
import com.orion.visor.framework.common.file.FileClient;
|
||||||
import com.orion.visor.framework.storage.configuration.config.StorageConfig;
|
import com.orion.visor.framework.storage.configuration.config.LocalStorageConfig;
|
||||||
|
import com.orion.visor.framework.storage.configuration.config.LogsStorageConfig;
|
||||||
import com.orion.visor.framework.storage.core.client.PrimaryFileClient;
|
import com.orion.visor.framework.storage.core.client.PrimaryFileClient;
|
||||||
import com.orion.visor.framework.storage.core.client.local.LocalFileClient;
|
import com.orion.visor.framework.storage.core.client.local.LocalFileClient;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
@@ -12,8 +13,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储配置类
|
* 存储配置类
|
||||||
*
|
*
|
||||||
@@ -25,12 +24,9 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_STORAGE)
|
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_STORAGE)
|
||||||
@EnableConfigurationProperties(StorageConfig.class)
|
@EnableConfigurationProperties({LocalStorageConfig.class, LogsStorageConfig.class})
|
||||||
public class OrionStorageAutoConfiguration {
|
public class OrionStorageAutoConfiguration {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StorageConfig config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 默认文件客户端
|
* @return 默认文件客户端
|
||||||
*/
|
*/
|
||||||
@@ -45,8 +41,8 @@ public class OrionStorageAutoConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "orion.storage.local.enabled", havingValue = "true")
|
@ConditionalOnProperty(value = "orion.storage.local.enabled", havingValue = "true")
|
||||||
public FileClient localFileClient() {
|
public FileClient localFileClient(LocalStorageConfig config) {
|
||||||
return new LocalFileClient(config.getLocal());
|
return new LocalFileClient(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,8 +50,8 @@ public class OrionStorageAutoConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "orion.storage.logs.enabled", havingValue = "true")
|
@ConditionalOnProperty(value = "orion.storage.logs.enabled", havingValue = "true")
|
||||||
public FileClient logsFileClient() {
|
public FileClient logsFileClient(LogsStorageConfig config) {
|
||||||
return new LocalFileClient(config.getLogs());
|
return new LocalFileClient(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,27 +2,19 @@ package com.orion.visor.framework.storage.configuration.config;
|
|||||||
|
|
||||||
import com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig;
|
import com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储配置
|
* 本地存储配置
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author Jiahang Li
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/6/30 18:40
|
* @since 2023/6/30 18:40
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ConfigurationProperties(prefix = "orion.storage")
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class StorageConfig {
|
@ConfigurationProperties(prefix = "orion.storage.local")
|
||||||
|
public class LocalStorageConfig extends LocalFileClientConfig {
|
||||||
/**
|
|
||||||
* 本地文件客户端 配置
|
|
||||||
*/
|
|
||||||
private LocalFileClientConfig local;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志文件客户端 配置
|
|
||||||
*/
|
|
||||||
private LocalFileClientConfig logs;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.orion.visor.framework.storage.configuration.config;
|
||||||
|
|
||||||
|
import com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志存储配置
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/6/30 18:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ConfigurationProperties(prefix = "orion.storage.logs")
|
||||||
|
public class LogsStorageConfig extends LocalFileClientConfig {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,19 +1,14 @@
|
|||||||
{
|
{
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
|
||||||
"name": "orion.storage",
|
|
||||||
"type": "com.orion.visor.framework.storage.configuration.config.StorageConfig",
|
|
||||||
"sourceType": "com.orion.visor.framework.storage.configuration.config.StorageConfig"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "orion.storage.local",
|
"name": "orion.storage.local",
|
||||||
"type": "com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig",
|
"type": "com.orion.visor.framework.storage.configuration.config.LocalStorageConfig",
|
||||||
"sourceType": "com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig"
|
"sourceType": "com.orion.visor.framework.storage.configuration.config.LocalStorageConfig"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "orion.storage.logs",
|
"name": "orion.storage.logs",
|
||||||
"type": "com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig",
|
"type": "com.orion.visor.framework.storage.configuration.config.LogsStorageConfig",
|
||||||
"sourceType": "com.orion.visor.framework.storage.core.client.local.LocalFileClientConfig"
|
"sourceType": "com.orion.visor.framework.storage.configuration.config.LogsStorageConfig"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"properties": [
|
"properties": [
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
{
|
{
|
||||||
"name": "orion.websocket.prefix",
|
"name": "orion.websocket.prefix",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
"description": "公共 websocket 前缀"
|
"description": "公共 websocket 前缀."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "orion.websocket.binary-buffer-size",
|
"name": "orion.websocket.binary-buffer-size",
|
||||||
@@ -3,7 +3,7 @@ server:
|
|||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: orion-visor-launch
|
name: orion-visor
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
main:
|
main:
|
||||||
@@ -142,7 +142,7 @@ knife4j:
|
|||||||
|
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
path: ${user.home}/orion/logs/orion-visor
|
path: ${user.home}/orion/logs/${spring.application.name}
|
||||||
name: ${logging.file.path}/app.log
|
name: ${logging.file.path}/app.log
|
||||||
logback:
|
logback:
|
||||||
rollingpolicy:
|
rollingpolicy:
|
||||||
@@ -189,10 +189,16 @@ app:
|
|||||||
exec-log:
|
exec-log:
|
||||||
# 是否拼接 ansi 执行状态日志
|
# 是否拼接 ansi 执行状态日志
|
||||||
append-ansi: true
|
append-ansi: true
|
||||||
# 自动清理执行文件
|
# 自动清理配置
|
||||||
auto-clear: true
|
auto-clear:
|
||||||
# 保留周期 (天)
|
# 批量执行日志
|
||||||
keep-period: 30
|
exec-log:
|
||||||
|
enabled: false
|
||||||
|
keep-period: 30
|
||||||
|
# 主机连接日志
|
||||||
|
host-connect-log:
|
||||||
|
enabled: false
|
||||||
|
keep-period: 30
|
||||||
|
|
||||||
# orion framework config
|
# orion framework config
|
||||||
orion:
|
orion:
|
||||||
@@ -253,14 +259,14 @@ orion:
|
|||||||
timestamp-prefix: false
|
timestamp-prefix: false
|
||||||
date-directory: false
|
date-directory: false
|
||||||
storage-path: ${user.home}
|
storage-path: ${user.home}
|
||||||
base-path: /orion/orion-visor/storage
|
base-path: /orion/${spring.application.name}/storage
|
||||||
# 日志文件存储
|
# 日志文件存储
|
||||||
logs:
|
logs:
|
||||||
enabled: true
|
enabled: true
|
||||||
timestamp-prefix: false
|
timestamp-prefix: false
|
||||||
date-directory: false
|
date-directory: false
|
||||||
storage-path: ${user.home}
|
storage-path: ${user.home}
|
||||||
base-path: /orion/orion-visor/logs
|
base-path: /orion/${spring.application.name}/logs
|
||||||
security:
|
security:
|
||||||
password-encoder-length: 4
|
password-encoder-length: 4
|
||||||
# 匿名接口
|
# 匿名接口
|
||||||
|
|||||||
@@ -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}}
|
|
||||||
@@ -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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/command-snippet")
|
@RequestMapping("/asset/command-snippet")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class CommandSnippetController {
|
public class CommandSnippetController {
|
||||||
|
|
||||||
@Resource
|
@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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/command-snippet-group")
|
@RequestMapping("/asset/command-snippet-group")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class CommandSnippetGroupController {
|
public class CommandSnippetGroupController {
|
||||||
|
|
||||||
@Resource
|
@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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/exec-command")
|
@RequestMapping("/asset/exec-command")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class ExecCommandController {
|
public class ExecCommandController {
|
||||||
|
|
||||||
@Resource
|
@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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -43,7 +43,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/exec-command-log")
|
@RequestMapping("/asset/exec-command-log")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class ExecCommandLogController {
|
public class ExecCommandLogController {
|
||||||
|
|
||||||
private static final String SOURCE = ExecSourceEnum.BATCH.name();
|
private static final String SOURCE = ExecSourceEnum.BATCH.name();
|
||||||
|
|||||||
@@ -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}}
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -34,7 +34,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/exec-job")
|
@RequestMapping("/asset/exec-job")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class ExecJobController {
|
public class ExecJobController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -42,7 +42,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/exec-job-log")
|
@RequestMapping("/asset/exec-job-log")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class ExecJobLogController {
|
public class ExecJobLogController {
|
||||||
|
|
||||||
private static final String SOURCE = ExecSourceEnum.JOB.name();
|
private static final String SOURCE = ExecSourceEnum.JOB.name();
|
||||||
|
|||||||
@@ -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}}
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -36,7 +36,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/exec-template")
|
@RequestMapping("/asset/exec-template")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class ExecTemplateController {
|
public class ExecTemplateController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -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"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -36,7 +36,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-connect-log")
|
@RequestMapping("/asset/host-connect-log")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostConnectLogController {
|
public class HostConnectLogController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -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.DemoDisableApi;
|
||||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||||
import com.orion.visor.module.asset.define.operator.HostOperatorType;
|
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.*;
|
||||||
import com.orion.visor.module.asset.entity.request.host.HostQueryRequest;
|
import com.orion.visor.module.asset.entity.vo.HostConfigVO;
|
||||||
import com.orion.visor.module.asset.entity.request.host.HostUpdateRequest;
|
|
||||||
import com.orion.visor.module.asset.entity.vo.HostVO;
|
import com.orion.visor.module.asset.entity.vo.HostVO;
|
||||||
import com.orion.visor.module.asset.service.HostService;
|
import com.orion.visor.module.asset.service.HostService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -37,7 +36,6 @@ import java.util.List;
|
|||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host")
|
@RequestMapping("/asset/host")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostController {
|
public class HostController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -61,6 +59,24 @@ public class HostController {
|
|||||||
return hostService.updateHostById(request);
|
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)
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "通过 id 查询主机")
|
@Operation(summary = "通过 id 查询主机")
|
||||||
@@ -70,12 +86,22 @@ public class HostController {
|
|||||||
return hostService.getHostById(id);
|
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)
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "查询主机")
|
@Operation(summary = "查询主机")
|
||||||
|
@Parameter(name = "type", description = "type", required = false)
|
||||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||||
public List<HostVO> getHostList() {
|
public List<HostVO> getHostList(@RequestParam(value = "type", required = false) String type) {
|
||||||
return hostService.getHostListByCache();
|
return hostService.getHostList(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoreLog(IgnoreLogMode.RET)
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
|
|||||||
@@ -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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-extra")
|
@RequestMapping("/asset/host-extra")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostExtraController {
|
public class HostExtraController {
|
||||||
|
|
||||||
@Resource
|
@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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-group")
|
@RequestMapping("/asset/host-group")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostGroupController {
|
public class HostGroupController {
|
||||||
|
|
||||||
@Resource
|
@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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-identity")
|
@RequestMapping("/asset/host-identity")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostIdentityController {
|
public class HostIdentityController {
|
||||||
|
|
||||||
@Resource
|
@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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-key")
|
@RequestMapping("/asset/host-key")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostKeyController {
|
public class HostKeyController {
|
||||||
|
|
||||||
@Resource
|
@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
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-sftp")
|
@RequestMapping("/asset/host-sftp")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
|
||||||
public class HostSftpLogController {
|
public class HostSftpLogController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
### 获取主机终端主题
|
|
||||||
GET {{baseUrl}}/asset/host-terminal/themes
|
|
||||||
Authorization: {{token}}
|
|
||||||
|
|
||||||
|
|
||||||
### 获取主机终端连接 token
|
|
||||||
GET {{baseUrl}}/asset/host-terminal/access
|
|
||||||
Authorization: {{token}}
|
|
||||||
|
|
||||||
|
|
||||||
###
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user