Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f73fa14bfd | ||
|
|
fd88c725d3 | ||
|
|
3a16f9d9ab | ||
|
|
de9b89d805 | ||
|
|
a05c387ba1 | ||
|
|
3cb6e5a2d4 | ||
|
|
104a9a0aa3 | ||
|
|
d7b747eac4 | ||
|
|
d2949c11f3 | ||
|
|
cd05f71173 | ||
|
|
e0dca73369 | ||
|
|
b8599a6693 | ||
|
|
a0adb415fa | ||
|
|
6c60756e54 | ||
|
|
ee9f51ce7d | ||
|
|
924b46b41a | ||
|
|
1fca5a1912 |
12
README.md
12
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)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
@@ -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.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.5
|
||||
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.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.5
|
||||
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.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.5
|
||||
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.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- ${SERVICE_PORT:-1081}:80
|
||||
@@ -32,7 +32,7 @@ services:
|
||||
- mysql
|
||||
- redis
|
||||
mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
@@ -52,7 +52,7 @@ services:
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.5
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
@@ -68,7 +68,7 @@ services:
|
||||
retries: 15
|
||||
start_period: 3s
|
||||
adminer:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.4
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.5
|
||||
ports:
|
||||
- 8081:8080
|
||||
depends_on:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/bash
|
||||
version=2.1.4
|
||||
version=2.1.5
|
||||
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.4
|
||||
version=2.1.5
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.1.4
|
||||
version=2.1.5
|
||||
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.4
|
||||
version=2.1.5
|
||||
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.4
|
||||
version=2.1.5
|
||||
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} .
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.1.4</revision>
|
||||
<revision>2.1.5</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.4";
|
||||
String VERSION = "2.1.5";
|
||||
|
||||
/**
|
||||
* 同 ${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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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.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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -53,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();
|
||||
}
|
||||
@@ -89,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -259,9 +259,10 @@ public class HostServiceImpl implements HostService {
|
||||
if (wrapper == null) {
|
||||
return DataGrid.of(Lists.empty());
|
||||
}
|
||||
// 数量条件
|
||||
LambdaQueryWrapper<HostDO> countWrapper = wrapper.clone();
|
||||
wrapper.select(HostDAO.BASE_COLUMN);
|
||||
// 基础条件
|
||||
LambdaQueryWrapper<HostDO> countWrapper = wrapper.clone()
|
||||
.select(HostDAO.BASE_COLUMN)
|
||||
.orderByAsc(HostDO::getId);
|
||||
// 查询
|
||||
DataGrid<HostVO> hosts = hostDAO.of(wrapper)
|
||||
.page(request)
|
||||
@@ -271,6 +272,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 +290,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 +326,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 +363,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 条件
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 缓存
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = "分配用户角色")
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.orion.visor.module.infra.entity.request.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 = "DataGroupRelCreateRequest", description = "数据分组关联 创建请求对象")
|
||||
public class DataGroupRelCreateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "组id")
|
||||
private Long groupId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "引用id")
|
||||
private Long relId;
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.orion.visor.module.infra.entity.request.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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据分组关联 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-11-7 18:44
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DataGroupRelUpdateRequest", description = "数据分组关联 更新请求对象")
|
||||
public class DataGroupRelUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "组id")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "引用id")
|
||||
private List<Long> relIdList;
|
||||
|
||||
}
|
||||
@@ -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.NotNull;
|
||||
import java.io.Serializable;
|
||||
@@ -30,7 +31,8 @@ public class CronNextRequest implements Serializable {
|
||||
private String expression;
|
||||
|
||||
@NotNull
|
||||
@Range(min = 1, max = 100)
|
||||
@Min(value = 1)
|
||||
@Max(value = 100)
|
||||
@Schema(description = "次数")
|
||||
private Integer times;
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.infra.entity.request.operator;
|
||||
|
||||
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-10-10 17:08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "OperatorLogClearRequest", description = "操作日志 清理请求对象")
|
||||
public class OperatorLogClearRequest extends OperatorLogQueryRequest implements DataClearRequest {
|
||||
|
||||
@NotNull
|
||||
@Min(value = 1)
|
||||
@Max(value = 2000)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.orion.visor.module.infra.handler.upload;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.lang.annotation.Keep;
|
||||
import com.orion.lang.utils.io.Streams;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.constant.ExtraFieldConst;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.orion.visor.module.infra.service;
|
||||
|
||||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据分组关联 服务类
|
||||
@@ -34,19 +34,23 @@ public interface DataGroupRelService {
|
||||
void updateRelGroup(String type, Long userId, List<Long> groupIdList, Long relId);
|
||||
|
||||
/**
|
||||
* 添加关联
|
||||
* 添加关联 只新增
|
||||
*
|
||||
* @param type type
|
||||
* @param userId userId
|
||||
* @param groupId groupId
|
||||
* @param relId relId
|
||||
*/
|
||||
void addGroupRel(String type, Long userId, Long groupId, Long relId);
|
||||
|
||||
/**
|
||||
* 添加关联
|
||||
* 添加关联 只新增
|
||||
*
|
||||
* @param list list
|
||||
* @param type type
|
||||
* @param userId userId
|
||||
* @param groupRelListMap groupRelListMap
|
||||
*/
|
||||
void addGroupRel(String type, Long userId, List<DataGroupRelCreateRequest> list);
|
||||
void addGroupRel(String type, Long userId, Map<Long, List<Long>> groupRelListMap);
|
||||
|
||||
/**
|
||||
* 通过 type 查询 relId 缓存
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.orion.visor.module.infra.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import com.orion.visor.module.infra.entity.domain.OperatorLogDO;
|
||||
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.LoginHistoryVO;
|
||||
import com.orion.visor.module.infra.entity.vo.OperatorLogVO;
|
||||
@@ -54,7 +57,7 @@ public interface OperatorLogService {
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer clearOperatorLog(OperatorLogQueryRequest request);
|
||||
Integer clearOperatorLog(OperatorLogClearRequest request);
|
||||
|
||||
/**
|
||||
* 查询用户登录日志
|
||||
@@ -65,4 +68,12 @@ public interface OperatorLogService {
|
||||
*/
|
||||
List<LoginHistoryVO> getLoginHistory(String username, Integer count);
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
LambdaQueryWrapper<OperatorLogDO> buildQueryWrapper(OperatorLogQueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orion.visor.module.infra.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.module.infra.entity.domain.SystemUserDO;
|
||||
import com.orion.visor.module.infra.entity.request.user.*;
|
||||
import com.orion.visor.module.infra.entity.vo.SystemUserVO;
|
||||
|
||||
@@ -62,6 +64,14 @@ public interface SystemUserService {
|
||||
*/
|
||||
DataGrid<SystemUserVO> getSystemUserPage(SystemUserQueryRequest request);
|
||||
|
||||
/**
|
||||
* 查询系统用户数量
|
||||
*
|
||||
* @param request request
|
||||
* @return count
|
||||
*/
|
||||
Long getSystemUserCount(SystemUserQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除用户
|
||||
*
|
||||
@@ -92,4 +102,12 @@ public interface SystemUserService {
|
||||
*/
|
||||
void resetPassword(UserResetPasswordRequest request);
|
||||
|
||||
/**
|
||||
* 获取查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
LambdaQueryWrapper<SystemUserDO> buildQueryWrapper(SystemUserQueryRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.infra.service.impl;
|
||||
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.collect.Maps;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
@@ -17,17 +18,13 @@ import com.orion.visor.module.infra.define.cache.DataGroupCacheKeyDefine;
|
||||
import com.orion.visor.module.infra.entity.domain.DataGroupDO;
|
||||
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 com.orion.visor.module.infra.service.DataGroupRelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -122,64 +119,32 @@ public class DataGroupRelServiceImpl implements DataGroupRelService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addGroupRel(String type, Long userId, Long groupId, Long relId) {
|
||||
DataGroupRelCreateRequest record = DataGroupRelCreateRequest.builder()
|
||||
.groupId(Valid.notNull(groupId))
|
||||
.relId(Valid.notNull(relId))
|
||||
.build();
|
||||
Map<Long, List<Long>> map = new HashMap<>();
|
||||
map.put(groupId, Lists.singleton(relId));
|
||||
// 插入
|
||||
SpringHolder.getBean(DataGroupRelService.class)
|
||||
.addGroupRel(type, userId, Lists.singleton(record));
|
||||
SpringHolder.getBean(DataGroupRelService.class).addGroupRel(type, userId, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addGroupRel(String type, Long userId, List<DataGroupRelCreateRequest> list) {
|
||||
if (Lists.isEmpty(list)) {
|
||||
public void addGroupRel(String type, Long userId, Map<Long, List<Long>> groupRelListMap) {
|
||||
if (Maps.isEmpty(groupRelListMap)) {
|
||||
return;
|
||||
}
|
||||
// 通过 groupId 分组
|
||||
Map<Long, List<DataGroupRelCreateRequest>> groupMapping = list.stream()
|
||||
.collect(Collectors.groupingBy(DataGroupRelCreateRequest::getGroupId));
|
||||
// 查询分组信息
|
||||
List<DataGroupDO> groups = dataGroupDAO.selectBatchIds(groupMapping.keySet());
|
||||
Valid.eq(groups.size(), groupMapping.size(), ErrorMessage.GROUP_ABSENT);
|
||||
// 查询关联是否存在
|
||||
groupMapping.forEach((k, v) -> {
|
||||
List<Long> relIdList = v.stream()
|
||||
.map(DataGroupRelCreateRequest::getRelId)
|
||||
.collect(Collectors.toList());
|
||||
// 查询关联
|
||||
List<Long> presentRelIdList = dataGroupRelDAO.of()
|
||||
.createWrapper()
|
||||
.eq(DataGroupRelDO::getGroupId, k)
|
||||
.in(DataGroupRelDO::getRelId, relIdList)
|
||||
.then()
|
||||
.stream()
|
||||
.map(DataGroupRelDO::getRelId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (!presentRelIdList.isEmpty()) {
|
||||
// 删除待插入的重复数据
|
||||
v.removeIf(s -> presentRelIdList.contains(s.getRelId()));
|
||||
}
|
||||
});
|
||||
// 构建插入数据
|
||||
List<DataGroupRelDO> records = new ArrayList<>();
|
||||
groupMapping.forEach((k, v) -> {
|
||||
groupRelListMap.forEach((k, v) -> {
|
||||
v.forEach(s -> records.add(DataGroupRelDO.builder()
|
||||
.groupId(k)
|
||||
.type(type)
|
||||
.userId(userId)
|
||||
.relId(s.getRelId())
|
||||
.relId(s)
|
||||
.build()));
|
||||
});
|
||||
// 不为空则插入
|
||||
if (!records.isEmpty()) {
|
||||
// 插入
|
||||
dataGroupRelDAO.insertBatch(records);
|
||||
// 删除缓存
|
||||
this.deleteCache(type, userId, groupMapping.keySet());
|
||||
}
|
||||
// 插入
|
||||
dataGroupRelDAO.insertBatch(records);
|
||||
// 删除缓存
|
||||
this.deleteCache(type, userId, groupRelListMap.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.orion.visor.module.infra.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.annotation.Keep;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisLists;
|
||||
import com.orion.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
|
||||
@@ -8,10 +8,12 @@ import com.orion.lang.utils.Valid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.module.infra.convert.OperatorLogConvert;
|
||||
import com.orion.visor.module.infra.dao.OperatorLogDAO;
|
||||
import com.orion.visor.module.infra.define.operator.AuthenticationOperatorType;
|
||||
import com.orion.visor.module.infra.entity.domain.OperatorLogDO;
|
||||
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.LoginHistoryVO;
|
||||
import com.orion.visor.module.infra.entity.vo.OperatorLogVO;
|
||||
@@ -47,7 +49,8 @@ public class OperatorLogServiceImpl implements OperatorLogService {
|
||||
@Override
|
||||
public DataGrid<OperatorLogVO> getOperatorLogPage(OperatorLogQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByDesc(OperatorLogDO::getId);
|
||||
// 查询
|
||||
return operatorLogDAO.of(wrapper)
|
||||
.page(request)
|
||||
@@ -66,14 +69,22 @@ public class OperatorLogServiceImpl implements OperatorLogService {
|
||||
|
||||
@Override
|
||||
public Long getOperatorLogCount(OperatorLogQueryRequest request) {
|
||||
return operatorLogDAO.selectCount(this.buildQueryWrapper(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return operatorLogDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer clearOperatorLog(OperatorLogQueryRequest request) {
|
||||
public Integer clearOperatorLog(OperatorLogClearRequest request) {
|
||||
log.info("OperatorLogService.clearOperatorLog start {}", JSON.toJSONString(request));
|
||||
// 删除参数
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.orderByAsc(OperatorLogDO::getId)
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
// 删除
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
int effect = operatorLogDAO.delete(wrapper);
|
||||
log.info("OperatorLogService.clearOperatorLog finish {}", effect);
|
||||
// 设置日志参数
|
||||
@@ -83,25 +94,20 @@ public class OperatorLogServiceImpl implements OperatorLogService {
|
||||
|
||||
@Override
|
||||
public List<LoginHistoryVO> getLoginHistory(String username, Integer count) {
|
||||
Valid.gt(count, 0, ErrorMessage.PARAM_ERROR);
|
||||
// 条件
|
||||
OperatorLogQueryRequest request = new OperatorLogQueryRequest();
|
||||
request.setUsername(username);
|
||||
request.setType(AuthenticationOperatorType.LOGIN);
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
Valid.inRange(count, 0, 100, ErrorMessage.PARAM_ERROR);
|
||||
// 查询
|
||||
return operatorLogDAO.of(wrapper)
|
||||
return operatorLogDAO.of()
|
||||
.createWrapper()
|
||||
.eq(OperatorLogDO::getUsername, username)
|
||||
.eq(OperatorLogDO::getType, AuthenticationOperatorType.LOGIN)
|
||||
.orderByDesc(OperatorLogDO::getId)
|
||||
.then()
|
||||
.limit(count)
|
||||
.list(OperatorLogConvert.MAPPER::toLoginHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<OperatorLogDO> buildQueryWrapper(OperatorLogQueryRequest request) {
|
||||
@Override
|
||||
public LambdaQueryWrapper<OperatorLogDO> buildQueryWrapper(OperatorLogQueryRequest request) {
|
||||
return operatorLogDAO.wrapper()
|
||||
.eq(OperatorLogDO::getUserId, request.getUserId())
|
||||
.eq(OperatorLogDO::getUsername, request.getUsername())
|
||||
@@ -110,8 +116,7 @@ public class OperatorLogServiceImpl implements OperatorLogService {
|
||||
.eq(OperatorLogDO::getType, request.getType())
|
||||
.eq(OperatorLogDO::getResult, request.getResult())
|
||||
.ge(OperatorLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 0))
|
||||
.le(OperatorLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 1))
|
||||
.orderByDesc(OperatorLogDO::getId);
|
||||
.le(OperatorLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -207,20 +207,25 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
|
||||
@Override
|
||||
public DataGrid<SystemUserVO> getSystemUserPage(SystemUserQueryRequest request) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemUserDO> wrapper = systemUserDAO.wrapper()
|
||||
.eq(SystemUserDO::getId, request.getId())
|
||||
.like(SystemUserDO::getUsername, request.getUsername())
|
||||
.like(SystemUserDO::getNickname, request.getNickname())
|
||||
.like(SystemUserDO::getMobile, request.getMobile())
|
||||
.like(SystemUserDO::getEmail, request.getEmail())
|
||||
.eq(SystemUserDO::getStatus, request.getStatus());
|
||||
// 条件
|
||||
LambdaQueryWrapper<SystemUserDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return systemUserDAO.of(wrapper)
|
||||
return systemUserDAO.of()
|
||||
.page(request)
|
||||
.wrapper(wrapper)
|
||||
.dataGrid(SystemUserConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSystemUserCount(SystemUserQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<SystemUserDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return systemUserDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemUserById(Long id) {
|
||||
return this.deleteSystemUserByIdList(Lists.singleton(id));
|
||||
@@ -358,4 +363,15 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
RedisUtils.delete(deleteKeys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapper<SystemUserDO> buildQueryWrapper(SystemUserQueryRequest request) {
|
||||
return systemUserDAO.wrapper()
|
||||
.eq(SystemUserDO::getId, request.getId())
|
||||
.like(SystemUserDO::getUsername, request.getUsername())
|
||||
.like(SystemUserDO::getNickname, request.getNickname())
|
||||
.like(SystemUserDO::getMobile, request.getMobile())
|
||||
.like(SystemUserDO::getEmail, request.getEmail())
|
||||
.eq(SystemUserDO::getStatus, request.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.orion.visor.module.infra.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.utils.collect.Lists;
|
||||
import com.orion.lang.utils.collect.Maps;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisStrings;
|
||||
import com.orion.visor.module.infra.convert.TagRelConvert;
|
||||
import com.orion.visor.module.infra.dao.TagDAO;
|
||||
@@ -45,12 +45,6 @@ public class TagRelServiceImpl implements TagRelService {
|
||||
|
||||
@Override
|
||||
public void addTagRel(String type, Long relId, List<Long> tagIdList) {
|
||||
// 删除引用
|
||||
TagRelQueryRequest deleteRequest = new TagRelQueryRequest();
|
||||
deleteRequest.setTagType(type);
|
||||
deleteRequest.setRelId(relId);
|
||||
LambdaQueryWrapper<TagRelDO> deleteWrapper = this.buildQueryWrapper(deleteRequest);
|
||||
tagRelDAO.delete(deleteWrapper);
|
||||
// 查询 tag
|
||||
List<TagDO> tagList = tagDAO.selectBatchIds(tagIdList);
|
||||
// 插入引用
|
||||
@@ -63,9 +57,6 @@ public class TagRelServiceImpl implements TagRelService {
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
tagRelDAO.insertBatch(tagRelList);
|
||||
// 设置缓存
|
||||
String cacheKey = TagCacheKeyDefine.TAG_REL.format(type, relId);
|
||||
RedisStrings.setJson(cacheKey, TagCacheKeyDefine.TAG_REL, TagRelConvert.MAPPER.toCacheList(tagRelList));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-visor/api'
|
||||
VITE_WS_BASE_URL= 'ws://127.0.0.1:9200/orion-visor/keep-alive'
|
||||
VITE_APP_VERSION= '2.1.4'
|
||||
VITE_APP_VERSION= '2.1.5'
|
||||
VITE_APP_RELEASE= 'community'
|
||||
VITE_SFTP_PREVIEW_MB= 2
|
||||
VITE_DEMO_MODE= false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
VITE_API_BASE_URL= '/orion-visor/api'
|
||||
VITE_WS_BASE_URL= '/orion-visor/keep-alive'
|
||||
VITE_APP_VERSION= '2.1.4'
|
||||
VITE_APP_VERSION= '2.1.5'
|
||||
VITE_APP_RELEASE= 'community'
|
||||
VITE_SFTP_PREVIEW_MB= 2
|
||||
VITE_DEMO_MODE= false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "orion-visor-ui",
|
||||
"description": "Orion Visor UI",
|
||||
"version": "2.1.4",
|
||||
"version": "2.1.5",
|
||||
"private": true,
|
||||
"author": "Jiahang Li",
|
||||
"license": "Apache 2.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { ClearRequest, DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
@@ -17,6 +17,12 @@ export interface HostConnectLogQueryRequest extends Pagination {
|
||||
startTimeRange?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机连接日志清理请求
|
||||
*/
|
||||
export interface HostConnectLogClearRequest extends HostConnectLogQueryRequest, ClearRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机连接日志查询响应
|
||||
*/
|
||||
@@ -88,13 +94,13 @@ export function deleteHostConnectLog(idList: Array<number>) {
|
||||
* 查询主机连接日志数量
|
||||
*/
|
||||
export function getHostConnectLogCount(request: HostConnectLogQueryRequest) {
|
||||
return axios.post<number>('/asset/host-connect-log/query-count', request);
|
||||
return axios.post<number>('/asset/host-connect-log/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空主机连接日志
|
||||
*/
|
||||
export function clearHostConnectLog(request: HostConnectLogQueryRequest) {
|
||||
export function clearHostConnectLog(request: HostConnectLogClearRequest) {
|
||||
return axios.post<number>('/asset/host-connect-log/clear', request);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user