Compare commits

...

87 Commits

Author SHA1 Message Date
李佳航
122b568cf5 Merge pull request #46 from dromara/dev
Dev
2024-07-29 11:39:00 +08:00
lijiahang
8b97c02d15 🐳 修改 docker 配置. 2024-07-29 11:15:44 +08:00
lijiahang
dcfb016ce5 🔖 升级版本. 2024-07-29 10:33:59 +08:00
lijiahang
c842de9e23 修改 hook 位置. 2024-07-29 10:25:11 +08:00
李佳航
1b2753a2b7 Merge pull request #44 from dromara/dev
Dev
2024-07-26 11:11:47 +08:00
lijiahang
29b44b8b77 🚨 修复 ts 构建报错. 2024-07-26 10:56:36 +08:00
lijiahang
7290b1364c 🔖 升级版本. 2024-07-26 10:25:38 +08:00
lijiahang
3851ead8bb 💄 修改滚动条样式. 2024-07-26 10:18:39 +08:00
lijiahang
305312cc26 🐛 修复文件上传列表显示错误. 2024-07-25 13:46:48 +08:00
李佳航
b4217555d2 Merge pull request #43 from dromara/dev
Dev
2024-07-25 11:16:59 +08:00
lijiahang
87b8e405f5 🔖 升级版本. 2024-07-25 10:27:49 +08:00
lijiahang
3513196a78 修改类型定义. 2024-07-24 15:29:15 +08:00
lijiahang
0240a12321 ⬆️ 修改升级sql. 2024-07-24 15:04:29 +08:00
lijiahang
3a8eac4d4a 重构终端功能. 2024-07-23 10:47:59 +08:00
lijiahang
4bd2de4ce2 🔨 重构主机模块. 2024-07-22 19:36:02 +08:00
lijiahang
b7608fccb3 🔨 修改主机逻辑. 2024-07-22 18:05:00 +08:00
lijiahang
bb925d354d 📝 修改 md 地址. 2024-07-22 10:37:11 +08:00
lijiahang
3a476d41d2 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	README.md
2024-07-22 10:31:45 +08:00
lijiahang
1927b10bcc 📝 修改 md 地址. 2024-07-22 10:31:05 +08:00
lijiahang
0664eff151 🐛 windows 移动文件失败. 2024-07-22 10:27:21 +08:00
lijiahang
a71456b209 去除注解. 2024-07-18 15:39:31 +08:00
lijiahang
48d308b1a8 🐛 批量执行历史显示错误. 2024-07-17 13:38:51 +08:00
lijiahang
f75d097d8a 删除 http 文件. 2024-07-17 13:35:04 +08:00
lijiahang
0d46d81c4e 优化文件上传逻辑. 2024-07-15 10:15:20 +08:00
lijiahangmax
c20c83245f 🐛 修复 windows 文件备份失败. 2024-07-14 21:24:53 +08:00
lijiahangmax
849e010bc3 Merge remote-tracking branch 'origin/dev' into dev 2024-07-12 00:02:57 +08:00
lijiahangmax
95c299eea4 💄 修改主机编辑样式. 2024-07-12 00:02:45 +08:00
李佳航
ad3edd4ccd Merge pull request #41 from dromara/dev
Dev
2024-07-11 11:08:52 +08:00
lijiahang
81b7b3505e 🚀 修改启动命令. 2024-07-11 10:56:49 +08:00
lijiahang
1522a6f3ad 🔖 升级版本. 2024-07-11 10:28:44 +08:00
lijiahang
04bae45955 修改执行参数. 2024-07-10 11:46:07 +08:00
lijiahang
873e910eb1 定时任务添加参数. 2024-07-10 10:21:16 +08:00
lijiahang
a7f86bf62a 💄 修改表格样式. 2024-07-09 10:34:39 +08:00
lijiahang
7ba278d210 📝 添加 NOTICE 文件. 2024-07-08 14:45:12 +08:00
lijiahang
e9ac9b9f13 修改字典值长度. 2024-07-08 14:44:33 +08:00
lijiahangmax
d34843f90c 主机终端主题从字典中获取. 2024-07-04 21:53:21 +08:00
lijiahang
374d0bdd9c Merge remote-tracking branch 'origin/dev' into dev 2024-07-04 10:29:58 +08:00
lijiahang
5d3dc83bab 🐛 修复操作日志分页无效. 2024-07-04 10:29:39 +08:00
lijiahangmax
05d0f75cdc Merge remote-tracking branch 'origin/dev' into dev 2024-06-30 01:14:58 +08:00
lijiahangmax
711a4a6bab 🐛 修复终端大小适配失效. 2024-06-30 01:14:44 +08:00
李佳航
08895ba170 Merge pull request #37 from LinuxSuRen/fix/e2e
🐛 e2e 配置失效.
2024-06-27 15:27:11 +08:00
rick
c2c8b108ac fix: the e2e testing failure due to auth error 2024-06-27 07:23:24 +00:00
李佳航
318e9f30b8 Merge pull request #36 from dromara/dev
🚀 修改 e2e 配置.
2024-06-27 14:46:36 +08:00
lijiahang
39a1001510 🚀 修改 e2e 配置. 2024-06-27 14:43:59 +08:00
李佳航
5e7b7ebfa7 Merge pull request #35 from dromara/dev
Dev
2024-06-27 13:46:39 +08:00
lijiahang
8d85cdf173 🚀 修改 e2e 配置. 2024-06-27 13:44:39 +08:00
lijiahang
79d95d1997 📝 修改 sql. 2024-06-27 13:31:10 +08:00
李佳航
1eb07d0b24 Merge pull request #34 from dromara/dev
Dev
2024-06-27 13:06:49 +08:00
lijiahang
601564b573 🔖 升级版本. 2024-06-27 13:03:25 +08:00
lijiahang
41384fab17 🐛 字典值排序无效. 2024-06-26 10:23:32 +08:00
lijiahang
f0a122d862 自动清理配置. 2024-06-25 10:42:32 +08:00
lijiahang
b08d75be62 🔨 更新 spring 配置描述文件. 2024-06-25 10:16:15 +08:00
lijiahangmax
02f5bef6b4 📝 修改命名. 2024-06-24 22:49:17 +08:00
lijiahang
ef10c8b8b6 修改前端包结构. 2024-06-24 09:57:33 +08:00
lijiahang
6c4e9cd5c6 🚀 修改 e2e 配置. 2024-06-24 09:54:57 +08:00
lijiahang
8dec40553d 优化 terminal 逻辑. 2024-06-21 10:15:33 +08:00
lijiahang
9ae5a6c627 🐛 修复机器码获取失败. 2024-06-20 11:55:00 +08:00
lijiahang
2ec1678f01 🔨 修改 ip 获取逻辑. 2024-06-20 11:53:39 +08:00
李佳航
f9e436e885 Merge pull request #30 from LinuxSuRen/e2e
🚀 add e2e testing base on docker compose.
2024-06-20 11:28:46 +08:00
rick
2a49e7670d fix the health check command 2024-06-20 02:56:16 +00:00
Rick
95d8988f11 Update e2e.yaml 2024-06-20 10:25:23 +08:00
Rick
e04a972df5 Update Dockerfile 2024-06-20 10:24:58 +08:00
rick
1ca9311625 fix the password in e2e 2024-06-20 01:52:10 +00:00
rick
630a1fd3cd test: add e2e testing base on docker compose 2024-06-20 01:29:43 +00:00
李佳航
0f6d84dab2 Merge pull request #28 from dromara/dev
Dev
2024-06-19 12:11:39 +08:00
lijiahang
f64eb395a8 🐳 修改镜像权限. 2024-06-19 11:53:06 +08:00
lijiahang
2e69c67de0 🐳 修改镜像权限. 2024-06-19 11:29:09 +08:00
lijiahang
7747b4e52e 🔖 升级版本. 2024-06-19 11:07:03 +08:00
lijiahang
830622aafb 💄 修改样式. 2024-06-19 10:48:00 +08:00
lijiahang
2919950c5b ⬆️ 升级 arco 版本. 2024-06-18 11:53:58 +08:00
lijiahangmax
d56cfbba82 添加系统设置页面. 2024-06-18 00:35:45 +08:00
lijiahang
cfe1924f11 获取应用信息. 2024-06-17 19:12:58 +08:00
lijiahang
dfd2ec45f4 🔨 修改 spring 应用名称. 2024-06-17 10:13:23 +08:00
李佳航
19c7e31f53 Merge pull request #24 from dromara/dev
Dev
2024-06-12 16:02:47 +08:00
lijiahang
f618aef988 🔖 升级版本. 2024-06-12 15:14:24 +08:00
lijiahang
af97f752f5 📝 修改仓库地址. 2024-06-12 15:13:07 +08:00
lijiahangmax
bfb80afee2 优化标准数据模型. 2024-06-12 00:21:25 +08:00
李佳航
72695af0f0 Merge pull request #23 from lijiahangmax/dev
🐛 登录后提示系统异常.
2024-06-11 16:30:55 +08:00
lijiahang
3a5b84eec4 🐛 登录后提示系统异常. 2024-06-11 16:07:38 +08:00
李佳航
387ed53328 Merge pull request #22 from lijiahangmax/dev
Dev
2024-06-11 13:20:15 +08:00
lijiahang
c9cbc5fd55 🔖 升级版本. 2024-06-11 12:50:42 +08:00
lijiahang
ae03460a33 优化会话关闭处理逻辑. 2024-06-11 12:31:16 +08:00
lijiahang
4b060a864a 登录历史参数化. 2024-06-11 12:28:24 +08:00
李佳航
07e8e63ee6 Merge pull request #21 from lijiahangmax/main
merge
2024-06-11 11:28:39 +08:00
lijiahang
ab1d4ed97f 🔨 规范化配置. 2024-06-11 11:12:44 +08:00
lijiahang
2bd7dfd5b8 🔨 规范化注释. 2024-06-07 16:05:26 +08:00
lijiahang
c39049e5f5 🔨 规范化包结构. 2024-06-07 15:41:52 +08:00
560 changed files with 7183 additions and 6662 deletions

