🔨 数据清理时添加条数限制.
This commit is contained in:
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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,12 +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 javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 公共页码请求
|
||||
@@ -17,16 +17,18 @@ import javax.validation.constraints.Min;
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "公共页码请求")
|
||||
public class PageRequest implements IPageRequest {
|
||||
public class PageRequest {
|
||||
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 10000, groups = Page.class)
|
||||
@Schema(description = "页码")
|
||||
private int page;
|
||||
private Integer page;
|
||||
|
||||
@NotNull(groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 200, groups = Page.class)
|
||||
@Schema(description = "大小")
|
||||
private int limit;
|
||||
private Integer limit;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SqlUtils {
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(Integer limit) {
|
||||
public static String limit(Number limit) {
|
||||
return Const.LIMIT + Const.SPACE + limit;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SqlUtils {
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(int offset, Integer limit) {
|
||||
public static String limit(Number offset, Number limit) {
|
||||
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class DataQuery<T> {
|
||||
|
||||
private final BaseMapper<T> dao;
|
||||
|
||||
private IPageRequest page;
|
||||
private PageRequest page;
|
||||
|
||||
private Wrapper<T> wrapper;
|
||||
|
||||
@@ -74,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;
|
||||
}
|
||||
|
||||
@@ -200,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
|
||||
|
||||
@@ -152,10 +152,9 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
#end
|
||||
@Override
|
||||
public Long get${type}Count(${type}QueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return ${typeLower}DAO.selectCount(wrapper);
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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,18 +1,24 @@
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://127.0.0.1:3306/orion_visor?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
url: jdbc:mysql://116.62.194.246:3306/orion_visor?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
username: root
|
||||
password: Data@123456
|
||||
password: maxData@123456
|
||||
# url: jdbc:mysql://101.43.254.243:3307/orion_visor?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
# username: root
|
||||
# password: Data@123456
|
||||
initial-size: 0
|
||||
min-idle: 1
|
||||
max-active: 5
|
||||
stat-view-servlet:
|
||||
enabled: false
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
host: 116.62.194.246
|
||||
port: 6379
|
||||
password: Data@123456
|
||||
password: maxData@123456
|
||||
# host: 101.43.254.243
|
||||
# port: 6380
|
||||
# password: Data@123456
|
||||
redisson:
|
||||
threads: 2
|
||||
netty-threads: 2
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
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;
|
||||
@@ -11,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;
|
||||
@@ -98,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 = "删除批量执行日志")
|
||||
@@ -125,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(@Validated(Clear.class) @RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecCommandLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
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.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;
|
||||
@@ -87,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 = "删除计划任务日志")
|
||||
@@ -114,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(@Validated(Clear.class) @RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecJobLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Id;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
@@ -10,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;
|
||||
@@ -50,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 = "查询全部主机连接会话")
|
||||
@@ -74,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(@Validated(Clear.class) @RequestBody HostConnectLogQueryRequest request) {
|
||||
public Integer clearHostConnectLog(@Validated @RequestBody HostConnectLogClearRequest request) {
|
||||
return hostConnectLogService.clearHostConnectLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
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.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;
|
||||
@@ -95,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 = "删除上传任务")
|
||||
@@ -113,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(@Validated(Clear.class) @RequestBody UploadTaskQueryRequest request) {
|
||||
public Integer clearUploadTask(@Validated @RequestBody UploadTaskClearRequest request) {
|
||||
return uploadTaskService.clearUploadTask(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
package com.orion.visor.module.asset.entity.request.exec;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -67,16 +62,4 @@ public class ExecLogQueryRequest extends PageRequest {
|
||||
@Schema(description = "状态")
|
||||
private List<String> statusList;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 1000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.orion.visor.module.asset.entity.request.host;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Id;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
@@ -70,16 +66,4 @@ public class HostConnectLogQueryRequest extends PageRequest {
|
||||
@Schema(description = "状态")
|
||||
private List<String> statusList;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 2000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
package com.orion.visor.module.asset.entity.request.upload;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -49,16 +44,4 @@ public class UploadTaskQueryRequest extends PageRequest {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date[] createTimeRange;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 2000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
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 +94,7 @@ public interface ExecLogService {
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer clearExecLog(ExecLogQueryRequest request);
|
||||
Integer clearExecLog(ExecLogClearRequest request);
|
||||
|
||||
/**
|
||||
* 中断命令执行
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.asset.service;
|
||||
|
||||
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 +96,7 @@ public interface HostConnectLogService {
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer clearHostConnectLog(HostConnectLogQueryRequest request);
|
||||
Integer clearHostConnectLog(HostConnectLogClearRequest request);
|
||||
|
||||
/**
|
||||
* 强制断开主机连接
|
||||
|
||||
@@ -80,6 +80,14 @@ public interface HostService {
|
||||
*/
|
||||
DataGrid<HostVO> getHostPage(HostQueryRequest request);
|
||||
|
||||
/**
|
||||
* 查询主机数量
|
||||
*
|
||||
* @param request request
|
||||
* @return count
|
||||
*/
|
||||
Long getHostCount(HostQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除主机
|
||||
*
|
||||
@@ -110,4 +118,9 @@ public interface HostService {
|
||||
*/
|
||||
Long getCurrentUpdateConfigHostId();
|
||||
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
void clearCache();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
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 +67,7 @@ public interface UploadTaskService {
|
||||
* @param request request
|
||||
* @return count
|
||||
*/
|
||||
Integer clearUploadTask(UploadTaskQueryRequest request);
|
||||
Integer clearUploadTask(UploadTaskClearRequest 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,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.id.UUIds;
|
||||
import com.orion.lang.utils.Arrays1;
|
||||
@@ -12,7 +13,6 @@ 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;
|
||||
@@ -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;
|
||||
@@ -219,17 +220,19 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
|
||||
@Override
|
||||
public Long queryExecLogCount(ExecLogQueryRequest request) {
|
||||
return execLogDAO.selectCount(this.buildQueryWrapper(request));
|
||||
return execLogDAO.of()
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.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)
|
||||
.last(SqlUtils.limit(request.getClearLimit()));
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
List<Long> idList = execLogDAO.selectList(wrapper)
|
||||
.stream()
|
||||
.map(ExecLogDO::getId)
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -186,17 +187,19 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
|
||||
@Override
|
||||
public Long getHostConnectLogCount(HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogDAO.selectCount(this.buildQueryWrapper(request));
|
||||
return hostConnectLogDAO.of()
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer clearHostConnectLog(HostConnectLogQueryRequest request) {
|
||||
public Integer clearHostConnectLog(HostConnectLogClearRequest request) {
|
||||
log.info("HostConnectLogService.clearHostConnectLog start {}", JSON.toJSONString(request));
|
||||
// 查询
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(HostConnectLogDO::getId)
|
||||
.last(SqlUtils.limit(request.getClearLimit()));
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
List<HostConnectLogDO> list = hostConnectLogDAO.selectList(wrapper);
|
||||
if (list.isEmpty()) {
|
||||
log.info("HostConnectLogService.clearHostConnectLog empty");
|
||||
|
||||
@@ -271,6 +271,13 @@ public class HostServiceImpl implements HostService {
|
||||
return hosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getHostCount(HostQueryRequest request) {
|
||||
return hostDAO.of()
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.countMax(request.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteHostById(Long id) {
|
||||
return this.deleteHostByIdList(Lists.singleton(id));
|
||||
@@ -315,10 +322,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("*"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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,7 +13,6 @@ 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;
|
||||
@@ -31,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;
|
||||
@@ -219,16 +216,18 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
|
||||
@Override
|
||||
public Long getUploadTaskCount(UploadTaskQueryRequest request) {
|
||||
return uploadTaskDAO.selectCount(this.buildQueryWrapper(request));
|
||||
return uploadTaskDAO.of()
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.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)
|
||||
.last(SqlUtils.limit(request.getClearLimit()));
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
List<Long> idList = uploadTaskDAO.of(wrapper)
|
||||
.list(UploadTaskDO::getId);
|
||||
// 删除
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.orion.visor.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
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.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;
|
||||
@@ -57,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);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class OperatorLogController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空操作日志")
|
||||
@PreAuthorize("@ss.hasPermission('infra:operator-log:management:clear')")
|
||||
public Integer clearOperatorLog(@Validated(Clear.class) @RequestBody OperatorLogQueryRequest request) {
|
||||
public Integer clearOperatorLog(@Validated @RequestBody OperatorLogClearRequest request) {
|
||||
return operatorLogService.clearOperatorLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,15 +1,10 @@
|
||||
package com.orion.visor.module.infra.entity.request.operator;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -53,16 +48,4 @@ public class OperatorLogQueryRequest extends PageRequest {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date[] startTimeRange;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 2000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,6 +2,7 @@ package com.orion.visor.module.infra.service;
|
||||
|
||||
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.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 +55,7 @@ public interface OperatorLogService {
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer clearOperatorLog(OperatorLogQueryRequest request);
|
||||
Integer clearOperatorLog(OperatorLogClearRequest request);
|
||||
|
||||
/**
|
||||
* 查询用户登录日志
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -13,6 +13,7 @@ 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;
|
||||
@@ -67,15 +68,17 @@ public class OperatorLogServiceImpl implements OperatorLogService {
|
||||
|
||||
@Override
|
||||
public Long getOperatorLogCount(OperatorLogQueryRequest request) {
|
||||
return operatorLogDAO.selectCount(this.buildQueryWrapper(request));
|
||||
return operatorLogDAO.of()
|
||||
.wrapper(this.buildQueryWrapper(request))
|
||||
.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);
|
||||
wrapper.last(SqlUtils.limit(request.getClearLimit()));
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.last(SqlUtils.limit(request.getLimit()));
|
||||
// 删除
|
||||
int effect = operatorLogDAO.delete(wrapper);
|
||||
log.info("OperatorLogService.clearOperatorLog finish {}", effect);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
@@ -15,7 +15,12 @@ export interface HostConnectLogQueryRequest extends Pagination {
|
||||
token?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主机连接日志清理请求
|
||||
*/
|
||||
export interface HostConnectLogClearRequest extends HostConnectLogQueryRequest, ClearRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
@@ -160,6 +161,13 @@ export function getHostPage(request: HostQueryRequest) {
|
||||
return axios.post<DataGrid<HostQueryResponse>>('/asset/host/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主机数量
|
||||
*/
|
||||
export function getHostCount(request: HostQueryRequest) {
|
||||
return axios.post<number>('/asset/host/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除主机
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { DataGrid } from '@/types/global';
|
||||
import type {
|
||||
ExecHostLogQueryResponse,
|
||||
ExecLogClearRequest,
|
||||
ExecLogInterruptRequest,
|
||||
ExecLogQueryRequest,
|
||||
ExecLogQueryResponse,
|
||||
@@ -80,13 +81,13 @@ export function deleteExecCommandHostLog(id: number) {
|
||||
* 查询批量执行日志数量
|
||||
*/
|
||||
export function getExecCommandLogCount(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-command-log/query-count', request);
|
||||
return axios.post<number>('/asset/exec-command-log/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空批量执行日志
|
||||
*/
|
||||
export function clearExecCommandLog(request: ExecLogQueryRequest) {
|
||||
export function clearExecCommandLog(request: ExecLogClearRequest) {
|
||||
return axios.post<number>('/asset/exec-command-log/clear', request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Pagination } from '@/types/global';
|
||||
import type { ClearRequest, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { createAppWebSocket } from '@/utils/http';
|
||||
|
||||
@@ -13,7 +13,12 @@ export interface ExecLogQueryRequest extends Pagination {
|
||||
command?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行日志清理请求
|
||||
*/
|
||||
export interface ExecLogClearRequest extends ExecLogQueryRequest, ClearRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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';
|
||||
@@ -40,7 +40,12 @@ export interface UploadTaskQueryRequest extends Pagination {
|
||||
description?: string;
|
||||
status?: string;
|
||||
createTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传任务清理请求
|
||||
*/
|
||||
export interface UploadTaskClearRequest extends UploadTaskQueryRequest, ClearRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,12 +175,12 @@ export function batchDeleteUploadTask(idList: Array<number>) {
|
||||
* 查询主机连接日志数量
|
||||
*/
|
||||
export function getUploadTaskCount(request: UploadTaskQueryRequest) {
|
||||
return axios.post<number>('/asset/upload-task/query-count', request);
|
||||
return axios.post<number>('/asset/upload-task/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空主机连接日志
|
||||
*/
|
||||
export function clearUploadTask(request: UploadTaskQueryRequest) {
|
||||
export function clearUploadTask(request: UploadTaskClearRequest) {
|
||||
return axios.post<number>('/asset/upload-task/clear', request);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { DataGrid } from '@/types/global';
|
||||
import type {
|
||||
ExecHostLogQueryResponse,
|
||||
ExecLogClearRequest,
|
||||
ExecLogInterruptRequest,
|
||||
ExecLogQueryRequest,
|
||||
ExecLogQueryResponse,
|
||||
@@ -73,13 +74,13 @@ export function deleteExecJobHostLog(id: number) {
|
||||
* 查询计划任务日志数量
|
||||
*/
|
||||
export function getExecJobLogCount(request: ExecLogQueryRequest) {
|
||||
return axios.post<number>('/asset/exec-job-log/query-count', request);
|
||||
return axios.post<number>('/asset/exec-job-log/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空计划任务日志
|
||||
*/
|
||||
export function clearExecJobLog(request: ExecLogQueryRequest) {
|
||||
export function clearExecJobLog(request: ExecLogClearRequest) {
|
||||
return axios.post<number>('/asset/exec-job-log/clear', request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 应用信息查询响应
|
||||
*/
|
||||
export interface SystemLicenseResponse {
|
||||
userCount: number;
|
||||
hostCount: number;
|
||||
release: string;
|
||||
releaseName: string;
|
||||
issueDate: number;
|
||||
expireDate: number;
|
||||
expireDay: number;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用信息查询响应
|
||||
*/
|
||||
@@ -9,13 +23,20 @@ export interface AppInfoResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓库版本信息查询响应
|
||||
* 应用最新版本信息
|
||||
*/
|
||||
export interface RepoReleaseResponse {
|
||||
tag_name: string;
|
||||
export interface AppReleaseResponse {
|
||||
tagName: string;
|
||||
body: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 license 信息
|
||||
*/
|
||||
export function getSystemLicenseInfo() {
|
||||
return axios.get<SystemLicenseResponse>('/infra/system-setting/license');
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用信息
|
||||
*/
|
||||
@@ -24,10 +45,10 @@ export function getSystemAppInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓库最后版本信息
|
||||
* 获取应用最新版本信息
|
||||
*/
|
||||
export function getRepoLatestRelease() {
|
||||
return axios.get<RepoReleaseResponse>('https://visor.orionsec.cn/releases-latest.json', {
|
||||
export function getAppLatestRelease() {
|
||||
return axios.get<AppReleaseResponse>('https://visor.orionsec.cn/releases-latest.json', {
|
||||
// 不添加请求头 否则会报 401
|
||||
setAuthorization: false,
|
||||
// 返回原始输出
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { ClearRequest, DataGrid, Pagination } from '@/types/global';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
@@ -13,7 +13,12 @@ export interface OperatorLogQueryRequest extends Pagination {
|
||||
riskLevel?: string;
|
||||
result?: number;
|
||||
startTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作日志清理参数
|
||||
*/
|
||||
export interface OperatorLogClearRequest extends OperatorLogQueryRequest, ClearRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,12 +70,12 @@ export function deleteOperatorLog(idList: Array<number>) {
|
||||
* 查询操作日志数量
|
||||
*/
|
||||
export function getOperatorLogCount(request: OperatorLogQueryRequest) {
|
||||
return axios.post<number>('/infra/operator-log/query-count', request);
|
||||
return axios.post<number>('/infra/operator-log/count', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
export function clearOperatorLog(request: OperatorLogQueryRequest) {
|
||||
export function clearOperatorLog(request: OperatorLogClearRequest) {
|
||||
return axios.post<number>('/infra/operator-log/clear', request);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ export interface Pagination {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface ClearRequest {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface NodeData {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@@ -55,12 +55,12 @@
|
||||
:options="toOptions(connectTypeKey)"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
<!-- 数量限制 -->
|
||||
<a-form-item field="limit" label="数量限制">
|
||||
<a-input-number v-model="formModel.limit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
:max="maxLimit"
|
||||
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
@@ -80,7 +80,7 @@
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { connectStatusKey, connectTypeKey, clearLimit } from '../types/const';
|
||||
import { connectStatusKey, connectTypeKey, maxClearLimit } from '../types/const';
|
||||
import { getHostConnectLogCount, clearHostConnectLog } from '@/api/asset/host-connect-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
@@ -101,14 +101,16 @@
|
||||
type: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
limit: maxLimit.value,
|
||||
};
|
||||
};
|
||||
|
||||
const maxLimit = ref<number>(0);
|
||||
const formModel = ref<HostConnectLogQueryRequest>({});
|
||||
|
||||
// 打开
|
||||
const open = (record: any) => {
|
||||
maxLimit.value = maxClearLimit;
|
||||
renderForm({ ...defaultForm(), ...record });
|
||||
setVisible(true);
|
||||
};
|
||||
@@ -122,8 +124,8 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
if (!formModel.value.limit) {
|
||||
Message.error('请输入数量限制');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -148,7 +150,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -12,8 +12,8 @@ export const HostConnectStatus = {
|
||||
FORCE_OFFLINE: 'FORCE_OFFLINE',
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 2000;
|
||||
|
||||
// 主机连接状态 字典项
|
||||
export const connectStatusKey = 'hostConnectStatus';
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
@close="handleClose">
|
||||
<a-spin class="full" :loading="loading">
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:auto-label-width="true">
|
||||
<!-- 执行时间 -->
|
||||
@@ -48,12 +47,12 @@
|
||||
:options="toOptions(execStatusKey)"
|
||||
placeholder="请选择执行状态" />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
<!-- 数量限制 -->
|
||||
<a-form-item field="limit" label="数量限制">
|
||||
<a-input-number v-model="formModel.limit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
:max="maxLimit"
|
||||
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
@@ -77,7 +76,7 @@
|
||||
import { getExecCommandLogCount, clearExecCommandLog } from '@/api/exec/exec-command-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { clearLimit } from '../types/const';
|
||||
import { maxClearLimit } from '../types/const';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
|
||||
const emits = defineEmits(['clear']);
|
||||
@@ -86,7 +85,7 @@
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions } = useDictStore();
|
||||
|
||||
const formRef = ref<any>();
|
||||
const maxLimit = ref<number>(0);
|
||||
const formModel = ref<ExecLogQueryRequest>({});
|
||||
|
||||
const defaultForm = (): ExecLogQueryRequest => {
|
||||
@@ -97,12 +96,13 @@
|
||||
command: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
limit: maxLimit.value,
|
||||
};
|
||||
};
|
||||
|
||||
// 打开
|
||||
const open = (record: any) => {
|
||||
maxLimit.value = maxClearLimit;
|
||||
renderForm({ ...defaultForm(), ...record });
|
||||
setVisible(true);
|
||||
};
|
||||
@@ -116,8 +116,8 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
if (!formModel.value.limit) {
|
||||
Message.error('请输入数量限制');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -142,7 +142,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// 清理数量
|
||||
export const clearLimit = 1000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 1000;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
@close="handleClose">
|
||||
<a-spin class="full" :loading="loading">
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:auto-label-width="true">
|
||||
<!-- 上传时间 -->
|
||||
@@ -49,12 +48,12 @@
|
||||
placeholder="请选择状态"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
<!-- 数量限制 -->
|
||||
<a-form-item field="limit" label="数量限制">
|
||||
<a-input-number v-model="formModel.limit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
:max="maxLimit"
|
||||
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
@@ -74,7 +73,7 @@
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { clearLimit, uploadTaskStatusKey } from '../types/const';
|
||||
import { maxClearLimit, uploadTaskStatusKey } from '../types/const';
|
||||
import { getUploadTaskCount, clearUploadTask } from '@/api/exec/upload-task';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
@@ -86,7 +85,7 @@
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions } = useDictStore();
|
||||
|
||||
const formRef = ref<any>();
|
||||
const maxLimit = ref<number>(0);
|
||||
const formModel = ref<UploadTaskQueryRequest>({});
|
||||
|
||||
const defaultForm = (): UploadTaskQueryRequest => {
|
||||
@@ -96,11 +95,13 @@
|
||||
description: undefined,
|
||||
status: undefined,
|
||||
createTimeRange: undefined,
|
||||
limit: maxLimit.value,
|
||||
};
|
||||
};
|
||||
|
||||
// 打开
|
||||
const open = (record: any) => {
|
||||
maxLimit.value = maxClearLimit;
|
||||
renderForm({ ...defaultForm(), ...record });
|
||||
setVisible(true);
|
||||
};
|
||||
@@ -114,8 +115,8 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
if (!formModel.value.limit) {
|
||||
Message.error('请输入数量限制');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -140,7 +141,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -26,8 +26,8 @@ export const UploadTaskFileStatus = {
|
||||
CANCELED: 'CANCELED',
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 2000;
|
||||
|
||||
// 上传任务状态 字典项
|
||||
export const uploadTaskStatusKey = 'uploadTaskStatus';
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
@close="handleClose">
|
||||
<a-spin class="full" :loading="loading">
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:auto-label-width="true">
|
||||
<!-- 执行时间 -->
|
||||
@@ -43,12 +42,12 @@
|
||||
:options="toOptions(execStatusKey)"
|
||||
placeholder="请选择执行状态" />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
<!-- 数量限制 -->
|
||||
<a-form-item field="limit" label="数量限制">
|
||||
<a-input-number v-model="formModel.limit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
:max="maxLimit"
|
||||
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
@@ -72,7 +71,7 @@
|
||||
import { getExecJobLogCount, clearExecJobLog } from '@/api/job/exec-job-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { clearLimit } from '../types/const';
|
||||
import { maxClearLimit } from '../types/const';
|
||||
import ExecJobSelector from '@/components/exec/job/selector/index.vue';
|
||||
|
||||
const emits = defineEmits(['clear']);
|
||||
@@ -81,7 +80,7 @@
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions } = useDictStore();
|
||||
|
||||
const formRef = ref<any>();
|
||||
const maxLimit = ref<number>(0);
|
||||
const formModel = ref<ExecLogQueryRequest>({});
|
||||
|
||||
const defaultForm = (): ExecLogQueryRequest => {
|
||||
@@ -92,12 +91,13 @@
|
||||
command: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
limit: maxLimit.value,
|
||||
};
|
||||
};
|
||||
|
||||
// 打开
|
||||
const open = (record: any) => {
|
||||
maxLimit.value = maxClearLimit;
|
||||
renderForm({ ...defaultForm(), ...record });
|
||||
setVisible(true);
|
||||
};
|
||||
@@ -111,8 +111,8 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
if (!formModel.value.limit) {
|
||||
Message.error('请输入数量限制');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -137,7 +137,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// 清理数量
|
||||
export const clearLimit = 1000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 1000;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
<!-- 不一致提示 -->
|
||||
<a-alert v-if="app.version && webVersion !== app.version"
|
||||
class="alert-wrapper">
|
||||
当前前端版本与后端版本不一致, 请使用 Ctrl + F5 刷新页面
|
||||
当前前端版本与后端版本不一致, 请使用 Ctrl + F5 强制刷新页面
|
||||
</a-alert>
|
||||
<!-- 升级提示 -->
|
||||
<a v-if="app.version && repo.tag_name && ('v' + app.version) !== repo.tag_name"
|
||||
<a v-if="app.version && repo.tagName && ('v' + app.version) !== repo.tagName"
|
||||
class="alert-href"
|
||||
target="_blank"
|
||||
:href="`https://github.com/dromara/orion-visor/releases/tag/${repo.tag_name}`">
|
||||
:href="`https://github.com/dromara/orion-visor/releases/tag/${repo.tagName}`">
|
||||
<a-alert class="alert-wrapper">
|
||||
新版本已发布, 请及时升级版本
|
||||
</a-alert>
|
||||
@@ -23,7 +23,7 @@
|
||||
:column="1">
|
||||
<!-- 机器码 -->
|
||||
<a-descriptions-item label="机器码">
|
||||
<span class="text-copy span-blue uuid-wrapper" @click="copy(app.uuid, true)">
|
||||
<span class="text-copy uuid-wrapper" @click="copy(app.uuid, true)">
|
||||
{{ app.uuid }}
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
@@ -37,7 +37,7 @@
|
||||
</a-descriptions-item>
|
||||
<!-- 当前后端版本 -->
|
||||
<a-descriptions-item label="最新发布版本">
|
||||
{{ repo.tag_name }}
|
||||
{{ repo.tagName }}
|
||||
</a-descriptions-item>
|
||||
<!-- 当前后端版本 -->
|
||||
<a-descriptions-item label="最新更新日志">
|
||||
@@ -58,9 +58,9 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { AppInfoResponse, RepoReleaseResponse } from '@/api/system/setting';
|
||||
import type { AppInfoResponse, AppReleaseResponse } from '@/api/system/setting';
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import { getRepoLatestRelease, getSystemAppInfo } from '@/api/system/setting';
|
||||
import { getAppLatestRelease, getSystemAppInfo } from '@/api/system/setting';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
uuid: '',
|
||||
});
|
||||
|
||||
const repo = reactive<RepoReleaseResponse>({
|
||||
tag_name: '',
|
||||
const repo = reactive<AppReleaseResponse>({
|
||||
tagName: '',
|
||||
body: '',
|
||||
});
|
||||
|
||||
@@ -86,14 +86,14 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 加载仓库信息
|
||||
// 加载版本信息
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const { data } = await getRepoLatestRelease();
|
||||
repo.tag_name = data.tag_name;
|
||||
const { data } = await getAppLatestRelease();
|
||||
repo.tagName = data.tagName;
|
||||
repo.body = data.body;
|
||||
} catch (e) {
|
||||
Message.error('获取仓库信息失败, 请等待后重试');
|
||||
Message.error('获取应用最新版本失败, 请等待后重试');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
}
|
||||
|
||||
.uuid-wrapper {
|
||||
color: rgb(var(--arcoblue-6));
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,12 +61,12 @@
|
||||
placeholder="请选择执行结果"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
<!-- 数量限制 -->
|
||||
<a-form-item field="limit" label="数量限制">
|
||||
<a-input-number v-model="formModel.limit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
:max="maxLimit"
|
||||
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
@@ -90,7 +90,7 @@
|
||||
import { getOperatorLogCount, clearOperatorLog } from '@/api/user/operator-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { operatorLogModuleKey, operatorLogResultKey, operatorLogTypeKey, operatorRiskLevelKey, clearLimit } from '../types/const';
|
||||
import { operatorLogModuleKey, operatorLogResultKey, operatorLogTypeKey, operatorRiskLevelKey, maxClearLimit } from '../types/const';
|
||||
import { labelFilter } from '@/types/form';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
|
||||
@@ -105,10 +105,11 @@
|
||||
riskLevel: undefined,
|
||||
result: undefined,
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
limit: maxLimit.value,
|
||||
};
|
||||
};
|
||||
|
||||
const maxLimit = ref<number>(0);
|
||||
const typeOptions = ref<SelectOptionData[]>(toOptions(operatorLogTypeKey));
|
||||
const formModel = ref<OperatorLogQueryRequest>({});
|
||||
|
||||
@@ -116,6 +117,7 @@
|
||||
|
||||
// 打开
|
||||
const open = (record: OperatorLogQueryRequest) => {
|
||||
maxLimit.value = maxClearLimit;
|
||||
renderForm({ ...defaultForm(), ...record });
|
||||
setVisible(true);
|
||||
};
|
||||
@@ -146,8 +148,8 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
if (!formModel.value.limit) {
|
||||
Message.error('请输入数量限制');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -172,7 +174,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -27,8 +27,8 @@ export const getLogDetail = (record: OperatorLogQueryResponse): Record<string, a
|
||||
}
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 2000;
|
||||
|
||||
// 操作日志模块 字典项
|
||||
export const operatorLogModuleKey = 'operatorLogModule';
|
||||
|
||||
Reference in New Issue
Block a user