Compare commits

..

121 Commits

Author SHA1 Message Date
李佳航
7015468e04 Merge pull request #60 from dromara/dev
Dev
2024-09-27 10:52:27 +08:00
lijiahang
ef57040e1d 📝 修改文档. 2024-09-27 10:41:06 +08:00
lijiahang
2a6537c604 🔖 升级版本. 2024-09-27 10:21:17 +08:00
lijiahang
541a9790ad 优化批量上传逻辑. 2024-09-26 17:38:39 +08:00
lijiahang
011e8ad089 📝 修改文档. 2024-09-14 17:18:51 +08:00
李佳航
3918d36c24 Merge pull request #59 from dromara/dev
Dev
2024-09-14 16:46:32 +08:00
lijiahang
37f452c7c3 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	README.md
2024-09-14 16:44:31 +08:00
lijiahang
fc885bc0ad 📝 修改文档. 2024-09-14 16:43:53 +08:00
李佳航
44c226092d Merge pull request #58 from dromara/dev
Dev
2024-09-11 21:18:41 +08:00
lijiahangmax
14cf8c2492 Merge remote-tracking branch 'origin/dev' into dev 2024-09-11 21:16:08 +08:00
lijiahangmax
d6f5898e61 📝 修改 logo. 2024-09-11 21:14:32 +08:00
lijiahang
0ab8e405cc 📝 修改文档. 2024-09-11 10:18:35 +08:00
lijiahang
4e4231d5a5 修改清理限制. 2024-09-03 10:53:39 +08:00
李佳航
2df3f2fa1a Merge pull request #56 from dromara/dev
🔖 升级版本.
2024-09-02 15:28:10 +08:00
lijiahang
d6048f78f0 🔖 升级版本. 2024-09-02 14:57:47 +08:00
李佳航
f73fa14bfd Merge pull request #55 from dromara/dev
Dev
2024-09-02 13:11:36 +08:00
lijiahang
fd88c725d3 :replace: 修改 demo 地址. 2024-09-02 13:06:17 +08:00
lijiahang
3a16f9d9ab 优化查询逻辑. 2024-09-02 12:37:11 +08:00
lijiahang
de9b89d805 🔖 升级版本. 2024-09-02 11:51:30 +08:00
lijiahangmax
a05c387ba1 修改配置. 2024-08-29 23:34:28 +08:00
lijiahangmax
3cb6e5a2d4 修改配置. 2024-08-29 23:33:46 +08:00
lijiahang
104a9a0aa3 🔨 数据清理时添加条数限制. 2024-08-29 18:26:26 +08:00
lijiahangmax
d7b747eac4 优化主机删除逻辑. 2024-08-29 00:33:13 +08:00
lijiahangmax
d2949c11f3 Merge remote-tracking branch 'origin/dev' into dev 2024-08-29 00:23:33 +08:00
lijiahangmax
cd05f71173 🐛 修复开始 webgl 终端显示错误. 2024-08-29 00:23:11 +08:00
lijiahang
e0dca73369 📝 修改文档. 2024-08-28 17:14:18 +08:00
lijiahang
b8599a6693 🐛 修复加载缓存时报错. 2024-08-28 10:46:06 +08:00
lijiahang
a0adb415fa 🔨 数据清理时添加条数限制. 2024-08-26 17:10:40 +08:00
lijiahang
6c60756e54 禁用 demo api. 2024-08-26 13:57:18 +08:00
lijiahangmax
ee9f51ce7d 🐛 修复 quartz 配置不生效. 2024-08-25 00:50:16 +08:00
lijiahangmax
924b46b41a 优化异常信息获取逻辑. 2024-08-24 19:59:45 +08:00
lijiahangmax
1fca5a1912 优化数据分组逻辑. 2024-08-23 01:44:05 +08:00
李佳航
120eb1ee69 Merge pull request #54 from dromara/dev
Dev
2024-08-22 12:27:58 +08:00
lijiahang
252c538571 🔖 升级版本. 2024-08-22 11:45:24 +08:00
lijiahang
1eec373b7e demo 禁用定时任务. 2024-08-21 13:23:31 +08:00
lijiahang
aa9b96a9c1 修改表格显示字段. 2024-08-21 12:56:07 +08:00
lijiahang
059fb30aa4 优化权限逻辑. 2024-08-20 10:20:35 +08:00
lijiahang
2afaf7ad34 Merge remote-tracking branch 'origin/dev' into dev 2024-08-19 09:53:15 +08:00
lijiahang
076a0956c5 修改心跳检测时间. 2024-08-19 09:49:41 +08:00
lijiahangmax
4a91ec47bf 添加主题. 2024-08-13 20:56:00 +08:00
lijiahangmax
1066b43b3d 全屏模式. 2024-08-12 00:07:54 +08:00
lijiahangmax
3f78125c43 Merge remote-tracking branch 'origin/dev' into dev 2024-08-11 23:07:14 +08:00
lijiahangmax
144a44673b 🐛 修复更新菜单后查询条件错误. 2024-08-11 23:06:59 +08:00
李佳航
777f7b3758 Merge pull request #52 from dromara/dev
Dev
2024-08-08 10:52:09 +08:00
lijiahang
947fa0fea3 🐳 添加 push 脚本. 2024-08-08 10:17:31 +08:00
lijiahang
7109e89fb4 🔖 升级版本. 2024-08-08 10:14:39 +08:00
lijiahang
70e7b1d544 修改终端标签颜色显示. 2024-08-07 10:18:39 +08:00
lijiahangmax
613f86155c 💄 修改终端样式. 2024-08-06 00:01:27 +08:00
lijiahang
8d0b58e48f ⬆️ 升级 orion kit 版本. 2024-08-05 13:49:52 +08:00
lijiahang
8cea9dc977 优化终端代码. 2024-08-05 09:11:54 +08:00
lijiahangmax
471acfdf00 优化自动聚焦逻辑. 2024-08-04 17:01:44 +08:00
lijiahangmax
8ed42131d0 优化命令片段处理逻辑. 2024-08-02 01:52:29 +08:00
lijiahangmax
18c605354a 🔨 修改终端逻辑. 2024-07-31 00:42:02 +08:00
李佳航
8c04411458 Merge pull request #48 from MemoryShadow/dev
perf: Use the.env file instead to modify docker-compose.yml
2024-07-30 17:53:31 +08:00
lijiahang
9a8d1d05cd 💄 修改终端样式. 2024-07-30 14:40:15 +08:00
MemoryShadow
1cbaf9c424 docs: Clarify behavior semantics and accelerate deployment efficiency 2024-07-29 07:02:32 +00:00
MemoryShadow
537c2fc108 perf: Use the.env file instead to modify docker-compose.yml 2024-07-29 07:02:21 +00:00
李佳航
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
577 changed files with 7929 additions and 7011 deletions