21
.github/workflows/e2e.yaml vendored Normal file
View 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
View File

@@ -0,0 +1,7 @@
* 在使用本项目前,请您仔细阅读免责声明,确保您已充分理解其中的内容
* 本项目采用 APACHE LICENSE 2.0 开源协议,如您需要源码的开发方式,需要遵循以下几点
1. 禁止修改或删除 LICENSE 文件。
2. 不可二次开发或参与同类竞品的开发。
3. 本项目可免费商业使用,商业使用请保留项目源码、出处、描述文件和作者声明等。

View File

@@ -13,27 +13,27 @@
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://github.com/lijiahangmax/orion-visor/releases"> href="https://github.com/dromara/orion-visor/releases">
<img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" /> <img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://gitee.com/lijiahangmax/orion-visor/stargazers"> href="https://gitee.com/dromara/orion-visor/stargazers">
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" /> <img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://gitee.com/lijiahangmax/orion-visor/members"> href="https://gitee.com/dromara/orion-visor/members">
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" /> <img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://github.com/lijiahangmax/orion-visor"> href="https://github.com/dromara/orion-visor">
<img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" /> <img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://github.com/lijiahangmax/orion-visor"> href="https://github.com/dromara/orion-visor">
<img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" /> <img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" />
</a> </a>
</p> </p>
@@ -51,18 +51,19 @@
## 演示环境 ## 演示环境
演示地址: 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) [gitcode](https://gitcode.com/dromara/orion-visor/overview)
⭐ 体验后可以点一下 `star` 这对我很重要! * 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目! * 🎭 演示环境部分功能不可用, 完整功能请本地部署!
[github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor) * 📛 演示环境请不要随便删除数据!
* 📧 如果演示环境不可用请联系我!
## 快速开始 ## 快速开始
```bash ```bash
# clone # clone
git clone https://github.com/lijiahangmax/orion-visor git clone https://github.com/dromara/orion-visor
cd orion-visor cd orion-visor
# 启动 # 启动
docker compose up -d docker compose up -d
@@ -130,8 +131,8 @@ docker compose up -d
## 免责声明 ## 免责声明
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/lijiahangmax/orion-visor/blob/main/DISCLAIMER.md) 在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/dromara/orion-visor/blob/main/DISCLAIMER.md)
## License ## License
本项目遵循 [Apache-2.0](https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE) 开源许可证。 本项目遵循 [Apache-2.0](https://github.com/dromara/orion-visor/blob/main/LICENSE) 开源许可证。

View File

@@ -0,0 +1,79 @@
version: '3.3'
services:
service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.2
privileged: true
ports:
- 1081:80
environment:
- MYSQL_HOST=mysql
- MYSQL_PORT=3306
- MYSQL_DATABASE=orion_visor
- MYSQL_USER=root
- MYSQL_PASSWORD=Data@123456
- REDIS_HOST=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:
mysql:
condition: service_healthy
redis:
condition: service_healthy
links:
- mysql
- redis
mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.2
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
redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.2
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://service:80
depends_on:
service:
condition: service_healthy
links:
- service

View File

@@ -1,26 +1,38 @@
version: '3.3' version: '3.3'
services: services:
orion-visor-service: service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.5 image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.2
privileged: true
ports: ports:
- 1081:80 - 1081:80
environment: environment:
- MYSQL_HOST=orion-visor-mysql - MYSQL_HOST=mysql
- MYSQL_PORT=3306 - MYSQL_PORT=3306
- MYSQL_DATABASE=orion_visor - MYSQL_DATABASE=orion_visor
- MYSQL_USER=root - MYSQL_USER=root
- MYSQL_PASSWORD=Data@123456 - MYSQL_PASSWORD=Data@123456
- REDIS_HOST=orion-visor-redis - REDIS_HOST=redis
- REDIS_PASSWORD=Data@123456 - REDIS_PASSWORD=Data@123456
- 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 mysql:
- orion-visor-redis condition: service_healthy
orion-visor-mysql: redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.5 condition: service_healthy
links:
- mysql
- redis
mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.2
privileged: true privileged: true
ports: ports:
- 3307:3306 - 3307:3306
@@ -30,20 +42,37 @@ 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
orion-visor-redis: healthcheck:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.5 test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
interval: 3s
timeout: 60s
retries: 10
start_period: 3s
redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.2
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}"
orion-visor-adminer: healthcheck:
image: adminer test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 3s
timeout: 60s
retries: 10
start_period: 3s
adminer:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.2
ports: ports:
- 8081:8080 - 8081:8080
depends_on:
mysql:
condition: service_healthy
links:
- mysql

