Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19c7e31f53 | ||
|
|
f618aef988 | ||
|
|
af97f752f5 | ||
|
|
bfb80afee2 | ||
|
|
72695af0f0 | ||
|
|
3a5b84eec4 | ||
|
|
387ed53328 | ||
|
|
c9cbc5fd55 | ||
|
|
ae03460a33 | ||
|
|
4b060a864a | ||
|
|
07e8e63ee6 | ||
|
|
ab1d4ed97f | ||
|
|
2bd7dfd5b8 | ||
|
|
c39049e5f5 | ||
|
|
5113aa63bd | ||
|
|
518fd8c839 | ||
|
|
a046faaa07 | ||
|
|
dcf25392ff | ||
|
|
7f24948efa | ||
|
|
59d9739f36 | ||
|
|
26a6d08d96 | ||
|
|
cd59c51344 | ||
|
|
8dec98406d | ||
|
|
9386bfc5c1 | ||
|
|
370272ca43 | ||
|
|
5c6758c8e7 | ||
|
|
11606e25bb | ||
|
|
285f0532d3 | ||
|
|
7bfa8a73be |
45
README.md
45
README.md
@@ -13,27 +13,27 @@
|
|||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://github.com/lijiahangmax/orion-visor/releases">
|
href="https://github.com/dromara/orion-visor/releases">
|
||||||
<img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" />
|
<img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://gitee.com/lijiahangmax/orion-visor/stargazers">
|
href="https://gitee.com/dromara/orion-visor/stargazers">
|
||||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://gitee.com/lijiahangmax/orion-visor/members">
|
href="https://gitee.com/dromara/orion-visor/members">
|
||||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://github.com/lijiahangmax/orion-visor">
|
href="https://github.com/dromara/orion-visor">
|
||||||
<img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" />
|
<img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" />
|
||||||
</a>
|
</a>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
style="text-decoration: none !important;"
|
style="text-decoration: none !important;"
|
||||||
href="https://github.com/lijiahangmax/orion-visor">
|
href="https://github.com/dromara/orion-visor">
|
||||||
<img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" />
|
<img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -51,31 +51,32 @@
|
|||||||
|
|
||||||
## 演示环境
|
## 演示环境
|
||||||
|
|
||||||
演示地址: http://101.43.254.243:1081/
|
* 🔗 演示地址: http://101.43.254.243:1081/
|
||||||
演示账号: admin/admin
|
* 🔏 演示账号: admin/admin
|
||||||
|
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor)
|
||||||
⭐ 体验后可以点一下 `star` 这对我很重要!
|
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||||
🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||||
[github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor)
|
* 📛 演示环境请不要随便删除数据!
|
||||||
|
* 📧 如果演示环境不可用请联系我!
|
||||||
|
|
||||||
## 快速开始
|
## 快速开始
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# clone
|
# clone
|
||||||
git clone https://github.com/lijiahangmax/orion-visor
|
git clone https://github.com/dromara/orion-visor
|
||||||
cd orion-visor
|
cd orion-visor
|
||||||
# 启动
|
# 启动
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
# 等待后端服务启动后 (2min±) 访问 http://localhost:1081/
|
||||||
```
|
```
|
||||||
|
|
||||||
## 项目文档
|
## 项目文档
|
||||||
|
|
||||||
* [文档地址](https://lijiahangmax.github.io/orion-visor/#/)
|
* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/)
|
||||||
* [docker安装](https://lijiahangmax.github.io/orion-visor/#/quickstart/docker-install)
|
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html)
|
||||||
* [普通安装](https://lijiahangmax.github.io/orion-visor/#/quickstart/install)
|
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html)
|
||||||
* [更新日志](https://lijiahangmax.github.io/orion-visor/#/about/change-log)
|
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html)
|
||||||
* [操作手册](https://lijiahangmax.github.io/orion-visor/#/operator/asset)
|
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html)
|
||||||
* [常见问题](https://lijiahangmax.github.io/orion-visor/#/quickstart/faq)
|
|
||||||
|
|
||||||
## 技术栈
|
## 技术栈
|
||||||
|
|
||||||
@@ -130,8 +131,8 @@ docker compose up -d
|
|||||||
|
|
||||||
## 免责声明
|
## 免责声明
|
||||||
|
|
||||||
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/lijiahangmax/orion-visor/blob/main/DISCLAIMER.md)
|
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/dromara/orion-visor/blob/main/DISCLAIMER.md)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
本项目遵循 [Apache-2.0](https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE) 开源许可证。
|
本项目遵循 [Apache-2.0](https://github.com/dromara/orion-visor/blob/main/LICENSE) 开源许可证。
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version: '3.3'
|
version: '3.3'
|
||||||
services:
|
services:
|
||||||
orion-visor-service:
|
orion-visor-service:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.3
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.8
|
||||||
ports:
|
ports:
|
||||||
- 1081:80
|
- 1081:80
|
||||||
environment:
|
environment:
|
||||||
@@ -20,7 +20,7 @@ services:
|
|||||||
- orion-visor-mysql
|
- orion-visor-mysql
|
||||||
- orion-visor-redis
|
- orion-visor-redis
|
||||||
orion-visor-mysql:
|
orion-visor-mysql:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.3
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.8
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 3307:3306
|
- 3307:3306
|
||||||
@@ -34,7 +34,7 @@ services:
|
|||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
|
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
|
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
|
||||||
orion-visor-redis:
|
orion-visor-redis:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.3
|
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.8
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 6380:6379
|
- 6380:6379
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
docker compose down
|
docker compose down
|
||||||
sh ./pull.sh
|
|
||||||
# demo 启动
|
# demo 启动
|
||||||
if [ "$1" == "demo" ]; then
|
if [ "$1" == "demo" ]; then
|
||||||
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.3
|
version=2.0.8
|
||||||
cp -r ../../sql ./sql
|
cp -r ../../sql ./sql
|
||||||
docker build -t orion-visor-mysql:${version} .
|
docker build -t orion-visor-mysql:${version} .
|
||||||
rm -rf ./sql
|
rm -rf ./sql
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.3
|
version=2.0.8
|
||||||
docker build -t orion-visor-redis:${version} .
|
docker build -t orion-visor-redis:${version} .
|
||||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
version=2.0.3
|
version=2.0.8
|
||||||
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} .
|
||||||
|
|||||||
@@ -40,6 +40,12 @@
|
|||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
<p><b>⛔⛔此页面已不再维护, 请跳转至
|
||||||
|
<a target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor">这里</a>
|
||||||
|
查看最新文档 ❗</b></p>
|
||||||
|
|
||||||
|
------------------------------
|
||||||
|
|
||||||
**`orion-visor`** 提供一站式服务器运维解决方案。
|
**`orion-visor`** 提供一站式服务器运维解决方案。
|
||||||
|
|
||||||
* **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。
|
* **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。
|
||||||
@@ -70,9 +76,8 @@ docker compose up -d
|
|||||||
|
|
||||||
## 项目文档
|
## 项目文档
|
||||||
|
|
||||||
* [文档地址](https://lijiahangmax.github.io/orion-visor/#/)
|
* [文档地址](/)
|
||||||
* [docker安装](/quickstart/docker-install)
|
* [安装文档](/quickstart/docker-install)
|
||||||
* [普通安装](/quickstart/install)
|
|
||||||
* [更新日志](/about/change-log)
|
* [更新日志](/about/change-log)
|
||||||
* [操作手册](/operator/asset)
|
* [操作手册](/operator/asset)
|
||||||
* [常见问题](/quickstart/faq)
|
* [常见问题](/quickstart/faq)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# orion-visor <small>2.0.3</small>
|
# orion-visor
|
||||||
|
|
||||||
> 一款高颜值、现代化的智能运维&轻量堡垒机平台。
|
> 一款高颜值、现代化的智能运维&轻量堡垒机平台。
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
|
||||||
<description>项目所有依赖</description>
|
<description>项目所有依赖</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.0.3</revision>
|
<revision>2.0.8</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.revision>1.0.7</orion.kit.revision>
|
<orion.kit.version>1.0.7</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>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.lijiahangmax</groupId>
|
<groupId>io.github.lijiahangmax</groupId>
|
||||||
<artifactId>orion-all</artifactId>
|
<artifactId>orion-all</artifactId>
|
||||||
<version>${orion.kit.revision}</version>
|
<version>${orion.kit.version}</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>orion-log</artifactId>
|
<artifactId>orion-log</artifactId>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目公共基准包</description>
|
<description>项目公共基准包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.orion.visor.framework.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/6 15:26
|
||||||
|
*/
|
||||||
|
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Keep {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,14 +14,14 @@ public interface AppConst extends OrionConst {
|
|||||||
/**
|
/**
|
||||||
* 同 ${orion.version} 迭代时候需要手动更改
|
* 同 ${orion.version} 迭代时候需要手动更改
|
||||||
*/
|
*/
|
||||||
String VERSION = "2.0.3";
|
String VERSION = "2.0.8";
|
||||||
|
|
||||||
String ORION_VISOR = "orion-visor";
|
String ORION_VISOR = "orion-visor";
|
||||||
|
|
||||||
String GITHUB = "https://github.com/lijiahangmax/orion-visor";
|
String GITHUB = "https://github.com/dromara/orion-visor";
|
||||||
|
|
||||||
String GITEE = "https://gitee.com/lijiahangmax/orion-visor";
|
String GITEE = "https://gitee.com/dromara/orion-visor";
|
||||||
|
|
||||||
String ISSUES = "https://github.com/lijiahangmax/orion-visor/issues";
|
String ISSUES = "https://github.com/dromara/orion-visor/issues";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
|
|||||||
|
|
||||||
Integer DEFAULT_SORT = 10;
|
Integer DEFAULT_SORT = 10;
|
||||||
|
|
||||||
int LOGIN_HISTORY_COUNT = 30;
|
|
||||||
|
|
||||||
Long NONE_ID = -1L;
|
Long NONE_ID = -1L;
|
||||||
|
|
||||||
Integer DEFAULT_VERSION = 1;
|
Integer DEFAULT_VERSION = 1;
|
||||||
|
|||||||
@@ -97,4 +97,6 @@ public interface ErrorMessage {
|
|||||||
|
|
||||||
String PLEASE_CHECK_HOST_SSH = "请检查主机 {} 是否存在/权限/SSH配置";
|
String PLEASE_CHECK_HOST_SSH = "请检查主机 {} 是否存在/权限/SSH配置";
|
||||||
|
|
||||||
|
String CLIENT_ABORT = "手动中断";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,19 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum MovePosition {
|
public enum MovePosition {
|
||||||
|
|
||||||
// 拖拽到目标元素上
|
/**
|
||||||
|
* 拖拽到目标元素上
|
||||||
|
*/
|
||||||
TOP(-1),
|
TOP(-1),
|
||||||
|
|
||||||
// 拖拽到目标元素中
|
/**
|
||||||
|
* 拖拽到目标元素中
|
||||||
|
*/
|
||||||
IN(0),
|
IN(0),
|
||||||
|
|
||||||
// 拖拽到目标元素下
|
/**
|
||||||
|
* 拖拽到目标元素下
|
||||||
|
*/
|
||||||
BOTTOM(1),
|
BOTTOM(1),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.orion.visor.framework.common.handler.data;
|
package com.orion.visor.framework.common.handler.data;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.orion.spring.SpringHolder;
|
import com.orion.spring.SpringHolder;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准数据定义
|
* 标准数据定义
|
||||||
@@ -12,45 +11,50 @@ import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/12/21 0:07
|
* @since 2023/12/21 0:07
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public interface GenericsDataDefinition {
|
public interface GenericsDataDefinition {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取数据模型类型
|
|
||||||
*
|
|
||||||
* @return class
|
|
||||||
*/
|
|
||||||
Class<? extends GenericsDataModel> getModel();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据处理策略
|
* 获取数据处理策略
|
||||||
*
|
*
|
||||||
* @return class
|
* @return class
|
||||||
*/
|
*/
|
||||||
Class<? extends MapDataStrategy<? extends GenericsDataModel>> getStrategy();
|
Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> getStrategyClass();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据模型策略处理器
|
* 获取数据模型策略处理器
|
||||||
*
|
*
|
||||||
* @param <Model> Model
|
* @param <M> Model
|
||||||
* @param <Strategy> Strategy
|
* @param <S> Strategy
|
||||||
* @return StrategyBean
|
* @return Strategy Bean
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
default <M extends GenericsDataModel, S extends GenericsDataStrategy<M>> S getStrategy() {
|
||||||
default <Model extends GenericsDataModel, Strategy extends MapDataStrategy<Model>> Strategy getStrategyBean() {
|
return (S) SpringHolder.getBean(this.getStrategyClass());
|
||||||
return (Strategy) SpringHolder.getBean(this.getStrategy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 反序列化对象
|
* 反序列化对象
|
||||||
*
|
*
|
||||||
* @param json json
|
* @param serialModel serialModel
|
||||||
* @param <Model> Model
|
* @param <M> Model
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
default <M extends GenericsDataModel> M parse(String serialModel) {
|
||||||
default <Model extends GenericsDataModel> Model parse(String json) {
|
return (M) this.getStrategy().parse(serialModel);
|
||||||
return (Model) JSON.parseObject(json, this.getModel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转为视图对象
|
||||||
|
*
|
||||||
|
* @param serialModel serialModel
|
||||||
|
* @param <M> Model
|
||||||
|
* @return viewModel
|
||||||
|
*/
|
||||||
|
default <M extends GenericsDataModel> M toView(String serialModel) {
|
||||||
|
GenericsDataStrategy<GenericsDataModel> strategy = this.getStrategy();
|
||||||
|
GenericsDataModel model = strategy.parse(serialModel);
|
||||||
|
strategy.toView(model);
|
||||||
|
return (M) model;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.orion.visor.framework.common.handler.data.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准数据模型
|
* 标准数据模型
|
||||||
*
|
*
|
||||||
@@ -20,4 +22,14 @@ public interface GenericsDataModel {
|
|||||||
return JSON.toJSONString(this);
|
return JSON.toJSONString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转为 map
|
||||||
|
*
|
||||||
|
* @return map
|
||||||
|
*/
|
||||||
|
default Map<String, Object> toMap() {
|
||||||
|
return JSON.parseObject(this.serial());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.orion.visor.framework.common.handler.data.strategy;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准数据处理策略 基类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/11 21:44
|
||||||
|
*/
|
||||||
|
public abstract class AbstractGenericsDataStrategy<M extends GenericsDataModel> implements GenericsDataStrategy<M> {
|
||||||
|
|
||||||
|
protected final Class<M> modelClass;
|
||||||
|
|
||||||
|
public AbstractGenericsDataStrategy(Class<M> modelClass) {
|
||||||
|
this.modelClass = modelClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新填充
|
||||||
|
*
|
||||||
|
* @param beforeModel 修改前的配置
|
||||||
|
* @param afterModel 修改后的配置
|
||||||
|
*/
|
||||||
|
protected void updateFill(M beforeModel, M afterModel) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预校验参数
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
*/
|
||||||
|
protected void preValid(M model) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验参数
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
*/
|
||||||
|
protected void valid(M model) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doValid(M beforeModel, M afterModel) {
|
||||||
|
// 预校验参数
|
||||||
|
this.preValid(afterModel);
|
||||||
|
// 更新填充
|
||||||
|
this.updateFill(beforeModel, afterModel);
|
||||||
|
// 校验参数
|
||||||
|
this.valid(afterModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public M parse(String serialModel) {
|
||||||
|
return JSON.parseObject(serialModel, modelClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toView(M model) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,60 +9,38 @@ import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/12/20 22:09
|
* @since 2023/12/20 22:09
|
||||||
*/
|
*/
|
||||||
public interface GenericsDataStrategy<Model extends GenericsDataModel, View> {
|
public interface GenericsDataStrategy<M extends GenericsDataModel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取默认值
|
* 获取默认值
|
||||||
*
|
*
|
||||||
* @return 默认值
|
* @return 默认值
|
||||||
*/
|
*/
|
||||||
Model getDefault();
|
M getDefault();
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新填充
|
|
||||||
*
|
|
||||||
* @param beforeModel 修改前的配置
|
|
||||||
* @param afterModel 修改后的配置
|
|
||||||
*/
|
|
||||||
void updateFill(Model beforeModel, Model afterModel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预校验参数
|
|
||||||
*
|
|
||||||
* @param model model
|
|
||||||
*/
|
|
||||||
void preValid(Model model);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验参数
|
|
||||||
*
|
|
||||||
* @param model model
|
|
||||||
*/
|
|
||||||
void valid(Model model);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行完整验证链
|
* 执行完整验证链
|
||||||
* <p>
|
* <p>
|
||||||
* preValid > updateFill > preValid
|
* preValid > updateFill > valid
|
||||||
*
|
*
|
||||||
* @param beforeModel beforeModel
|
* @param beforeModel beforeModel
|
||||||
* @param afterModel afterModel
|
* @param afterModel afterModel
|
||||||
*/
|
*/
|
||||||
default void doValidChain(Model beforeModel, Model afterModel) {
|
void doValid(M beforeModel, M afterModel);
|
||||||
// 预校验参数
|
|
||||||
this.preValid(afterModel);
|
/**
|
||||||
// 更新填充
|
* 解析数据
|
||||||
this.updateFill(beforeModel, afterModel);
|
*
|
||||||
// 校验参数
|
* @param serialModel serialModel
|
||||||
this.valid(afterModel);
|
* @return model
|
||||||
}
|
*/
|
||||||
|
M parse(String serialModel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转为视图配置
|
* 转为视图配置
|
||||||
*
|
*
|
||||||
* @param model model
|
* @param model model
|
||||||
* @return 视图配置
|
|
||||||
*/
|
*/
|
||||||
View toView(String model);
|
void toView(M model);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.orion.visor.framework.common.handler.data.strategy;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* map 数据处理策略
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2023/12/20 22:11
|
|
||||||
*/
|
|
||||||
public interface MapDataStrategy<Model extends GenericsDataModel> extends GenericsDataStrategy<Model, Map<String, Object>> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default Map<String, Object> toView(String model) {
|
|
||||||
return JSONObject.parseObject(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 banner 打印包</description>
|
<description>项目 banner 打印包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -36,24 +36,47 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
|||||||
@Value("${management.endpoints.web.base-path:''}")
|
@Value("${management.endpoints.web.base-path:''}")
|
||||||
private String managementEndpoints;
|
private String managementEndpoints;
|
||||||
|
|
||||||
|
@Value("${springdoc.api-docs.enabled}")
|
||||||
|
private Boolean apiDocsEnabled;
|
||||||
|
|
||||||
|
@Value("${spring.datasource.druid.stat-view-servlet.enabled}")
|
||||||
|
private Boolean druidConsoleEnabled;
|
||||||
|
|
||||||
|
@Value("#{'${management.endpoints.web.exposure.include}' != 'shutdown'}")
|
||||||
|
private Boolean springBootActuatorEnabled;
|
||||||
|
|
||||||
|
@Value("${spring.boot.admin.client.enabled}")
|
||||||
|
private Boolean springBootAdminClientEnabled;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
String line = AnsiAppender.create()
|
AnsiAppender appender = AnsiAppender.create()
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n")
|
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n");
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
// swagger 地址
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n")
|
if (apiDocsEnabled) {
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n")
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n");
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ")
|
}
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n")
|
// druid 控制台
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ")
|
if (druidConsoleEnabled) {
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n")
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
|
||||||
.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ")
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n");
|
||||||
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"")
|
}
|
||||||
.toString();
|
// admin actuator 端点
|
||||||
|
if (springBootActuatorEnabled) {
|
||||||
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n");
|
||||||
|
}
|
||||||
|
// admin server 控制台
|
||||||
|
if (springBootAdminClientEnabled) {
|
||||||
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n");
|
||||||
|
}
|
||||||
|
appender.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ")
|
||||||
|
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"");
|
||||||
Threads.start(() -> {
|
Threads.start(() -> {
|
||||||
Threads.sleep(1000L);
|
Threads.sleep(1000L);
|
||||||
System.out.println(line);
|
System.out.println(appender);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ ${AnsiColor.BRIGHT_GREEN}:: Application Name ${AnsiColor.BLUE}${spring.appli
|
|||||||
${AnsiColor.BRIGHT_GREEN}:: Application Version ${AnsiColor.BLUE}${orion.version}
|
${AnsiColor.BRIGHT_GREEN}:: Application Version ${AnsiColor.BLUE}${orion.version}
|
||||||
${AnsiColor.BRIGHT_GREEN}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version}
|
${AnsiColor.BRIGHT_GREEN}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version}
|
||||||
${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active}
|
${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active}
|
||||||
|
${AnsiColor.BRIGHT_GREEN}:: Demo Mode ${AnsiColor.BLUE}${orion.demo}
|
||||||
${AnsiColor.DEFAULT}
|
${AnsiColor.DEFAULT}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目操作日志包</description>
|
<description>项目操作日志包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目数据源配置包</description>
|
<description>项目数据源配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目数据脱敏包</description>
|
<description>项目数据脱敏包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目定时任务配置包</description>
|
<description>项目定时任务配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目日志配置包</description>
|
<description>项目日志配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
|||||||
}
|
}
|
||||||
Method method = invocation.getMethod();
|
Method method = invocation.getMethod();
|
||||||
// 方法签名
|
// 方法签名
|
||||||
requestLog.append("\tmethodSign: ").append(method.getDeclaringClass().getName()).append('#')
|
// requestLog.append("\tmethodSign: ").append(method.getDeclaringClass().getName()).append('#')
|
||||||
.append(method.getName()).append("\n");
|
// .append(method.getName()).append("\n");
|
||||||
// 参数
|
// 方法参数
|
||||||
requestLog.append("\tparameter: ").append(this.requestToString(method, invocation.getArguments()));
|
requestLog.append("\tparameter: ").append(this.requestToString(method, invocation.getArguments()));
|
||||||
log.info(requestLog.toString());
|
log.info(requestLog.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
|||||||
}
|
}
|
||||||
Method method = invocation.getMethod();
|
Method method = invocation.getMethod();
|
||||||
// 方法签名
|
// 方法签名
|
||||||
fields.put(METHOD_SIGN, method.getDeclaringClass().getName() + "#" + method.getName());
|
// fields.put(METHOD_SIGN, method.getDeclaringClass().getName() + "#" + method.getName());
|
||||||
// 参数
|
// 方法参数
|
||||||
fields.put(PARAMETER, this.requestToString(method, invocation.getArguments()));
|
fields.put(PARAMETER, this.requestToString(method, invocation.getArguments()));
|
||||||
log.info("api请求-开始 {}", JSON.toJSONString(fields));
|
log.info("api请求-开始 {}", JSON.toJSONString(fields));
|
||||||
fields.clear();
|
fields.clear();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目监控配置包</description>
|
<description>项目监控配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 mybatis 配置包</description>
|
<description>项目 mybatis 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -62,10 +62,6 @@ public class CustomFileFilter {
|
|||||||
if (!table.isEnableCache()) {
|
if (!table.isEnableCache()) {
|
||||||
files.removeIf(file -> isServerCacheFile(file.getTemplatePath()));
|
files.removeIf(file -> isServerCacheFile(file.getTemplatePath()));
|
||||||
}
|
}
|
||||||
// 不生成导出文件
|
|
||||||
if (!table.isEnableExport()) {
|
|
||||||
files.removeIf(file -> isExportFile(file.getTemplatePath()));
|
|
||||||
}
|
|
||||||
// 不生成操作日志文件
|
// 不生成操作日志文件
|
||||||
if (!table.isEnableOperatorLog()) {
|
if (!table.isEnableOperatorLog()) {
|
||||||
files.removeIf(file -> isOperatorLogFile(file.getTemplatePath()));
|
files.removeIf(file -> isOperatorLogFile(file.getTemplatePath()));
|
||||||
|
|||||||
@@ -73,16 +73,6 @@ public class ServerTemplate extends Template {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 生成导出
|
|
||||||
// *
|
|
||||||
// * @return this
|
|
||||||
// */
|
|
||||||
// public ServerTemplate enableExport() {
|
|
||||||
// table.enableExport = true;
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不生成单元测试
|
* 不生成单元测试
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -43,11 +43,6 @@ public class Table {
|
|||||||
*/
|
*/
|
||||||
protected boolean enableUnitTest;
|
protected boolean enableUnitTest;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否生成导出
|
|
||||||
*/
|
|
||||||
protected boolean enableExport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否可缓存
|
* 是否可缓存
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class VueTemplate extends Template {
|
|||||||
public VueTemplate(Table table, String module, String feature) {
|
public VueTemplate(Table table, String module, String feature) {
|
||||||
super(table);
|
super(table);
|
||||||
table.enableVue = true;
|
table.enableVue = true;
|
||||||
|
table.enableRowSelection = true;
|
||||||
table.module = module;
|
table.module = module;
|
||||||
table.feature = feature;
|
table.feature = feature;
|
||||||
}
|
}
|
||||||
@@ -54,12 +55,12 @@ public class VueTemplate extends Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表可多选
|
* 关闭列表可多选
|
||||||
*
|
*
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public VueTemplate enableRowSelection() {
|
public VueTemplate disableRowSelection() {
|
||||||
table.enableRowSelection = true;
|
table.enableRowSelection = false;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,19 +68,5 @@ Authorization: {{token}}
|
|||||||
${httpComment} ${apiComment.batchDelete}
|
${httpComment} ${apiComment.batchDelete}
|
||||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/batch-delete?idList=1,2,3
|
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/batch-delete?idList=1,2,3
|
||||||
Authorization: {{token}}
|
Authorization: {{token}}
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
|
|
||||||
${httpComment} ${apiComment.export}
|
|
||||||
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/export
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: {{token}}
|
|
||||||
|
|
||||||
{
|
|
||||||
#foreach($field in ${table.fields})
|
|
||||||
"${field.propertyName}": ""#if($foreach.hasNext),#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
${httpComment}
|
${httpComment}
|
||||||
|
|||||||
@@ -141,19 +141,6 @@ public class ${table.controllerName} {
|
|||||||
public Integer batchDelete${type}(@RequestParam("idList") List<Long> idList) {
|
public Integer batchDelete${type}(@RequestParam("idList") List<Long> idList) {
|
||||||
return ${typeLower}Service.delete${type}ByIdList(idList);
|
return ${typeLower}Service.delete${type}ByIdList(idList);
|
||||||
}
|
}
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
#if($meta.enableOperatorLog)
|
|
||||||
@OperatorLog(${type}OperatorType.EXPORT)
|
|
||||||
#end
|
|
||||||
@PostMapping("/export")
|
|
||||||
@Operation(summary = "${apiComment.export}")
|
|
||||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:export')")
|
|
||||||
public void export${type}(@Validated @RequestBody ${type}QueryRequest request,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
${typeLower}Service.export${type}(request, response);
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ public interface ${type}Convert {
|
|||||||
${type}DO to(${type}QueryRequest request);
|
${type}DO to(${type}QueryRequest request);
|
||||||
|
|
||||||
${type}VO to(${type}DO domain);
|
${type}VO to(${type}DO domain);
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
${type}Export toExport(${type}DO domain);
|
|
||||||
#end
|
|
||||||
|
|
||||||
List<${type}VO> to(List<${type}DO> list);
|
List<${type}VO> to(List<${type}DO> list);
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ public class ${type}OperatorType extends InitializingOperatorTypes {
|
|||||||
public static final String UPDATE = "${typeHyphen}:update";
|
public static final String UPDATE = "${typeHyphen}:update";
|
||||||
|
|
||||||
public static final String DELETE = "${typeHyphen}:delete";
|
public static final String DELETE = "${typeHyphen}:delete";
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
public static final String EXPORT = "${typeHyphen}:export";
|
|
||||||
#end
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OperatorType[] types() {
|
public OperatorType[] types() {
|
||||||
@@ -32,9 +28,6 @@ public class ${type}OperatorType extends InitializingOperatorTypes {
|
|||||||
new OperatorType(L, CREATE, "创建$!{table.comment}"),
|
new OperatorType(L, CREATE, "创建$!{table.comment}"),
|
||||||
new OperatorType(M, UPDATE, "更新$!{table.comment}"),
|
new OperatorType(M, UPDATE, "更新$!{table.comment}"),
|
||||||
new OperatorType(H, DELETE, "删除$!{table.comment}"),
|
new OperatorType(H, DELETE, "删除$!{table.comment}"),
|
||||||
#if($meta.enableExport)
|
|
||||||
new OperatorType(M, EXPORT, "导出$!{table.comment}"),
|
|
||||||
#end
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.orion.lang.define.wrapper.DataGrid;
|
import com.orion.lang.define.wrapper.DataGrid;
|
||||||
import com.orion.lang.utils.Strings;
|
import com.orion.lang.utils.Strings;
|
||||||
import com.orion.lang.utils.collect.Lists;
|
import com.orion.lang.utils.collect.Lists;
|
||||||
#if($meta.enableExport)
|
|
||||||
import com.orion.office.excel.writer.exporting.ExcelExport;
|
|
||||||
#end
|
|
||||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||||
#if($meta.enableExport)
|
|
||||||
import com.orion.visor.framework.common.utils.FileNames;
|
|
||||||
#end
|
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
#if($meta.enableCache)
|
#if($meta.enableCache)
|
||||||
import com.orion.visor.framework.redis.core.utils.RedisMaps;
|
import com.orion.visor.framework.redis.core.utils.RedisMaps;
|
||||||
@@ -23,18 +17,11 @@ import ${pkg}.*;
|
|||||||
import ${package.Entity}.${entity};
|
import ${package.Entity}.${entity};
|
||||||
import ${package.Mapper}.${table.mapperName};
|
import ${package.Mapper}.${table.mapperName};
|
||||||
import ${package.Service}.${table.serviceName};
|
import ${package.Service}.${table.serviceName};
|
||||||
#if($meta.enableExport)
|
|
||||||
import com.orion.web.servlet.web.Servlets;
|
|
||||||
#end
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
#if($meta.enableExport)
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
#end
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -54,6 +41,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
private ${type}DAO ${typeLower}DAO;
|
private ${type}DAO ${typeLower}DAO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long create${type}(${type}CreateRequest request) {
|
public Long create${type}(${type}CreateRequest request) {
|
||||||
log.info("${type}Service-create${type} request: {}", JSON.toJSONString(request));
|
log.info("${type}Service-create${type} request: {}", JSON.toJSONString(request));
|
||||||
// 转换
|
// 转换
|
||||||
@@ -72,6 +60,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer update${type}ById(${type}UpdateRequest request) {
|
public Integer update${type}ById(${type}UpdateRequest request) {
|
||||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||||
log.info("${type}Service-update${type}ById id: {}, request: {}", id, JSON.toJSONString(request));
|
log.info("${type}Service-update${type}ById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||||
@@ -93,6 +82,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer update${type}(${type}QueryRequest query, ${type}UpdateRequest update) {
|
public Integer update${type}(${type}QueryRequest query, ${type}UpdateRequest update) {
|
||||||
log.info("${type}Service.update${type} query: {}, update: {}", JSON.toJSONString(query), JSON.toJSONString(update));
|
log.info("${type}Service.update${type} query: {}, update: {}", JSON.toJSONString(query), JSON.toJSONString(update));
|
||||||
// 条件
|
// 条件
|
||||||
@@ -179,6 +169,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer delete${type}ById(Long id) {
|
public Integer delete${type}ById(Long id) {
|
||||||
log.info("${type}Service-delete${type}ById id: {}", id);
|
log.info("${type}Service-delete${type}ById id: {}", id);
|
||||||
// 检查数据是否存在
|
// 检查数据是否存在
|
||||||
@@ -195,6 +186,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer delete${type}ByIdList(List<Long> idList) {
|
public Integer delete${type}ByIdList(List<Long> idList) {
|
||||||
log.info("${type}Service-delete${type}ByIdList idList: {}", idList);
|
log.info("${type}Service-delete${type}ByIdList idList: {}", idList);
|
||||||
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
||||||
@@ -207,6 +199,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer delete${type}(${type}QueryRequest request) {
|
public Integer delete${type}(${type}QueryRequest request) {
|
||||||
log.info("${type}Service.delete${type} request: {}", JSON.toJSONString(request));
|
log.info("${type}Service.delete${type} request: {}", JSON.toJSONString(request));
|
||||||
// 条件
|
// 条件
|
||||||
@@ -220,26 +213,6 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
|||||||
#end
|
#end
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void export${type}(${type}QueryRequest request, HttpServletResponse response) throws IOException {
|
|
||||||
log.info("${type}Service.export${type} request: {}", JSON.toJSONString(request));
|
|
||||||
// 条件
|
|
||||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
|
||||||
// 查询
|
|
||||||
List<${type}Export> rows = ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::toExport);
|
|
||||||
log.info("${type}Service.export${type} size: {}", rows.size());
|
|
||||||
// 导出
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
||||||
ExcelExport.create(${type}Export.class)
|
|
||||||
.addRows(rows)
|
|
||||||
.write(out)
|
|
||||||
.close();
|
|
||||||
// 传输
|
|
||||||
Servlets.transfer(response, out.toByteArray(), FileNames.exportName(${type}Export.TITLE));
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查对象是否存在
|
* 检查对象是否存在
|
||||||
|
|||||||
@@ -115,16 +115,5 @@ public interface ${table.serviceName} {
|
|||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
Integer delete${type}(${type}QueryRequest request);
|
Integer delete${type}(${type}QueryRequest request);
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${apiComment.export}
|
|
||||||
*
|
|
||||||
* @param request request
|
|
||||||
* @param response response
|
|
||||||
* @throws IOException IOException
|
|
||||||
*/
|
|
||||||
void export${type}(${type}QueryRequest request, HttpServletResponse response) throws IOException;
|
|
||||||
#end
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,7 @@ VALUES
|
|||||||
(@MODULE_KEY_ID, 'operatorLogModule', '${package.ModuleName}:${typeHyphen}', '$!{table.comment}', '{}', @MODULE_KEY_MAX_SORT + 10, now(), now(), '1', '1', 0),
|
(@MODULE_KEY_ID, 'operatorLogModule', '${package.ModuleName}:${typeHyphen}', '$!{table.comment}', '{}', @MODULE_KEY_MAX_SORT + 10, now(), now(), '1', '1', 0),
|
||||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:create', '创建$!{table.comment}', '{}', 10, now(), now(), '1', '1', 0),
|
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:create', '创建$!{table.comment}', '{}', 10, now(), now(), '1', '1', 0),
|
||||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:update', '更新$!{table.comment}', '{}', 20, now(), now(), '1', '1', 0),
|
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:update', '更新$!{table.comment}', '{}', 20, now(), now(), '1', '1', 0),
|
||||||
#if($meta.enableExport)
|
|
||||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), '1', '1', 0),
|
|
||||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:export', '导出$!{table.comment}', '{}', 40, now(), now(), '1', '1', 0);
|
|
||||||
#else
|
|
||||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), '1', '1', 0);
|
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), '1', '1', 0);
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
|
|||||||
@@ -133,12 +133,4 @@ export function batchDelete${vue.featureEntity}(idList: Array<number>) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#if($meta.enableExport)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* $apiComment.export
|
|
||||||
*/
|
|
||||||
export function export${vue.featureEntity}(request: ${vue.featureEntity}QueryRequest) {
|
|
||||||
return axios.post('/${package.ModuleName}/${typeHyphen}/export', request);
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|||||||
@@ -79,12 +79,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- table -->
|
<!-- table -->
|
||||||
|
#if($vue.enableRowSelection)
|
||||||
|
<a-table v-model:selected-keys="selectedKeys"
|
||||||
|
row-key="id"
|
||||||
|
#else
|
||||||
<a-table row-key="id"
|
<a-table row-key="id"
|
||||||
|
#end
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
#if($vue.enableRowSelection)
|
#if($vue.enableRowSelection)
|
||||||
v-model:selected-keys="selectedKeys"
|
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
#end
|
#end
|
||||||
:data="tableRenderData"
|
:data="tableRenderData"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const columns = [
|
|||||||
title: 'id',
|
title: 'id',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
slotName: 'id',
|
slotName: 'id',
|
||||||
width: 70,
|
width: 100,
|
||||||
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"){
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 redis 配置包</description>
|
<description>项目 redis 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.orion.visor.framework.redis.configuration.config.RedissonConfig;
|
|||||||
import com.orion.visor.framework.redis.core.lock.RedisLocker;
|
import com.orion.visor.framework.redis.core.lock.RedisLocker;
|
||||||
import com.orion.visor.framework.redis.core.utils.RedisUtils;
|
import com.orion.visor.framework.redis.core.utils.RedisUtils;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.redisson.config.SingleServerConfig;
|
||||||
import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer;
|
import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||||
@@ -14,6 +15,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
|||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
@@ -35,6 +37,7 @@ public class OrionRedisAutoConfiguration {
|
|||||||
* @param redisConnectionFactory factory
|
* @param redisConnectionFactory factory
|
||||||
* @return RedisTemplate
|
* @return RedisTemplate
|
||||||
*/
|
*/
|
||||||
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||||
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
||||||
@@ -58,6 +61,9 @@ public class OrionRedisAutoConfiguration {
|
|||||||
return config -> {
|
return config -> {
|
||||||
config.setThreads(redissonConfig.getThreads());
|
config.setThreads(redissonConfig.getThreads());
|
||||||
config.setNettyThreads(redissonConfig.getNettyThreads());
|
config.setNettyThreads(redissonConfig.getNettyThreads());
|
||||||
|
// 单机配置
|
||||||
|
SingleServerConfig single = config.useSingleServer();
|
||||||
|
single.setConnectionMinimumIdleSize(redissonConfig.getMinimumIdleSize());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,15 @@ public class RedissonConfig {
|
|||||||
*/
|
*/
|
||||||
private Integer nettyThreads;
|
private Integer nettyThreads;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小空闲连接数
|
||||||
|
*/
|
||||||
|
private Integer minimumIdleSize;
|
||||||
|
|
||||||
public RedissonConfig() {
|
public RedissonConfig() {
|
||||||
this.threads = 16;
|
this.threads = 16;
|
||||||
this.nettyThreads = 16;
|
this.nettyThreads = 16;
|
||||||
|
this.minimumIdleSize = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,12 @@
|
|||||||
"type": "java.lang.Integer",
|
"type": "java.lang.Integer",
|
||||||
"description": "netty 线程数.",
|
"description": "netty 线程数.",
|
||||||
"defaultValue": "16"
|
"defaultValue": "16"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spring.redisson.minimum-idle-size",
|
||||||
|
"type": "java.lang.Integer",
|
||||||
|
"description": "最小空闲连接数.",
|
||||||
|
"defaultValue": "16"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 security 配置包</description>
|
<description>项目 security 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目存储层配置包</description>
|
<description>项目存储层配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 swagger 配置包</description>
|
<description>项目 swagger 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -38,10 +37,9 @@ import java.util.Optional;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2022/6/21 11:22
|
* @since 2022/6/21 11:22
|
||||||
*/
|
*/
|
||||||
@Profile({"dev"})
|
|
||||||
@ConditionalOnClass({OpenAPI.class})
|
@ConditionalOnClass({OpenAPI.class})
|
||||||
@EnableConfigurationProperties(SwaggerConfig.class)
|
@EnableConfigurationProperties(SwaggerConfig.class)
|
||||||
@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true)
|
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true")
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
|
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
|
||||||
public class OrionSwaggerAutoConfiguration {
|
public class OrionSwaggerAutoConfiguration {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目单元测试包</description>
|
<description>项目单元测试包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 web 包</description>
|
<description>项目 web 包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目 websocket 配置包</description>
|
<description>项目 websocket 配置包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<description>项目组件包</description>
|
<description>项目组件包</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>orion-visor-framework-common</module>
|
<module>orion-visor-framework-common</module>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description>
|
<description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- spring boot 配置所需依赖 -->
|
<!-- spring boot 配置所需依赖 -->
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
package com.orion.visor.launch;
|
package com.orion.visor.launch;
|
||||||
|
|
||||||
|
import com.orion.lang.utils.Strings;
|
||||||
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
|
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
|
||||||
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
|
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||||
|
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||||
|
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.core.type.AnnotationMetadata;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* application 启动类
|
* application 启动类
|
||||||
@@ -14,7 +24,35 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
|||||||
public class LaunchApplication {
|
public class LaunchApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new SpringApplicationBuilder(LaunchApplication.class).run(args);
|
new SpringApplicationBuilder(LaunchApplication.class)
|
||||||
|
.beanNameGenerator(new CustomBeanNameGenerator())
|
||||||
|
.run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义 bean 名称生成器
|
||||||
|
*/
|
||||||
|
public static class CustomBeanNameGenerator implements BeanNameGenerator {
|
||||||
|
|
||||||
|
private static final String BEAN_ANNOTATION_CLASS_NAME = "org.springframework.stereotype.Component";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
|
||||||
|
// 兼容注解自定义名称
|
||||||
|
if (definition instanceof AnnotatedBeanDefinition) {
|
||||||
|
AnnotationMetadata metadata = ((AnnotatedBeanDefinition) definition).getMetadata();
|
||||||
|
// 处理自定义 bean 名称
|
||||||
|
return Optional.of(metadata)
|
||||||
|
.map(s -> s.getAnnotationAttributes(BEAN_ANNOTATION_CLASS_NAME))
|
||||||
|
.map(s -> s.get(Const.VALUE))
|
||||||
|
.map(Object::toString)
|
||||||
|
.filter(Strings::isNotBlank)
|
||||||
|
.orElseGet(definition::getBeanClassName);
|
||||||
|
} else {
|
||||||
|
// 非注解形式默认使用默认名称
|
||||||
|
return BeanDefinitionReaderUtils.generateBeanName(definition, registry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ spring:
|
|||||||
initial-size: 0
|
initial-size: 0
|
||||||
min-idle: 1
|
min-idle: 1
|
||||||
max-active: 5
|
max-active: 5
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: false
|
||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -14,6 +16,20 @@ spring:
|
|||||||
redisson:
|
redisson:
|
||||||
threads: 2
|
threads: 2
|
||||||
netty-threads: 2
|
netty-threads: 2
|
||||||
|
minimum-idle-size: 2
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
enabled: false
|
||||||
|
server:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
enabled-by-default: false
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: shutdown
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ spring:
|
|||||||
min-idle: 5
|
min-idle: 5
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
max-active: 20
|
max-active: 20
|
||||||
web-stat-filter:
|
# 控制台
|
||||||
enabled: true
|
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
login-username: ${DRUID_USERNAME:admin}
|
||||||
|
login-password: ${DRUID_PASSWORD:admin}
|
||||||
|
web-stat-filter:
|
||||||
|
enabled: true
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -24,12 +27,23 @@ spring:
|
|||||||
redisson:
|
redisson:
|
||||||
threads: 4
|
threads: 4
|
||||||
netty-threads: 4
|
netty-threads: 4
|
||||||
|
minimum-idle-size: 4
|
||||||
quartz:
|
quartz:
|
||||||
properties:
|
properties:
|
||||||
org:
|
org:
|
||||||
quartz:
|
quartz:
|
||||||
threadPool:
|
threadPool:
|
||||||
threadCount: 10
|
threadCount: 10
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
enabled: true
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
enabled-by-default: true
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
api-docs:
|
api-docs:
|
||||||
@@ -39,6 +53,7 @@ springdoc:
|
|||||||
|
|
||||||
knife4j:
|
knife4j:
|
||||||
enable: false
|
enable: false
|
||||||
|
production: true
|
||||||
|
|
||||||
orion:
|
orion:
|
||||||
# 是否为演示模式
|
# 是否为演示模式
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ spring:
|
|||||||
mvc:
|
mvc:
|
||||||
pathmatch:
|
pathmatch:
|
||||||
matching-strategy: ANT_PATH_MATCHER
|
matching-strategy: ANT_PATH_MATCHER
|
||||||
|
async:
|
||||||
|
# 异步请求时间 30min
|
||||||
|
request-timeout: 1800000
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
@@ -37,13 +40,14 @@ spring:
|
|||||||
# 最大生存的时间
|
# 最大生存的时间
|
||||||
max-evictable-idle-time-millis: 900000
|
max-evictable-idle-time-millis: 900000
|
||||||
validation-query: SELECT 1
|
validation-query: SELECT 1
|
||||||
web-stat-filter:
|
# 控制台
|
||||||
enabled: true
|
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
url-pattern: /druid/*
|
url-pattern: /druid/*
|
||||||
login-username:
|
login-username:
|
||||||
login-password:
|
login-password:
|
||||||
|
web-stat-filter:
|
||||||
|
enabled: true
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -85,7 +89,7 @@ spring:
|
|||||||
misfireThreshold: 60000
|
misfireThreshold: 60000
|
||||||
clusterCheckinInterval: 5000
|
clusterCheckinInterval: 5000
|
||||||
isClustered: true
|
isClustered: true
|
||||||
#连接池
|
# 连接池
|
||||||
threadPool:
|
threadPool:
|
||||||
class: org.quartz.simpl.SimpleThreadPool
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
threadCount: 5
|
threadCount: 5
|
||||||
@@ -95,12 +99,16 @@ spring:
|
|||||||
admin:
|
admin:
|
||||||
context-path: /admin
|
context-path: /admin
|
||||||
client:
|
client:
|
||||||
|
enabled: true
|
||||||
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path}
|
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path}
|
||||||
instance:
|
instance:
|
||||||
service-host-type: IP
|
service-host-type: IP
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
|
enabled-by-default: true
|
||||||
web:
|
web:
|
||||||
base-path: /actuator
|
base-path: /actuator
|
||||||
exposure:
|
exposure:
|
||||||
@@ -195,7 +203,7 @@ orion:
|
|||||||
api:
|
api:
|
||||||
# 公共 api 前缀
|
# 公共 api 前缀
|
||||||
prefix: /orion-visor/api
|
prefix: /orion-visor/api
|
||||||
# 是否开启跨域
|
# 是否允许跨域
|
||||||
cors: true
|
cors: true
|
||||||
websocket:
|
websocket:
|
||||||
# 公共 websocket 前缀
|
# 公共 websocket 前缀
|
||||||
@@ -212,10 +220,10 @@ orion:
|
|||||||
title: orion-visor 运维平台
|
title: orion-visor 运维平台
|
||||||
description: 一站式运维服务平台
|
description: 一站式运维服务平台
|
||||||
version: ${orion.version}
|
version: ${orion.version}
|
||||||
url: https://github.com/lijiahangmax/orion-visor
|
url: https://github.com/dromara/orion-visor
|
||||||
email: ljh1553488six@139.com
|
email: ljh1553488six@139.com
|
||||||
license: Apache-2.0
|
license: Apache-2.0
|
||||||
license-url: https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE
|
license-url: https://github.com/dromara/orion-visor/blob/main/LICENSE
|
||||||
grouped-api:
|
grouped-api:
|
||||||
infra:
|
infra:
|
||||||
group: "infra - 基建模块"
|
group: "infra - 基建模块"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目资产模块</description>
|
<description>项目资产模块</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.orion.visor.module.infra.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令片段 对外服务类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/3 11:07
|
||||||
|
*/
|
||||||
|
public interface CommandSnippetApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 userId 删除
|
||||||
|
*
|
||||||
|
* @param userIdList userIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
Integer deleteByUserIdList(List<Long> userIdList);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.orion.visor.module.infra.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径标签 对外服务类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/3 11:07
|
||||||
|
*/
|
||||||
|
public interface PathBookmarkApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 userId 删除
|
||||||
|
*
|
||||||
|
* @param userIdList userIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
Integer deleteByUserIdList(List<Long> userIdList);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<description>项目资产模块</description>
|
<description>项目资产模块</description>
|
||||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
<url>https://github.com/dromara/orion-visor</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.orion.visor.module.asset.api.impl;
|
||||||
|
|
||||||
|
import com.orion.visor.module.asset.service.CommandSnippetService;
|
||||||
|
import com.orion.visor.module.infra.api.CommandSnippetApi;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令片段 对外服务实现类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/3 11:11
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class CommandSnippetApiImpl implements CommandSnippetApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CommandSnippetService commandSnippetService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||||
|
return commandSnippetService.deleteByUserIdList(userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.orion.visor.module.asset.api.impl;
|
||||||
|
|
||||||
|
import com.orion.visor.module.asset.service.PathBookmarkService;
|
||||||
|
import com.orion.visor.module.infra.api.PathBookmarkApi;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径标签 对外服务实现类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/6/3 11:11
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class PathBookmarkApiImpl implements PathBookmarkApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PathBookmarkService pathBookmarkService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||||
|
return pathBookmarkService.deleteByUserIdList(userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -98,6 +98,15 @@ public class ExecJobController {
|
|||||||
return execJobService.deleteExecJobById(id);
|
return execJobService.deleteExecJobById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperatorLog(ExecJobOperatorType.DELETE)
|
||||||
|
@DeleteMapping("/batch-delete")
|
||||||
|
@Operation(summary = "批量删除计划任务")
|
||||||
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('asset:exec-job:delete')")
|
||||||
|
public Integer batchDeleteExecJob(@RequestParam("idList") List<Long> idList) {
|
||||||
|
return execJobService.deleteExecJobByIdList(idList);
|
||||||
|
}
|
||||||
|
|
||||||
@OperatorLog(ExecJobOperatorType.TRIGGER)
|
@OperatorLog(ExecJobOperatorType.TRIGGER)
|
||||||
@PostMapping("/trigger")
|
@PostMapping("/trigger")
|
||||||
@Operation(summary = "手动触发计划任务")
|
@Operation(summary = "手动触发计划任务")
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行模板 api
|
* 执行模板 api
|
||||||
@@ -92,5 +93,14 @@ public class ExecTemplateController {
|
|||||||
return execTemplateService.deleteExecTemplateById(id);
|
return execTemplateService.deleteExecTemplateById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||||
|
@DeleteMapping("/batch-delete")
|
||||||
|
@Operation(summary = "批量删除执行模板")
|
||||||
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('asset:exec-template:delete')")
|
||||||
|
public Integer batchDeleteExecTemplate(@RequestParam("idList") List<Long> idList) {
|
||||||
|
return execTemplateService.deleteExecTemplateByIdList(idList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,5 +96,15 @@ public class HostController {
|
|||||||
return hostService.deleteHostById(id);
|
return hostService.deleteHostById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DemoDisableApi
|
||||||
|
@OperatorLog(HostOperatorType.DELETE)
|
||||||
|
@DeleteMapping("/batch-delete")
|
||||||
|
@Operation(summary = "批量删除主机")
|
||||||
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('asset:host:delete')")
|
||||||
|
public Integer batchDeleteHost(@RequestParam("idList") List<Long> idList) {
|
||||||
|
return hostService.deleteHostByIdList(idList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,5 +97,15 @@ public class HostIdentityController {
|
|||||||
return hostIdentityService.deleteHostIdentityById(id);
|
return hostIdentityService.deleteHostIdentityById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DemoDisableApi
|
||||||
|
@OperatorLog(HostIdentityOperatorType.DELETE)
|
||||||
|
@DeleteMapping("/batch-delete")
|
||||||
|
@Operation(summary = "批量删除主机身份")
|
||||||
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('asset:host-identity:delete')")
|
||||||
|
public Integer batchDeleteHostIdentity(@RequestParam("idList") List<Long> idList) {
|
||||||
|
return hostIdentityService.deleteHostIdentityByIdList(idList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,5 +96,15 @@ public class HostKeyController {
|
|||||||
return hostKeyService.deleteHostKeyById(id);
|
return hostKeyService.deleteHostKeyById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DemoDisableApi
|
||||||
|
@OperatorLog(HostKeyOperatorType.DELETE)
|
||||||
|
@DeleteMapping("/batch-delete")
|
||||||
|
@Operation(summary = "批量删除主机密钥")
|
||||||
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('asset:host-key:delete')")
|
||||||
|
public Integer batchDeleteHostKey(@RequestParam("idList") List<Long> idList) {
|
||||||
|
return hostKeyService.deleteHostKeyByIdList(idList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
### 分页查询 SFTP 操作日志
|
### 分页查询 SFTP 操作日志
|
||||||
POST {{baseUrl}}/asset/host-sftp-log/query
|
POST {{baseUrl}}/asset/host-sftp/query-log
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Authorization: {{token}}
|
Authorization: {{token}}
|
||||||
|
|
||||||
@@ -10,8 +10,12 @@ Authorization: {{token}}
|
|||||||
|
|
||||||
|
|
||||||
### 删除 SFTP 操作日志
|
### 删除 SFTP 操作日志
|
||||||
DELETE {{baseUrl}}/asset/host-sftp-log/delete?idList=1,2,3
|
DELETE {{baseUrl}}/asset/host-sftp/delete-log?idList=1,2,3
|
||||||
Authorization: {{token}}
|
Authorization: {{token}}
|
||||||
|
|
||||||
|
|
||||||
|
### 下载文件
|
||||||
|
GET {{baseUrl}}/asset/host-sftp/download?channelId=123&transferToken=123
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
|||||||
import com.orion.visor.framework.common.validator.group.Page;
|
import com.orion.visor.framework.common.validator.group.Page;
|
||||||
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.IgnoreWrapper;
|
||||||
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.HostTerminalOperatorType;
|
import com.orion.visor.module.asset.define.operator.HostTerminalOperatorType;
|
||||||
import com.orion.visor.module.asset.entity.request.host.HostSftpLogQueryRequest;
|
import com.orion.visor.module.asset.entity.request.host.HostSftpLogQueryRequest;
|
||||||
import com.orion.visor.module.asset.entity.vo.HostSftpLogVO;
|
import com.orion.visor.module.asset.entity.vo.HostSftpLogVO;
|
||||||
import com.orion.visor.module.asset.service.HostSftpLogService;
|
import com.orion.visor.module.asset.service.HostSftpService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -17,44 +18,60 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.annotation.security.PermitAll;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SFTP 操作日志服务 api
|
* SFTP 操作服务 api
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author Jiahang Li
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023-12-26 22:09
|
* @since 2023-12-26 22:09
|
||||||
*/
|
*/
|
||||||
@Tag(name = "asset - SFTP 操作日志服务")
|
@Tag(name = "asset - SFTP 操作服务")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Validated
|
@Validated
|
||||||
@RestWrapper
|
@RestWrapper
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/asset/host-sftp-log")
|
@RequestMapping("/asset/host-sftp")
|
||||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||||
public class HostSftpLogController {
|
public class HostSftpLogController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HostSftpLogService hostSftpLogService;
|
private HostSftpService hostSftpService;
|
||||||
|
|
||||||
@IgnoreLog(IgnoreLogMode.RET)
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
@PostMapping("/query")
|
@PostMapping("/query-log")
|
||||||
@Operation(summary = "分页查询 SFTP 操作日志")
|
@Operation(summary = "分页查询 SFTP 操作日志")
|
||||||
@PreAuthorize("@ss.hasAnyPermission('infra:operator-log:query', 'asset:host-sftp-log:management:query')")
|
@PreAuthorize("@ss.hasAnyPermission('infra:operator-log:query', 'asset:host-sftp-log:management:query')")
|
||||||
public DataGrid<HostSftpLogVO> getHostSftpLogPage(@Validated(Page.class) @RequestBody HostSftpLogQueryRequest request) {
|
public DataGrid<HostSftpLogVO> getHostSftpLogPage(@Validated(Page.class) @RequestBody HostSftpLogQueryRequest request) {
|
||||||
return hostSftpLogService.getHostSftpLogPage(request);
|
return hostSftpService.getHostSftpLogPage(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperatorLog(HostTerminalOperatorType.DELETE_SFTP_LOG)
|
@OperatorLog(HostTerminalOperatorType.DELETE_SFTP_LOG)
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete-log")
|
||||||
@Operation(summary = "删除 SFTP 操作日志")
|
@Operation(summary = "删除 SFTP 操作日志")
|
||||||
@Parameter(name = "idList", description = "idList", required = true)
|
@Parameter(name = "idList", description = "idList", required = true)
|
||||||
@PreAuthorize("@ss.hasAnyPermission('infra:operator-log:delete', 'asset:host-sftp-log:management:delete')")
|
@PreAuthorize("@ss.hasAnyPermission('infra:operator-log:delete', 'asset:host-sftp-log:management:delete')")
|
||||||
public Integer deleteHostSftpLog(@RequestParam("idList") List<Long> idList) {
|
public Integer deleteHostSftpLog(@RequestParam("idList") List<Long> idList) {
|
||||||
return hostSftpLogService.deleteHostSftpLog(idList);
|
return hostSftpService.deleteHostSftpLog(idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PermitAll
|
||||||
|
@IgnoreWrapper
|
||||||
|
@IgnoreLog(IgnoreLogMode.RET)
|
||||||
|
@GetMapping("/download")
|
||||||
|
@Operation(summary = "下载文件")
|
||||||
|
@Parameter(name = "channelId", description = "channelId", required = true)
|
||||||
|
@Parameter(name = "transferToken", description = "transferToken", required = true)
|
||||||
|
public StreamingResponseBody downloadWithTransferToken(@RequestParam("channelId") String channelId,
|
||||||
|
@RequestParam("transferToken") String transferToken,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
return hostSftpService.downloadWithTransferToken(channelId, transferToken, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
|||||||
import com.orion.visor.module.asset.entity.domain.CommandSnippetDO;
|
import com.orion.visor.module.asset.entity.domain.CommandSnippetDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命令片段 Mapper 接口
|
* 命令片段 Mapper 接口
|
||||||
*
|
*
|
||||||
@@ -42,4 +44,16 @@ public interface CommandSnippetDAO extends IMapper<CommandSnippetDO> {
|
|||||||
return this.delete(wrapper);
|
return this.delete(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 userId 删除
|
||||||
|
*
|
||||||
|
* @param userIdList userIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
default int deleteByUserIdList(List<Long> userIdList) {
|
||||||
|
LambdaQueryWrapper<CommandSnippetDO> wrapper = this.lambda()
|
||||||
|
.in(CommandSnippetDO::getUserId, userIdList);
|
||||||
|
return this.delete(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ public interface ExecJobHostDAO extends IMapper<ExecJobHostDO> {
|
|||||||
return this.delete(wrapper);
|
return this.delete(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 jobId 删除
|
||||||
|
*
|
||||||
|
* @param jobIdList jobIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
default Integer deleteByJobIdList(List<Long> jobIdList) {
|
||||||
|
LambdaQueryWrapper<ExecJobHostDO> wrapper = this.wrapper()
|
||||||
|
.in(ExecJobHostDO::getJobId, jobIdList);
|
||||||
|
return this.delete(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过 hostId 删除
|
* 通过 hostId 删除
|
||||||
*
|
*
|
||||||
@@ -56,4 +68,16 @@ public interface ExecJobHostDAO extends IMapper<ExecJobHostDO> {
|
|||||||
return this.delete(wrapper);
|
return this.delete(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 hostId 删除
|
||||||
|
*
|
||||||
|
* @param hostIdList hostIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
default Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||||
|
LambdaQueryWrapper<ExecJobHostDO> wrapper = this.wrapper()
|
||||||
|
.in(ExecJobHostDO::getHostId, hostIdList);
|
||||||
|
return this.delete(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,17 +95,17 @@ public interface HostConfigDAO extends IMapper<HostConfigDO> {
|
|||||||
/**
|
/**
|
||||||
* 设置 keyId 为 NULL
|
* 设置 keyId 为 NULL
|
||||||
*
|
*
|
||||||
* @param keyId keyId
|
* @param keyIdList keyIdList
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
int setKeyIdWithNull(@Param("keyId") Long keyId);
|
int setKeyIdWithNull(@Param("keyIdList") List<Long> keyIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置 identityId 为 NULL
|
* 设置 identityId 为 NULL
|
||||||
*
|
*
|
||||||
* @param identityId identityId
|
* @param identityIdList identityIdList
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
int setIdentityIdWithNull(@Param("identityId") Long identityId);
|
int setIdentityIdWithNull(@Param("identityIdList") List<Long> identityIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||||
import com.orion.visor.module.asset.entity.domain.HostIdentityDO;
|
import com.orion.visor.module.asset.entity.domain.HostIdentityDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机身份 Mapper 接口
|
* 主机身份 Mapper 接口
|
||||||
@@ -20,13 +21,13 @@ public interface HostIdentityDAO extends IMapper<HostIdentityDO> {
|
|||||||
/**
|
/**
|
||||||
* 设置 keyId 为 null
|
* 设置 keyId 为 null
|
||||||
*
|
*
|
||||||
* @param keyId keyId
|
* @param keyIdList keyIdList
|
||||||
* @return effect
|
* @return effect
|
||||||
*/
|
*/
|
||||||
default int setKeyWithNull(@Param("keyId") Long keyId) {
|
default int setKeyWithNull(List<Long> keyIdList) {
|
||||||
LambdaUpdateWrapper<HostIdentityDO> updateWrapper = Wrappers.<HostIdentityDO>lambdaUpdate()
|
LambdaUpdateWrapper<HostIdentityDO> updateWrapper = Wrappers.<HostIdentityDO>lambdaUpdate()
|
||||||
.set(HostIdentityDO::getKeyId, null)
|
.set(HostIdentityDO::getKeyId, null)
|
||||||
.eq(HostIdentityDO::getKeyId, keyId);
|
.in(HostIdentityDO::getKeyId, keyIdList);
|
||||||
return this.update(null, updateWrapper);
|
return this.update(null, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
|||||||
import com.orion.visor.module.asset.entity.domain.PathBookmarkDO;
|
import com.orion.visor.module.asset.entity.domain.PathBookmarkDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路径标签 Mapper 接口
|
* 路径标签 Mapper 接口
|
||||||
*
|
*
|
||||||
@@ -42,4 +44,16 @@ public interface PathBookmarkDAO extends IMapper<PathBookmarkDO> {
|
|||||||
return this.delete(wrapper);
|
return this.delete(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 userId 删除
|
||||||
|
*
|
||||||
|
* @param userIdList userIdList
|
||||||
|
* @return effect
|
||||||
|
*/
|
||||||
|
default int deleteByUserIdList(List<Long> userIdList) {
|
||||||
|
LambdaQueryWrapper<PathBookmarkDO> wrapper = this.lambda()
|
||||||
|
.in(PathBookmarkDO::getUserId, userIdList);
|
||||||
|
return this.delete(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.orion.visor.module.asset.enums;
|
|||||||
import com.orion.visor.framework.common.enums.EnableStatus;
|
import com.orion.visor.framework.common.enums.EnableStatus;
|
||||||
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel;
|
|
||||||
import com.orion.visor.module.asset.handler.host.config.strategy.HostSshConfigStrategy;
|
import com.orion.visor.module.asset.handler.host.config.strategy.HostSshConfigStrategy;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -24,7 +23,6 @@ public enum HostConfigTypeEnum implements GenericsDataDefinition {
|
|||||||
* SSH 配置
|
* SSH 配置
|
||||||
*/
|
*/
|
||||||
SSH("ssh",
|
SSH("ssh",
|
||||||
HostSshConfigModel.class,
|
|
||||||
HostSshConfigStrategy.class,
|
HostSshConfigStrategy.class,
|
||||||
EnableStatus.ENABLED.getValue()),
|
EnableStatus.ENABLED.getValue()),
|
||||||
|
|
||||||
@@ -32,9 +30,7 @@ public enum HostConfigTypeEnum implements GenericsDataDefinition {
|
|||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
private final Class<? extends GenericsDataModel> model;
|
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||||
|
|
||||||
private final Class<? extends MapDataStrategy<? extends GenericsDataModel>> strategy;
|
|
||||||
|
|
||||||
private final Integer defaultStatus;
|
private final Integer defaultStatus;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package com.orion.visor.module.asset.enums;
|
|||||||
|
|
||||||
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
import com.orion.visor.framework.common.handler.data.GenericsDataDefinition;
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.extra.model.HostLabelExtraModel;
|
|
||||||
import com.orion.visor.module.asset.handler.host.extra.model.HostSshExtraModel;
|
|
||||||
import com.orion.visor.module.asset.handler.host.extra.strategy.HostLabelExtraStrategy;
|
import com.orion.visor.module.asset.handler.host.extra.strategy.HostLabelExtraStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.extra.strategy.HostSshExtraStrategy;
|
import com.orion.visor.module.asset.handler.host.extra.strategy.HostSshExtraStrategy;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -24,20 +22,18 @@ public enum HostExtraItemEnum implements GenericsDataDefinition {
|
|||||||
/**
|
/**
|
||||||
* SSH 额外配置
|
* SSH 额外配置
|
||||||
*/
|
*/
|
||||||
SSH("ssh", HostSshExtraModel.class, HostSshExtraStrategy.class),
|
SSH("ssh", HostSshExtraStrategy.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标签额外配置
|
* 标签额外配置
|
||||||
*/
|
*/
|
||||||
LABEL("label", HostLabelExtraModel.class, HostLabelExtraStrategy.class),
|
LABEL("label", HostLabelExtraStrategy.class),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String item;
|
private final String item;
|
||||||
|
|
||||||
private final Class<? extends GenericsDataModel> model;
|
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||||
|
|
||||||
private final Class<? extends MapDataStrategy<? extends GenericsDataModel>> strategy;
|
|
||||||
|
|
||||||
public static HostExtraItemEnum of(String type) {
|
public static HostExtraItemEnum of(String type) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.orion.visor.module.asset.handler.host.config.model;
|
|||||||
|
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import com.orion.visor.framework.common.security.UpdatePasswordAction;
|
import com.orion.visor.framework.common.security.UpdatePasswordAction;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -24,61 +23,86 @@ import javax.validation.constraints.Size;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Schema(name = "HostSftpConfig", description = "主机 SSH 配置")
|
|
||||||
public class HostSshConfigModel implements GenericsDataModel, UpdatePasswordAction {
|
public class HostSshConfigModel implements GenericsDataModel, UpdatePasswordAction {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ssh 端口
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Range(min = 1, max = 65535)
|
@Range(min = 1, max = 65535)
|
||||||
@Schema(description = "ssh 端口")
|
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
@Schema(description = "用户名")
|
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 认证方式
|
||||||
|
*/
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Size(max = 12)
|
@Size(max = 12)
|
||||||
@Schema(description = "认证方式")
|
|
||||||
private String authType;
|
private String authType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统类型
|
||||||
|
*/
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Size(max = 12)
|
@Size(max = 12)
|
||||||
@Schema(description = "系统类型")
|
|
||||||
private String osType;
|
private String osType;
|
||||||
|
|
||||||
@Schema(description = "密码")
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Schema(description = "身份id")
|
/**
|
||||||
|
* 身份id
|
||||||
|
*/
|
||||||
private Long identityId;
|
private Long identityId;
|
||||||
|
|
||||||
@Schema(description = "密钥id")
|
/**
|
||||||
|
* 密钥id
|
||||||
|
*/
|
||||||
private Long keyId;
|
private Long keyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接超时时间
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Range(min = 0, max = 100000)
|
@Range(min = 0, max = 100000)
|
||||||
@Schema(description = "连接超时时间")
|
|
||||||
private Integer connectTimeout;
|
private Integer connectTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SSH输出编码
|
||||||
|
*/
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Size(max = 12)
|
@Size(max = 12)
|
||||||
@Schema(description = "SSH输出编码")
|
|
||||||
private String charset;
|
private String charset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称编码
|
||||||
|
*/
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Size(max = 12)
|
@Size(max = 12)
|
||||||
@Schema(description = "文件名称编码")
|
|
||||||
private String fileNameCharset;
|
private String fileNameCharset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件内容编码
|
||||||
|
*/
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Size(max = 12)
|
@Size(max = 12)
|
||||||
@Schema(description = "文件内容编码")
|
|
||||||
private String fileContentCharset;
|
private String fileContentCharset;
|
||||||
|
|
||||||
@Schema(description = "是否使用新密码 仅参数")
|
/**
|
||||||
|
* 是否使用新密码 仅参数
|
||||||
|
*/
|
||||||
private Boolean useNewPassword;
|
private Boolean useNewPassword;
|
||||||
|
|
||||||
@Schema(description = "是否已设置密码 仅返回")
|
/**
|
||||||
|
* 是否已设置密码 仅返回
|
||||||
|
*/
|
||||||
private Boolean hasPassword;
|
private Boolean hasPassword;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.config.strategy;
|
package com.orion.visor.module.asset.handler.host.config.strategy;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.orion.lang.utils.Booleans;
|
import com.orion.lang.utils.Booleans;
|
||||||
import com.orion.lang.utils.Charsets;
|
import com.orion.lang.utils.Charsets;
|
||||||
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.visor.framework.common.constant.Const;
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.framework.common.security.PasswordModifier;
|
import com.orion.visor.framework.common.security.PasswordModifier;
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
||||||
@@ -18,7 +17,6 @@ import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机 SSH 配置策略
|
* 主机 SSH 配置策略
|
||||||
@@ -28,7 +26,7 @@ import java.util.Map;
|
|||||||
* @since 2023/9/19 14:26
|
* @since 2023/9/19 14:26
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel> {
|
public class HostSshConfigStrategy extends AbstractGenericsDataStrategy<HostSshConfigModel> {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HostKeyDAO hostKeyDAO;
|
private HostKeyDAO hostKeyDAO;
|
||||||
@@ -40,6 +38,10 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
|
|
||||||
private static final String USERNAME = "root";
|
private static final String USERNAME = "root";
|
||||||
|
|
||||||
|
public HostSshConfigStrategy() {
|
||||||
|
super(HostSshConfigModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostSshConfigModel getDefault() {
|
public HostSshConfigModel getDefault() {
|
||||||
return HostSshConfigModel.builder()
|
return HostSshConfigModel.builder()
|
||||||
@@ -55,7 +57,7 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preValid(HostSshConfigModel model) {
|
protected void preValid(HostSshConfigModel model) {
|
||||||
// 验证认证类型
|
// 验证认证类型
|
||||||
Valid.valid(HostSshAuthTypeEnum::of, model.getAuthType());
|
Valid.valid(HostSshAuthTypeEnum::of, model.getAuthType());
|
||||||
// 验证系统版本
|
// 验证系统版本
|
||||||
@@ -77,13 +79,13 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void valid(HostSshConfigModel model) {
|
protected void valid(HostSshConfigModel model) {
|
||||||
// 验证填充后的参数
|
// 验证填充后的参数
|
||||||
Valid.valid(model);
|
Valid.valid(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(HostSshConfigModel beforeModel, HostSshConfigModel afterModel) {
|
protected void updateFill(HostSshConfigModel beforeModel, HostSshConfigModel afterModel) {
|
||||||
// 加密密码
|
// 加密密码
|
||||||
this.checkEncryptPassword(beforeModel, afterModel);
|
this.checkEncryptPassword(beforeModel, afterModel);
|
||||||
afterModel.setHasPassword(null);
|
afterModel.setHasPassword(null);
|
||||||
@@ -91,14 +93,12 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> toView(String config) {
|
public void toView(HostSshConfigModel model) {
|
||||||
if (config == null) {
|
if (model == null) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
HostSshConfigModel model = JSON.parseObject(config, HostSshConfigModel.class);
|
|
||||||
model.setHasPassword(Strings.isNotBlank(model.getPassword()));
|
model.setHasPassword(Strings.isNotBlank(model.getPassword()));
|
||||||
model.setPassword(null);
|
model.setPassword(null);
|
||||||
return JSON.parseObject(JSON.toJSONString(model));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.exec.command;
|
package com.orion.visor.module.asset.handler.host.exec.command;
|
||||||
|
|
||||||
import com.orion.visor.module.asset.define.AssetThreadPools;
|
import com.orion.visor.module.asset.define.AssetThreadPools;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandDTO;
|
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.handler.ExecTaskHandler;
|
import com.orion.visor.module.asset.handler.host.exec.command.handler.ExecTaskHandler;
|
||||||
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量执行命令执行器
|
* 批量执行命令执行器
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.exec.command.dto;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量执行启动主机对象
|
|
||||||
*
|
|
||||||
* @author Jiahang Li
|
|
||||||
* @version 1.0.0
|
|
||||||
* @since 2024/3/11 15:46
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Schema(name = "ExecCommandHostDTO", description = "批量执行启动主机对象")
|
|
||||||
public class ExecCommandHostDTO {
|
|
||||||
|
|
||||||
@Schema(description = "hostLogId")
|
|
||||||
private Long hostLogId;
|
|
||||||
|
|
||||||
@Schema(description = "hostId")
|
|
||||||
private Long hostId;
|
|
||||||
|
|
||||||
@Schema(description = "主机名称")
|
|
||||||
private String hostName;
|
|
||||||
|
|
||||||
@Schema(description = "主机地址")
|
|
||||||
private String hostAddress;
|
|
||||||
|
|
||||||
@Schema(description = "日志文件路径")
|
|
||||||
private String logPath;
|
|
||||||
|
|
||||||
@Schema(description = "脚本路径")
|
|
||||||
private String scriptPath;
|
|
||||||
|
|
||||||
@Schema(description = "执行命令")
|
|
||||||
private String command;
|
|
||||||
|
|
||||||
@Schema(description = "主机用户")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Schema(description = "命令编码")
|
|
||||||
private String charset;
|
|
||||||
|
|
||||||
@Schema(description = "文件名称编码")
|
|
||||||
private String fileNameCharset;
|
|
||||||
|
|
||||||
@Schema(description = "文件内容编码")
|
|
||||||
private String fileContentCharset;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -20,8 +20,8 @@ import com.orion.visor.framework.common.file.FileClient;
|
|||||||
import com.orion.visor.module.asset.dao.ExecHostLogDAO;
|
import com.orion.visor.module.asset.dao.ExecHostLogDAO;
|
||||||
import com.orion.visor.module.asset.entity.domain.ExecHostLogDO;
|
import com.orion.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||||
import com.orion.visor.module.asset.enums.ExecHostStatusEnum;
|
import com.orion.visor.module.asset.enums.ExecHostStatusEnum;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandDTO;
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandHostDTO;
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.log.manager.ExecLogManager;
|
import com.orion.visor.module.asset.handler.host.exec.log.manager.ExecLogManager;
|
||||||
import com.orion.visor.module.asset.service.HostTerminalService;
|
import com.orion.visor.module.asset.service.HostTerminalService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import com.orion.lang.utils.time.Dates;
|
|||||||
import com.orion.net.host.ssh.ExitCode;
|
import com.orion.net.host.ssh.ExitCode;
|
||||||
import com.orion.visor.framework.common.constant.Const;
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
import com.orion.visor.module.asset.enums.ExecHostStatusEnum;
|
import com.orion.visor.module.asset.enums.ExecHostStatusEnum;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandDTO;
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandHostDTO;
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命令执行器 ansi 日志输出
|
* 命令执行器 ansi 日志输出
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.orion.visor.module.asset.handler.host.exec.command.handler;
|
|||||||
|
|
||||||
import com.orion.lang.support.timeout.TimeoutChecker;
|
import com.orion.lang.support.timeout.TimeoutChecker;
|
||||||
import com.orion.lang.support.timeout.TimeoutEndpoint;
|
import com.orion.lang.support.timeout.TimeoutEndpoint;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandDTO;
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandHostDTO;
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import com.orion.visor.module.asset.define.message.ExecMessageDefine;
|
|||||||
import com.orion.visor.module.asset.entity.domain.ExecLogDO;
|
import com.orion.visor.module.asset.entity.domain.ExecLogDO;
|
||||||
import com.orion.visor.module.asset.enums.ExecHostStatusEnum;
|
import com.orion.visor.module.asset.enums.ExecHostStatusEnum;
|
||||||
import com.orion.visor.module.asset.enums.ExecStatusEnum;
|
import com.orion.visor.module.asset.enums.ExecStatusEnum;
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandDTO;
|
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.dto.ExecCommandHostDTO;
|
|
||||||
import com.orion.visor.module.asset.handler.host.exec.command.manager.ExecTaskManager;
|
import com.orion.visor.module.asset.handler.host.exec.command.manager.ExecTaskManager;
|
||||||
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||||
|
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||||
import com.orion.visor.module.infra.api.SystemMessageApi;
|
import com.orion.visor.module.infra.api.SystemMessageApi;
|
||||||
import com.orion.visor.module.infra.entity.dto.message.SystemMessageDTO;
|
import com.orion.visor.module.infra.entity.dto.message.SystemMessageDTO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.exec.command.dto;
|
package com.orion.visor.module.asset.handler.host.exec.command.model;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -19,31 +18,46 @@ import java.util.List;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Schema(name = "ExecCommandDTO", description = "批量执行启动对象")
|
|
||||||
public class ExecCommandDTO {
|
public class ExecCommandDTO {
|
||||||
|
|
||||||
@Schema(description = "logId")
|
/**
|
||||||
|
* logId
|
||||||
|
*/
|
||||||
private Long logId;
|
private Long logId;
|
||||||
|
|
||||||
@Schema(description = "用户id")
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Schema(description = "用户名")
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Schema(description = "执行描述")
|
/**
|
||||||
|
* 执行描述
|
||||||
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Schema(description = "执行序列")
|
/**
|
||||||
|
* 执行序列
|
||||||
|
*/
|
||||||
private Integer execSeq;
|
private Integer execSeq;
|
||||||
|
|
||||||
@Schema(description = "超时时间")
|
/**
|
||||||
|
* 超时时间
|
||||||
|
*/
|
||||||
private Integer timeout;
|
private Integer timeout;
|
||||||
|
|
||||||
@Schema(description = "是否使用脚本执行")
|
/**
|
||||||
|
* 是否使用脚本执行
|
||||||
|
*/
|
||||||
private Boolean scriptExec;
|
private Boolean scriptExec;
|
||||||
|
|
||||||
@Schema(description = "执行主机")
|
/**
|
||||||
|
* 执行主机
|
||||||
|
*/
|
||||||
private List<ExecCommandHostDTO> hosts;
|
private List<ExecCommandHostDTO> hosts;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.orion.visor.module.asset.handler.host.exec.command.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量执行启动主机对象
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/3/11 15:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ExecCommandHostDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hostLogId
|
||||||
|
*/
|
||||||
|
private Long hostLogId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hostId
|
||||||
|
*/
|
||||||
|
private Long hostId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机名称
|
||||||
|
*/
|
||||||
|
private String hostName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String hostAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志文件路径
|
||||||
|
*/
|
||||||
|
private String logPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 脚本路径
|
||||||
|
*/
|
||||||
|
private String scriptPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行命令
|
||||||
|
*/
|
||||||
|
private String command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机用户
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令编码
|
||||||
|
*/
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称编码
|
||||||
|
*/
|
||||||
|
private String fileNameCharset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件内容编码
|
||||||
|
*/
|
||||||
|
private String fileContentCharset;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.exec.log;
|
package com.orion.visor.module.asset.handler.host.exec.log;
|
||||||
|
|
||||||
|
import com.orion.visor.framework.common.annotation.Keep;
|
||||||
import com.orion.visor.framework.common.constant.ExtraFieldConst;
|
import com.orion.visor.framework.common.constant.ExtraFieldConst;
|
||||||
import com.orion.visor.framework.common.file.FileClient;
|
import com.orion.visor.framework.common.file.FileClient;
|
||||||
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
||||||
@@ -29,6 +30,7 @@ import javax.annotation.Resource;
|
|||||||
@Component
|
@Component
|
||||||
public class ExecLogTailHandler extends AbstractWebSocketHandler {
|
public class ExecLogTailHandler extends AbstractWebSocketHandler {
|
||||||
|
|
||||||
|
@Keep
|
||||||
@Resource
|
@Resource
|
||||||
private FileClient logsFileClient;
|
private FileClient logsFileClient;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.extra.model;
|
package com.orion.visor.module.asset.handler.host.extra.model;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -18,13 +17,16 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Schema(name = "HostLabelExtraModel", description = "主机拓展信息 - 标签模型")
|
|
||||||
public class HostLabelExtraModel implements GenericsDataModel {
|
public class HostLabelExtraModel implements GenericsDataModel {
|
||||||
|
|
||||||
@Schema(description = "别名")
|
/**
|
||||||
|
* 别名
|
||||||
|
*/
|
||||||
private String alias;
|
private String alias;
|
||||||
|
|
||||||
@Schema(description = "颜色")
|
/**
|
||||||
|
* 颜色
|
||||||
|
*/
|
||||||
private String color;
|
private String color;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.extra.model;
|
package com.orion.visor.module.asset.handler.host.extra.model;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -18,19 +17,26 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Schema(name = "HostExtraSshModel", description = "主机拓展信息 - ssh 模型")
|
|
||||||
public class HostSshExtraModel implements GenericsDataModel {
|
public class HostSshExtraModel implements GenericsDataModel {
|
||||||
|
|
||||||
@Schema(description = "认证方式")
|
/**
|
||||||
|
* 认证方式
|
||||||
|
*/
|
||||||
private String authType;
|
private String authType;
|
||||||
|
|
||||||
@Schema(description = "认证方式")
|
/**
|
||||||
|
* 认证方式
|
||||||
|
*/
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Schema(description = "主机密钥")
|
/**
|
||||||
|
* 主机密钥
|
||||||
|
*/
|
||||||
private Long keyId;
|
private Long keyId;
|
||||||
|
|
||||||
@Schema(description = "主机身份")
|
/**
|
||||||
|
* 主机身份
|
||||||
|
*/
|
||||||
private Long identityId;
|
private Long identityId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.constant.Const;
|
import com.orion.visor.framework.common.constant.Const;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.module.asset.handler.host.extra.model.HostLabelExtraModel;
|
import com.orion.visor.module.asset.handler.host.extra.model.HostLabelExtraModel;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -13,7 +13,11 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 2024/2/29 23:16
|
* @since 2024/2/29 23:16
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class HostLabelExtraStrategy implements MapDataStrategy<HostLabelExtraModel> {
|
public class HostLabelExtraStrategy extends AbstractGenericsDataStrategy<HostLabelExtraModel> {
|
||||||
|
|
||||||
|
public HostLabelExtraStrategy() {
|
||||||
|
super(HostLabelExtraModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostLabelExtraModel getDefault() {
|
public HostLabelExtraModel getDefault() {
|
||||||
@@ -36,12 +40,4 @@ public class HostLabelExtraStrategy implements MapDataStrategy<HostLabelExtraMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void preValid(HostLabelExtraModel model) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void valid(HostLabelExtraModel model) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
||||||
|
|
||||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
import com.orion.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||||
import com.orion.visor.framework.common.utils.Valid;
|
import com.orion.visor.framework.common.utils.Valid;
|
||||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||||
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
||||||
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
|||||||
* @since 2023/12/20 22:17
|
* @since 2023/12/20 22:17
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel> {
|
public class HostSshExtraStrategy extends AbstractGenericsDataStrategy<HostSshExtraModel> {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HostKeyDAO hostKeyDAO;
|
private HostKeyDAO hostKeyDAO;
|
||||||
@@ -33,6 +33,10 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
|||||||
@Resource
|
@Resource
|
||||||
private DataPermissionApi dataPermissionApi;
|
private DataPermissionApi dataPermissionApi;
|
||||||
|
|
||||||
|
public HostSshExtraStrategy() {
|
||||||
|
super(HostSshExtraModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostSshExtraModel getDefault() {
|
public HostSshExtraModel getDefault() {
|
||||||
return HostSshExtraModel.builder()
|
return HostSshExtraModel.builder()
|
||||||
@@ -40,10 +44,6 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateFill(HostSshExtraModel beforeModel, HostSshExtraModel afterModel) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preValid(HostSshExtraModel model) {
|
public void preValid(HostSshExtraModel model) {
|
||||||
HostExtraSshAuthTypeEnum authType = Valid.valid(HostExtraSshAuthTypeEnum::of, model.getAuthType());
|
HostExtraSshAuthTypeEnum authType = Valid.valid(HostExtraSshAuthTypeEnum::of, model.getAuthType());
|
||||||
@@ -79,8 +79,4 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void valid(HostSshExtraModel model) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.orion.visor.module.asset.handler.host.terminal;
|
|||||||
|
|
||||||
import com.orion.visor.module.asset.define.AssetThreadPools;
|
import com.orion.visor.module.asset.define.AssetThreadPools;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.enums.InputTypeEnum;
|
import com.orion.visor.module.asset.handler.host.terminal.enums.InputTypeEnum;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.manager.TerminalManager;
|
import com.orion.visor.module.asset.handler.host.terminal.manager.HostTerminalManager;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.socket.CloseStatus;
|
import org.springframework.web.socket.CloseStatus;
|
||||||
@@ -24,7 +24,7 @@ import javax.annotation.Resource;
|
|||||||
public class TerminalMessageDispatcher extends AbstractWebSocketHandler {
|
public class TerminalMessageDispatcher extends AbstractWebSocketHandler {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TerminalManager terminalManager;
|
private HostTerminalManager hostTerminalManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
||||||
@@ -65,7 +65,7 @@ public class TerminalMessageDispatcher extends AbstractWebSocketHandler {
|
|||||||
String id = session.getId();
|
String id = session.getId();
|
||||||
log.info("TerminalMessageDispatcher-afterConnectionClosed id: {}, code: {}, reason: {}", id, status.getCode(), status.getReason());
|
log.info("TerminalMessageDispatcher-afterConnectionClosed id: {}, code: {}, reason: {}", id, status.getCode(), status.getReason());
|
||||||
// 关闭会话
|
// 关闭会话
|
||||||
terminalManager.closeSession(id);
|
hostTerminalManager.closeSession(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
|||||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||||
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
|
import com.orion.visor.module.asset.handler.host.terminal.enums.OutputTypeEnum;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.manager.TerminalManager;
|
import com.orion.visor.module.asset.handler.host.terminal.manager.HostTerminalManager;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalConfig;
|
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalConfig;
|
||||||
import com.orion.visor.module.asset.handler.host.terminal.session.ITerminalSession;
|
import com.orion.visor.module.asset.handler.host.terminal.session.ITerminalSession;
|
||||||
@@ -27,7 +27,7 @@ import java.util.Map;
|
|||||||
public abstract class AbstractTerminalHandler<T extends TerminalBasePayload> implements ITerminalHandler<T> {
|
public abstract class AbstractTerminalHandler<T extends TerminalBasePayload> implements ITerminalHandler<T> {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected TerminalManager terminalManager;
|
protected HostTerminalManager hostTerminalManager;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OperatorLogFrameworkService operatorLogFrameworkService;
|
private OperatorLogFrameworkService operatorLogFrameworkService;
|
||||||
@@ -75,7 +75,7 @@ public abstract class AbstractTerminalHandler<T extends TerminalBasePayload> imp
|
|||||||
String channelId = channel.getId();
|
String channelId = channel.getId();
|
||||||
String sessionId = payload.getSessionId();
|
String sessionId = payload.getSessionId();
|
||||||
// 获取会话并且设置参数
|
// 获取会话并且设置参数
|
||||||
ITerminalSession session = terminalManager.getSession(channelId, sessionId);
|
ITerminalSession session = hostTerminalManager.getSession(channelId, sessionId);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
TerminalConfig config = session.getConfig();
|
TerminalConfig config = session.getConfig();
|
||||||
extra.put(OperatorLogs.HOST_ID, config.getHostId());
|
extra.put(OperatorLogs.HOST_ID, config.getHostId());
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user