15
.env.example Normal file
View File

@@ -0,0 +1,15 @@
SERVICE_PORT=1081
VOLUME_BASE=/data/orion-visor-space/docker-volumes
MYSQL_HOST=mysql
MYSQL_PORT=3306
MYSQL_DATABASE=orion_visor
MYSQL_USER=orion
MYSQL_PASSWORD=Data@123456
MYSQL_ROOT_PASSWORD=Data@123456
REDIS_HOST=redis
REDIS_PASSWORD=Data@123456
SECRET_KEY=uQeacXV8b3isvKLK
DEMO_MODE=false

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

1
.gitignore vendored
View File

@@ -33,3 +33,4 @@ build/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
.env

7
NOTICE Normal file
View File

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

View File

@@ -1,5 +1,5 @@
<div align="center"><img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/29/cec03bbd-0eab-464d-9caf-d0b5a7ffc5a6.png" alt="logo" width="32" /></div> <div align="center"><img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/9/11/11e7e78e-2af0-4c68-9811-db8a4c4400f4.png" alt="logo" width="520" /></div>
<p style="margin-top: 12px" align="center"><b>一款高颜值、现代化的智能运维&轻量堡垒机平台。</b></p> <p style="margin-top: 12px" align="center"><b>一款高颜值、现代化的自动化运维&轻量堡垒机平台。</b></p>
<p align="center"> <p align="center">
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
@@ -19,12 +19,12 @@
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://gitee.com/dromara/orion-visor/stargazers"> href="https://gitee.com/dromara/orion-visor/stargazers">
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" /> <img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=gvp" alt="star" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
href="https://gitee.com/dromara/orion-visor/members"> href="https://gitee.com/dromara/orion-visor/members">
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" /> <img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=gvp" alt="fork" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"
@@ -40,7 +40,7 @@
------------------------------ ------------------------------
**`orion-visor`** 提供一站式服务器运维解决方案。 **`orion-visor`** 提供一站式自动化运维解决方案。
* **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。 * **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。
* **在线终端**:提供在线终端 SSH 服务,支持快捷命令、自定义快捷键和主题风格。 * **在线终端**:提供在线终端 SSH 服务,支持快捷命令、自定义快捷键和主题风格。
@@ -51,9 +51,9 @@
## 演示环境 ## 演示环境
* 🔗 演示地址: http://101.43.254.243:1081/ * 🔗 演示地址: [https://dv.orionsec.cn/](https://dv.orionsec.cn/)
* 🔏 演示账号: 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/dromara/orion-visor/overview)
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目! * 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
* 🎭 演示环境部分功能不可用, 完整功能请本地部署! * 🎭 演示环境部分功能不可用, 完整功能请本地部署!
* 📛 演示环境请不要随便删除数据! * 📛 演示环境请不要随便删除数据!
@@ -63,7 +63,7 @@
```bash ```bash
# clone # clone
git clone https://github.com/dromara/orion-visor git clone --depth=1 https://github.com/dromara/orion-visor
cd orion-visor cd orion-visor
# 启动 # 启动
docker compose up -d docker compose up -d
@@ -72,11 +72,11 @@ docker compose up -d
## 项目文档 ## 项目文档
* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/) * [文档地址](https://visor.orionsec.cn/)
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html) * [安装文档](https://visor.orionsec.cn/quickstart/docker.html)
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html) * [更新日志](https://visor.orionsec.cn/update/change-log.html)
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html) * [操作手册](https://visor.orionsec.cn/operator/asset.html)
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html) * [常见问题](https://visor.orionsec.cn/support/faq.html)
## 技术栈 ## 技术栈
@@ -111,14 +111,18 @@ docker compose up -d
[![Star History Chart](https://api.star-history.com/svg?repos=lijiahangmax/orion-visor&type=Date)](https://star-history.com/#lijiahangmax/orion-visor&Date) [![Star History Chart](https://api.star-history.com/svg?repos=lijiahangmax/orion-visor&type=Date)](https://star-history.com/#lijiahangmax/orion-visor&Date)
## 关于我
本人专注于使用 Java 和 Vue 进行全栈开发, 并在系统自动化运维方面拥有丰富开发的经验。如果您在这些领域有需求或遇到痛点, 请随时联系我, 并备注“合作”。
## 联系我 ## 联系我
<div style="display: flex;"> <div style="display: flex;">
<img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/d42d91f3-f0ee-4c63-adab-a35809e0804c.jpg" alt="wx" width="298px" height="398px"/> <img src="https://bjuimg.obs.cn-north-4.myhuaweicloud.com/images/2024/5/17/d42d91f3-f0ee-4c63-adab-a35809e0804c.jpg" alt="wx" width="298px" height="398px"/>
</div> </div>
![个人微信: ljh1553488](https://img.shields.io/badge/ljh1553488-blue?style=social&label=WX%3A) 微信: ljh1553488
![QQ群1: 755242157](https://img.shields.io/badge/755242157-blue?style=social&label=QQ%E7%BE%A41%3A%20) QQ群: 755242157
📧 咨询问题微信备注: vis 📧 咨询问题微信备注: vis
📧 合作/功能定制备注: 合作 📧 合作/功能定制备注: 合作

View File

@@ -0,0 +1,79 @@
version: '3.3'
services:
service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.7
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.7
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.7
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,50 +1,78 @@
version: '3.3' version: '3.3'
services: services:
orion-visor-service: service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.9 image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.7
privileged: true privileged: true
ports: ports:
- 1081:80 - ${SERVICE_PORT:-1081}:80
environment: environment:
- MYSQL_HOST=orion-visor-mysql - MYSQL_HOST=${MYSQL_HOST:-mysql}
- MYSQL_PORT=3306 - MYSQL_PORT=${MYSQL_PORT:-3306}
- MYSQL_DATABASE=orion_visor - MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
- MYSQL_USER=root - MYSQL_USER=${MYSQL_USER:-root}
- MYSQL_PASSWORD=Data@123456 - MYSQL_PASSWORD=${MYSQL_PASSWORD:-Data@123456}
- REDIS_HOST=orion-visor-redis - REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PASSWORD=Data@123456 - REDIS_PASSWORD=${REDIS_PASSWORD:-Data@123456}
- SECRET_KEY=uQeacXV8b3isvKLK - SECRET_KEY=${SECRET_KEY:-uQeacXV8b3isvKLK}
- DEMO_MODE=false - DEMO_MODE=${DEMO_MODE:-false}
volumes: volumes:
- /data/orion-visor-space/docker-volumes/orion-visor-service/root-orion:/root/orion - ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/service/root-orion:/root/orion
healthcheck:
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
interval: 15s
timeout: 300s
retries: 15
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.9 condition: service_healthy
links:
- mysql
- redis
mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.7
privileged: true privileged: true
ports: ports:
- 3307:3306 - 3307:3306
environment: environment:
- MYSQL_DATABASE=orion_visor - MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
- MYSQL_USER=orion - MYSQL_USER=${MYSQL_USER:-orion}
- MYSQL_PASSWORD=Data@123456 - MYSQL_PASSWORD=${MYSQL_PASSWORD:-Data@123456}
- MYSQL_ROOT_PASSWORD=Data@123456 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-Data@123456}
volumes: volumes:
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql:/var/lib/mysql - ${VOLUME_BASE:-/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 - ${VOLUME_BASE:-/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 - ${VOLUME_BASE:-/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.9 test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
interval: 15s
timeout: 60s
retries: 15
start_period: 3s
redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.7
privileged: true privileged: true
ports: ports:
- 6380:6379 - 6380:6379
environment: environment:
- REDIS_PASSWORD=Data@123456 - REDIS_PASSWORD=${REDIS_PASSWORD:-Data@123456}
volumes: volumes:
- /data/orion-visor-space/docker-volumes/orion-visor-redis/data:/data - ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/redis/data:/data
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}" 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: 15s
timeout: 60s
retries: 15
start_period: 3s
adminer:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.7
ports: ports:
- 8081:8080 - 8081:8080
depends_on:
mysql:
condition: service_healthy
links:
- mysql

View File

@@ -2,6 +2,6 @@
docker compose down docker compose down
# 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}/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

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

@@ -0,0 +1,4 @@
#/bin/bash
version=2.1.7
docker build -t orion-visor-adminer:${version} .
docker tag orion-visor-adminer:${version} 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/user-permission/user
header:
Authorization: Bearer {{.login.data.token}}
expect:
bodyFieldsExpect:
code: 200
msg: "success"
- name: menu
request:
api: /orion-visor/api/infra/user-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,7 +1,6 @@
#/bin/bash #/bin/bash
version=2.0.9 version=2.1.7
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
docker tag orion-visor-mysql:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version} docker tag orion-visor-mysql:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}

6
docker/push.sh Normal file
View File

@@ -0,0 +1,6 @@
#/bin/bash
version=2.1.7
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}

View File

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

View File

@@ -1,9 +1,8 @@
#/bin/bash #/bin/bash
version=2.0.9 version=2.1.7
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} .
rm -rf ./orion-visor-launch.jar rm -rf ./orion-visor-launch.jar
rm -rf ./dist rm -rf ./dist
docker tag orion-visor-service:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version} docker tag orion-visor-service:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:${version}

View File

@@ -29,7 +29,7 @@ server {
location /orion-visor/api { location /orion-visor/api {
proxy_pass http://localhost:9200/orion-visor/api; proxy_pass http://localhost:9200/orion-visor/api;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }

View File

@@ -19,12 +19,12 @@
<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/lijiahangmax/orion-visor/stargazers">
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" /> <img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=gvp" alt="star" />
</a> </a>
<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/lijiahangmax/orion-visor/members">
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" /> <img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=gvp" alt="fork" />
</a> </a>
<a target="_blank" <a target="_blank"
style="text-decoration: none !important;" style="text-decoration: none !important;"

View File

@@ -21,22 +21,35 @@ Dashboard 修改)
```shell ```shell
# github # github
git clone https://github.com/lijiahangmax/orion-visor git clone --depth=1 https://github.com/lijiahangmax/orion-visor
# gitee # gitee
git clone https://gitee.com/lijiahangmax/orion-visor git clone --depth=1 https://gitee.com/lijiahangmax/orion-visor
``` ```
### 构建镜像 ### 拉取镜像
``` ```
# 进入仓库目录 # 进入仓库目录
cd orion-visor cd orion-visor
# 修改 docker-compose.yml (建议修改) # 创建名为 .env 的 .env.example 副本
# MYSQL_USER mysql 用户名 cp .env.example .env
# MYSQL_PASSWORD mysql 用户密码 # 将其中的值删除以保持默认或将其修改为你喜欢的值
# MYSQL_ROOT_PASSWORD mysql root 密码 # SERVICE_PORT 你希望服务监听的端口
# REDIS_PASSWORD redis 密码 # VOLUME_BASE 你希望数据持久化保存的目录, 如果不提前创建将以 docker 进程宿主身份创建(通常是 root)
# SECRET_KEY 加密密钥
# MYSQL_HOST mysql 服务所在的主机, 如果你没有现有的 MySQL 请保持值为 mysql, 如果你有自部署的请在 docker-compose.yml 中移除 services.mysql 以节约性能
# MYSQL_PORT mysql 监听的端口
# MYSQL_DATABASE mysql 数据库
# MYSQL_USER mysql 用户名
# MYSQL_PASSWORD mysql 用户密码
# MYSQL_ROOT_PASSWORD mysql root 密码
# REDIS_HOST redis 服务所在的主机, 如果你没有现有的 Redis 请保持值为 redis, 如果你有自部署的请在 docker-compose.yml 中移除 services.redis 以节约性能
# REDIS_PASSWORD redis 密码
# SECRET_KEY 加密密钥
# 拉取远程镜像
docker compose pull
``` ```
### 启动 ### 启动
@@ -45,7 +58,7 @@ cd orion-visor
docker compose up -d docker compose up -d
``` ```
### 修改加密方式 ### 修改 MySQL 账户的加密方式
``` ```
访问 adminer: http://localhost:8081 访问 adminer: http://localhost:8081

View File

@@ -14,11 +14,11 @@
<url>https://github.com/dromara/orion-visor</url> <url>https://github.com/dromara/orion-visor</url>
<properties> <properties>
<revision>2.0.9</revision> <revision>2.1.7</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>
<orion.kit.version>1.0.7</orion.kit.version> <orion.kit.version>1.0.8</orion.kit.version>
<aspectj.version>1.9.7</aspectj.version> <aspectj.version>1.9.7</aspectj.version>
<lombok.version>1.18.26</lombok.version> <lombok.version>1.18.26</lombok.version>
<springdoc.version>1.6.15</springdoc.version> <springdoc.version>1.6.15</springdoc.version>

View File

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

View File

@@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
/** /**
* 同 ${orion.version} 迭代时候需要手动更改 * 同 ${orion.version} 迭代时候需要手动更改
*/ */
String VERSION = "2.0.9"; String VERSION = "2.1.7";
/** /**
* 同 ${spring.application.name} * 同 ${spring.application.name}

View File

@@ -29,4 +29,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
String SYSTEM_USERNAME = "system"; String SYSTEM_USERNAME = "system";
int BATCH_COUNT = 500;
} }

View File

@@ -1,5 +1,8 @@
package com.orion.visor.framework.common.constant; package com.orion.visor.framework.common.constant;
import com.orion.lang.exception.ApplicationException;
import com.orion.lang.exception.argument.InvalidArgumentException;
/** /**
* 错误信息 * 错误信息
* *
@@ -61,6 +64,10 @@ public interface ErrorMessage {
String GROUP_ABSENT = "分组不存在"; String 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,20 +90,73 @@ 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 = "任务不存在";
String CONNECT_ERROR = "连接失败";
String AUTH_ERROR = "认证失败";
String SCRIPT_UPLOAD_ERROR = "脚本上传失败";
String EXEC_ERROR = "执行失败";
String ILLEGAL_STATUS = "当前状态不支持此操作"; String ILLEGAL_STATUS = "当前状态不支持此操作";
String CHECK_AUTHORIZED_HOST = "请选择已授权的主机"; String CHECK_AUTHORIZED_HOST = "请选择已授权的主机";
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 = "手动中断";
String UNABLE_DOWNLOAD_FOLDER = "无法下载文件夹";
/**
* 是否为业务异常
*
* @param ex ex
* @return biz exception
*/
static boolean isBizException(Exception ex) {
if (ex == null) {
return false;
}
return ex instanceof InvalidArgumentException
|| ex instanceof IllegalArgumentException
|| ex instanceof ApplicationException;
}
/**
* 获取错误信息
*
* @param ex ex
* @param defaultMsg defaultMsg
* @return message
*/
static String getErrorMessage(Exception ex, String defaultMsg) {
if (ex == null) {
return null;
}
String message = ex.getMessage();
if (message == null) {
return defaultMsg;
}
// 业务异常
if (isBizException(ex)) {
return message;
}
return defaultMsg;
}
} }

View File

@@ -21,6 +21,8 @@ public interface ExtraFieldConst extends FieldConst {
String USERNAME = "username"; String USERNAME = "username";
String HOME = "home";
String STATUS_NAME = "statusName"; String STATUS_NAME = "statusName";
String KEY_NAME = "keyName"; String KEY_NAME = "keyName";
@@ -43,4 +45,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,26 @@
package com.orion.visor.framework.common.entity;
/**
* 数据清理请求 定义
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/8/29 11:26
*/
public interface DataClearRequest {
/**
* 获取清理数量限制
*
* @return 清理限制
*/
Integer getLimit();
/**
* 设置清理数量限制
*
* @param limit limit
*/
void setLimit(Integer limit);
}

View File

@@ -1,10 +1,12 @@
package com.orion.visor.framework.common.entity; package com.orion.visor.framework.common.entity;
import com.orion.lang.define.wrapper.IPageRequest;
import com.orion.visor.framework.common.validator.group.Page; import com.orion.visor.framework.common.validator.group.Page;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* 公共页码请求 * 公共页码请求
@@ -15,14 +17,18 @@ import org.hibernate.validator.constraints.Range;
*/ */
@Data @Data
@Schema(description = "公共页码请求") @Schema(description = "公共页码请求")
public class PageRequest implements IPageRequest { public class PageRequest {
@Range(min = 1, max = 10000, groups = Page.class) @NotNull(groups = Page.class)
@Min(value = 1, groups = Page.class)
@Max(value = 10000, groups = Page.class)
@Schema(description = "页码") @Schema(description = "页码")
private int page; private Integer page;
@Range(min = 1, max = 100, groups = Page.class) @NotNull(groups = Page.class)
@Min(value = 1, groups = Page.class)
@Max(value = 200, groups = Page.class)
@Schema(description = "大小") @Schema(description = "大小")
private int limit; private Integer limit;
} }

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

@@ -1,6 +1,8 @@
package com.orion.visor.framework.common.meta; package com.orion.visor.framework.common.meta;
import com.alibaba.ttl.TransmittableThreadLocal; import com.alibaba.ttl.TransmittableThreadLocal;
import com.orion.lang.id.UUIds;
import org.slf4j.MDC;
/** /**
* traceId 持有者 * traceId 持有者
@@ -23,16 +25,74 @@ public class TraceIdHolder {
*/ */
private static final ThreadLocal<String> HOLDER = new TransmittableThreadLocal<>(); private static final ThreadLocal<String> HOLDER = new TransmittableThreadLocal<>();
/**
* 获取 traceId
*
* @return traceId
*/
public static String get() { public static String get() {
return HOLDER.get(); return HOLDER.get();
} }
public static void set(String traceId) { /**
HOLDER.set(traceId); * 设置 traceId
*/
public static void set() {
set(createTraceId());
} }
/**
* 设置 traceId
*
* @param traceId traceId
*/
public static void set(String traceId) {
// 设置应用上下文
HOLDER.set(traceId);
// 设置日志上下文
setMdc(traceId);
}
/**
* 删除 traceId
*/
public static void remove() { public static void remove() {
// 移除应用上下文
HOLDER.remove(); HOLDER.remove();
// 移除日志上下文
removeMdc();
}
/**
* 从应用上下文 设置到日志上下文
*/
public static void setMdc() {
setMdc(HOLDER.get());
}
/**
* 设置到日志上下文
*
* @param traceId traceId
*/
public static void setMdc(String traceId) {
MDC.put(TRACE_ID_MDC, traceId);
}
/**
* 移除日志上下文
*/
public static void removeMdc() {
MDC.remove(TRACE_ID_MDC);
}
/**
* 创建 traceId
*
* @return traceId
*/
public static String createTraceId() {
return UUIds.random32();
} }
} }

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) {
// 获取实际地址 X_REAL_IP 在多代理情况下会有问题
// String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
// if (!Strings.isBlank(realIp)) {
// return realIp;
// }
// 获取请求地址
return Servlets.getRemoteAddr(request);
}
/** /**
* 获取 ip 位置 * 获取 ip 位置
* *

View File

@@ -1,38 +0,0 @@
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

@@ -1,6 +1,8 @@
package com.orion.visor.framework.common.utils; package com.orion.visor.framework.common.utils;
import com.orion.lang.utils.Objects1; import com.orion.lang.utils.Objects1;
import com.orion.lang.utils.Systems;
import com.orion.lang.utils.io.Files1;
import com.orion.visor.framework.common.constant.AppConst; import com.orion.visor.framework.common.constant.AppConst;
import com.orion.visor.framework.common.constant.Const; import com.orion.visor.framework.common.constant.Const;
@@ -24,9 +26,25 @@ public class PathUtils {
* @return 用户目录 * @return 用户目录
*/ */
public static String getHomePath(boolean isWindows, String username) { public static String getHomePath(boolean isWindows, String username) {
return getHomePath(isWindows, username, false);
}
/**
* 获取用户根目录
*
* @param isWindows isWindows
* @param username 用户名
* @param prependSeparator 是否在头部添加分隔符
* @return 用户目录
*/
public static String getHomePath(boolean isWindows, String username, boolean prependSeparator) {
if (isWindows) { if (isWindows) {
// windows // windows
return "C:/Users/" + username; if (prependSeparator) {
return "/C:/Users/" + username;
} else {
return "C:/Users/" + username;
}
} else { } else {
// linux // linux
if (Const.ROOT.equals(username)) { if (Const.ROOT.equals(username)) {
@@ -66,4 +84,34 @@ public class PathUtils {
return path.toString(); return path.toString();
} }
/**
* 头部添加分隔符
*
* @param path path
* @return path
*/
public static String prependSeparator(String path) {
if (path.startsWith("/")) {
return path;
}
return "/" + path;
}
/**
* 获取 orion path
*
* @param path path
* @return path
*/
public static String getOrionPath(String path) {
path = Systems.HOME_DIR
+ Files1.SEPARATOR
+ AppConst.ORION
+ Files1.SEPARATOR
+ AppConst.APP_NAME
+ Files1.SEPARATOR
+ path;
return Files1.getPath(path);
}
} }

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

@@ -0,0 +1,38 @@
package com.orion.visor.framework.common.utils;
import com.orion.visor.framework.common.constant.Const;
/**
* sql 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/8/26 16:03
*/
public class SqlUtils {
private SqlUtils() {
}
/**
* limit n
*
* @param limit limit
* @return limit
*/
public static String limit(Number limit) {
return Const.LIMIT + Const.SPACE + limit;
}
/**
* limit offset limit
*
* @param offset offset
* @param limit limit
* @return limit
*/
public static String limit(Number offset, Number limit) {
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
}
}

View File

@@ -9,6 +9,7 @@ import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import javax.validation.Validator; import javax.validation.Validator;
import java.util.Collection; import java.util.Collection;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
@@ -31,6 +32,10 @@ public class Valid extends com.orion.lang.utils.Valid {
return notBlank(s, ErrorMessage.PARAM_MISSING); return notBlank(s, ErrorMessage.PARAM_MISSING);
} }
public static <T extends Map<?, ?>> T notEmpty(T map) {
return notEmpty(map, ErrorMessage.PARAM_MISSING);
}
public static <T extends Collection<?>> T notEmpty(T object) { public static <T extends Collection<?>> T notEmpty(T object) {
return notEmpty(object, ErrorMessage.PARAM_MISSING); return notEmpty(object, ErrorMessage.PARAM_MISSING);
} }

View File

@@ -1,7 +1,5 @@
package com.orion.visor.framework.common.validator.group; package com.orion.visor.framework.common.validator.group;
import javax.validation.groups.Default;
/** /**
* 批量验证分组 * 批量验证分组
* *
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
* @version 1.0.0 * @version 1.0.0
* @since 2023/9/1 19:13 * @since 2023/9/1 19:13
*/ */
public interface Batch extends Default { public interface Batch {
} }

View File

@@ -0,0 +1,11 @@
package com.orion.visor.framework.common.validator.group;
/**
* 清理验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Clear {
}

View File

@@ -0,0 +1,11 @@
package com.orion.visor.framework.common.validator.group;
/**
* 导出验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Export {
}

View File

@@ -1,7 +1,5 @@
package com.orion.visor.framework.common.validator.group; package com.orion.visor.framework.common.validator.group;
import javax.validation.groups.Default;
/** /**
* 分页验证分组 * 分页验证分组
* *
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
* @version 1.0.0 * @version 1.0.0
* @since 2023/9/1 19:13 * @since 2023/9/1 19:13
*/ */
public interface Id extends Default { public interface Id {
} }

View File

@@ -0,0 +1,11 @@
package com.orion.visor.framework.common.validator.group;
/**
* 导出验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Import {
}

View File

@@ -1,7 +1,5 @@
package com.orion.visor.framework.common.validator.group; package com.orion.visor.framework.common.validator.group;
import javax.validation.groups.Default;
/** /**
* 分页验证分组 * 分页验证分组
* *
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
* @version 1.0.0 * @version 1.0.0
* @since 2023/9/1 19:13 * @since 2023/9/1 19:13
*/ */
public interface Page extends Default { public interface Page {
} }

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

@@ -7,9 +7,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder; import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
import javax.sql.DataSource;
/** /**
* quartz 配置 * quartz 配置
@@ -22,27 +19,6 @@ import javax.sql.DataSource;
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_JOB_QUARTZ) @AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_JOB_QUARTZ)
public class OrionQuartzAutoConfiguration { public class OrionQuartzAutoConfiguration {
/**
* @return 任务工厂
*/
@Bean
public SpringBeanJobFactory jobFactory() {
return new SpringBeanJobFactory();
}
/**
* @param dataSource dataSource
* @param jobFactory jobFactory
* @return 调度器工厂
*/
@Bean
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource, SpringBeanJobFactory jobFactory) {
SchedulerFactoryBean factory = new SchedulerFactoryBean();
factory.setDataSource(dataSource);
factory.setJobFactory(jobFactory);
return factory;
}
/** /**
* @param schedulerFactoryBean 调度器工厂 * @param schedulerFactoryBean 调度器工厂
* @return 调度器 * @return 调度器

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

@@ -6,6 +6,9 @@ import java.lang.annotation.*;
/** /**
* 不执行统一日志打印 * 不执行统一日志打印
* <p>
* 如果设置在方法上,则忽略该方法的日志打印
* 如果设置到参数上,则忽略该参数的日志打印
* *
* @author Jiahang Li * @author Jiahang Li
* @version 1.0.0 * @version 1.0.0

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())) {

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) -> {

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

@@ -3,6 +3,7 @@ package com.orion.visor.framework.mybatis.core.generator.core;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.generator.config.po.TableField; import com.baomidou.mybatisplus.generator.config.po.TableField;
import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.orion.lang.utils.Exceptions;
import com.orion.lang.utils.Strings; 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.visor.framework.common.constant.FieldConst; import com.orion.visor.framework.common.constant.FieldConst;
@@ -47,7 +48,7 @@ public class DictParser {
.stream() .stream()
.filter(s -> variable.equals(s.getName()) || variable.equals(s.getPropertyName())) .filter(s -> variable.equals(s.getName()) || variable.equals(s.getPropertyName()))
.findFirst() .findFirst()
.orElseThrow(() -> new RuntimeException("未查询到字典映射字段 " + variable)); .orElseThrow(() -> Exceptions.runtime("未查询到字典映射字段 " + variable));
// 设置字段名称 // 设置字段名称
if (meta.getField() == null) { if (meta.getField() == null) {
meta.setField(Strings.firstUpper(tableField.getPropertyName())); meta.setField(Strings.firstUpper(tableField.getPropertyName()));

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

@@ -3,6 +3,7 @@ package com.orion.visor.framework.mybatis.core.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.orion.visor.framework.common.constant.Const;
import com.orion.visor.framework.mybatis.core.query.Conditions; import com.orion.visor.framework.mybatis.core.query.Conditions;
import com.orion.visor.framework.mybatis.core.query.DataQuery; import com.orion.visor.framework.mybatis.core.query.DataQuery;
@@ -61,7 +62,7 @@ public interface IMapper<T> extends BaseMapper<T> {
* @return 是否成功 * @return 是否成功
*/ */
default boolean insertBatch(Collection<T> entities) { default boolean insertBatch(Collection<T> entities) {
return Db.saveBatch(entities); return this.insertBatch(entities, Const.BATCH_COUNT);
} }
/** /**
@@ -82,7 +83,7 @@ public interface IMapper<T> extends BaseMapper<T> {
* @return 是否成功 * @return 是否成功
*/ */
default boolean updateBatch(Collection<T> entities) { default boolean updateBatch(Collection<T> entities) {
return Db.updateBatchById(entities); return this.updateBatch(entities, Const.BATCH_COUNT);
} }
/** /**
@@ -113,7 +114,7 @@ public interface IMapper<T> extends BaseMapper<T> {
* @return 是否成功 * @return 是否成功
*/ */
default boolean insertOrUpdateBatch(Collection<T> entities) { default boolean insertOrUpdateBatch(Collection<T> entities) {
return Db.saveOrUpdateBatch(entities); return this.insertOrUpdateBatch(entities, Const.BATCH_COUNT);
} }
/** /**

View File

@@ -16,6 +16,7 @@ import com.orion.lang.utils.collect.Lists;
import com.orion.lang.utils.reflect.Classes; import com.orion.lang.utils.reflect.Classes;
import com.orion.spring.SpringHolder; import com.orion.spring.SpringHolder;
import com.orion.visor.framework.common.constant.Const; import com.orion.visor.framework.common.constant.Const;
import com.orion.visor.framework.common.utils.SqlUtils;
import com.orion.visor.framework.mybatis.core.domain.BaseDO; import com.orion.visor.framework.mybatis.core.domain.BaseDO;
import java.io.Serializable; import java.io.Serializable;
@@ -36,7 +37,7 @@ public class DataQuery<T> {
private final BaseMapper<T> dao; private final BaseMapper<T> dao;
private IPageRequest page; private PageRequest page;
private Wrapper<T> wrapper; private Wrapper<T> wrapper;
@@ -73,8 +74,9 @@ public class DataQuery<T> {
return new DataQuery<>(dao, wrapper); return new DataQuery<>(dao, wrapper);
} }
public DataQuery<T> page(IPageRequest page) { public DataQuery<T> page(com.orion.visor.framework.common.entity.PageRequest page) {
this.page = Valid.notNull(page, "page is null"); com.orion.visor.framework.common.entity.PageRequest pr = Valid.notNull(page, "page is null");
this.page = new PageRequest(pr.getPage(), pr.getLimit());
return this; return this;
} }
@@ -111,11 +113,11 @@ public class DataQuery<T> {
} }
public DataQuery<T> limit(int limit) { public DataQuery<T> limit(int limit) {
return this.last(Const.LIMIT + Const.SPACE + limit); return this.last(SqlUtils.limit(limit));
} }
public DataQuery<T> limit(int offset, int limit) { public DataQuery<T> limit(int offset, int limit) {
return this.last(Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit); return this.last(SqlUtils.limit(offset, limit));
} }
public DataQuery<T> only() { public DataQuery<T> only() {
@@ -199,6 +201,18 @@ public class DataQuery<T> {
return dao.selectCount(wrapper); return dao.selectCount(wrapper);
} }
public Long countMax(Number max) {
Long count = dao.selectCount(wrapper);
if (max == null) {
return count;
}
long maxValue = max.longValue();
if (maxValue <= 0L) {
return count;
}
return Math.min(count, maxValue);
}
public boolean absent() { public boolean absent() {
return dao.selectCount(wrapper) == 0; return dao.selectCount(wrapper) == 0;
} }
@@ -210,14 +224,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

@@ -60,6 +60,18 @@ Authorization: {{token}}
} }
${httpComment} ${apiComment.queryCount}
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/count
Content-Type: application/json
Authorization: {{token}}
{
#foreach($field in ${table.fields})
"${field.propertyName}": ""#if($foreach.hasNext),#end
#end
}
${httpComment} ${apiComment.deleteById} ${httpComment} ${apiComment.deleteById}
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete?id=1 DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete?id=1
Authorization: {{token}} Authorization: {{token}}

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
@@ -114,6 +113,13 @@ public class ${table.controllerName} {
return ${typeLower}Service.get${type}Page(request); return ${typeLower}Service.get${type}Page(request);
} }
@PostMapping("/count")
@Operation(summary = "${apiComment.queryCount}")
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
public Long get${type}Count(@Validated @RequestBody ${type}QueryRequest request) {
return ${typeLower}Service.get${type}Count(request);
}
#if($meta.enableDemoApi) #if($meta.enableDemoApi)
@DemoDisableApi @DemoDisableApi
#end #end

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

@@ -122,7 +122,8 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
@Override @Override
public List<${type}VO> get${type}List(${type}QueryRequest request) { public List<${type}VO> get${type}List(${type}QueryRequest request) {
// 条件 // 条件
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request); LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
.orderByDesc(${type}DO::getId);
// 查询 // 查询
return ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::to); return ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::to);
} }
@@ -148,24 +149,28 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
.sorted(Comparator.comparing(${type}VO::getId).reversed()) .sorted(Comparator.comparing(${type}VO::getId).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
#end #end
@Override
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
// 条件
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
.orderByDesc(${type}DO::getId);
// 查询
return ${typeLower}DAO.of()
.page(request)
.wrapper(wrapper)
.dataGrid(${type}Convert.MAPPER::to);
}
@Override @Override
public Long get${type}Count(${type}QueryRequest request) { public Long get${type}Count(${type}QueryRequest request) {
// 条件 // 条件
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request); LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
// 查询 // 查询
return ${typeLower}DAO.selectCount(wrapper); return ${typeLower}DAO.of()
} .wrapper(wrapper)
.countMax(request.getLimit());
@Override
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
// 条件
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
// 查询
return ${typeLower}DAO.of(wrapper)
.page(request)
.dataGrid(${type}Convert.MAPPER::to);
} }
@Override @Override
@@ -235,13 +240,8 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
Valid.isFalse(present, ErrorMessage.DATA_PRESENT); Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
} }
/** @Override
* 构建查询 wrapper public LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
*
* @param request request
* @return wrapper
*/
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
String searchValue = request.getSearchValue(); String searchValue = request.getSearchValue();
return ${typeLower}DAO.wrapper() return ${typeLower}DAO.wrapper()
#foreach($field in ${table.fields}) #foreach($field in ${table.fields})
@@ -251,8 +251,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
#foreach($field in ${table.fields}) #foreach($field in ${table.fields})
.eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end .eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end
#end #end
) );
.orderByDesc(${type}DO::getId);
} }
} }