View File

@@ -1,8 +1,7 @@
#/bin/bash #/bin/bash
docker compose down docker compose down
sh ./pull.sh
# demo 启动 # demo 启动
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

View File

@@ -0,0 +1 @@
FROM adminer:latest

5
docker/adminer/build.sh Normal file
View File

@@ -0,0 +1,5 @@
#/bin/bash
version=2.1.2
docker build -t orion-visor-adminer:${version} .
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}

7
docker/e2e/Dockerfile Normal file
View 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
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
atest run -p testsuite.yaml --report md

49
docker/e2e/testsuite.yaml Normal file
View 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

View File

@@ -1,5 +1,5 @@
#/bin/bash #/bin/bash
version=2.0.5 version=2.1.2
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

View File

@@ -1,5 +1,5 @@
#/bin/bash #/bin/bash
version=2.0.5 version=2.1.2
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}

View File

@@ -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 && \

View File

@@ -1,5 +1,5 @@
#/bin/bash #/bin/bash
version=2.0.5 version=2.1.2
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} .

View File

@@ -11,10 +11,10 @@
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description>项目所有依赖</description> <description>项目所有依赖</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<properties> <properties>
<revision>2.0.5</revision> <revision>2.1.2</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>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目公共基准包</description> <description>项目公共基准包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -0,0 +1,17 @@
package com.orion.visor.framework.common.annotation;
import java.lang.annotation.*;
/**
* 保留
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/6 15:26
*/
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Keep {
}

