Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19c7e31f53 | ||
|
|
f618aef988 | ||
|
|
af97f752f5 | ||
|
|
bfb80afee2 | ||
|
|
72695af0f0 | ||
|
|
3a5b84eec4 | ||
|
|
387ed53328 | ||
|
|
c9cbc5fd55 | ||
|
|
ae03460a33 | ||
|
|
4b060a864a | ||
|
|
07e8e63ee6 | ||
|
|
ab1d4ed97f | ||
|
|
2bd7dfd5b8 | ||
|
|
c39049e5f5 |
33
README.md
33
README.md
@@ -13,27 +13,27 @@
|
||||
</a>
|
||||
<a target="_blank"
|
||||
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" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitee.com/lijiahangmax/orion-visor/stargazers">
|
||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
||||
href="https://gitee.com/dromara/orion-visor/stargazers">
|
||||
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitee.com/lijiahangmax/orion-visor/members">
|
||||
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
||||
href="https://gitee.com/dromara/orion-visor/members">
|
||||
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
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" />
|
||||
</a>
|
||||
<a target="_blank"
|
||||
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" />
|
||||
</a>
|
||||
</p>
|
||||
@@ -51,18 +51,19 @@
|
||||
|
||||
## 演示环境
|
||||
|
||||
演示地址: http://101.43.254.243:1081/
|
||||
演示账号: admin/admin
|
||||
|
||||
⭐ 体验后可以点一下 `star` 这对我很重要!
|
||||
🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
[github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor)
|
||||
* 🔗 演示地址: http://101.43.254.243:1081/
|
||||
* 🔏 演示账号: admin/admin
|
||||
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||
* 📛 演示环境请不要随便删除数据!
|
||||
* 📧 如果演示环境不可用请联系我!
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
# clone
|
||||
git clone https://github.com/lijiahangmax/orion-visor
|
||||
git clone https://github.com/dromara/orion-visor
|
||||
cd orion-visor
|
||||
# 启动
|
||||
docker compose up -d
|
||||
@@ -130,8 +131,8 @@ docker compose up -d
|
||||
|
||||
## 免责声明
|
||||
|
||||
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/lijiahangmax/orion-visor/blob/main/DISCLAIMER.md)
|
||||
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/dromara/orion-visor/blob/main/DISCLAIMER.md)
|
||||
|
||||
## License
|
||||
|
||||
本项目遵循 [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'
|
||||
services:
|
||||
orion-visor-service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.5
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.8
|
||||
ports:
|
||||
- 1081:80
|
||||
environment:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
- orion-visor-mysql
|
||||
- orion-visor-redis
|
||||
orion-visor-mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.5
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.8
|
||||
privileged: true
|
||||
ports:
|
||||
- 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/etc-mysql:/etc/mysql
|
||||
orion-visor-redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.5
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.8
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#/bin/bash
|
||||
docker compose down
|
||||
sh ./pull.sh
|
||||
# demo 启动
|
||||
if [ "$1" == "demo" ]; then
|
||||
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.0.5
|
||||
version=2.0.8
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.0.5
|
||||
version=2.0.8
|
||||
docker build -t orion-visor-redis:${version} .
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.0.5
|
||||
version=2.0.8
|
||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||
mv ../../orion-visor-ui/dist ./dist
|
||||
docker build -t orion-visor-service:${version} .
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<description>项目所有依赖</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.0.5</revision>
|
||||
<revision>2.0.8</revision>
|
||||
<spring.boot.version>2.7.17</spring.boot.version>
|
||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目公共基准包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<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} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.0.5";
|
||||
String VERSION = "2.0.8";
|
||||
|
||||
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;
|
||||
|
||||
int LOGIN_HISTORY_COUNT = 30;
|
||||
|
||||
Long NONE_ID = -1L;
|
||||
|
||||
Integer DEFAULT_VERSION = 1;
|
||||
|
||||
@@ -14,13 +14,19 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum MovePosition {
|
||||
|
||||
// 拖拽到目标元素上
|
||||
/**
|
||||
* 拖拽到目标元素上
|
||||
*/
|
||||
TOP(-1),
|
||||
|
||||
// 拖拽到目标元素中
|
||||
/**
|
||||
* 拖拽到目标元素中
|
||||
*/
|
||||
IN(0),
|
||||
|
||||
// 拖拽到目标元素下
|
||||
/**
|
||||
* 拖拽到目标元素下
|
||||
*/
|
||||
BOTTOM(1),
|
||||
|
||||
;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orion.visor.framework.common.handler.data;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.spring.SpringHolder;
|
||||
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
|
||||
* @since 2023/12/21 0:07
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public interface GenericsDataDefinition {
|
||||
|
||||
/**
|
||||
* 获取数据模型类型
|
||||
*
|
||||
* @return class
|
||||
*/
|
||||
Class<? extends GenericsDataModel> getModel();
|
||||
|
||||
/**
|
||||
* 获取数据处理策略
|
||||
*
|
||||
* @return class
|
||||
*/
|
||||
Class<? extends MapDataStrategy<? extends GenericsDataModel>> getStrategy();
|
||||
Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> getStrategyClass();
|
||||
|
||||
/**
|
||||
* 获取数据模型策略处理器
|
||||
*
|
||||
* @param <Model> Model
|
||||
* @param <Strategy> Strategy
|
||||
* @return StrategyBean
|
||||
* @param <M> Model
|
||||
* @param <S> Strategy
|
||||
* @return Strategy Bean
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
default <Model extends GenericsDataModel, Strategy extends MapDataStrategy<Model>> Strategy getStrategyBean() {
|
||||
return (Strategy) SpringHolder.getBean(this.getStrategy());
|
||||
default <M extends GenericsDataModel, S extends GenericsDataStrategy<M>> S getStrategy() {
|
||||
return (S) SpringHolder.getBean(this.getStrategyClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化对象
|
||||
*
|
||||
* @param json json
|
||||
* @param <Model> Model
|
||||
* @param serialModel serialModel
|
||||
* @param <M> Model
|
||||
* @return object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
default <Model extends GenericsDataModel> Model parse(String json) {
|
||||
return (Model) JSON.parseObject(json, this.getModel());
|
||||
default <M extends GenericsDataModel> M parse(String serialModel) {
|
||||
return (M) this.getStrategy().parse(serialModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转为视图对象
|
||||
*
|
||||
* @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 java.util.Map;
|
||||
|
||||
/**
|
||||
* 标准数据模型
|
||||
*
|
||||
@@ -20,4 +22,14 @@ public interface GenericsDataModel {
|
||||
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
|
||||
* @since 2023/12/20 22:09
|
||||
*/
|
||||
public interface GenericsDataStrategy<Model extends GenericsDataModel, View> {
|
||||
public interface GenericsDataStrategy<M extends GenericsDataModel> {
|
||||
|
||||
/**
|
||||
* 获取默认值
|
||||
*
|
||||
* @return 默认值
|
||||
*/
|
||||
Model 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);
|
||||
M getDefault();
|
||||
|
||||
/**
|
||||
* 执行完整验证链
|
||||
* <p>
|
||||
* preValid > updateFill > preValid
|
||||
* preValid > updateFill > valid
|
||||
*
|
||||
* @param beforeModel beforeModel
|
||||
* @param afterModel afterModel
|
||||
*/
|
||||
default void doValidChain(Model beforeModel, Model afterModel) {
|
||||
// 预校验参数
|
||||
this.preValid(afterModel);
|
||||
// 更新填充
|
||||
this.updateFill(beforeModel, afterModel);
|
||||
// 校验参数
|
||||
this.valid(afterModel);
|
||||
}
|
||||
void doValid(M beforeModel, M afterModel);
|
||||
|
||||
/**
|
||||
* 解析数据
|
||||
*
|
||||
* @param serialModel serialModel
|
||||
* @return model
|
||||
*/
|
||||
M parse(String serialModel);
|
||||
|
||||
/**
|
||||
* 转为视图配置
|
||||
*
|
||||
* @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>
|
||||
|
||||
<description>项目 banner 打印包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -36,24 +36,47 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
||||
@Value("${management.endpoints.web.base-path:''}")
|
||||
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
|
||||
public void run(ApplicationArguments args) {
|
||||
String line = AnsiAppender.create()
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n")
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n")
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n")
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: actuator endpoint ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + managementEndpoints + "\n")
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: admin console ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + adminSeverContextPath + "\n")
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: server 健康检测 ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "curl -X GET --location \"http://127.0.0.1:" + port + apiPrefix + "/server/bootstrap/health\"")
|
||||
.toString();
|
||||
AnsiAppender appender = AnsiAppender.create()
|
||||
.append(AnsiForeground.BRIGHT_GREEN, ":: orion-visor-launch v" + version + " 服务已启动(" + env + ") ::\n");
|
||||
// swagger 地址
|
||||
if (apiDocsEnabled) {
|
||||
appender.append(AnsiForeground.BRIGHT_GREEN, ":: swagger 文档 ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/doc.html\n");
|
||||
}
|
||||
// druid 控制台
|
||||
if (druidConsoleEnabled) {
|
||||
appender.append(AnsiForeground.BRIGHT_GREEN, ":: druid console ")
|
||||
.append(AnsiForeground.BRIGHT_BLUE, "http://127.0.0.1:" + port + "/druid/index.html\n");
|
||||
}
|
||||
// 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.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}:: SpringBoot Version ${AnsiColor.BLUE}${spring-boot.version}
|
||||
${AnsiColor.BRIGHT_GREEN}:: Active Profile ${AnsiColor.BLUE}${spring.profiles.active}
|
||||
${AnsiColor.BRIGHT_GREEN}:: Demo Mode ${AnsiColor.BLUE}${orion.demo}
|
||||
${AnsiColor.DEFAULT}
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目操作日志包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目数据源配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目数据脱敏包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目定时任务配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目日志配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -72,9 +72,9 @@ public class PrettyLogPrinterInterceptor extends AbstractLogPrinterInterceptor {
|
||||
}
|
||||
Method method = invocation.getMethod();
|
||||
// 方法签名
|
||||
requestLog.append("\tmethodSign: ").append(method.getDeclaringClass().getName()).append('#')
|
||||
.append(method.getName()).append("\n");
|
||||
// 参数
|
||||
// requestLog.append("\tmethodSign: ").append(method.getDeclaringClass().getName()).append('#')
|
||||
// .append(method.getName()).append("\n");
|
||||
// 方法参数
|
||||
requestLog.append("\tparameter: ").append(this.requestToString(method, invocation.getArguments()));
|
||||
log.info(requestLog.toString());
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ public class RowLogPrinterInterceptor extends AbstractLogPrinterInterceptor impl
|
||||
}
|
||||
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()));
|
||||
log.info("api请求-开始 {}", JSON.toJSONString(fields));
|
||||
fields.clear();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目监控配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目 mybatis 配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目 redis 配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
@@ -36,6 +37,7 @@ public class OrionRedisAutoConfiguration {
|
||||
* @param redisConnectionFactory factory
|
||||
* @return RedisTemplate
|
||||
*/
|
||||
@Primary
|
||||
@Bean
|
||||
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目 security 配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目存储层配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目 swagger 配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -38,10 +37,9 @@ import java.util.Optional;
|
||||
* @version 1.0.0
|
||||
* @since 2022/6/21 11:22
|
||||
*/
|
||||
@Profile({"dev"})
|
||||
@ConditionalOnClass({OpenAPI.class})
|
||||
@EnableConfigurationProperties(SwaggerConfig.class)
|
||||
@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true")
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
|
||||
public class OrionSwaggerAutoConfiguration {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目单元测试包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目 web 包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目 websocket 配置包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>项目组件包</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<modules>
|
||||
<module>orion-visor-framework-common</module>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>后端服务主项目容器 按需引用 orion-visor-module-xxx 依赖</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<!-- spring boot 配置所需依赖 -->
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
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.builder.SpringApplicationBuilder;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* application 启动类
|
||||
@@ -14,7 +24,35 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
public class LaunchApplication {
|
||||
|
||||
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
|
||||
min-idle: 1
|
||||
max-active: 5
|
||||
stat-view-servlet:
|
||||
enabled: false
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
@@ -15,6 +17,19 @@ spring:
|
||||
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:
|
||||
configuration:
|
||||
|
||||
@@ -10,10 +10,13 @@ spring:
|
||||
min-idle: 5
|
||||
# 最大连接池数量
|
||||
max-active: 20
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
# 控制台
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
login-username: ${DRUID_USERNAME:admin}
|
||||
login-password: ${DRUID_PASSWORD:admin}
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
@@ -31,6 +34,16 @@ spring:
|
||||
quartz:
|
||||
threadPool:
|
||||
threadCount: 10
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
enabled: true
|
||||
server:
|
||||
enabled: true
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
enabled-by-default: true
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
@@ -40,6 +53,7 @@ springdoc:
|
||||
|
||||
knife4j:
|
||||
enable: false
|
||||
production: true
|
||||
|
||||
orion:
|
||||
# 是否为演示模式
|
||||
|
||||
@@ -40,13 +40,14 @@ spring:
|
||||
# 最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
validation-query: SELECT 1
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
# 控制台
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
login-username:
|
||||
login-password:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
@@ -88,7 +89,7 @@ spring:
|
||||
misfireThreshold: 60000
|
||||
clusterCheckinInterval: 5000
|
||||
isClustered: true
|
||||
#连接池
|
||||
# 连接池
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 5
|
||||
@@ -98,12 +99,16 @@ spring:
|
||||
admin:
|
||||
context-path: /admin
|
||||
client:
|
||||
enabled: true
|
||||
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path}
|
||||
instance:
|
||||
service-host-type: IP
|
||||
server:
|
||||
enabled: true
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
enabled-by-default: true
|
||||
web:
|
||||
base-path: /actuator
|
||||
exposure:
|
||||
@@ -215,10 +220,10 @@ orion:
|
||||
title: orion-visor 运维平台
|
||||
description: 一站式运维服务平台
|
||||
version: ${orion.version}
|
||||
url: https://github.com/lijiahangmax/orion-visor
|
||||
url: https://github.com/dromara/orion-visor
|
||||
email: ljh1553488six@139.com
|
||||
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:
|
||||
infra:
|
||||
group: "infra - 基建模块"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目资产模块</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目资产模块</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -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.handler.data.GenericsDataDefinition;
|
||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
||||
import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel;
|
||||
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||
import com.orion.visor.module.asset.handler.host.config.strategy.HostSshConfigStrategy;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -24,7 +23,6 @@ public enum HostConfigTypeEnum implements GenericsDataDefinition {
|
||||
* SSH 配置
|
||||
*/
|
||||
SSH("ssh",
|
||||
HostSshConfigModel.class,
|
||||
HostSshConfigStrategy.class,
|
||||
EnableStatus.ENABLED.getValue()),
|
||||
|
||||
@@ -32,9 +30,7 @@ public enum HostConfigTypeEnum implements GenericsDataDefinition {
|
||||
|
||||
private final String type;
|
||||
|
||||
private final Class<? extends GenericsDataModel> model;
|
||||
|
||||
private final Class<? extends MapDataStrategy<? extends GenericsDataModel>> strategy;
|
||||
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||
|
||||
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.model.GenericsDataModel;
|
||||
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
|
||||
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.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||
import com.orion.visor.module.asset.handler.host.extra.strategy.HostLabelExtraStrategy;
|
||||
import com.orion.visor.module.asset.handler.host.extra.strategy.HostSshExtraStrategy;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -24,20 +22,18 @@ public enum HostExtraItemEnum implements GenericsDataDefinition {
|
||||
/**
|
||||
* 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 Class<? extends GenericsDataModel> model;
|
||||
|
||||
private final Class<? extends MapDataStrategy<? extends GenericsDataModel>> strategy;
|
||||
private final Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> strategyClass;
|
||||
|
||||
public static HostExtraItemEnum of(String type) {
|
||||
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.security.UpdatePasswordAction;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -24,61 +23,86 @@ import javax.validation.constraints.Size;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HostSftpConfig", description = "主机 SSH 配置")
|
||||
public class HostSshConfigModel implements GenericsDataModel, UpdatePasswordAction {
|
||||
|
||||
/**
|
||||
* ssh 端口
|
||||
*/
|
||||
@NotNull
|
||||
@Range(min = 1, max = 65535)
|
||||
@Schema(description = "ssh 端口")
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Size(max = 128)
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 认证方式
|
||||
*/
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "认证方式")
|
||||
private String authType;
|
||||
|
||||
/**
|
||||
* 系统类型
|
||||
*/
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "系统类型")
|
||||
private String osType;
|
||||
|
||||
@Schema(description = "密码")
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
@Schema(description = "身份id")
|
||||
/**
|
||||
* 身份id
|
||||
*/
|
||||
private Long identityId;
|
||||
|
||||
@Schema(description = "密钥id")
|
||||
/**
|
||||
* 密钥id
|
||||
*/
|
||||
private Long keyId;
|
||||
|
||||
/**
|
||||
* 连接超时时间
|
||||
*/
|
||||
@NotNull
|
||||
@Range(min = 0, max = 100000)
|
||||
@Schema(description = "连接超时时间")
|
||||
private Integer connectTimeout;
|
||||
|
||||
/**
|
||||
* SSH输出编码
|
||||
*/
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "SSH输出编码")
|
||||
private String charset;
|
||||
|
||||
/**
|
||||
* 文件名称编码
|
||||
*/
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "文件名称编码")
|
||||
private String fileNameCharset;
|
||||
|
||||
/**
|
||||
* 文件内容编码
|
||||
*/
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "文件内容编码")
|
||||
private String fileContentCharset;
|
||||
|
||||
@Schema(description = "是否使用新密码 仅参数")
|
||||
/**
|
||||
* 是否使用新密码 仅参数
|
||||
*/
|
||||
private Boolean useNewPassword;
|
||||
|
||||
@Schema(description = "是否已设置密码 仅返回")
|
||||
/**
|
||||
* 是否已设置密码 仅返回
|
||||
*/
|
||||
private Boolean hasPassword;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
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.Charsets;
|
||||
import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.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.utils.Valid;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机 SSH 配置策略
|
||||
@@ -28,7 +26,7 @@ import java.util.Map;
|
||||
* @since 2023/9/19 14:26
|
||||
*/
|
||||
@Component
|
||||
public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel> {
|
||||
public class HostSshConfigStrategy extends AbstractGenericsDataStrategy<HostSshConfigModel> {
|
||||
|
||||
@Resource
|
||||
private HostKeyDAO hostKeyDAO;
|
||||
@@ -40,6 +38,10 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
||||
|
||||
private static final String USERNAME = "root";
|
||||
|
||||
public HostSshConfigStrategy() {
|
||||
super(HostSshConfigModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostSshConfigModel getDefault() {
|
||||
return HostSshConfigModel.builder()
|
||||
@@ -55,7 +57,7 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preValid(HostSshConfigModel model) {
|
||||
protected void preValid(HostSshConfigModel model) {
|
||||
// 验证认证类型
|
||||
Valid.valid(HostSshAuthTypeEnum::of, model.getAuthType());
|
||||
// 验证系统版本
|
||||
@@ -77,13 +79,13 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valid(HostSshConfigModel model) {
|
||||
protected void valid(HostSshConfigModel model) {
|
||||
// 验证填充后的参数
|
||||
Valid.valid(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(HostSshConfigModel beforeModel, HostSshConfigModel afterModel) {
|
||||
protected void updateFill(HostSshConfigModel beforeModel, HostSshConfigModel afterModel) {
|
||||
// 加密密码
|
||||
this.checkEncryptPassword(beforeModel, afterModel);
|
||||
afterModel.setHasPassword(null);
|
||||
@@ -91,14 +93,12 @@ public class HostSshConfigStrategy implements MapDataStrategy<HostSshConfigModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toView(String config) {
|
||||
if (config == null) {
|
||||
return null;
|
||||
public void toView(HostSshConfigModel model) {
|
||||
if (model == null) {
|
||||
return;
|
||||
}
|
||||
HostSshConfigModel model = JSON.parseObject(config, HostSshConfigModel.class);
|
||||
model.setHasPassword(Strings.isNotBlank(model.getPassword()));
|
||||
model.setPassword(null);
|
||||
return JSON.parseObject(JSON.toJSONString(model));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.orion.visor.module.asset.handler.host.exec.command;
|
||||
|
||||
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.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.entity.domain.ExecHostLogDO;
|
||||
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.dto.ExecCommandHostDTO;
|
||||
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.asset.handler.host.exec.log.manager.ExecLogManager;
|
||||
import com.orion.visor.module.asset.service.HostTerminalService;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -9,8 +9,8 @@ import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.net.host.ssh.ExitCode;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
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.dto.ExecCommandHostDTO;
|
||||
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandDTO;
|
||||
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||
|
||||
/**
|
||||
* 命令执行器 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.TimeoutEndpoint;
|
||||
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.model.ExecCommandDTO;
|
||||
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||
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.enums.ExecHostStatusEnum;
|
||||
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.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.entity.dto.message.SystemMessageDTO;
|
||||
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.Builder;
|
||||
import lombok.Data;
|
||||
@@ -19,31 +18,46 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "ExecCommandDTO", description = "批量执行启动对象")
|
||||
public class ExecCommandDTO {
|
||||
|
||||
@Schema(description = "logId")
|
||||
/**
|
||||
* logId
|
||||
*/
|
||||
private Long logId;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
@Schema(description = "执行描述")
|
||||
/**
|
||||
* 执行描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
@Schema(description = "执行序列")
|
||||
/**
|
||||
* 执行序列
|
||||
*/
|
||||
private Integer execSeq;
|
||||
|
||||
@Schema(description = "超时时间")
|
||||
/**
|
||||
* 超时时间
|
||||
*/
|
||||
private Integer timeout;
|
||||
|
||||
@Schema(description = "是否使用脚本执行")
|
||||
/**
|
||||
* 是否使用脚本执行
|
||||
*/
|
||||
private Boolean scriptExec;
|
||||
|
||||
@Schema(description = "执行主机")
|
||||
/**
|
||||
* 执行主机
|
||||
*/
|
||||
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;
|
||||
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.constant.ExtraFieldConst;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
||||
@@ -29,6 +30,7 @@ import javax.annotation.Resource;
|
||||
@Component
|
||||
public class ExecLogTailHandler extends AbstractWebSocketHandler {
|
||||
|
||||
@Keep
|
||||
@Resource
|
||||
private FileClient logsFileClient;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.extra.model;
|
||||
|
||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,13 +17,16 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HostLabelExtraModel", description = "主机拓展信息 - 标签模型")
|
||||
public class HostLabelExtraModel implements GenericsDataModel {
|
||||
|
||||
@Schema(description = "别名")
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
private String color;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.extra.model;
|
||||
|
||||
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,19 +17,26 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HostExtraSshModel", description = "主机拓展信息 - ssh 模型")
|
||||
public class HostSshExtraModel implements GenericsDataModel {
|
||||
|
||||
@Schema(description = "认证方式")
|
||||
/**
|
||||
* 认证方式
|
||||
*/
|
||||
private String authType;
|
||||
|
||||
@Schema(description = "认证方式")
|
||||
/**
|
||||
* 认证方式
|
||||
*/
|
||||
private String username;
|
||||
|
||||
@Schema(description = "主机密钥")
|
||||
/**
|
||||
* 主机密钥
|
||||
*/
|
||||
private Long keyId;
|
||||
|
||||
@Schema(description = "主机身份")
|
||||
/**
|
||||
* 主机身份
|
||||
*/
|
||||
private Long identityId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orion.visor.module.asset.handler.host.extra.strategy;
|
||||
|
||||
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 org.springframework.stereotype.Component;
|
||||
|
||||
@@ -13,7 +13,11 @@ import org.springframework.stereotype.Component;
|
||||
* @since 2024/2/29 23:16
|
||||
*/
|
||||
@Component
|
||||
public class HostLabelExtraStrategy implements MapDataStrategy<HostLabelExtraModel> {
|
||||
public class HostLabelExtraStrategy extends AbstractGenericsDataStrategy<HostLabelExtraModel> {
|
||||
|
||||
public HostLabelExtraStrategy() {
|
||||
super(HostLabelExtraModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.module.asset.dao.HostIdentityDAO;
|
||||
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
||||
* @since 2023/12/20 22:17
|
||||
*/
|
||||
@Component
|
||||
public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel> {
|
||||
public class HostSshExtraStrategy extends AbstractGenericsDataStrategy<HostSshExtraModel> {
|
||||
|
||||
@Resource
|
||||
private HostKeyDAO hostKeyDAO;
|
||||
@@ -33,6 +33,10 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
||||
@Resource
|
||||
private DataPermissionApi dataPermissionApi;
|
||||
|
||||
public HostSshExtraStrategy() {
|
||||
super(HostSshExtraModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostSshExtraModel getDefault() {
|
||||
return HostSshExtraModel.builder()
|
||||
@@ -40,10 +44,6 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(HostSshExtraModel beforeModel, HostSshExtraModel afterModel) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preValid(HostSshExtraModel model) {
|
||||
HostExtraSshAuthTypeEnum authType = Valid.valid(HostExtraSshAuthTypeEnum::of, model.getAuthType());
|
||||
@@ -79,8 +79,4 @@ public class HostSshExtraStrategy implements MapDataStrategy<HostSshExtraModel>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valid(HostSshExtraModel model) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -17,13 +16,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "TerminalBasePayload", description = "终端基础 payload")
|
||||
public class TerminalBasePayload {
|
||||
|
||||
@Schema(description = "会话id")
|
||||
/**
|
||||
* 会话id
|
||||
*/
|
||||
private String sessionId;
|
||||
|
||||
@Schema(description = "消息类型")
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model;
|
||||
|
||||
import com.orion.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,35 +16,51 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "TerminalConfig", description = "主机终端连接参数")
|
||||
public class TerminalConfig {
|
||||
|
||||
@Schema(description = "logId")
|
||||
/**
|
||||
* logId
|
||||
*/
|
||||
private Long logId;
|
||||
|
||||
@Schema(description = "主机id")
|
||||
/**
|
||||
* 主机id
|
||||
*/
|
||||
private Long hostId;
|
||||
|
||||
@Schema(description = "主机名称")
|
||||
/**
|
||||
* 主机名称
|
||||
*/
|
||||
private String hostName;
|
||||
|
||||
@Schema(description = "主机地址")
|
||||
/**
|
||||
* 主机地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
@Schema(description = "cols")
|
||||
/**
|
||||
* cols
|
||||
*/
|
||||
private Integer cols;
|
||||
|
||||
@Schema(description = "rows")
|
||||
/**
|
||||
* rows
|
||||
*/
|
||||
private Integer rows;
|
||||
|
||||
@Schema(description = "SSH输出编码")
|
||||
/**
|
||||
* SSH输出编码
|
||||
*/
|
||||
private String charset;
|
||||
|
||||
@Schema(description = "文件名称编码")
|
||||
/**
|
||||
* 文件名称编码
|
||||
*/
|
||||
private String fileNameCharset;
|
||||
|
||||
@Schema(description = "文件内容编码")
|
||||
/**
|
||||
* 文件内容编码
|
||||
*/
|
||||
private String fileContentCharset;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,10 +19,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpBaseRequest", description = "sftp 基础请求 实体对象")
|
||||
public class SftpBaseRequest extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "path")
|
||||
/**
|
||||
* path
|
||||
*/
|
||||
private String path;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,10 +20,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpChangeModRequest", description = "sftp 修改文件权限 实体对象")
|
||||
public class SftpChangeModRequest extends SftpBaseRequest {
|
||||
|
||||
@Schema(description = "10进制的8进制 权限")
|
||||
/**
|
||||
* 10进制的8进制 权限
|
||||
*/
|
||||
private Integer mod;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,10 +20,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpDownloadDirectoryFlatRequest", description = "sftp 下载文件夹展开文件 实体对象")
|
||||
public class SftpDownloadFlatDirectoryRequest extends SftpBaseRequest {
|
||||
|
||||
@Schema(description = "当前路径")
|
||||
/**
|
||||
* 当前路径
|
||||
*/
|
||||
private String currentPath;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,10 +20,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpListRequest", description = "sftp 列表请求 实体对象")
|
||||
public class SftpListRequest extends SftpBaseRequest {
|
||||
|
||||
@Schema(description = "是否显示隐藏文件")
|
||||
/**
|
||||
* 是否显示隐藏文件
|
||||
*/
|
||||
private Integer showHiddenFile;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,10 +20,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpMoveRequest", description = "sftp 移动文件 实体对象")
|
||||
public class SftpMoveRequest extends SftpBaseRequest {
|
||||
|
||||
@Schema(description = "target")
|
||||
/**
|
||||
* target
|
||||
*/
|
||||
private String target;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,10 +20,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpSetContentRequest", description = "sftp 设置文件内容 实体对象")
|
||||
public class SftpSetContentRequest extends SftpBaseRequest {
|
||||
|
||||
@Schema(description = "content")
|
||||
/**
|
||||
* content
|
||||
*/
|
||||
private String content;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -22,10 +21,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SshInputRequest", description = "ssh 输入请求 实体对象")
|
||||
public class SshInputRequest extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "command")
|
||||
/**
|
||||
* command
|
||||
*/
|
||||
private String command;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -22,13 +21,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SshResizeRequest", description = "ssh 修改大小请求 实体对象")
|
||||
public class SshResizeRequest extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "列数")
|
||||
/**
|
||||
* 列数
|
||||
*/
|
||||
private Integer cols;
|
||||
|
||||
@Schema(description = "行数")
|
||||
/**
|
||||
* 行数
|
||||
*/
|
||||
private Integer rows;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -22,13 +21,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalConnectRequest", description = "主机连接检查请求 实体对象")
|
||||
public class TerminalCheckRequest extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "主机id")
|
||||
/**
|
||||
* 主机id
|
||||
*/
|
||||
private Long hostId;
|
||||
|
||||
@Schema(description = "连接类型")
|
||||
/**
|
||||
* 连接类型
|
||||
*/
|
||||
private String connectType;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.request;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -22,16 +21,21 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalConnectRequest", description = "终端连接请求 实体对象")
|
||||
public class TerminalConnectRequest extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "伪终端类型")
|
||||
/**
|
||||
* 伪终端类型
|
||||
*/
|
||||
private String terminalType;
|
||||
|
||||
@Schema(description = "列数")
|
||||
/**
|
||||
* 列数
|
||||
*/
|
||||
private Integer cols;
|
||||
|
||||
@Schema(description = "行数")
|
||||
/**
|
||||
* 行数
|
||||
*/
|
||||
private Integer rows;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,13 +19,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpBaseResponse", description = "sftp 基础响应 实体对象")
|
||||
public class SftpBaseResponse extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "结果")
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "消息")
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -19,13 +18,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpDownloadFlatDirectoryResponse", description = "sftp 下载文件夹展开文件 实体对象")
|
||||
public class SftpDownloadFlatDirectoryResponse extends SftpBaseResponse {
|
||||
|
||||
@Schema(description = "currentPath")
|
||||
/**
|
||||
* currentPath
|
||||
*/
|
||||
private String currentPath;
|
||||
|
||||
@Schema(description = "body")
|
||||
/**
|
||||
* body
|
||||
*/
|
||||
private String body;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -19,37 +18,56 @@ import java.util.Date;
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SftpFileResponse", description = "sftp 文件响应 实体对象")
|
||||
public class SftpFileVO {
|
||||
|
||||
@Schema(description = "名称")
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
@Schema(description = "绝对路径")
|
||||
/**
|
||||
* 绝对路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
@Schema(description = "文件后缀")
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String suffix;
|
||||
|
||||
@Schema(description = "文件大小(byte)")
|
||||
/**
|
||||
* 文件大小(byte)
|
||||
*/
|
||||
private Long size;
|
||||
|
||||
@Schema(description = "属性")
|
||||
/**
|
||||
* 属性
|
||||
*/
|
||||
private String attr;
|
||||
|
||||
@Schema(description = "是否为目录")
|
||||
/**
|
||||
* 是否为目录
|
||||
*/
|
||||
private Boolean isDir;
|
||||
|
||||
@Schema(description = "10进制表现的8进制权限")
|
||||
/**
|
||||
* 10进制表现的8进制权限
|
||||
*/
|
||||
private Integer permission;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer uid;
|
||||
|
||||
@Schema(description = "组id")
|
||||
/**
|
||||
* 组id
|
||||
*/
|
||||
private Integer gid;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -19,13 +18,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpGetContentResponse", description = "sftp 获取内容响应 实体对象")
|
||||
public class SftpGetContentResponse extends SftpBaseResponse {
|
||||
|
||||
@Schema(description = "path")
|
||||
/**
|
||||
* path
|
||||
*/
|
||||
private String path;
|
||||
|
||||
@Schema(description = "content")
|
||||
/**
|
||||
* content
|
||||
*/
|
||||
private String content;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -19,13 +18,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SftpListResponse", description = "sftp 列表响应 实体对象")
|
||||
public class SftpListResponse extends SftpBaseResponse {
|
||||
|
||||
@Schema(description = "path")
|
||||
/**
|
||||
* path
|
||||
*/
|
||||
private String path;
|
||||
|
||||
@Schema(description = "body")
|
||||
/**
|
||||
* body
|
||||
*/
|
||||
private String body;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,10 +19,11 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SshOutputResponse", description = "ssh 输出响应 实体对象")
|
||||
public class SshOutputResponse extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "body")
|
||||
/**
|
||||
* body
|
||||
*/
|
||||
private String body;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,13 +19,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalCheckResponse", description = "主机连接检查响应 实体对象")
|
||||
public class TerminalCheckResponse extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "检查结果")
|
||||
/**
|
||||
* 检查结果
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,13 +19,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalCloseResponse", description = "主机连接关闭响应 实体对象")
|
||||
public class TerminalCloseResponse extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "是否为强制关闭")
|
||||
/**
|
||||
* 是否为强制关闭
|
||||
*/
|
||||
private Integer forceClose;
|
||||
|
||||
@Schema(description = "关闭信息")
|
||||
/**
|
||||
* 关闭信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.terminal.model.response;
|
||||
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalBasePayload;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,13 +19,16 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "TerminalConnectResponse", description = "终端连接响应 实体对象")
|
||||
public class TerminalConnectResponse extends TerminalBasePayload {
|
||||
|
||||
@Schema(description = "检查结果")
|
||||
/**
|
||||
* 检查结果
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.transfer.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -17,13 +16,16 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SftpFileBackupParams", description = "sftp 文件备份参数")
|
||||
public class SftpFileBackupParams {
|
||||
|
||||
@Schema(description = "文件名称")
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "时间戳")
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.transfer.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -17,16 +16,21 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "FileOperatorRequest", description = "文件操作请求 实体对象")
|
||||
public class TransferOperatorRequest {
|
||||
|
||||
@Schema(description = "文件路径")
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
@Schema(description = "type")
|
||||
/**
|
||||
* type
|
||||
*/
|
||||
private String type;
|
||||
|
||||
@Schema(description = "主机id")
|
||||
/**
|
||||
* 主机id
|
||||
*/
|
||||
private Long hostId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.transfer.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -17,28 +16,41 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "FileOperatorResponse", description = "文件操作响应 实体对象")
|
||||
public class TransferOperatorResponse {
|
||||
|
||||
@Schema(description = "channelId")
|
||||
/**
|
||||
* channelId
|
||||
*/
|
||||
private String channelId;
|
||||
|
||||
@Schema(description = "type")
|
||||
/**
|
||||
* type
|
||||
*/
|
||||
private String type;
|
||||
|
||||
@Schema(description = "主机id")
|
||||
/**
|
||||
* 主机id
|
||||
*/
|
||||
private Long hostId;
|
||||
|
||||
@Schema(description = "是否成功")
|
||||
/**
|
||||
* 是否成功
|
||||
*/
|
||||
private Boolean success;
|
||||
|
||||
@Schema(description = "传输的大小")
|
||||
/**
|
||||
* 传输的大小
|
||||
*/
|
||||
private Integer currentSize;
|
||||
|
||||
@Schema(description = "transferToken")
|
||||
/**
|
||||
* transferToken
|
||||
*/
|
||||
private String transferToken;
|
||||
|
||||
@Schema(description = "消息")
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.asset.handler.host.upload.dto;
|
||||
package com.orion.visor.module.asset.handler.host.upload.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -17,22 +16,31 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "FileUploadFileItemDTO", description = "文件上传文件对象")
|
||||
public class FileUploadFileItemDTO {
|
||||
|
||||
@Schema(description = "id")
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "fileId")
|
||||
/**
|
||||
* fileId
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
@Schema(description = "远程路径")
|
||||
/**
|
||||
* 远程路径
|
||||
*/
|
||||
private String remotePath;
|
||||
|
||||
@Schema(description = "当前大小")
|
||||
/**
|
||||
* 当前大小
|
||||
*/
|
||||
private Long current;
|
||||
|
||||
@Schema(description = "状态")
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -15,8 +15,8 @@ import com.orion.visor.module.asset.entity.domain.UploadTaskDO;
|
||||
import com.orion.visor.module.asset.entity.domain.UploadTaskFileDO;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskFileStatusEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskStatusEnum;
|
||||
import com.orion.visor.module.asset.handler.host.upload.dto.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.manager.FileUploadTaskManager;
|
||||
import com.orion.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.uploader.FileUploader;
|
||||
import com.orion.visor.module.asset.handler.host.upload.uploader.IFileUploader;
|
||||
import com.orion.visor.module.asset.service.UploadTaskService;
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.orion.visor.module.asset.entity.domain.UploadTaskFileDO;
|
||||
import com.orion.visor.module.asset.entity.dto.HostTerminalConnectDTO;
|
||||
import com.orion.visor.module.asset.enums.HostSshOsTypeEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskFileStatusEnum;
|
||||
import com.orion.visor.module.asset.handler.host.upload.dto.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.service.HostTerminalService;
|
||||
import com.orion.visor.module.asset.service.UploadTaskService;
|
||||
import com.orion.visor.module.asset.utils.SftpUtils;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orion.visor.module.asset.handler.host.upload.uploader;
|
||||
|
||||
import com.orion.lang.able.SafeCloseable;
|
||||
import com.orion.visor.module.asset.handler.host.upload.dto.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.orion.lang.utils.json.matcher.ReplacementFormatter;
|
||||
import com.orion.lang.utils.json.matcher.ReplacementFormatters;
|
||||
import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.constant.PathConst;
|
||||
@@ -36,8 +37,8 @@ import com.orion.visor.module.asset.entity.vo.ExecLogVO;
|
||||
import com.orion.visor.module.asset.enums.*;
|
||||
import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel;
|
||||
import com.orion.visor.module.asset.handler.host.exec.command.ExecTaskExecutors;
|
||||
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.model.ExecCommandDTO;
|
||||
import com.orion.visor.module.asset.handler.host.exec.command.model.ExecCommandHostDTO;
|
||||
import com.orion.visor.module.asset.service.AssetAuthorizedDataService;
|
||||
import com.orion.visor.module.asset.service.ExecCommandService;
|
||||
import com.orion.visor.module.asset.service.HostConfigService;
|
||||
@@ -67,6 +68,7 @@ public class ExecCommandServiceImpl implements ExecCommandService {
|
||||
|
||||
private static final int DESC_OMIT = 60;
|
||||
|
||||
@Keep
|
||||
@Resource
|
||||
private FileClient logsFileClient;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.io.Files1;
|
||||
import com.orion.lang.utils.io.Streams;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.constant.PathConst;
|
||||
@@ -80,6 +81,7 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
@Resource
|
||||
private HostConfigService hostConfigService;
|
||||
|
||||
@Keep
|
||||
@Resource
|
||||
private FileClient logsFileClient;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.enums.BooleanBit;
|
||||
import com.orion.visor.framework.common.enums.EnableStatus;
|
||||
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.framework.common.utils.Valid;
|
||||
import com.orion.visor.module.asset.convert.HostConfigConvert;
|
||||
import com.orion.visor.module.asset.dao.HostConfigDAO;
|
||||
@@ -53,7 +53,7 @@ public class HostConfigServiceImpl implements HostConfigService {
|
||||
// 转换
|
||||
HostConfigVO vo = HostConfigConvert.MAPPER.to(config);
|
||||
// 获取配置
|
||||
Map<String, Object> configMap = configType.getStrategyBean().toView(config.getConfig());
|
||||
Map<String, Object> configMap = configType.toView(config.getConfig()).toMap();
|
||||
vo.setConfig(configMap);
|
||||
return vo;
|
||||
}
|
||||
@@ -121,10 +121,10 @@ public class HostConfigServiceImpl implements HostConfigService {
|
||||
OperatorLogs.add(OperatorLogs.TYPE, type.getType());
|
||||
// 检查版本
|
||||
Valid.eq(record.getVersion(), request.getVersion(), ErrorMessage.DATA_MODIFIED);
|
||||
MapDataStrategy<GenericsDataModel> strategy = type.getStrategyBean();
|
||||
GenericsDataStrategy<GenericsDataModel> strategy = type.getStrategy();
|
||||
GenericsDataModel beforeConfig = type.parse(record.getConfig());
|
||||
// 更新前校验
|
||||
strategy.doValidChain(beforeConfig, newConfig);
|
||||
strategy.doValid(beforeConfig, newConfig);
|
||||
// 修改配置
|
||||
HostConfigDO update = new HostConfigDO();
|
||||
update.setId(record.getId());
|
||||
@@ -225,7 +225,7 @@ public class HostConfigServiceImpl implements HostConfigService {
|
||||
insert.setHostId(hostId);
|
||||
insert.setType(type.getType());
|
||||
insert.setStatus(type.getDefaultStatus());
|
||||
insert.setConfig(type.getStrategyBean().getDefault().serial());
|
||||
insert.setConfig(type.getStrategy().getDefault().serial());
|
||||
insert.setVersion(Const.DEFAULT_VERSION);
|
||||
return insert;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class HostConfigServiceImpl implements HostConfigService {
|
||||
}
|
||||
// 转为视图
|
||||
HostConfigVO vo = HostConfigConvert.MAPPER.to(row);
|
||||
Map<String, Object> config = type.getStrategyBean().toView(row.getConfig());
|
||||
Map<String, Object> config = type.toView(row.getConfig()).toMap();
|
||||
vo.setConfig(config);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.orion.visor.module.asset.service.impl;
|
||||
import com.orion.lang.function.Functions;
|
||||
import com.orion.lang.utils.collect.Maps;
|
||||
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.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostExtraQueryRequest;
|
||||
@@ -98,7 +98,7 @@ public class HostExtraServiceImpl implements HostExtraService {
|
||||
Long hostId = request.getHostId();
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
HostExtraItemEnum item = Valid.valid(HostExtraItemEnum::of, request.getItem());
|
||||
MapDataStrategy<GenericsDataModel> strategy = item.getStrategyBean();
|
||||
GenericsDataStrategy<GenericsDataModel> strategy = item.getStrategy();
|
||||
// 查询原始配置
|
||||
DataExtraQueryDTO query = DataExtraQueryDTO.builder()
|
||||
.userId(userId)
|
||||
@@ -114,7 +114,7 @@ public class HostExtraServiceImpl implements HostExtraService {
|
||||
GenericsDataModel newExtra = item.parse(request.getExtra());
|
||||
GenericsDataModel beforeExtra = item.parse(beforeExtraItem.getValue());
|
||||
// 更新验证
|
||||
strategy.doValidChain(beforeExtra, newExtra);
|
||||
strategy.doValid(beforeExtra, newExtra);
|
||||
// 更新配置
|
||||
return dataExtraApi.updateExtraValue(beforeExtraItem.getId(), newExtra.serial());
|
||||
}
|
||||
@@ -129,12 +129,11 @@ public class HostExtraServiceImpl implements HostExtraService {
|
||||
* @return viewMap
|
||||
*/
|
||||
private Map<String, Object> checkItemAndToView(HostExtraItemEnum item, String extraValue, Long userId, Long hostId) {
|
||||
MapDataStrategy<GenericsDataModel> strategy = item.getStrategyBean();
|
||||
if (extraValue == null) {
|
||||
// 初始化默认数据
|
||||
extraValue = this.checkInitItem(item, userId, hostId);
|
||||
}
|
||||
return strategy.toView(extraValue);
|
||||
return item.toView(extraValue).toMap();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +145,7 @@ public class HostExtraServiceImpl implements HostExtraService {
|
||||
* @return defaultValue
|
||||
*/
|
||||
private String checkInitItem(HostExtraItemEnum item, Long userId, Long hostId) {
|
||||
MapDataStrategy<GenericsDataModel> strategy = item.getStrategyBean();
|
||||
GenericsDataStrategy<GenericsDataModel> strategy = item.getStrategy();
|
||||
// 初始化默认数据
|
||||
String extraValue = strategy.getDefault().serial();
|
||||
// 插入默认值
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.orion.lang.utils.collect.Maps;
|
||||
import com.orion.lang.utils.io.Files1;
|
||||
import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
@@ -37,7 +38,7 @@ import com.orion.visor.module.asset.enums.HostConfigTypeEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskFileStatusEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskStatusEnum;
|
||||
import com.orion.visor.module.asset.handler.host.upload.FileUploadTasks;
|
||||
import com.orion.visor.module.asset.handler.host.upload.dto.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.manager.FileUploadTaskManager;
|
||||
import com.orion.visor.module.asset.handler.host.upload.task.IFileUploadTask;
|
||||
import com.orion.visor.module.asset.handler.host.upload.uploader.IFileUploader;
|
||||
@@ -86,6 +87,7 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
@Resource
|
||||
private FileUploadTaskManager fileUploadTaskManager;
|
||||
|
||||
@Keep
|
||||
@Resource
|
||||
private FileClient localFileClient;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.task;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.io.Files1;
|
||||
import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.common.utils.LockerUtils;
|
||||
import com.orion.visor.module.asset.dao.ExecHostLogDAO;
|
||||
@@ -37,6 +38,7 @@ public class ExecLogFileAutoClearTask {
|
||||
@Resource
|
||||
private AppExecLogConfig appExecLogConfig;
|
||||
|
||||
@Keep
|
||||
@Resource
|
||||
private FileClient logsFileClient;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>项目资产模块</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<modules>
|
||||
<module>orion-visor-module-asset-provider</module>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目基建模块 用户 菜单 日志等</description>
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.orion.visor.module.infra.handler.preference.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orion.lang.utils.Refs;
|
||||
import com.orion.lang.utils.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 偏好
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/8 13:54
|
||||
*/
|
||||
public interface PreferenceModel {
|
||||
|
||||
/**
|
||||
* 转为 map
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
default Map<String, String> toMap() {
|
||||
JSONObject map = JSON.parseObject(JSON.toJSONString(this));
|
||||
return Maps.map(map, Function.identity(), Refs::json);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user