View File

@@ -1,5 +1,6 @@
package ${package.Service}; package ${package.Service};
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.orion.lang.define.wrapper.DataGrid; import com.orion.lang.define.wrapper.DataGrid;
#foreach($pkg in ${customModuleFilePackages}) #foreach($pkg in ${customModuleFilePackages})
import ${pkg}.*; import ${pkg}.*;
@@ -116,4 +117,12 @@ public interface ${table.serviceName} {
*/ */
Integer delete${type}(${type}QueryRequest request); Integer delete${type}(${type}QueryRequest request);
/**
* 构建查询 wrapper
*
* @param request request
* @return wrapper
*/
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request);
} }

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

@@ -115,6 +115,13 @@ export function get${vue.featureEntity}Page(request: ${vue.featureEntity}QueryRe
return axios.post<DataGrid<${vue.featureEntity}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request); return axios.post<DataGrid<${vue.featureEntity}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request);
} }
/**
* $apiComment.queryCount
*/
export function get${vue.featureEntity}Count(request: ${vue.featureEntity}QueryRequest) {
return axios.post<number>('/${package.ModuleName}/${typeHyphen}/count', request);
}
/** /**
* $apiComment.deleteById * $apiComment.deleteById
*/ */

View File

@@ -1,9 +1,9 @@
<template> <template>
<card-list v-model:searchValue="formModel.searchValue" <card-list v-model:searchValue="formModel.searchValue"
search-input-placeholder="输入搜索值" search-input-placeholder="输入搜索值"
create-card-position="head" :create-card-position="false"
: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"
@@ -68,21 +68,22 @@
<template #extra="{ record }"> <template #extra="{ record }">
<a-space> <a-space>
<!-- 更多操作 --> <!-- 更多操作 -->
<a-dropdown trigger="hover"> <a-dropdown trigger="hover" :popup-max-height="false">
<icon-more class="card-extra-icon" /> <icon-more class="card-extra-icon" />
<template #content> <template #content>
<!-- 修改 --> <!-- 修改 -->
<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

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