View File

@@ -14,14 +14,17 @@ public interface AppConst extends OrionConst {
/** /**
* 同 ${orion.version} 迭代时候需要手动更改 * 同 ${orion.version} 迭代时候需要手动更改
*/ */
String VERSION = "2.0.5"; String VERSION = "2.1.2";
String ORION_VISOR = "orion-visor"; /**
* 同 ${spring.application.name}
*/
String APP_NAME = "orion-visor";
String GITHUB = "https://github.com/lijiahangmax/orion-visor"; String GITHUB = "https://github.com/dromara/orion-visor";
String GITEE = "https://gitee.com/lijiahangmax/orion-visor"; String GITEE = "https://gitee.com/dromara/orion-visor";
String ISSUES = "https://github.com/lijiahangmax/orion-visor/issues"; String ISSUES = "https://github.com/dromara/orion-visor/issues";
} }

View File

@@ -13,4 +13,8 @@ public interface CnConst {
String CN_ROLE = "角色"; String CN_ROLE = "角色";
String CN_UNKNOWN = "未知";
String CN_INTRANET_IP = "内网IP";
} }

View File

@@ -17,16 +17,10 @@ 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;
int LOGIN_HISTORY_COUNT = 30;
Long NONE_ID = -1L; Long NONE_ID = -1L;
Integer DEFAULT_VERSION = 1; Integer DEFAULT_VERSION = 1;

View File

@@ -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 = "手动中断";

View File

@@ -43,4 +43,6 @@ public interface ExtraFieldConst extends FieldConst {
String LOG_ID = "logId"; String LOG_ID = "logId";
String DARK = "dark";
} }

View File

@@ -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";
} }

View File

