Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2df3f2fa1a | ||
|
|
d6048f78f0 | ||
|
|
f73fa14bfd | ||
|
|
fd88c725d3 | ||
|
|
3a16f9d9ab | ||
|
|
de9b89d805 | ||
|
|
a05c387ba1 | ||
|
|
3cb6e5a2d4 | ||
|
|
104a9a0aa3 | ||
|
|
d7b747eac4 | ||
|
|
d2949c11f3 | ||
|
|
cd05f71173 | ||
|
|
e0dca73369 | ||
|
|
b8599a6693 | ||
|
|
a0adb415fa | ||
|
|
6c60756e54 | ||
|
|
ee9f51ce7d | ||
|
|
924b46b41a | ||
|
|
1fca5a1912 | ||
|
|
120eb1ee69 | ||
|
|
252c538571 | ||
|
|
1eec373b7e | ||
|
|
aa9b96a9c1 | ||
|
|
059fb30aa4 | ||
|
|
2afaf7ad34 | ||
|
|
076a0956c5 | ||
|
|
4a91ec47bf | ||
|
|
1066b43b3d | ||
|
|
3f78125c43 | ||
|
|
144a44673b |
14
README.md
14
README.md
@@ -51,7 +51,7 @@
|
||||
|
||||
## 演示环境
|
||||
|
||||
* 🔗 演示地址: http://101.43.254.243:1081/
|
||||
* 🔗 演示地址: https://dv.orionsec.cn/
|
||||
* 🔏 演示账号: admin/admin
|
||||
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor/overview)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
```bash
|
||||
# clone
|
||||
git clone https://github.com/dromara/orion-visor
|
||||
git clone --depth=1 https://github.com/dromara/orion-visor
|
||||
cd orion-visor
|
||||
# 启动
|
||||
docker compose up -d
|
||||
@@ -72,11 +72,11 @@ docker compose up -d
|
||||
|
||||
## 项目文档
|
||||
|
||||
* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/)
|
||||
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html)
|
||||
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html)
|
||||
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html)
|
||||
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html)
|
||||
* [文档地址](https://visor.orionsec.cn/)
|
||||
* [安装文档](https://visor.orionsec.cn/quickstart/docker.html)
|
||||
* [更新日志](https://visor.orionsec.cn/update/change-log.html)
|
||||
* [操作手册](https://visor.orionsec.cn/operator/asset.html)
|
||||
* [常见问题](https://visor.orionsec.cn/support/faq.html)
|
||||
|
||||
## 技术栈
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.6
|
||||
privileged: true
|
||||
ports:
|
||||
- 1081:80
|
||||
@@ -32,7 +32,7 @@ services:
|
||||
- mysql
|
||||
- redis
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.6
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
@@ -52,7 +52,7 @@ services:
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.6
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.6
|
||||
privileged: true
|
||||
ports:
|
||||
- ${SERVICE_PORT:-1081}:80
|
||||
@@ -19,9 +19,9 @@ services:
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/service/root-orion:/root/orion
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
|
||||
interval: 3s
|
||||
interval: 15s
|
||||
timeout: 300s
|
||||
retries: 200
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
depends_on:
|
||||
mysql:
|
||||
@@ -32,7 +32,7 @@ services:
|
||||
- mysql
|
||||
- redis
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.6
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
@@ -47,12 +47,12 @@ services:
|
||||
- ${VOLUME_BASE:-/data/orion-visor-space/docker-volumes}/mysql/etc-mysql:/etc/mysql
|
||||
healthcheck:
|
||||
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
|
||||
interval: 3s
|
||||
interval: 15s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.6
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
@@ -63,12 +63,12 @@ services:
|
||||
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 3s
|
||||
interval: 15s
|
||||
timeout: 60s
|
||||
retries: 10
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
adminer:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.6
|
||||
ports:
|
||||
- 8081:8080
|
||||
depends_on:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
version=2.1.3
|
||||
version=2.1.6
|
||||
docker build -t orion-visor-adminer:${version} .
|
||||
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
|
||||
|
||||
@@ -17,7 +17,7 @@ items:
|
||||
code: 200
|
||||
- name: userPermission
|
||||
request:
|
||||
api: /orion-visor/api/infra/permission/user
|
||||
api: /orion-visor/api/infra/user-permission/user
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
expect:
|
||||
@@ -26,7 +26,7 @@ items:
|
||||
msg: "success"
|
||||
- name: menu
|
||||
request:
|
||||
api: /orion-visor/api/infra/permission/menu
|
||||
api: /orion-visor/api/infra/user-permission/menu
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
expect:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.1.3
|
||||
version=2.1.6
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.1.3
|
||||
version=2.1.6
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
version=2.1.3
|
||||
version=2.1.6
|
||||
docker build -t orion-visor-redis:${version} .
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.1.3
|
||||
version=2.1.6
|
||||
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} .
|
||||
|
||||
@@ -29,7 +29,7 @@ server {
|
||||
location /orion-visor/api {
|
||||
proxy_pass http://localhost:9200/orion-visor/api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.1.3</revision>
|
||||
<revision>2.1.6</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>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.orion.visor.framework.common.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 保留
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/6 15:26
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Keep {
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.1.3";
|
||||
String VERSION = "2.1.6";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
|
||||
@@ -29,4 +29,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons
|
||||
|
||||
String SYSTEM_USERNAME = "system";
|
||||
|
||||
int BATCH_COUNT = 500;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.orion.visor.framework.common.constant;
|
||||
|
||||
import com.orion.lang.exception.ApplicationException;
|
||||
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*
|
||||
@@ -97,6 +100,14 @@ public interface ErrorMessage {
|
||||
|
||||
String TASK_ABSENT = "任务不存在";
|
||||
|
||||
String CONNECT_ERROR = "连接失败";
|
||||
|
||||
String AUTH_ERROR = "认证失败";
|
||||
|
||||
String SCRIPT_UPLOAD_ERROR = "脚本上传失败";
|
||||
|
||||
String EXEC_ERROR = "执行失败";
|
||||
|
||||
String ILLEGAL_STATUS = "当前状态不支持此操作";
|
||||
|
||||
String CHECK_AUTHORIZED_HOST = "请选择已授权的主机";
|
||||
@@ -111,4 +122,41 @@ public interface ErrorMessage {
|
||||
|
||||
String UNABLE_DOWNLOAD_FOLDER = "无法下载文件夹";
|
||||
|
||||
/**
|
||||
* 是否为业务异常
|
||||
*
|
||||
* @param ex ex
|
||||
* @return biz exception
|
||||
*/
|
||||
static boolean isBizException(Exception ex) {
|
||||
if (ex == null) {
|
||||
return false;
|
||||
}
|
||||
return ex instanceof InvalidArgumentException
|
||||
|| ex instanceof IllegalArgumentException
|
||||
|| ex instanceof ApplicationException;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取错误信息
|
||||
*
|
||||
* @param ex ex
|
||||
* @param defaultMsg defaultMsg
|
||||
* @return message
|
||||
*/
|
||||
static String getErrorMessage(Exception ex, String defaultMsg) {
|
||||
if (ex == null) {
|
||||
return null;
|
||||
}
|
||||
String message = ex.getMessage();
|
||||
if (message == null) {
|
||||
return defaultMsg;
|
||||
}
|
||||
// 业务异常
|
||||
if (isBizException(ex)) {
|
||||
return message;
|
||||
}
|
||||
return defaultMsg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orion.visor.framework.common.entity;
|
||||
|
||||
/**
|
||||
* 数据清理请求 定义
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/29 11:26
|
||||
*/
|
||||
public interface DataClearRequest {
|
||||
|
||||
/**
|
||||
* 获取清理数量限制
|
||||
*
|
||||
* @return 清理限制
|
||||
*/
|
||||
Integer getLimit();
|
||||
|
||||
/**
|
||||
* 设置清理数量限制
|
||||
*
|
||||
* @param limit limit
|
||||
*/
|
||||
void setLimit(Integer limit);
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.orion.visor.framework.common.entity;
|
||||
|
||||
import com.orion.lang.define.wrapper.IPageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 公共页码请求
|
||||
@@ -15,14 +17,18 @@ import org.hibernate.validator.constraints.Range;
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "公共页码请求")
|
||||
public class PageRequest implements IPageRequest {
|
||||
public class PageRequest {
|
||||
|
||||
@Range(min = 1, max = 10000, groups = Page.class)
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 10000, groups = Page.class)
|
||||
@Schema(description = "页码")
|
||||
private int page;
|
||||
private Integer page;
|
||||
|
||||
@Range(min = 1, max = 200, groups = Page.class)
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 200, groups = Page.class)
|
||||
@Schema(description = "大小")
|
||||
private int limit;
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orion.visor.framework.common.meta;
|
||||
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
import com.orion.lang.id.UUIds;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
/**
|
||||
* traceId 持有者
|
||||
@@ -23,16 +25,74 @@ public class TraceIdHolder {
|
||||
*/
|
||||
private static final ThreadLocal<String> HOLDER = new TransmittableThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 获取 traceId
|
||||
*
|
||||
* @return traceId
|
||||
*/
|
||||
public static String get() {
|
||||
return HOLDER.get();
|
||||
}
|
||||
|
||||
public static void set(String traceId) {
|
||||
HOLDER.set(traceId);
|
||||
/**
|
||||
* 设置 traceId
|
||||
*/
|
||||
public static void set() {
|
||||
set(createTraceId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 traceId
|
||||
*
|
||||
* @param traceId traceId
|
||||
*/
|
||||
public static void set(String traceId) {
|
||||
// 设置应用上下文
|
||||
HOLDER.set(traceId);
|
||||
// 设置日志上下文
|
||||
setMdc(traceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 traceId
|
||||
*/
|
||||
public static void remove() {
|
||||
// 移除应用上下文
|
||||
HOLDER.remove();
|
||||
// 移除日志上下文
|
||||
removeMdc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从应用上下文 设置到日志上下文
|
||||
*/
|
||||
public static void setMdc() {
|
||||
setMdc(HOLDER.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置到日志上下文
|
||||
*
|
||||
* @param traceId traceId
|
||||
*/
|
||||
public static void setMdc(String traceId) {
|
||||
MDC.put(TRACE_ID_MDC, traceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除日志上下文
|
||||
*/
|
||||
public static void removeMdc() {
|
||||
MDC.remove(TRACE_ID_MDC);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 traceId
|
||||
*
|
||||
* @return traceId
|
||||
*/
|
||||
public static String createTraceId() {
|
||||
return UUIds.random32();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ public class IpUtils {
|
||||
* @return addr
|
||||
*/
|
||||
public static String getRemoteAddr(HttpServletRequest request) {
|
||||
// 获取实际地址
|
||||
String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
|
||||
if (!Strings.isBlank(realIp)) {
|
||||
return realIp;
|
||||
}
|
||||
// 获取实际地址 X_REAL_IP 在多代理情况下会有问题
|
||||
// String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
|
||||
// if (!Strings.isBlank(realIp)) {
|
||||
// return realIp;
|
||||
// }
|
||||
// 获取请求地址
|
||||
return Servlets.getRemoteAddr(request);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.orion.visor.framework.common.utils;
|
||||
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
|
||||
/**
|
||||
* sql 工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/26 16:03
|
||||
*/
|
||||
public class SqlUtils {
|
||||
|
||||
private SqlUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* limit n
|
||||
*
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(Number limit) {
|
||||
return Const.LIMIT + Const.SPACE + limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* limit offset limit
|
||||
*
|
||||
* @param offset offset
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(Number offset, Number limit) {
|
||||
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Validator;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -31,6 +32,10 @@ public class Valid extends com.orion.lang.utils.Valid {
|
||||
return notBlank(s, ErrorMessage.PARAM_MISSING);
|
||||
}
|
||||
|
||||
public static <T extends Map<?, ?>> T notEmpty(T map) {
|
||||
return notEmpty(map, ErrorMessage.PARAM_MISSING);
|
||||
}
|
||||
|
||||
public static <T extends Collection<?>> T notEmpty(T object) {
|
||||
return notEmpty(object, ErrorMessage.PARAM_MISSING);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 批量验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Batch extends Default {
|
||||
public interface Batch {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 清理验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Clear {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Export {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Id extends Default {
|
||||
public interface Id {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Import {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Page extends Default {
|
||||
public interface Page {
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* quartz 配置
|
||||
@@ -22,27 +19,6 @@ import javax.sql.DataSource;
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_JOB_QUARTZ)
|
||||
public class OrionQuartzAutoConfiguration {
|
||||
|
||||
/**
|
||||
* @return 任务工厂
|
||||
*/
|
||||
@Bean
|
||||
public SpringBeanJobFactory jobFactory() {
|
||||
return new SpringBeanJobFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataSource dataSource
|
||||
* @param jobFactory jobFactory
|
||||
* @return 调度器工厂
|
||||
*/
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource, SpringBeanJobFactory jobFactory) {
|
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
factory.setDataSource(dataSource);
|
||||
factory.setJobFactory(jobFactory);
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schedulerFactoryBean 调度器工厂
|
||||
* @return 调度器
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 不执行统一日志打印
|
||||
* <p>
|
||||
* 如果设置在方法上,则忽略该方法的日志打印
|
||||
* 如果设置到参数上,则忽略该参数的日志打印
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.framework.mybatis.core.generator.core;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableField;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
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.FieldConst;
|
||||
@@ -47,7 +48,7 @@ public class DictParser {
|
||||
.stream()
|
||||
.filter(s -> variable.equals(s.getName()) || variable.equals(s.getPropertyName()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new RuntimeException("未查询到字典映射字段 " + variable));
|
||||
.orElseThrow(() -> Exceptions.runtime("未查询到字典映射字段 " + variable));
|
||||
// 设置字段名称
|
||||
if (meta.getField() == null) {
|
||||
meta.setField(Strings.firstUpper(tableField.getPropertyName()));
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.framework.mybatis.core.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.mybatis.core.query.Conditions;
|
||||
import com.orion.visor.framework.mybatis.core.query.DataQuery;
|
||||
|
||||
@@ -61,7 +62,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
default boolean insertBatch(Collection<T> entities) {
|
||||
return Db.saveBatch(entities);
|
||||
return this.insertBatch(entities, Const.BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +83,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
default boolean updateBatch(Collection<T> entities) {
|
||||
return Db.updateBatchById(entities);
|
||||
return this.updateBatch(entities, Const.BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +114,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
default boolean insertOrUpdateBatch(Collection<T> entities) {
|
||||
return Db.saveOrUpdateBatch(entities);
|
||||
return this.insertOrUpdateBatch(entities, Const.BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.reflect.Classes;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -36,7 +37,7 @@ public class DataQuery<T> {
|
||||
|
||||
private final BaseMapper<T> dao;
|
||||
|
||||
private IPageRequest page;
|
||||
private PageRequest page;
|
||||
|
||||
private Wrapper<T> wrapper;
|
||||
|
||||
@@ -73,8 +74,9 @@ public class DataQuery<T> {
|
||||
return new DataQuery<>(dao, wrapper);
|
||||
}
|
||||
|
||||
public DataQuery<T> page(IPageRequest page) {
|
||||
this.page = Valid.notNull(page, "page is null");
|
||||
public DataQuery<T> page(com.orion.visor.framework.common.entity.PageRequest page) {
|
||||
com.orion.visor.framework.common.entity.PageRequest pr = Valid.notNull(page, "page is null");
|
||||
this.page = new PageRequest(pr.getPage(), pr.getLimit());
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -111,11 +113,11 @@ public class DataQuery<T> {
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + limit);
|
||||
return this.last(SqlUtils.limit(limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int offset, int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit);
|
||||
return this.last(SqlUtils.limit(offset, limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> only() {
|
||||
@@ -199,6 +201,18 @@ public class DataQuery<T> {
|
||||
return dao.selectCount(wrapper);
|
||||
}
|
||||
|
||||
public Long countMax(Number max) {
|
||||
Long count = dao.selectCount(wrapper);
|
||||
if (max == null) {
|
||||
return count;
|
||||
}
|
||||
long maxValue = max.longValue();
|
||||
if (maxValue <= 0L) {
|
||||
return count;
|
||||
}
|
||||
return Math.min(count, maxValue);
|
||||
}
|
||||
|
||||
public boolean absent() {
|
||||
return dao.selectCount(wrapper) == 0;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,18 @@ Authorization: {{token}}
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.queryCount}
|
||||
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/count
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
#foreach($field in ${table.fields})
|
||||
"${field.propertyName}": ""#if($foreach.hasNext),#end
|
||||
#end
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.deleteById}
|
||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
@@ -113,6 +113,13 @@ public class ${table.controllerName} {
|
||||
return ${typeLower}Service.get${type}Page(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "${apiComment.queryCount}")
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||
public Long get${type}Count(@Validated @RequestBody ${type}QueryRequest request) {
|
||||
return ${typeLower}Service.get${type}Count(request);
|
||||
}
|
||||
|
||||
#if($meta.enableDemoApi)
|
||||
@DemoDisableApi
|
||||
#end
|
||||
|
||||
@@ -122,7 +122,8 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
@Override
|
||||
public List<${type}VO> get${type}List(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::to);
|
||||
}
|
||||
@@ -148,24 +149,28 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
.sorted(Comparator.comparing(${type}VO::getId).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.page(request)
|
||||
.wrapper(wrapper)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long get${type}Count(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(${type}Convert.MAPPER::to);
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,13 +240,8 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request) {
|
||||
String searchValue = request.getSearchValue();
|
||||
return ${typeLower}DAO.wrapper()
|
||||
#foreach($field in ${table.fields})
|
||||
@@ -251,8 +251,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end
|
||||
#end
|
||||
)
|
||||
.orderByDesc(${type}DO::getId);
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ${package.Service};
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
@@ -116,4 +117,12 @@ public interface ${table.serviceName} {
|
||||
*/
|
||||
Integer delete${type}(${type}QueryRequest request);
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<${type}DO> buildQueryWrapper(${type}QueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -115,6 +115,13 @@ export function get${vue.featureEntity}Page(request: ${vue.featureEntity}QueryRe
|
||||
return axios.post<DataGrid<${vue.featureEntity}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.queryCount
|
||||
*/
|
||||
export function get${vue.featureEntity}Count(request: ${vue.featureEntity}QueryRequest) {
|
||||
return axios.post<number>('/${package.ModuleName}/${typeHyphen}/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.deleteById
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<card-list v-model:searchValue="formModel.searchValue"
|
||||
search-input-placeholder="输入搜索值"
|
||||
create-card-position="head"
|
||||
:create-card-position="false"
|
||||
:loading="loading"
|
||||
:field-config="fieldConfig"
|
||||
:list="list"
|
||||
|
||||
@@ -98,6 +98,13 @@ public class SecurityUtils {
|
||||
return loginUser != null ? loginUser.getTimestamp() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空用户上下文
|
||||
*/
|
||||
public static void clearAuthentication() {
|
||||
SecurityContextHolder.getContext().setAuthentication(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前用户
|
||||
*
|
||||
@@ -107,7 +114,9 @@ public class SecurityUtils {
|
||||
public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) {
|
||||
// 创建 authentication
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginUser, null, Collections.emptyList());
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
if (request != null) {
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
}
|
||||
// 设置上下文
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.orion.visor.framework.web.core.filter;
|
||||
|
||||
import com.orion.lang.id.UUIds;
|
||||
import com.orion.visor.framework.common.meta.TraceIdHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
@@ -23,21 +21,17 @@ public class TraceIdFilter extends OncePerRequestFilter {
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
try {
|
||||
// 获 traceId
|
||||
String traceId = UUIds.random32();
|
||||
// 设置应用上下文
|
||||
// 获取 traceId
|
||||
String traceId = TraceIdHolder.createTraceId();
|
||||
// 设置 traceId 上下文
|
||||
TraceIdHolder.set(traceId);
|
||||
// 设置日志上下文
|
||||
MDC.put(TraceIdHolder.TRACE_ID_MDC, traceId);
|
||||
// 设置响应头
|
||||
response.setHeader(TraceIdHolder.TRACE_ID_HEADER, traceId);
|
||||
// 执行请求
|
||||
filterChain.doFilter(request, response);
|
||||
} finally {
|
||||
// 清理应用上下文
|
||||
// 清空 traceId 上下文
|
||||
TraceIdHolder.remove();
|
||||
// 清理日志上下文
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ management:
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
# 日志打印
|
||||
# sql 日志打印
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
@@ -82,13 +82,13 @@ spring:
|
||||
instanceName: quartzScheduler
|
||||
jobStore:
|
||||
# 持久化配置
|
||||
class: org.quartz.impl.jdbcjobstore.JobStoreTX
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
useProperties: false
|
||||
tablePrefix: QRTZ_
|
||||
misfireThreshold: 60000
|
||||
clusterCheckinInterval: 5000
|
||||
isClustered: true
|
||||
isClustered: false
|
||||
# 连接池
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
@@ -167,6 +167,8 @@ app:
|
||||
allow-refresh: true
|
||||
# 凭证续签最大次数
|
||||
max-refresh-count: 3
|
||||
# 登录失败发送站内信阈值
|
||||
login-failed-send-threshold: 3
|
||||
# 登录失败锁定次数
|
||||
login-failed-lock-count: 5
|
||||
# 登录失败锁定时间 (分)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostGroupOperatorType;
|
||||
import com.orion.visor.module.asset.define.operator.HostIdentityOperatorType;
|
||||
@@ -43,6 +44,7 @@ public class AssetDataGrantServiceController {
|
||||
@Resource
|
||||
private AssetAuthorizedDataService assetAuthorizedDataService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostGroupOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-group")
|
||||
@Operation(summary = "主机分组授权")
|
||||
@@ -60,6 +62,7 @@ public class AssetDataGrantServiceController {
|
||||
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_GROUP, request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostKeyOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-key")
|
||||
@Operation(summary = "主机密钥授权")
|
||||
@@ -77,6 +80,7 @@ public class AssetDataGrantServiceController {
|
||||
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_KEY, request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostIdentityOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-identity")
|
||||
@Operation(summary = "主机身份授权")
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecCommandLogOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
@@ -97,6 +98,14 @@ public class ExecCommandLogController {
|
||||
return execLogService.getExecHistory(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询批量执行日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
public Long getExecCommandLogCount(@Validated @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecCommandLogOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除批量执行日志")
|
||||
@@ -124,19 +133,11 @@ public class ExecCommandLogController {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询批量执行日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:management:clear')")
|
||||
public Long getExecCommandLogCount(@RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecCommandLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空批量执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:management:clear')")
|
||||
public Integer clearExecCommandLog(@RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecCommandLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
@@ -178,4 +179,3 @@ public class ExecCommandLogController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecJobOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.*;
|
||||
@@ -39,6 +40,7 @@ public class ExecJobController {
|
||||
@Resource
|
||||
private ExecJobService execJobService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建计划任务")
|
||||
@@ -47,6 +49,7 @@ public class ExecJobController {
|
||||
return execJobService.createExecJob(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新计划任务")
|
||||
@@ -55,6 +58,7 @@ public class ExecJobController {
|
||||
return execJobService.updateExecJobById(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE_STATUS)
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新计划任务状态")
|
||||
@@ -88,6 +92,7 @@ public class ExecJobController {
|
||||
return execJobService.getExecJobPage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除计划任务")
|
||||
@@ -97,6 +102,7 @@ public class ExecJobController {
|
||||
return execJobService.deleteExecJobById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除计划任务")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecJobLogOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
@@ -86,6 +87,14 @@ public class ExecJobLogController {
|
||||
return execLogService.getExecLogStatus(idList, SOURCE);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询计划任务日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
public Long getExecJobLogCount(@Validated @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobLogOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除计划任务日志")
|
||||
@@ -113,19 +122,11 @@ public class ExecJobLogController {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询计划任务日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:management:clear')")
|
||||
public Long getExecJobLogCount(@RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:management:clear')")
|
||||
public Integer clearExecJobLog(@RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecJobLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
@@ -167,4 +168,3 @@ public class ExecJobLogController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecTemplateOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
@@ -41,6 +42,7 @@ public class ExecTemplateController {
|
||||
@Resource
|
||||
private ExecTemplateService execTemplateService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建执行模板")
|
||||
@@ -49,6 +51,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.createExecTemplate(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新执行模板")
|
||||
@@ -83,6 +86,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.getExecTemplatePage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除执行模板")
|
||||
@@ -92,6 +96,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.deleteExecTemplateById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除执行模板")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostConnectLogOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConnectLogVO;
|
||||
import com.orion.visor.module.asset.service.HostConnectLogService;
|
||||
@@ -49,6 +50,13 @@ public class HostConnectLogController {
|
||||
return hostConnectLogService.getHostConnectLogPage(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询主机连接日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:query')")
|
||||
public Long getHostConnectLogCount(@Validated @RequestBody HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogService.getHostConnectLogCount(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/session")
|
||||
@Operation(summary = "查询全部主机连接会话")
|
||||
@@ -73,18 +81,11 @@ public class HostConnectLogController {
|
||||
return hostConnectLogService.deleteHostConnectLog(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询主机连接日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:clear')")
|
||||
public Long getHostConnectLogCount(@RequestBody HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogService.getHostConnectLogCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostConnectLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空主机连接日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:clear')")
|
||||
public Integer clearHostConnectLog(@RequestBody HostConnectLogQueryRequest request) {
|
||||
public Integer clearHostConnectLog(@Validated @RequestBody HostConnectLogClearRequest request) {
|
||||
return hostConnectLogService.clearHostConnectLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class HostController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询主机")
|
||||
@Parameter(name = "type", description = "type", required = false)
|
||||
@Parameter(name = "type", description = "type")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public List<HostVO> getHostList(@RequestParam(value = "type", required = false) String type) {
|
||||
return hostService.getHostList(type);
|
||||
@@ -112,6 +112,14 @@ public class HostController {
|
||||
return hostService.getHostPage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询主机数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public Long getHostExportCount(@Validated @RequestBody HostQueryRequest request) {
|
||||
return hostService.getHostCount(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.UploadTaskOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskCreateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskRequest;
|
||||
@@ -94,6 +95,13 @@ public class UploadTaskController {
|
||||
return uploadTaskService.getUploadTaskStatus(idList, queryFiles);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询上传任务数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:query')")
|
||||
public Long getUploadTaskCount(@RequestBody UploadTaskQueryRequest request) {
|
||||
return uploadTaskService.getUploadTaskCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(UploadTaskOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除上传任务")
|
||||
@@ -112,18 +120,11 @@ public class UploadTaskController {
|
||||
return uploadTaskService.deleteUploadTaskByIdList(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@Operation(summary = "查询上传任务数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:management:clear')")
|
||||
public Long getUploadTaskCount(@RequestBody UploadTaskQueryRequest request) {
|
||||
return uploadTaskService.getUploadTaskCount(request);
|
||||
}
|
||||
|
||||
@OperatorLog(UploadTaskOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空上传任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:management:clear')")
|
||||
public Integer clearUploadTask(@RequestBody UploadTaskQueryRequest request) {
|
||||
public Integer clearUploadTask(@Validated @RequestBody UploadTaskClearRequest request) {
|
||||
return uploadTaskService.clearUploadTask(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class HostOperatorType extends InitializingOperatorTypes {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建主机 <sb>${name}</sb>"),
|
||||
new OperatorType(L, UPDATE, "修改主机 <sb>${name}</sb>"),
|
||||
new OperatorType(H, DELETE, "删除主机 <sb>${name}</sb>"),
|
||||
new OperatorType(H, DELETE, "删除主机 <sb>${count}</sb> 条"),
|
||||
new OperatorType(M, UPDATE_STATUS, "修改主机状态 <sb>${name}</sb> - <sb>${status}</sb>"),
|
||||
new OperatorType(M, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb>"),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.entity.request.exec;
|
||||
|
||||
import com.orion.visor.framework.common.entity.DataClearRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 批量执行日志 清理请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "ExecLogClearRequest", description = "批量执行日志 清理请求对象")
|
||||
public class ExecLogClearRequest extends ExecLogQueryRequest implements DataClearRequest {
|
||||
|
||||
@NotNull
|
||||
@Min(value = 1)
|
||||
@Max(value = 1000)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.entity.request.host;
|
||||
|
||||
import com.orion.visor.framework.common.entity.DataClearRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 主机连接日志 清理请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-12-26 22:09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "HostConnectLogClearRequest", description = "主机连接日志 清理请求对象")
|
||||
public class HostConnectLogClearRequest extends HostConnectLogQueryRequest implements DataClearRequest {
|
||||
|
||||
@NotNull
|
||||
@Min(value = 1)
|
||||
@Max(value = 2000)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package com.orion.visor.module.asset.entity.request.host;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Id;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -24,6 +26,7 @@ import java.util.List;
|
||||
@Schema(name = "HostConnectLogQueryRequest", description = "主机连接日志 查询请求对象")
|
||||
public class HostConnectLogQueryRequest extends PageRequest {
|
||||
|
||||
@NotNull(groups = Id.class)
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
@@ -45,7 +46,8 @@ public class HostCreateRequest implements Serializable {
|
||||
@Schema(description = "主机地址")
|
||||
private String address;
|
||||
|
||||
@Range(min = 1, max = 65535)
|
||||
@Min(value = 1)
|
||||
@Max(value = 65535)
|
||||
@Schema(description = "主机端口")
|
||||
private Integer port;
|
||||
|
||||
|
||||
@@ -5,11 +5,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,7 +43,9 @@ public class HostUpdateRequest implements Serializable {
|
||||
@Schema(description = "主机地址")
|
||||
private String address;
|
||||
|
||||
@Range(min = 1, max = 65535)
|
||||
@NotNull
|
||||
@Min(value = 1)
|
||||
@Max(value = 65535)
|
||||
@Schema(description = "主机端口")
|
||||
private Integer port;
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.entity.request.upload;
|
||||
|
||||
import com.orion.visor.framework.common.entity.DataClearRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 上传任务 清理请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.7
|
||||
* @since 2024-5-7 22:15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "UploadTaskClearRequest", description = "上传任务 清理请求对象")
|
||||
public class UploadTaskClearRequest extends UploadTaskQueryRequest implements DataClearRequest {
|
||||
|
||||
@NotNull
|
||||
@Min(value = 1)
|
||||
@Max(value = 2000)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
@@ -10,17 +10,17 @@ package com.orion.visor.module.asset.enums;
|
||||
public enum HostExtraSshAuthTypeEnum {
|
||||
|
||||
/**
|
||||
* 默认验证方式
|
||||
* 默认认证方式
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* 自定义密钥验证
|
||||
* 自定义密钥认证
|
||||
*/
|
||||
CUSTOM_KEY,
|
||||
|
||||
/**
|
||||
* 自定义身份验证
|
||||
* 自定义身份认证
|
||||
*/
|
||||
CUSTOM_IDENTITY,
|
||||
|
||||
@@ -28,14 +28,14 @@ public enum HostExtraSshAuthTypeEnum {
|
||||
|
||||
public static HostExtraSshAuthTypeEnum of(String type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
return DEFAULT;
|
||||
}
|
||||
for (HostExtraSshAuthTypeEnum value : values()) {
|
||||
if (value.name().equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orion.visor.module.asset.enums;
|
||||
|
||||
/**
|
||||
* 主机验证类型 - ssh
|
||||
* 主机认证类型 - ssh
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
@@ -10,17 +10,17 @@ package com.orion.visor.module.asset.enums;
|
||||
public enum HostSshAuthTypeEnum {
|
||||
|
||||
/**
|
||||
* 密码验证
|
||||
* 密码认证
|
||||
*/
|
||||
PASSWORD,
|
||||
|
||||
/**
|
||||
* 密钥验证
|
||||
* 密钥认证
|
||||
*/
|
||||
KEY,
|
||||
|
||||
/**
|
||||
* 身份验证
|
||||
* 身份认证
|
||||
*/
|
||||
IDENTITY,
|
||||
|
||||
@@ -28,14 +28,14 @@ public enum HostSshAuthTypeEnum {
|
||||
|
||||
public static HostSshAuthTypeEnum of(String type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
return PASSWORD;
|
||||
}
|
||||
for (HostSshAuthTypeEnum value : values()) {
|
||||
if (value.name().equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return PASSWORD;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ public enum HostSshOsTypeEnum {
|
||||
|
||||
public static HostSshOsTypeEnum of(String type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
return LINUX;
|
||||
}
|
||||
for (HostSshOsTypeEnum value : values()) {
|
||||
if (value.name().equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return LINUX;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 主机 SSH 配置
|
||||
@@ -64,7 +61,8 @@ public class HostSshConfigModel implements GenericsDataModel, UpdatePasswordActi
|
||||
* 连接超时时间
|
||||
*/
|
||||
@NotNull
|
||||
@Range(min = 0, max = 100000)
|
||||
@Min(value = 1)
|
||||
@Max(value = 100000)
|
||||
private Integer connectTimeout;
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,10 +55,6 @@ public class HostSshConfigStrategy extends AbstractGenericsDataStrategy<HostSshC
|
||||
|
||||
@Override
|
||||
protected void preValid(HostSshConfigModel model) {
|
||||
// 验证认证类型
|
||||
Valid.valid(HostSshAuthTypeEnum::of, model.getAuthType());
|
||||
// 验证系统版本
|
||||
Valid.valid(HostSshOsTypeEnum::of, model.getOsType());
|
||||
// 验证编码格式
|
||||
this.validCharset(model.getCharset());
|
||||
this.validCharset(model.getFileNameCharset());
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.orion.lang.exception.AuthenticationException;
|
||||
import com.orion.lang.exception.ConnectionRuntimeException;
|
||||
import com.orion.lang.exception.SftpException;
|
||||
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||
import com.orion.lang.support.timeout.TimeoutChecker;
|
||||
import com.orion.lang.support.timeout.TimeoutEndpoint;
|
||||
import com.orion.lang.utils.Booleans;
|
||||
@@ -16,6 +15,7 @@ import com.orion.net.host.SessionStore;
|
||||
import com.orion.net.host.sftp.SftpExecutor;
|
||||
import com.orion.net.host.ssh.command.CommandExecutor;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
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;
|
||||
@@ -289,17 +289,25 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
* @return errorMessage
|
||||
*/
|
||||
protected String getErrorMessage(Exception ex) {
|
||||
if (ex == null) {
|
||||
return null;
|
||||
}
|
||||
String message;
|
||||
if (ex instanceof InvalidArgumentException || ex instanceof IllegalArgumentException) {
|
||||
if (ErrorMessage.isBizException(ex)) {
|
||||
// 业务异常
|
||||
message = ex.getMessage();
|
||||
} else if (ex instanceof ConnectionRuntimeException) {
|
||||
message = "连接失败";
|
||||
// 连接异常
|
||||
message = ErrorMessage.CONNECT_ERROR;
|
||||
} else if (ex instanceof AuthenticationException) {
|
||||
message = "认证失败";
|
||||
// 认证异常
|
||||
message = ErrorMessage.AUTH_ERROR;
|
||||
} else if (ex instanceof SftpException) {
|
||||
message = "脚本上传失败";
|
||||
// 上传异常
|
||||
message = ErrorMessage.SCRIPT_UPLOAD_ERROR;
|
||||
} else {
|
||||
message = "执行失败";
|
||||
// 其他异常
|
||||
message = ErrorMessage.EXEC_ERROR;
|
||||
}
|
||||
return Strings.retain(message, 250);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.exec.log;
|
||||
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.lang.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;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.orion.lang.utils.Strings;
|
||||
import com.orion.net.host.SessionHolder;
|
||||
import com.orion.net.host.SessionLogger;
|
||||
import com.orion.net.host.SessionStore;
|
||||
import com.orion.visor.framework.common.constant.AppConst;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.utils.CryptoUtils;
|
||||
import com.orion.visor.module.asset.entity.dto.HostTerminalConnectDTO;
|
||||
@@ -43,6 +44,8 @@ public class SessionStores {
|
||||
SessionHolder sessionHolder = SessionHolder.create();
|
||||
sessionHolder.setLogger(SessionLogger.INFO);
|
||||
SessionStore session = createSessionStore(conn, sessionHolder);
|
||||
// 设置版本
|
||||
session.getSession().setClientVersion("SSH-2.0-ORION_VISOR_V" + AppConst.VERSION);
|
||||
// 连接
|
||||
session.connect();
|
||||
log.info("SessionStores-open-success hostId: {}, address: {}, username: {}", hostId, address, username);
|
||||
@@ -50,7 +53,7 @@ public class SessionStores {
|
||||
} catch (Exception e) {
|
||||
String message = e.getMessage();
|
||||
log.error("SessionStores-open-error hostId: {}, address: {}, username: {}, message: {}", hostId, address, username, message, e);
|
||||
throw Exceptions.runtime(getErrorMessage(e), e);
|
||||
throw Exceptions.app(getErrorMessage(e), e);
|
||||
} finally {
|
||||
CURRENT_ADDRESS.remove();
|
||||
}
|
||||
@@ -86,7 +89,10 @@ public class SessionStores {
|
||||
SessionStore session = sessionHolder.getSession(conn.getHostAddress(), conn.getHostPort(), conn.getUsername());
|
||||
// 使用密码认证
|
||||
if (!useKey) {
|
||||
session.password(CryptoUtils.decryptAsString(conn.getPassword()));
|
||||
String password = conn.getPassword();
|
||||
if (!Strings.isEmpty(password)) {
|
||||
session.password(CryptoUtils.decryptAsString(password));
|
||||
}
|
||||
}
|
||||
// 超时时间
|
||||
session.timeout(conn.getTimeout());
|
||||
|
||||
@@ -97,13 +97,8 @@ public abstract class AbstractTerminalHandler<T extends TerminalBasePayload> imp
|
||||
* @return msg
|
||||
*/
|
||||
protected String getErrorMessage(Exception ex) {
|
||||
if (ex == null) {
|
||||
return null;
|
||||
}
|
||||
if (ex instanceof InvalidArgumentException || ex instanceof IllegalArgumentException) {
|
||||
return ex.getMessage();
|
||||
}
|
||||
return ErrorMessage.OPERATE_ERROR;
|
||||
// 获取错误信息
|
||||
return ErrorMessage.getErrorMessage(ex, ErrorMessage.OPERATE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,13 +65,15 @@ public class TerminalConnectHandler extends AbstractTerminalHandler<TerminalConn
|
||||
// 移除会话连接信息
|
||||
channel.getAttributes().remove(sessionId);
|
||||
Exception ex = null;
|
||||
ITerminalSession session = null;
|
||||
try {
|
||||
// 连接主机
|
||||
ITerminalSession session = this.connect(sessionId, connect, channel, payload);
|
||||
session = this.connect(sessionId, connect, channel, payload);
|
||||
// 添加会话到 manager
|
||||
hostTerminalManager.addSession(session);
|
||||
} catch (Exception e) {
|
||||
ex = e;
|
||||
Streams.close(session);
|
||||
// 修改连接状态为失败
|
||||
Map<String, Object> extra = Maps.newMap(4);
|
||||
extra.put(ExtraFieldConst.ERROR_MESSAGE, this.getConnectErrorMessage(e));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.orion.visor.module.asset.handler.host.transfer.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
||||
@@ -62,13 +61,15 @@ public class TransferUtils {
|
||||
public static String getErrorMessage(Exception ex) {
|
||||
if (ex == null) {
|
||||
return null;
|
||||
} else if (ex instanceof InvalidArgumentException || ex instanceof IllegalArgumentException) {
|
||||
} else if (ErrorMessage.isBizException(ex)) {
|
||||
// 业务异常
|
||||
String message = ex.getMessage();
|
||||
if (Strings.isBlank(message)) {
|
||||
return ErrorMessage.OPERATE_ERROR;
|
||||
}
|
||||
return message;
|
||||
} else if (ex instanceof ClientAbortException) {
|
||||
// 客户端主动断开
|
||||
return ErrorMessage.CLIENT_ABORT;
|
||||
}
|
||||
return ErrorMessage.OPERATE_ERROR;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import com.orion.visor.module.asset.entity.dto.ExecLogTailDTO;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecLogStatusVO;
|
||||
@@ -93,7 +96,7 @@ public interface ExecLogService {
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer clearExecLog(ExecLogQueryRequest request);
|
||||
Integer clearExecLog(ExecLogClearRequest request);
|
||||
|
||||
/**
|
||||
* 中断命令执行
|
||||
@@ -143,4 +146,12 @@ public interface ExecLogService {
|
||||
*/
|
||||
void asyncDeleteLogFiles(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
LambdaQueryWrapper<ExecLogDO> buildQueryWrapper(ExecLogQueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.module.asset.entity.domain.HostConnectLogDO;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogCreateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConnectLogVO;
|
||||
@@ -95,7 +97,7 @@ public interface HostConnectLogService {
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer clearHostConnectLog(HostConnectLogQueryRequest request);
|
||||
Integer clearHostConnectLog(HostConnectLogClearRequest request);
|
||||
|
||||
/**
|
||||
* 强制断开主机连接
|
||||
@@ -105,4 +107,12 @@ public interface HostConnectLogService {
|
||||
*/
|
||||
Integer forceOffline(HostConnectLogQueryRequest request);
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
LambdaQueryWrapper<HostConnectLogDO> buildQueryWrapper(HostConnectLogQueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.module.asset.entity.domain.HostDO;
|
||||
import com.orion.visor.module.asset.entity.request.host.*;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConfigVO;
|
||||
import com.orion.visor.module.asset.entity.vo.HostVO;
|
||||
@@ -80,6 +82,14 @@ public interface HostService {
|
||||
*/
|
||||
DataGrid<HostVO> getHostPage(HostQueryRequest request);
|
||||
|
||||
/**
|
||||
* 查询主机数量
|
||||
*
|
||||
* @param request request
|
||||
* @return count
|
||||
*/
|
||||
Long getHostCount(HostQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除主机
|
||||
*
|
||||
@@ -110,4 +120,17 @@ public interface HostService {
|
||||
*/
|
||||
Long getCurrentUpdateConfigHostId();
|
||||
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
void clearCache();
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
LambdaQueryWrapper<HostDO> buildQueryWrapper(HostQueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.module.asset.entity.domain.UploadTaskDO;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskCreateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskRequest;
|
||||
@@ -66,7 +69,7 @@ public interface UploadTaskService {
|
||||
* @param request request
|
||||
* @return count
|
||||
*/
|
||||
Integer clearUploadTask(UploadTaskQueryRequest request);
|
||||
Integer clearUploadTask(UploadTaskClearRequest request);
|
||||
|
||||
/**
|
||||
* 删除上传任务
|
||||
@@ -112,4 +115,12 @@ public interface UploadTaskService {
|
||||
*/
|
||||
void clearUploadSwapFiles(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
LambdaQueryWrapper<UploadTaskDO> buildQueryWrapper(UploadTaskQueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.orion.visor.module.asset.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.lang.annotation.Keep;
|
||||
import com.orion.lang.function.Functions;
|
||||
import com.orion.lang.id.UUIds;
|
||||
import com.orion.lang.utils.Strings;
|
||||
@@ -11,7 +12,6 @@ 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.FileConst;
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.orion.visor.module.asset.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.annotation.Keep;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||
import com.orion.lang.id.UUIds;
|
||||
import com.orion.lang.utils.Arrays1;
|
||||
import com.orion.lang.utils.Objects1;
|
||||
@@ -13,12 +13,12 @@ import com.orion.lang.utils.io.Files1;
|
||||
import com.orion.lang.utils.io.Streams;
|
||||
import com.orion.spring.SpringHolder;
|
||||
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.FileConst;
|
||||
import com.orion.visor.framework.common.enums.EndpointDefine;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisStrings;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
@@ -31,6 +31,7 @@ import com.orion.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||
import com.orion.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import com.orion.visor.module.asset.entity.dto.ExecHostLogTailDTO;
|
||||
import com.orion.visor.module.asset.entity.dto.ExecLogTailDTO;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogTailRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
@@ -92,7 +93,8 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
@Override
|
||||
public DataGrid<ExecLogVO> getExecLogPage(ExecLogQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<ExecLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
LambdaQueryWrapper<ExecLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(ExecLogDO::getId);
|
||||
// 查询
|
||||
return execLogDAO.of(wrapper)
|
||||
.page(request)
|
||||
@@ -219,16 +221,23 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
|
||||
@Override
|
||||
public Long queryExecLogCount(ExecLogQueryRequest request) {
|
||||
return execLogDAO.selectCount(this.buildQueryWrapper(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<ExecLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return execLogDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer clearExecLog(ExecLogQueryRequest request) {
|
||||
public Integer clearExecLog(ExecLogClearRequest request) {
|
||||
log.info("ExecLogService.clearExecLog start {}", JSON.toJSONString(request));
|
||||
// 查询
|
||||
LambdaQueryWrapper<ExecLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(ExecLogDO::getId);
|
||||
.select(ExecLogDO::getId)
|
||||
.orderByAsc(ExecLogDO::getId)
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
List<Long> idList = execLogDAO.selectList(wrapper)
|
||||
.stream()
|
||||
.map(ExecLogDO::getId)
|
||||
@@ -421,10 +430,8 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
} catch (Exception e) {
|
||||
log.error("ExecLogService.downloadLogFile error id: {}", id, e);
|
||||
Streams.close(in);
|
||||
String errorMessage = ErrorMessage.FILE_READ_ERROR_CLEAR;
|
||||
if (e instanceof InvalidArgumentException || e instanceof IllegalArgumentException) {
|
||||
errorMessage = e.getMessage();
|
||||
}
|
||||
// 获取错误信息
|
||||
String errorMessage = ErrorMessage.getErrorMessage(e, ErrorMessage.FILE_READ_ERROR_CLEAR);
|
||||
// 响应错误信息
|
||||
try {
|
||||
Servlets.transfer(response, Strings.bytes(errorMessage), FileConst.ERROR_LOG);
|
||||
@@ -450,13 +457,8 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
.forEach(Files1::delete);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<ExecLogDO> buildQueryWrapper(ExecLogQueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<ExecLogDO> buildQueryWrapper(ExecLogQueryRequest request) {
|
||||
return execLogDAO.wrapper()
|
||||
.eq(ExecLogDO::getId, request.getId())
|
||||
.eq(ExecLogDO::getUserId, request.getUserId())
|
||||
@@ -469,8 +471,7 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
.in(ExecLogDO::getStatus, request.getStatusList())
|
||||
.ge(ExecLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 0))
|
||||
.le(ExecLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 1))
|
||||
.le(ExecLogDO::getCreateTime, request.getCreateTimeLe())
|
||||
.orderByDesc(ExecLogDO::getId);
|
||||
.le(ExecLogDO::getCreateTime, request.getCreateTimeLe());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,12 +8,14 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.module.asset.convert.HostConnectLogConvert;
|
||||
import com.orion.visor.module.asset.dao.HostConnectLogDAO;
|
||||
import com.orion.visor.module.asset.entity.domain.HostConnectLogDO;
|
||||
import com.orion.visor.module.asset.entity.dto.HostConnectLogExtraDTO;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogClearRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogCreateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.HostConnectLogVO;
|
||||
@@ -26,6 +28,7 @@ import com.orion.visor.module.asset.service.HostConnectLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
@@ -70,7 +73,8 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
@Override
|
||||
public DataGrid<HostConnectLogVO> getHostConnectLogPage(HostConnectLogQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(HostConnectLogDO::getId);
|
||||
// 查询
|
||||
return hostConnectLogDAO.of(wrapper)
|
||||
.page(request)
|
||||
@@ -101,7 +105,8 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
// 条件
|
||||
request.setIdList(idList);
|
||||
request.setStatus(HostConnectStatusEnum.CONNECTING.name());
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(HostConnectLogDO::getId);
|
||||
// 查询
|
||||
return hostConnectLogDAO.of(wrapper)
|
||||
.list(s -> {
|
||||
@@ -167,13 +172,14 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteHostConnectLog(List<Long> idList) {
|
||||
log.info("HostConnectLogService.deleteHostConnectLog start {}", JSON.toJSONString(idList));
|
||||
if (Lists.isEmpty(idList)) {
|
||||
OperatorLogs.add(OperatorLogs.COUNT, Const.N_0);
|
||||
return Const.N_0;
|
||||
}
|
||||
// 删除
|
||||
// 删除日志表
|
||||
int effect = hostConnectLogDAO.deleteBatchIds(idList);
|
||||
log.info("HostConnectLogService.deleteHostConnectLog finish {}", effect);
|
||||
// 设置日志参数
|
||||
@@ -183,15 +189,23 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
|
||||
@Override
|
||||
public Long getHostConnectLogCount(HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogDAO.selectCount(this.buildQueryWrapper(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return hostConnectLogDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer clearHostConnectLog(HostConnectLogQueryRequest request) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer clearHostConnectLog(HostConnectLogClearRequest request) {
|
||||
log.info("HostConnectLogService.clearHostConnectLog start {}", JSON.toJSONString(request));
|
||||
// 查询
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(HostConnectLogDO::getId);
|
||||
.select(HostConnectLogDO::getId)
|
||||
.orderByAsc(HostConnectLogDO::getId)
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
List<HostConnectLogDO> list = hostConnectLogDAO.selectList(wrapper);
|
||||
if (list.isEmpty()) {
|
||||
log.info("HostConnectLogService.clearHostConnectLog empty");
|
||||
@@ -226,13 +240,8 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
return this.updateStatus(record, HostConnectStatusEnum.FORCE_OFFLINE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<HostConnectLogDO> buildQueryWrapper(HostConnectLogQueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<HostConnectLogDO> buildQueryWrapper(HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogDAO.wrapper()
|
||||
.eq(HostConnectLogDO::getId, request.getId())
|
||||
.in(HostConnectLogDO::getId, request.getIdList())
|
||||
@@ -245,8 +254,7 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
.in(HostConnectLogDO::getStatus, request.getStatusList())
|
||||
.ge(HostConnectLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 0))
|
||||
.le(HostConnectLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 1))
|
||||
.le(HostConnectLogDO::getCreateTime, request.getCreateTimeLe())
|
||||
.orderByDesc(HostConnectLogDO::getId);
|
||||
.le(HostConnectLogDO::getCreateTime, request.getCreateTimeLe());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -261,7 +261,9 @@ public class HostServiceImpl implements HostService {
|
||||
}
|
||||
// 数量条件
|
||||
LambdaQueryWrapper<HostDO> countWrapper = wrapper.clone();
|
||||
wrapper.select(HostDAO.BASE_COLUMN);
|
||||
// 基础条件
|
||||
wrapper.select(HostDAO.BASE_COLUMN)
|
||||
.orderByAsc(HostDO::getId);
|
||||
// 查询
|
||||
DataGrid<HostVO> hosts = hostDAO.of(wrapper)
|
||||
.page(request)
|
||||
@@ -271,6 +273,16 @@ public class HostServiceImpl implements HostService {
|
||||
return hosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getHostCount(HostQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<HostDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return hostDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteHostById(Long id) {
|
||||
return this.deleteHostByIdList(Lists.singleton(id));
|
||||
@@ -279,17 +291,10 @@ public class HostServiceImpl implements HostService {
|
||||
@Override
|
||||
public Integer deleteHostByIdList(List<Long> idList) {
|
||||
log.info("HostService-deleteHostByIdList idList: {}", idList);
|
||||
// 查询
|
||||
List<HostDO> hosts = hostDAO.selectBaseByIdList(idList);
|
||||
Valid.notEmpty(hosts, ErrorMessage.HOST_ABSENT);
|
||||
// 添加日志参数
|
||||
String name = hosts.stream()
|
||||
.map(HostDO::getName)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
||||
OperatorLogs.add(OperatorLogs.COUNT, hosts.size());
|
||||
// 删除
|
||||
int effect = hostDAO.deleteBatchIds(hosts);
|
||||
int effect = hostDAO.deleteBatchIds(idList);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.COUNT, idList.size());
|
||||
log.info("HostService-deleteHostByIdList effect: {}", effect);
|
||||
// 删除缓存
|
||||
this.clearCache();
|
||||
@@ -322,10 +327,8 @@ public class HostServiceImpl implements HostService {
|
||||
return CURRENT_UPDATE_CONFIG_ID.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
private void clearCache() {
|
||||
@Override
|
||||
public void clearCache() {
|
||||
RedisMaps.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
||||
}
|
||||
|
||||
@@ -361,13 +364,8 @@ public class HostServiceImpl implements HostService {
|
||||
Valid.isFalse(present, ErrorMessage.CODE_PRESENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<HostDO> buildQueryWrapper(HostQueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<HostDO> buildQueryWrapper(HostQueryRequest request) {
|
||||
String searchValue = request.getSearchValue();
|
||||
LambdaQueryWrapper<HostDO> wrapper = hostDAO.wrapper();
|
||||
// tag 条件
|
||||
|
||||
@@ -75,6 +75,10 @@ public class HostTerminalServiceImpl implements HostTerminalService {
|
||||
|
||||
@Override
|
||||
public List<HostTerminalThemeVO> getTerminalThemes() {
|
||||
// if (true) {
|
||||
// String arr = "";
|
||||
// return JSON.parseArray(arr, HostTerminalThemeVO.class);
|
||||
// }
|
||||
List<JSONObject> themes = dictValueApi.getDictValue(THEME_DICT_KEY);
|
||||
return themes.stream()
|
||||
.map(s -> HostTerminalThemeVO.builder()
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.asset.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.annotation.Keep;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Arrays1;
|
||||
import com.orion.lang.utils.Booleans;
|
||||
@@ -12,12 +13,12 @@ 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.enums.EndpointDefine;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.common.security.LoginUser;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.mybatis.core.query.Conditions;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
@@ -30,10 +31,7 @@ import com.orion.visor.module.asset.dao.UploadTaskFileDAO;
|
||||
import com.orion.visor.module.asset.entity.domain.UploadTaskDO;
|
||||
import com.orion.visor.module.asset.entity.domain.UploadTaskFileDO;
|
||||
import com.orion.visor.module.asset.entity.dto.UploadTaskExtraDTO;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskCreateRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskFileRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.UploadTaskRequest;
|
||||
import com.orion.visor.module.asset.entity.request.upload.*;
|
||||
import com.orion.visor.module.asset.entity.vo.*;
|
||||
import com.orion.visor.module.asset.enums.HostTypeEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskFileStatusEnum;
|
||||
@@ -171,7 +169,8 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
@Override
|
||||
public DataGrid<UploadTaskVO> getUploadTaskPage(UploadTaskQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<UploadTaskDO> wrapper = this.buildQueryWrapper(request);
|
||||
LambdaQueryWrapper<UploadTaskDO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(UploadTaskDO::getId);
|
||||
// 查询
|
||||
return uploadTaskDAO.of(wrapper)
|
||||
.page(request)
|
||||
@@ -218,15 +217,22 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
|
||||
@Override
|
||||
public Long getUploadTaskCount(UploadTaskQueryRequest request) {
|
||||
return uploadTaskDAO.selectCount(this.buildQueryWrapper(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<UploadTaskDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return uploadTaskDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Integer clearUploadTask(UploadTaskQueryRequest request) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer clearUploadTask(UploadTaskClearRequest request) {
|
||||
// 查询id
|
||||
LambdaQueryWrapper<UploadTaskDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(UploadTaskDO::getId);
|
||||
.select(UploadTaskDO::getId)
|
||||
.orderByAsc(UploadTaskDO::getId)
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
List<Long> idList = uploadTaskDAO.of(wrapper)
|
||||
.list(UploadTaskDO::getId);
|
||||
// 删除
|
||||
@@ -305,13 +311,8 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
paths.forEach(Files1::delete);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<UploadTaskDO> buildQueryWrapper(UploadTaskQueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<UploadTaskDO> buildQueryWrapper(UploadTaskQueryRequest request) {
|
||||
return uploadTaskDAO.wrapper()
|
||||
.eq(UploadTaskDO::getId, request.getId())
|
||||
.eq(UploadTaskDO::getUserId, request.getUserId())
|
||||
@@ -319,8 +320,7 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
.like(UploadTaskDO::getRemotePath, request.getRemotePath())
|
||||
.eq(UploadTaskDO::getStatus, request.getStatus())
|
||||
.ge(UploadTaskDO::getCreateTime, Arrays1.getIfPresent(request.getCreateTimeRange(), 0))
|
||||
.le(UploadTaskDO::getCreateTime, Arrays1.getIfPresent(request.getCreateTimeRange(), 1))
|
||||
.orderByDesc(UploadTaskDO::getId);
|
||||
.le(UploadTaskDO::getCreateTime, Arrays1.getIfPresent(request.getCreateTimeRange(), 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.orion.visor.module.asset.task;
|
||||
import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.visor.framework.common.utils.LockerUtils;
|
||||
import com.orion.visor.module.asset.define.config.AppExecLogAutoClearConfig;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import com.orion.visor.module.asset.enums.ExecStatusEnum;
|
||||
import com.orion.visor.module.asset.service.ExecLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -57,7 +57,7 @@ public class ExecLogFileAutoClearTask {
|
||||
.subDay(appExecLogAutoClearConfig.getKeepPeriod())
|
||||
.date();
|
||||
// 清理
|
||||
ExecLogQueryRequest request = new ExecLogQueryRequest();
|
||||
ExecLogClearRequest request = new ExecLogClearRequest();
|
||||
request.setCreateTimeLe(createLessEq);
|
||||
request.setStatusList(ExecStatusEnum.FINISH_STATUS_LIST);
|
||||
execLogService.clearExecLog(request);
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.orion.visor.module.asset.task;
|
||||
import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.visor.framework.common.utils.LockerUtils;
|
||||
import com.orion.visor.module.asset.define.config.AppHostConnectLogAutoClearConfig;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogQueryRequest;
|
||||
import com.orion.visor.module.asset.entity.request.host.HostConnectLogClearRequest;
|
||||
import com.orion.visor.module.asset.enums.HostConnectStatusEnum;
|
||||
import com.orion.visor.module.asset.service.HostConnectLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -57,7 +57,7 @@ public class HostConnectLogAutoClearTask {
|
||||
.subDay(appHostConnectLogAutoClearConfig.getKeepPeriod())
|
||||
.date();
|
||||
// 清理
|
||||
HostConnectLogQueryRequest request = new HostConnectLogQueryRequest();
|
||||
HostConnectLogClearRequest request = new HostConnectLogClearRequest();
|
||||
request.setCreateTimeLe(createLessEq);
|
||||
request.setStatusList(HostConnectStatusEnum.FINISH_STATUS_LIST);
|
||||
hostConnectLogService.clearHostConnectLog(request);
|
||||
|
||||
@@ -28,13 +28,15 @@ public class TerminalThemeGenerator {
|
||||
List<File> files = Files1.listFiles("D:\\idea-project\\iTerm2-Color-Schemes\\vhs");
|
||||
// 过滤的 theme
|
||||
List<String> schemaFilter = Lists.of(
|
||||
"Dracula", "Atom",
|
||||
"catppuccin-mocha", "MaterialDesignColors",
|
||||
"catppuccin-macchiato", "OneHalfDark",
|
||||
"Apple System Colors", "Builtin Tango Light",
|
||||
"Duotone Dark", "BlulocoLight",
|
||||
"Chester", "CLRS",
|
||||
"Calamity", "Tomorrow"
|
||||
"Dracula", "Builtin Tango Light",
|
||||
"Atom", "AtomOneLight",
|
||||
"OneHalfDark", "OneHalfLight",
|
||||
"Apple System Colors", "Tomorrow",
|
||||
"catppuccin-mocha", "catppuccin-latte",
|
||||
"catppuccin-macchiato", "BlulocoLight",
|
||||
"catppuccin-frappe", "MaterialDesignColors",
|
||||
"GitHub Dark", "Github",
|
||||
"DimmedMonokai", "Duotone Dark"
|
||||
);
|
||||
// 颜色大写
|
||||
ValueFilter colorFilter = (Object object, String name, Object value) -> {
|
||||
@@ -60,7 +62,7 @@ public class TerminalThemeGenerator {
|
||||
theme.setDark(Colors.isDarkColor(background));
|
||||
theme.setSchema(JSON.parseObject(JSON.toJSONString(schema), TerminalThemeSchema.class));
|
||||
return theme;
|
||||
}).collect(Collectors.toList());
|
||||
}).skip(0).limit(50).collect(Collectors.toList());
|
||||
// 排序
|
||||
if (!Lists.isEmpty(schemaFilter)) {
|
||||
arr.sort(Comparator.comparing(s -> schemaFilter.indexOf(s.getName())));
|
||||
@@ -70,11 +72,12 @@ public class TerminalThemeGenerator {
|
||||
for (TerminalTheme theme : arr) {
|
||||
System.out.println("name: " + theme.name);
|
||||
System.out.println("dark: " + theme.dark);
|
||||
System.out.println("value: \n" + JSON.toJSONString(theme.schema, colorFilter));
|
||||
System.out.println("value: " + JSON.toJSONString(theme.schema, colorFilter));
|
||||
System.out.println("json: " + JSON.toJSONString(theme, colorFilter));
|
||||
System.out.println();
|
||||
}
|
||||
// String json = JSON.toJSONString(arr, colorFilter);
|
||||
// System.out.println("\n" + json);
|
||||
String json = JSON.toJSONString(arr, colorFilter);
|
||||
System.out.println("\n" + json);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import com.orion.visor.module.infra.entity.dto.user.SystemUserAuthDTO;
|
||||
|
||||
/**
|
||||
* 认证服务实现
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/14 21:37
|
||||
*/
|
||||
public interface AuthenticationApi {
|
||||
|
||||
/**
|
||||
* 通过密码认证
|
||||
*
|
||||
* @param username username
|
||||
* @param password password
|
||||
* @param addFailedCount addFailedCount
|
||||
* @return result
|
||||
*/
|
||||
SystemUserAuthDTO authByPassword(String username, String password, boolean addFailedCount);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import com.orion.visor.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||
import com.orion.visor.module.infra.enums.DataGroupTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
@@ -37,6 +36,7 @@ public interface DataGroupRelApi {
|
||||
/**
|
||||
* 添加关联
|
||||
*
|
||||
* @param type type
|
||||
* @param groupId groupId
|
||||
* @param relId relId
|
||||
*/
|
||||
@@ -45,9 +45,10 @@ public interface DataGroupRelApi {
|
||||
/**
|
||||
* 批量添加关联
|
||||
*
|
||||
* @param list list
|
||||
* @param type type
|
||||
* @param groupRelListMap groupRelListMap
|
||||
*/
|
||||
void addGroupRel(DataGroupTypeEnum type, List<DataGroupRelCreateDTO> list);
|
||||
void addGroupRel(DataGroupTypeEnum type, Map<Long, List<Long>> groupRelListMap);
|
||||
|
||||
/**
|
||||
* 通过 type 查询 relId 缓存
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import com.orion.visor.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||
import com.orion.visor.module.infra.enums.DataGroupTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
@@ -40,11 +39,11 @@ public interface DataGroupUserRelApi {
|
||||
/**
|
||||
* 批量添加关联
|
||||
*
|
||||
* @param type type
|
||||
* @param userId userId
|
||||
* @param list list
|
||||
* @param type type
|
||||
* @param userId userId
|
||||
* @param groupRelListMap groupRelListMap
|
||||
*/
|
||||
void addGroupRel(DataGroupTypeEnum type, Long userId, List<DataGroupRelCreateDTO> list);
|
||||
void addGroupRel(DataGroupTypeEnum type, Long userId, Map<Long, List<Long>> groupRelListMap);
|
||||
|
||||
/**
|
||||
* 通过 type 查询 relId 缓存
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限 对外服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/19 15:22
|
||||
*/
|
||||
public interface PermissionApi {
|
||||
|
||||
/**
|
||||
* 用户是否为管理员用户
|
||||
*
|
||||
* @param id id
|
||||
* @return isAdmin
|
||||
*/
|
||||
boolean isAdminUser(Long id);
|
||||
|
||||
/**
|
||||
* 检查当前用户是否含有此角色
|
||||
*
|
||||
* @param userId userId
|
||||
* @param role role
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean hasRole(Long userId, String role);
|
||||
|
||||
/**
|
||||
* 检查当前用户是否含有任意角色
|
||||
*
|
||||
* @param userId userId
|
||||
* @param roles roles
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean hasAnyRole(Long userId, List<String> roles);
|
||||
|
||||
/**
|
||||
* 检查当前用户是否含有此权限
|
||||
*
|
||||
* @param userId userId
|
||||
* @param permission permission
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean hasPermission(Long userId, String permission);
|
||||
|
||||
/**
|
||||
* 检查当前用户是否含任意权限
|
||||
*
|
||||
* @param userId userId
|
||||
* @param permissions permissions
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean hasAnyPermission(Long userId, List<String> permissions);
|
||||
|
||||
}
|
||||
@@ -11,6 +11,22 @@ import com.orion.visor.module.infra.entity.dto.user.SystemUserDTO;
|
||||
*/
|
||||
public interface SystemUserApi {
|
||||
|
||||
/**
|
||||
* 通过 id 查询用户名
|
||||
*
|
||||
* @param id id
|
||||
* @return username
|
||||
*/
|
||||
String getUsernameById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 查询花名
|
||||
*
|
||||
* @param id id
|
||||
* @return nickname
|
||||
*/
|
||||
String getNicknameById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 查询用户
|
||||
*
|
||||
@@ -19,12 +35,4 @@ public interface SystemUserApi {
|
||||
*/
|
||||
SystemUserDTO getUserById(Long id);
|
||||
|
||||
/**
|
||||
* 用户是否为管理员用户
|
||||
*
|
||||
* @param id id
|
||||
* @return isAdmin
|
||||
*/
|
||||
boolean isAdminUser(Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.orion.visor.module.infra.entity.dto.data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 数据分组关联 创建请求业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-11-7 18:44
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DataGroupRelCreateDTO", description = "数据分组关联 创建请求业务对象")
|
||||
public class DataGroupRelCreateDTO implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "组id")
|
||||
private Long groupId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "引用id")
|
||||
private Long relId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.orion.visor.module.infra.entity.dto.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户状态检查 业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/14 21:52
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemUserAuthDTO", description = "用户认证 业务对象")
|
||||
public class SystemUserAuthDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "花名")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "密码是否正确")
|
||||
private Boolean passRight;
|
||||
|
||||
@Schema(description = "认证是否通过")
|
||||
private Boolean authed;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.orion.visor.module.infra.api.impl;
|
||||
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.module.infra.api.AuthenticationApi;
|
||||
import com.orion.visor.module.infra.entity.domain.SystemUserDO;
|
||||
import com.orion.visor.module.infra.entity.dto.user.SystemUserAuthDTO;
|
||||
import com.orion.visor.module.infra.service.AuthenticationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 认证服务实现
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/14 21:37
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AuthenticationApiImpl implements AuthenticationApi {
|
||||
|
||||
@Resource
|
||||
private AuthenticationService authenticationService;
|
||||
|
||||
@Override
|
||||
public SystemUserAuthDTO authByPassword(String username, String password, boolean addFailedCount) {
|
||||
SystemUserAuthDTO result = new SystemUserAuthDTO();
|
||||
try {
|
||||
// 登录预检
|
||||
SystemUserDO user = authenticationService.preCheckLogin(username, password);
|
||||
result.setId(user.getId());
|
||||
result.setUsername(user.getUsername());
|
||||
result.setNickname(user.getNickname());
|
||||
// 检查用户密码
|
||||
boolean passRight = authenticationService.checkUserPassword(user, password, addFailedCount);
|
||||
result.setPassRight(passRight);
|
||||
Valid.isTrue(passRight, ErrorMessage.USERNAME_PASSWORD_ERROR);
|
||||
// 检查用户状态
|
||||
authenticationService.checkUserStatus(user);
|
||||
result.setAuthed(true);
|
||||
} catch (Exception e) {
|
||||
result.setAuthed(false);
|
||||
result.setErrorMessage(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,8 @@ package com.orion.visor.module.infra.api.impl;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.module.infra.api.DataGroupRelApi;
|
||||
import com.orion.visor.module.infra.convert.DataGroupRelProviderConvert;
|
||||
import com.orion.visor.module.infra.entity.domain.DataGroupRelDO;
|
||||
import com.orion.visor.module.infra.entity.dto.DataGroupRelCacheDTO;
|
||||
import com.orion.visor.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||
import com.orion.visor.module.infra.entity.request.data.DataGroupRelCreateRequest;
|
||||
import com.orion.visor.module.infra.enums.DataGroupTypeEnum;
|
||||
import com.orion.visor.module.infra.service.DataGroupRelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -57,10 +54,9 @@ public class DataGroupRelApiImpl implements DataGroupRelApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroupRel(DataGroupTypeEnum type, List<DataGroupRelCreateDTO> list) {
|
||||
Valid.valid(list);
|
||||
List<DataGroupRelCreateRequest> rows = DataGroupRelProviderConvert.MAPPER.toList(list);
|
||||
dataGroupRelService.addGroupRel(type.name(), Const.SYSTEM_USER_ID, rows);
|
||||
public void addGroupRel(DataGroupTypeEnum type, Map<Long, List<Long>> groupRelListMap) {
|
||||
Valid.notEmpty(groupRelListMap);
|
||||
dataGroupRelService.addGroupRel(type.name(), Const.SYSTEM_USER_ID, groupRelListMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,11 +2,8 @@ package com.orion.visor.module.infra.api.impl;
|
||||
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.module.infra.api.DataGroupUserRelApi;
|
||||
import com.orion.visor.module.infra.convert.DataGroupRelProviderConvert;
|
||||
import com.orion.visor.module.infra.entity.domain.DataGroupRelDO;
|
||||
import com.orion.visor.module.infra.entity.dto.DataGroupRelCacheDTO;
|
||||
import com.orion.visor.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||
import com.orion.visor.module.infra.entity.request.data.DataGroupRelCreateRequest;
|
||||
import com.orion.visor.module.infra.enums.DataGroupTypeEnum;
|
||||
import com.orion.visor.module.infra.service.DataGroupRelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -50,10 +47,9 @@ public class DataGroupUserRelApiImpl implements DataGroupUserRelApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroupRel(DataGroupTypeEnum type, Long userId, List<DataGroupRelCreateDTO> list) {
|
||||
Valid.valid(list);
|
||||
List<DataGroupRelCreateRequest> rows = DataGroupRelProviderConvert.MAPPER.toList(list);
|
||||
dataGroupRelService.addGroupRel(type.name(), userId, rows);
|
||||
public void addGroupRel(DataGroupTypeEnum type, Long userId, Map<Long, List<Long>> groupRelListMap) {
|
||||
Valid.notEmpty(groupRelListMap);
|
||||
dataGroupRelService.addGroupRel(type.name(), userId, groupRelListMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,9 +32,12 @@ public class OperatorLogApiImpl implements OperatorLogApi {
|
||||
@Override
|
||||
public DataGrid<OperatorLogDTO> getOperatorLogPage(OperatorLogQueryDTO request) {
|
||||
Valid.valid(request);
|
||||
// 条件
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return operatorLogDAO.of()
|
||||
.page(request)
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.wrapper(wrapper)
|
||||
.dataGrid(OperatorLogProviderConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.orion.visor.module.infra.api.impl;
|
||||
|
||||
import com.orion.visor.module.infra.api.PermissionApi;
|
||||
import com.orion.visor.module.infra.service.PermissionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限 对外服务类实现
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/19 15:25
|
||||
*/
|
||||
@Service
|
||||
public class PermissionApiImpl implements PermissionApi {
|
||||
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Override
|
||||
public boolean isAdminUser(Long id) {
|
||||
return permissionService.isAdminUser(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRole(Long userId, String role) {
|
||||
return permissionService.hasRole(userId, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnyRole(Long userId, List<String> roles) {
|
||||
return permissionService.hasAnyRole(userId, roles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Long userId, String permission) {
|
||||
return permissionService.hasPermission(userId, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnyPermission(Long userId, List<String> permissions) {
|
||||
return permissionService.hasAnyPermission(userId, permissions);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.orion.visor.module.infra.convert.SystemUserProviderConvert;
|
||||
import com.orion.visor.module.infra.dao.SystemUserDAO;
|
||||
import com.orion.visor.module.infra.entity.domain.SystemUserDO;
|
||||
import com.orion.visor.module.infra.entity.dto.user.SystemUserDTO;
|
||||
import com.orion.visor.module.infra.service.SystemUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -23,8 +22,25 @@ public class SystemUserApiImpl implements SystemUserApi {
|
||||
@Resource
|
||||
private SystemUserDAO systemUserDAO;
|
||||
|
||||
@Resource
|
||||
private SystemUserService systemUserService;
|
||||
@Override
|
||||
public String getUsernameById(Long id) {
|
||||
return systemUserDAO.of()
|
||||
.createWrapper()
|
||||
.select(SystemUserDO::getUsername)
|
||||
.eq(SystemUserDO::getId, id)
|
||||
.then()
|
||||
.getOne(SystemUserDO::getUsername);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNicknameById(Long id) {
|
||||
return systemUserDAO.of()
|
||||
.createWrapper()
|
||||
.select(SystemUserDO::getNickname)
|
||||
.eq(SystemUserDO::getId, id)
|
||||
.then()
|
||||
.getOne(SystemUserDO::getNickname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemUserDTO getUserById(Long id) {
|
||||
@@ -35,9 +51,4 @@ public class SystemUserApiImpl implements SystemUserApi {
|
||||
return SystemUserProviderConvert.MAPPER.to(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdminUser(Long id) {
|
||||
return systemUserService.isAdminUser(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.infra.define.operator.OperatorLogOperatorType;
|
||||
import com.orion.visor.module.infra.entity.request.operator.OperatorLogClearRequest;
|
||||
import com.orion.visor.module.infra.entity.request.operator.OperatorLogQueryRequest;
|
||||
import com.orion.visor.module.infra.entity.vo.OperatorLogVO;
|
||||
import com.orion.visor.module.infra.service.OperatorLogService;
|
||||
@@ -56,10 +57,10 @@ public class OperatorLogController {
|
||||
return operatorLogService.deleteOperatorLog(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query-count")
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询操作日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('infra:operator-log:management:clear')")
|
||||
public Long getOperatorLogCount(@RequestBody OperatorLogQueryRequest request) {
|
||||
@PreAuthorize("@ss.hasPermission('infra:operator-log:query')")
|
||||
public Long getOperatorLogCount(@Validated @RequestBody OperatorLogQueryRequest request) {
|
||||
return operatorLogService.getOperatorLogCount(request);
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@ public class OperatorLogController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空操作日志")
|
||||
@PreAuthorize("@ss.hasPermission('infra:operator-log:management:clear')")
|
||||
public Integer clearOperatorLog(@RequestBody OperatorLogQueryRequest request) {
|
||||
public Integer clearOperatorLog(@Validated @RequestBody OperatorLogClearRequest request) {
|
||||
return operatorLogService.clearOperatorLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class SystemRoleController {
|
||||
@Resource
|
||||
private SystemRoleMenuService systemRoleMenuService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemRoleOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建角色")
|
||||
@@ -56,6 +57,7 @@ public class SystemRoleController {
|
||||
return systemRoleService.createSystemRole(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemRoleOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新角色")
|
||||
@@ -116,6 +118,7 @@ public class SystemRoleController {
|
||||
return systemRoleService.deleteSystemRoleById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemRoleOperatorType.GRANT_MENU)
|
||||
@PutMapping("/grant-menu")
|
||||
@Operation(summary = "分配角色菜单")
|
||||
|
||||
@@ -55,6 +55,7 @@ public class SystemUserController {
|
||||
@Resource
|
||||
private OperatorLogService operatorLogService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户")
|
||||
@@ -63,6 +64,7 @@ public class SystemUserController {
|
||||
return systemUserService.createSystemUser(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新用户")
|
||||
@@ -82,6 +84,7 @@ public class SystemUserController {
|
||||
return systemUserService.updateUserStatus(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.GRANT_ROLE)
|
||||
@PutMapping("/grant-role")
|
||||
@Operation(summary = "分配用户角色")
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.infra.entity.vo.SystemMenuVO;
|
||||
import com.orion.visor.module.infra.entity.vo.UserPermissionVO;
|
||||
import com.orion.visor.module.infra.service.PermissionService;
|
||||
import com.orion.visor.module.infra.service.UserPermissionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -26,22 +26,23 @@ import java.util.List;
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/14 11:20
|
||||
*/
|
||||
@Tag(name = "infra - 权限服务")
|
||||
@Tag(name = "infra - 用户权限服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/permission")
|
||||
public class PermissionController {
|
||||
@RequestMapping("/infra/user-permission")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class UserPermissionController {
|
||||
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
private UserPermissionService userPermissionService;
|
||||
|
||||
@PutMapping("/refresh-cache")
|
||||
@Operation(summary = "刷新角色权限缓存")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:management:refresh-cache')")
|
||||
public Boolean refreshCache() {
|
||||
permissionService.initPermissionCache();
|
||||
userPermissionService.initPermissionCache();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,14 +50,14 @@ public class PermissionController {
|
||||
@GetMapping("/menu")
|
||||
@Operation(summary = "获取用户菜单")
|
||||
public List<SystemMenuVO> getUserMenuList() {
|
||||
return permissionService.getUserMenuList();
|
||||
return userPermissionService.getUserMenuList();
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/user")
|
||||
@Operation(summary = "获取用户权限聚合信息")
|
||||
public UserPermissionVO getUserPermission() {
|
||||
return permissionService.getUserPermission();
|
||||
return userPermissionService.getUserPermission();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.orion.visor.module.infra.convert;
|
||||
|
||||
import com.orion.visor.module.infra.entity.domain.DataGroupRelDO;
|
||||
import com.orion.visor.module.infra.entity.dto.DataGroupRelCacheDTO;
|
||||
import com.orion.visor.module.infra.entity.request.data.DataGroupRelCreateRequest;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -18,8 +17,6 @@ public interface DataGroupRelConvert {
|
||||
|
||||
DataGroupRelConvert MAPPER = Mappers.getMapper(DataGroupRelConvert.class);
|
||||
|
||||
DataGroupRelDO to(DataGroupRelCreateRequest request);
|
||||
|
||||
DataGroupRelCacheDTO toCache(DataGroupRelDO domain);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.orion.visor.module.infra.convert;
|
||||
|
||||
import com.orion.visor.module.infra.entity.dto.data.DataGroupRelCreateDTO;
|
||||
import com.orion.visor.module.infra.entity.request.data.DataGroupRelCreateRequest;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据分组关联 对外服务对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-11-7 18:44
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataGroupRelProviderConvert {
|
||||
|
||||
DataGroupRelProviderConvert MAPPER = Mappers.getMapper(DataGroupRelProviderConvert.class);
|
||||
|
||||
DataGroupRelCreateRequest toRequest(DataGroupRelCreateDTO request);
|
||||
|
||||
List<DataGroupRelCreateRequest> toList(List<DataGroupRelCreateDTO> list);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user