@@ -98,6 +98,13 @@ public class SecurityUtils {
return loginUser != null ? loginUser.getTimestamp() : null; return loginUser != null ? loginUser.getTimestamp() : null;
} }
/**
* 清空用户上下文
*/
public static void clearAuthentication() {
SecurityContextHolder.getContext().setAuthentication(null);
}
/** /**
* 设置当前用户 * 设置当前用户
* *
@@ -107,7 +114,9 @@ public class SecurityUtils {
public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) { public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) {
// 创建 authentication // 创建 authentication
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginUser, null, Collections.emptyList()); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginUser, null, Collections.emptyList());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); if (request != null) {
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
}
// 设置上下文 // 设置上下文
SecurityContextHolder.getContext().setAuthentication(authentication); SecurityContextHolder.getContext().setAuthentication(authentication);
} }

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

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

@@ -1,8 +1,6 @@
package com.orion.visor.framework.web.core.filter; package com.orion.visor.framework.web.core.filter;
import com.orion.lang.id.UUIds;
import com.orion.visor.framework.common.meta.TraceIdHolder; import com.orion.visor.framework.common.meta.TraceIdHolder;
import org.slf4j.MDC;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
@@ -23,21 +21,17 @@ public class TraceIdFilter extends OncePerRequestFilter {
@Override @Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
try { try {
// 获 traceId // 获 traceId
String traceId = UUIds.random32(); String traceId = TraceIdHolder.createTraceId();
// 设置应用上下文 // 设置 traceId 上下文
TraceIdHolder.set(traceId); TraceIdHolder.set(traceId);
// 设置日志上下文
MDC.put(TraceIdHolder.TRACE_ID_MDC, traceId);
// 设置响应头 // 设置响应头
response.setHeader(TraceIdHolder.TRACE_ID_HEADER, traceId); response.setHeader(TraceIdHolder.TRACE_ID_HEADER, traceId);
// 执行请求 // 执行请求
filterChain.doFilter(request, response); filterChain.doFilter(request, response);
} finally { } finally {
// 清理应用上下文 // 清空 traceId 上下文
TraceIdHolder.remove(); TraceIdHolder.remove();
// 清理日志上下文
MDC.clear();
} }
} }

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

@@ -33,5 +33,5 @@ management:
mybatis-plus: mybatis-plus:
configuration: configuration:
# 日志打印 # sql 日志打印
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

View File

@@ -82,13 +82,13 @@ spring:
instanceName: quartzScheduler instanceName: quartzScheduler
jobStore: jobStore:
# 持久化配置 # 持久化配置
class: org.quartz.impl.jdbcjobstore.JobStoreTX class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
useProperties: false useProperties: false
tablePrefix: QRTZ_ tablePrefix: QRTZ_
misfireThreshold: 60000 misfireThreshold: 60000
clusterCheckinInterval: 5000 clusterCheckinInterval: 5000
isClustered: true isClustered: false
# 连接池 # 连接池
threadPool: threadPool:
class: org.quartz.simpl.SimpleThreadPool class: org.quartz.simpl.SimpleThreadPool
@@ -167,6 +167,8 @@ app:
allow-refresh: true allow-refresh: true
# 凭证续签最大次数 # 凭证续签最大次数
max-refresh-count: 3 max-refresh-count: 3
# 登录失败发送站内信阈值
login-failed-send-threshold: 3
# 登录失败锁定次数 # 登录失败锁定次数
login-failed-lock-count: 5 login-failed-lock-count: 5
# 登录失败锁定时间 (分) # 登录失败锁定时间 (分)
@@ -189,10 +191,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:

View File

@@ -5,6 +5,7 @@ import com.orion.visor.module.asset.handler.host.terminal.TerminalMessageDispatc
import com.orion.visor.module.asset.handler.host.transfer.TransferMessageDispatcher; import com.orion.visor.module.asset.handler.host.transfer.TransferMessageDispatcher;
import com.orion.visor.module.asset.interceptor.ExecLogTailInterceptor; import com.orion.visor.module.asset.interceptor.ExecLogTailInterceptor;
import com.orion.visor.module.asset.interceptor.TerminalAccessInterceptor; import com.orion.visor.module.asset.interceptor.TerminalAccessInterceptor;
import com.orion.visor.module.asset.interceptor.TerminalTransferInterceptor;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
@@ -28,6 +29,9 @@ public class AssetWebSocketConfiguration implements WebSocketConfigurer {
@Resource @Resource
private TerminalAccessInterceptor terminalAccessInterceptor; private TerminalAccessInterceptor terminalAccessInterceptor;
@Resource
private TerminalTransferInterceptor terminalTransferInterceptor;
@Resource @Resource
private ExecLogTailInterceptor execLogTailInterceptor; private ExecLogTailInterceptor execLogTailInterceptor;
@@ -42,13 +46,13 @@ public class AssetWebSocketConfiguration implements WebSocketConfigurer {
@Override @Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 终端 // 终端会话
registry.addHandler(terminalMessageDispatcher, prefix + "/host/terminal/{accessToken}") registry.addHandler(terminalMessageDispatcher, prefix + "/host/terminal/{accessToken}")
.addInterceptors(terminalAccessInterceptor) .addInterceptors(terminalAccessInterceptor)
.setAllowedOrigins("*"); .setAllowedOrigins("*");
// 文件传输 // 文件传输
registry.addHandler(transferMessageDispatcher, prefix + "/host/transfer/{accessToken}") registry.addHandler(transferMessageDispatcher, prefix + "/host/transfer/{transferToken}")
.addInterceptors(terminalAccessInterceptor) .addInterceptors(terminalTransferInterceptor)
.setAllowedOrigins("*"); .setAllowedOrigins("*");
// 执行日志 // 执行日志
registry.addHandler(execLogTailHandler, prefix + "/exec/log/{token}") registry.addHandler(execLogTailHandler, prefix + "/exec/log/{token}")

View File

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

View File

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

View File

@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog; import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.visor.framework.log.core.annotation.IgnoreLog; import com.orion.visor.framework.log.core.annotation.IgnoreLog;
import com.orion.visor.framework.log.core.enums.IgnoreLogMode; 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.framework.web.core.annotation.RestWrapper;
import com.orion.visor.module.asset.define.operator.HostGroupOperatorType; import com.orion.visor.module.asset.define.operator.HostGroupOperatorType;
import com.orion.visor.module.asset.define.operator.HostIdentityOperatorType; import com.orion.visor.module.asset.define.operator.HostIdentityOperatorType;
@@ -43,6 +44,7 @@ public class AssetDataGrantServiceController {
@Resource @Resource
private AssetAuthorizedDataService assetAuthorizedDataService; private AssetAuthorizedDataService assetAuthorizedDataService;
@DemoDisableApi
@OperatorLog(HostGroupOperatorType.GRANT) @OperatorLog(HostGroupOperatorType.GRANT)
@PutMapping("/grant-host-group") @PutMapping("/grant-host-group")
@Operation(summary = "主机分组授权") @Operation(summary = "主机分组授权")
@@ -60,6 +62,7 @@ public class AssetDataGrantServiceController {
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_GROUP, request); return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_GROUP, request);
} }
@DemoDisableApi
@OperatorLog(HostKeyOperatorType.GRANT) @OperatorLog(HostKeyOperatorType.GRANT)
@PutMapping("/grant-host-key") @PutMapping("/grant-host-key")
@Operation(summary = "主机密钥授权") @Operation(summary = "主机密钥授权")
@@ -77,6 +80,7 @@ public class AssetDataGrantServiceController {
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_KEY, request); return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_KEY, request);
} }
@DemoDisableApi
@OperatorLog(HostIdentityOperatorType.GRANT) @OperatorLog(HostIdentityOperatorType.GRANT)
@PutMapping("/grant-host-identity") @PutMapping("/grant-host-identity")
@Operation(summary = "主机身份授权") @Operation(summary = "主机身份授权")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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