@@ -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";

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -14,13 +14,19 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
public enum MovePosition { public enum MovePosition {
// 拖拽到目标元素上 /**
* 拖拽到目标元素上
*/
TOP(-1), TOP(-1),
// 拖拽到目标元素中 /**
* 拖拽到目标元素中
*/
IN(0), IN(0),
// 拖拽到目标元素下 /**
* 拖拽到目标元素下
*/
BOTTOM(1), BOTTOM(1),
; ;

View File

@@ -1,9 +1,8 @@
package com.orion.visor.framework.common.handler.data; package com.orion.visor.framework.common.handler.data;
import com.alibaba.fastjson.JSON;
import com.orion.spring.SpringHolder; import com.orion.spring.SpringHolder;
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel; import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy; import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
/** /**
* 标准数据定义 * 标准数据定义
@@ -12,45 +11,50 @@ import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
* @version 1.0.0 * @version 1.0.0
* @since 2023/12/21 0:07 * @since 2023/12/21 0:07
*/ */
@SuppressWarnings("unchecked")
public interface GenericsDataDefinition { public interface GenericsDataDefinition {
/**
* 获取数据模型类型
*
* @return class
*/
Class<? extends GenericsDataModel> getModel();
/** /**
* 获取数据处理策略 * 获取数据处理策略
* *
* @return class * @return class
*/ */
Class<? extends MapDataStrategy<? extends GenericsDataModel>> getStrategy(); Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> getStrategyClass();
/** /**
* 获取数据模型策略处理器 * 获取数据模型策略处理器
* *
* @param <Model> Model * @param <M> Model
* @param <Strategy> Strategy * @param <S> Strategy
* @return StrategyBean * @return Strategy Bean
*/ */
@SuppressWarnings("unchecked") default <M extends GenericsDataModel, S extends GenericsDataStrategy<M>> S getStrategy() {
default <Model extends GenericsDataModel, Strategy extends MapDataStrategy<Model>> Strategy getStrategyBean() { return (S) SpringHolder.getBean(this.getStrategyClass());
return (Strategy) SpringHolder.getBean(this.getStrategy());
} }
/** /**
* 反序列化对象 * 反序列化对象
* *
* @param json json * @param serialModel serialModel
* @param <Model> Model * @param <M> Model
* @return object * @return object
*/ */
@SuppressWarnings("unchecked") default <M extends GenericsDataModel> M parse(String serialModel) {
default <Model extends GenericsDataModel> Model parse(String json) { return (M) this.getStrategy().parse(serialModel);
return (Model) JSON.parseObject(json, this.getModel());
} }
/**
* 转为视图对象
*
* @param serialModel serialModel
* @param <M> Model
* @return viewModel
*/
default <M extends GenericsDataModel> M toView(String serialModel) {
GenericsDataStrategy<GenericsDataModel> strategy = this.getStrategy();
GenericsDataModel model = strategy.parse(serialModel);
strategy.toView(model);
return (M) model;
}
} }

View File

@@ -2,6 +2,8 @@ package com.orion.visor.framework.common.handler.data.model;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import java.util.Map;
/** /**
* 标准数据模型 * 标准数据模型
* *
@@ -20,4 +22,14 @@ public interface GenericsDataModel {
return JSON.toJSONString(this); return JSON.toJSONString(this);
} }
/**
* 转为 map
*
* @return map
*/
default Map<String, Object> toMap() {
return JSON.parseObject(this.serial());
}
} }

View File

@@ -0,0 +1,65 @@
package com.orion.visor.framework.common.handler.data.strategy;
import com.alibaba.fastjson.JSON;
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
/**
* 标准数据处理策略 基类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/11 21:44
*/
public abstract class AbstractGenericsDataStrategy<M extends GenericsDataModel> implements GenericsDataStrategy<M> {
protected final Class<M> modelClass;
public AbstractGenericsDataStrategy(Class<M> modelClass) {
this.modelClass = modelClass;
}
/**
* 更新填充
*
* @param beforeModel 修改前的配置
* @param afterModel 修改后的配置
*/
protected void updateFill(M beforeModel, M afterModel) {
}
/**
* 预校验参数
*
* @param model model
*/
protected void preValid(M model) {
}
/**
* 校验参数
*
* @param model model
*/
protected void valid(M model) {
}
@Override
public void doValid(M beforeModel, M afterModel) {
// 预校验参数
this.preValid(afterModel);
// 更新填充
this.updateFill(beforeModel, afterModel);
// 校验参数
this.valid(afterModel);
}
@Override
public M parse(String serialModel) {
return JSON.parseObject(serialModel, modelClass);
}
@Override
public void toView(M model) {
}
}

View File

@@ -9,60 +9,38 @@ import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
* @version 1.0.0 * @version 1.0.0
* @since 2023/12/20 22:09 * @since 2023/12/20 22:09
*/ */
public interface GenericsDataStrategy<Model extends GenericsDataModel, View> { public interface GenericsDataStrategy<M extends GenericsDataModel> {
/** /**
* 获取默认值 * 获取默认值
* *
* @return 默认值 * @return 默认值
*/ */
Model getDefault(); M getDefault();
/**
* 更新填充
*
* @param beforeModel 修改前的配置
* @param afterModel 修改后的配置
*/
void updateFill(Model beforeModel, Model afterModel);
/**
* 预校验参数
*
* @param model model
*/
void preValid(Model model);
/**
* 校验参数
*
* @param model model
*/
void valid(Model model);
/** /**
* 执行完整验证链 * 执行完整验证链
* <p> * <p>
* preValid > updateFill > preValid * preValid > updateFill > valid
* *
* @param beforeModel beforeModel * @param beforeModel beforeModel
* @param afterModel afterModel * @param afterModel afterModel
*/ */
default void doValidChain(Model beforeModel, Model afterModel) { void doValid(M beforeModel, M afterModel);
// 预校验参数
this.preValid(afterModel); /**
// 更新填充 * 解析数据
this.updateFill(beforeModel, afterModel); *
// 校验参数 * @param serialModel serialModel
this.valid(afterModel); * @return model
} */
M parse(String serialModel);
/** /**
* 转为视图配置 * 转为视图配置
* *
* @param model model * @param model model
* @return 视图配置
*/ */
View toView(String model); void toView(M model);
} }

View File

@@ -1,22 +0,0 @@
package com.orion.visor.framework.common.handler.data.strategy;
import com.alibaba.fastjson.JSONObject;
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
import java.util.Map;
/**
* map 数据处理策略
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/20 22:11
*/
public interface MapDataStrategy<Model extends GenericsDataModel> extends GenericsDataStrategy<Model, Map<String, Object>> {
@Override
default Map<String, Object> toView(String model) {
return JSONObject.parseObject(model);
}
}

View File

@@ -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;
} }
} }

View File

@@ -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);
}
}

View File

@@ -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;
} }
/** /**

View File

@@ -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));

View File

@@ -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"
}, },
{ {

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 banner 打印包</description> <description>项目 banner 打印包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -36,24 +36,47 @@ public class BannerApplicationRunner implements ApplicationRunner {
@Value("${management.endpoints.web.base-path:''}") @Value("${management.endpoints.web.base-path:''}")
private String managementEndpoints; private String managementEndpoints;
@Value("${springdoc.api-docs.enabled}")
private Boolean apiDocsEnabled;
@Value("${spring.datasource.druid.stat-view-servlet.enabled}")
private Boolean druidConsoleEnabled;
@Value("#{'${management.endpoints.web.exposure.include}' != 'shutdown'}")
private Boolean springBootActuatorEnabled;
@Value("${spring.boot.admin.client.enabled}")
private Boolean springBootAdminClientEnabled;
@Override @Override
public void run(ApplicationArguments args) { public void run(ApplicationArguments args) {
String line = 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");
.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ") // swagger 地址
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n") if (apiDocsEnabled) {
.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ") appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n") .append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n");
.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ") }
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n") // druid 控制台
.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ") if (druidConsoleEnabled) {
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n") appender.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ") .append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n");
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"") }
.toString(); // admin actuator 端点
if (springBootActuatorEnabled) {
appender.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ")
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n");
}
// admin server 控制台
if (springBootAdminClientEnabled) {
appender.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ")
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n");
}
appender.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ")
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"");
Threads.start(() -> { Threads.start(() -> {
Threads.sleep(1000L); Threads.sleep(1000L);
System.out.println(line); System.out.println(appender);
}); });
} }

View File

@@ -8,4 +8,5 @@ ${AnsiColor.BRIGHT_GREEN}:: Application Name ${AnsiColor.BLUE}${spring.appli
${AnsiColor.BRIGHT_GREEN}:: Application Version ${AnsiColor.BLUE}${orion.version} ${AnsiColor.BRIGHT_GREEN}:: Application Version ${AnsiColor.BLUE}${orion.version}
${AnsiColor.BRIGHT_GREEN}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version} ${AnsiColor.BRIGHT_GREEN}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version}
${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active} ${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active}
${AnsiColor.BRIGHT_GREEN}:: Demo Mode ${AnsiColor.BLUE}${orion.demo}
${AnsiColor.DEFAULT} ${AnsiColor.DEFAULT}

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目操作日志包</description> <description>项目操作日志包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目数据源配置包</description> <description>项目数据源配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目数据脱敏包</description> <description>项目数据脱敏包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目定时任务配置包</description> <description>项目定时任务配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目日志配置包</description> <description>项目日志配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -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);
}
}
} }

View File

@@ -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);
}
}

View File

@@ -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())) {
@@ -72,9 +73,9 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
} }
Method method = invocation.getMethod(); Method method = invocation.getMethod();
// 方法签名 // 方法签名
requestLog.append("\tmethodSign: ").append(method.getDeclaringClass().getName()).append('#') // requestLog.append("\tmethodSign: ").append(method.getDeclaringClass().getName()).append('#')
.append(method.getName()).append("\n"); // .append(method.getName()).append("\n");
// 参数 // 方法参数
requestLog.append("\tparameter: ").append(this.requestToString(method, invocation.getArguments())); requestLog.append("\tparameter: ").append(this.requestToString(method, invocation.getArguments()));
log.info(requestLog.toString()); log.info(requestLog.toString());
} }

View File

@@ -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) -> {
@@ -73,8 +74,8 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
} }
Method method = invocation.getMethod(); Method method = invocation.getMethod();
// 方法签名 // 方法签名
fields.put(METHOD_SIGN, method.getDeclaringClass().getName() + "#" + method.getName()); // fields.put(METHOD_SIGN, method.getDeclaringClass().getName() + "#" + method.getName());
// 参数 // 方法参数
fields.put(PARAMETER, this.requestToString(method, invocation.getArguments())); fields.put(PARAMETER, this.requestToString(method, invocation.getArguments()));
log.info("api请求-开始 {}", JSON.toJSONString(fields)); log.info("api请求-开始 {}", JSON.toJSONString(fields));
fields.clear(); fields.clear();

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目监控配置包</description> <description>项目监控配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 mybatis 配置包</description> <description>项目 mybatis 配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -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 文件

View File

@@ -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);
} }

View File

@@ -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");
} }
/** /**

View File

@@ -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
* *

View File

@@ -33,6 +33,11 @@ public class Table {
*/ */
protected String bizPackage; protected String bizPackage;
/**
* 是否生成 api http 文件
*/
protected boolean enableApiHttp;
/** /**
* 是否生成对外 api * 是否生成对外 api
*/ */

View File

@@ -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();

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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>
@@ -115,7 +118,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}'; import type { ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
import { usePagination, useColLayout } from '@/types/card'; import { useCardPagination, useCardColLayout } from '@/hooks/card';
import { computed, reactive, ref, onMounted } from 'vue'; import { computed, reactive, ref, onMounted } from 'vue';
import useLoading from '@/hooks/loading'; import useLoading from '@/hooks/loading';
import { objectTruthKeyCount, resetObject } from '@/utils'; import { objectTruthKeyCount, resetObject } from '@/utils';
@@ -133,8 +136,8 @@
const emits = defineEmits(['openAdd', 'openUpdate']); const emits = defineEmits(['openAdd', 'openUpdate']);
const cardColLayout = useColLayout(); const cardColLayout = useCardColLayout();
const pagination = usePagination(); const pagination = useCardPagination();
const { loading, setLoading } = useLoading(); const { loading, setLoading } = useLoading();
#if($dictMap.entrySet().size() > 0) #if($dictMap.entrySet().size() > 0)
const { toOptions, getDictValue } = useDictStore(); const { toOptions, getDictValue } = useDictStore();

View File

@@ -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"

View File

@@ -94,8 +94,8 @@
:data="tableRenderData" :data="tableRenderData"
:pagination="pagination" :pagination="pagination"
:bordered="false" :bordered="false"
@page-change="(page) => fetchTableData(page, pagination.pageSize)" @page-change="(page: number) => fetchTableData(page, pagination.pageSize)"
@page-size-change="(size) => fetchTableData(1, size)"> @page-size-change="(size: number) => fetchTableData(1, size)">
#foreach($field in ${table.fields}) #foreach($field in ${table.fields})
#if(${dictMap.containsKey(${field.propertyName})}) #if(${dictMap.containsKey(${field.propertyName})})
<!-- $field.comment --> <!-- $field.comment -->
@@ -151,9 +151,9 @@
import {} from '../types/const'; import {} from '../types/const';
#end #end
#if($vue.enableRowSelection) #if($vue.enableRowSelection)
import { usePagination, useRowSelection } from '@/types/table'; import { useTablePagination, useRowSelection } from '@/hooks/table';
#else #else
import { usePagination } from '@/types/table'; import { useTablePagination } from '@/hooks/table';
#end #end
#if($dictMap.entrySet().size() > 0) #if($dictMap.entrySet().size() > 0)
import { useDictStore } from '@/store'; import { useDictStore } from '@/store';
@@ -161,7 +161,7 @@
const emits = defineEmits(['openAdd', 'openUpdate']); const emits = defineEmits(['openAdd', 'openUpdate']);
const pagination = usePagination(); const pagination = useTablePagination();
#if($vue.enableRowSelection) #if($vue.enableRowSelection)
const rowSelection = useRowSelection(); const rowSelection = useRowSelection();
#end #end

View File

@@ -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')

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 redis 配置包</description> <description>项目 redis 配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -15,6 +15,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.RedisSerializer;
@@ -36,6 +37,7 @@ public class OrionRedisAutoConfiguration {
* @param redisConnectionFactory factory * @param redisConnectionFactory factory
* @return RedisTemplate * @return RedisTemplate
*/ */
@Primary
@Bean @Bean
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) { public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>(); RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 security 配置包</description> <description>项目 security 配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -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);
} }
} }

View File

@@ -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 {
/** /**

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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": [

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目存储层配置包</description> <description>项目存储层配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -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);
} }
} }

View File

@@ -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;
} }

View File

@@ -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 {
}

View File

@@ -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": [

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 swagger 配置包</description> <description>项目 swagger 配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import java.util.HashMap; import java.util.HashMap;
@@ -38,10 +37,9 @@ import java.util.Optional;
* @version 1.0.0 * @version 1.0.0
* @since 2022/6/21 11:22 * @since 2022/6/21 11:22
*/ */
@Profile({"dev"})
@ConditionalOnClass({OpenAPI.class}) @ConditionalOnClass({OpenAPI.class})
@EnableConfigurationProperties(SwaggerConfig.class) @EnableConfigurationProperties(SwaggerConfig.class)
@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true")
@AutoConfiguration @AutoConfiguration
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER) @AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
public class OrionSwaggerAutoConfiguration { public class OrionSwaggerAutoConfiguration {

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目单元测试包</description> <description>项目单元测试包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 web 包</description> <description>项目 web 包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -14,7 +14,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>项目 websocket 配置包</description> <description>项目 websocket 配置包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -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",

View File

@@ -13,7 +13,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<description>项目组件包</description> <description>项目组件包</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<modules> <modules>
<module>orion-visor-framework-common</module> <module>orion-visor-framework-common</module>

View File

@@ -13,7 +13,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description> <description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description>
<url>https://github.com/lijiahangmax/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<dependencies> <dependencies>
<!-- spring boot 配置所需依赖 --> <!-- spring boot 配置所需依赖 -->

View File

@@ -1,7 +1,17 @@
package com.orion.visor.launch; package com.orion.visor.launch;
import com.orion.lang.utils.Strings;
import com.orion.visor.framework.common.constant.Const;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.core.type.AnnotationMetadata;
import java.util.Optional;
/** /**
* application 启动类 * application 启动类
@@ -14,7 +24,35 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
public class LaunchApplication { public class LaunchApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(LaunchApplication.class).run(args); new SpringApplicationBuilder(LaunchApplication.class)
.beanNameGenerator(new CustomBeanNameGenerator())
.run(args);
}
/**
* 自定义 bean 名称生成器
*/
public static class CustomBeanNameGenerator implements BeanNameGenerator {
private static final String BEAN_ANNOTATION_CLASS_NAME = "org.springframework.stereotype.Component";
@Override
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
// 兼容注解自定义名称
if (definition instanceof AnnotatedBeanDefinition) {
AnnotationMetadata metadata = ((AnnotatedBeanDefinition) definition).getMetadata();
// 处理自定义 bean 名称
return Optional.of(metadata)
.map(s -> s.getAnnotationAttributes(BEAN_ANNOTATION_CLASS_NAME))
.map(s -> s.get(Const.VALUE))
.map(Object::toString)
.filter(Strings::isNotBlank)
.orElseGet(definition::getBeanClassName);
} else {
// 非注解形式默认使用默认名称
return BeanDefinitionReaderUtils.generateBeanName(definition, registry);
}
}
} }
} }

View File

@@ -7,6 +7,8 @@ spring:
initial-size: 0 initial-size: 0
min-idle: 1 min-idle: 1
max-active: 5 max-active: 5
stat-view-servlet:
enabled: false
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
@@ -15,6 +17,19 @@ spring:
threads: 2 threads: 2
netty-threads: 2 netty-threads: 2
minimum-idle-size: 2 minimum-idle-size: 2
boot:
admin:
client:
enabled: false
server:
enabled: false
management:
endpoints:
enabled-by-default: false
web:
exposure:
include: shutdown
mybatis-plus: mybatis-plus:
configuration: configuration:

View File

@@ -10,10 +10,13 @@ spring:
min-idle: 5 min-idle: 5
# 最大连接池数量 # 最大连接池数量
max-active: 20 max-active: 20
web-stat-filter: # 控制台
enabled: true
stat-view-servlet: stat-view-servlet:
enabled: true enabled: true
login-username: ${DRUID_USERNAME:admin}
login-password: ${DRUID_PASSWORD:admin}
web-stat-filter:
enabled: true
filter: filter:
stat: stat:
enabled: true enabled: true
@@ -31,6 +34,16 @@ spring:
quartz: quartz:
threadPool: threadPool:
threadCount: 10 threadCount: 10
boot:
admin:
client:
enabled: true
server:
enabled: true
management:
endpoints:
enabled-by-default: true
springdoc: springdoc:
api-docs: api-docs:
@@ -40,6 +53,7 @@ springdoc:
knife4j: knife4j:
enable: false enable: false
production: true
orion: orion:
# 是否为演示模式 # 是否为演示模式

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