🎉 优化 exec 模块逻辑.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-module-exec</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>orion-visor-module-exec-provider</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目执行模块</description>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -20,21 +20,25 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.jsch;
|
||||
package org.dromara.visor.module.exec.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 连接消息
|
||||
* 执行任务对外服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/7/11 16:30
|
||||
* @since 2024/10/14 13:10
|
||||
*/
|
||||
public interface SessionMessage {
|
||||
public interface ExecJobApi {
|
||||
|
||||
String AUTHENTICATION_FAILURE = "身份认证失败. {}";
|
||||
|
||||
String SERVER_UNREACHABLE = "无法连接至服务器. {}";
|
||||
|
||||
String CONNECTION_TIMEOUT = "连接服务器超时. {}";
|
||||
/**
|
||||
* 通过 hostId 删除任务主机
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByHostIdList(List<Long> hostIdList);
|
||||
|
||||
}
|
||||
@@ -20,20 +20,25 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.api;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecTemplateHostDO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行模板主机 Mapper 接口
|
||||
* 执行模板对外服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.6
|
||||
* @since 2024-4-22 12:13
|
||||
* @version 1.0.0
|
||||
* @since 2024/10/14 13:10
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecTemplateHostDAO extends IMapper<ExecTemplateHostDO> {
|
||||
public interface ExecTemplateApi {
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除模板主机
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByHostIdList(List<Long> hostIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-module-exec</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>orion-visor-module-exec-service</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目执行模块</description>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<!-- common -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- module common -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-module-common</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- module provider -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-module-infra-provider</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-module-asset-provider</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-module-exec-provider</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- framework starter -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-log</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-biz-operator-log</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-desensitize</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-storage</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 混淆插件 -->
|
||||
<plugin>
|
||||
<groupId>com.github.wvengen</groupId>
|
||||
<artifactId>proguard-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.exec.api.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.module.exec.api.ExecJobApi;
|
||||
import org.dromara.visor.module.exec.dao.ExecJobHostDAO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行任务对外服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/10/14 13:10
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExecJobApiImpl implements ExecJobApi {
|
||||
|
||||
@Resource
|
||||
private ExecJobHostDAO execJobHostDAO;
|
||||
|
||||
@Override
|
||||
public Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||
return execJobHostDAO.deleteByHostIdList(hostIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.exec.api.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.module.exec.api.ExecTemplateApi;
|
||||
import org.dromara.visor.module.exec.dao.ExecTemplateHostDAO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行模板对外服务实现
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/10/14 13:10
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExecTemplateApiImpl implements ExecTemplateApi {
|
||||
|
||||
@Resource
|
||||
private ExecTemplateHostDAO execTemplateHostDAO;
|
||||
|
||||
@Override
|
||||
public Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||
return execTemplateHostDAO.deleteByHostIdList(hostIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.exec.configuration;
|
||||
|
||||
import org.dromara.visor.module.exec.handler.exec.log.ExecLogTailHandler;
|
||||
import org.dromara.visor.module.exec.interceptor.ExecLogTailInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 执行模块 websocket 配置
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/12/28 11:39
|
||||
*/
|
||||
@Configuration
|
||||
public class ExecWebSocketConfiguration implements WebSocketConfigurer {
|
||||
|
||||
@Value("${orion.websocket.prefix}")
|
||||
private String prefix;
|
||||
|
||||
@Resource
|
||||
private ExecLogTailInterceptor execLogTailInterceptor;
|
||||
|
||||
@Resource
|
||||
private ExecLogTailHandler execLogTailHandler;
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
// 执行日志
|
||||
registry.addHandler(execLogTailHandler, prefix + "/exec/log/{token}")
|
||||
.addInterceptors(execLogTailInterceptor)
|
||||
.setAllowedOrigins("*");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -28,11 +28,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.enums.ReturnType;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.asset.define.operator.ExecCommandOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecCommandRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ReExecCommandRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.asset.service.ExecCommandService;
|
||||
import org.dromara.visor.module.exec.define.operator.ExecCommandOperatorType;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecCommandRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ReExecCommandRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.exec.service.ExecCommandService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -49,12 +49,12 @@ import javax.annotation.Resource;
|
||||
* @version 1.0.0
|
||||
* @since 2024/3/11 11:44
|
||||
*/
|
||||
@Tag(name = "asset - 批量执行服务")
|
||||
@Tag(name = "exec - 批量执行服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-command")
|
||||
@RequestMapping("/exec/exec-command")
|
||||
public class ExecCommandController {
|
||||
|
||||
@Resource
|
||||
@@ -63,7 +63,7 @@ public class ExecCommandController {
|
||||
@OperatorLog(value = ExecCommandOperatorType.EXEC, ret = ReturnType.IGNORE)
|
||||
@PostMapping("/exec")
|
||||
@Operation(summary = "批量执行命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command:exec')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command:exec')")
|
||||
public ExecLogVO execCommand(@Validated @RequestBody ExecCommandRequest request) {
|
||||
return execCommandService.execCommand(request);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class ExecCommandController {
|
||||
@OperatorLog(value = ExecCommandOperatorType.EXEC, ret = ReturnType.IGNORE)
|
||||
@PostMapping("/re-exec")
|
||||
@Operation(summary = "重新执行命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command:exec')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command:exec')")
|
||||
public ExecLogVO reExecCommand(@Validated @RequestBody ReExecCommandRequest request) {
|
||||
return execCommandService.reExecCommand(request.getLogId());
|
||||
}
|
||||
@@ -20,13 +20,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Valid;
|
||||
import org.dromara.visor.common.validator.group.Page;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
@@ -34,16 +29,21 @@ import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.asset.define.operator.ExecCommandLogOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogStatusVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.asset.enums.ExecSourceEnum;
|
||||
import org.dromara.visor.module.asset.service.ExecHostLogService;
|
||||
import org.dromara.visor.module.asset.service.ExecLogService;
|
||||
import org.dromara.visor.module.exec.define.operator.ExecCommandLogOperatorType;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecInterruptRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecLogClearRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecLogStatusVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.exec.enums.ExecSourceEnum;
|
||||
import org.dromara.visor.module.exec.service.ExecHostLogService;
|
||||
import org.dromara.visor.module.exec.service.ExecLogService;
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -59,12 +59,12 @@ import java.util.List;
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Tag(name = "asset - 批量执行日志服务")
|
||||
@Tag(name = "exec - 批量执行日志服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-command-log")
|
||||
@RequestMapping("/exec/exec-command-log")
|
||||
public class ExecCommandLogController {
|
||||
|
||||
private static final String SOURCE = ExecSourceEnum.BATCH.name();
|
||||
@@ -78,7 +78,7 @@ public class ExecCommandLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询批量执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:query')")
|
||||
public DataGrid<ExecLogVO> getExecCommandLogPage(@Validated(Page.class) @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.getExecLogPage(request);
|
||||
@@ -87,7 +87,7 @@ public class ExecCommandLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询批量执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:query')")
|
||||
public ExecLogVO getExecCommandLog(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLog(id, SOURCE);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class ExecCommandLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-host")
|
||||
@Operation(summary = "查询执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:query')")
|
||||
public ExecHostLogVO getExecCommandHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.getExecHostLog(id);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class ExecCommandLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/host-list")
|
||||
@Operation(summary = "查询全部执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:query')")
|
||||
public List<ExecHostLogVO> getExecCommandHostLogList(@RequestParam("logId") Long logId) {
|
||||
return execHostLogService.getExecHostLogList(logId);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class ExecCommandLogController {
|
||||
@GetMapping("/status")
|
||||
@Operation(summary = "查询命令执行状态")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:query')")
|
||||
public ExecLogStatusVO getExecCommandLogStatus(@RequestParam("idList") List<Long> idList) {
|
||||
return execLogService.getExecLogStatus(idList, SOURCE);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class ExecCommandLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/history")
|
||||
@Operation(summary = "查询执行历史")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec-command-log:query', 'asset:exec-command:exec')")
|
||||
@PreAuthorize("@ss.hasAnyPermission('exec:exec-command-log:query', 'exec:exec-command:exec')")
|
||||
public List<ExecLogVO> getExecCommandLogHistory(@Validated(Page.class) ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
request.setUserId(SecurityUtils.getLoginUserId());
|
||||
@@ -129,7 +129,7 @@ public class ExecCommandLogController {
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询批量执行日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:query')")
|
||||
public Long getExecCommandLogCount(@Validated @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
@@ -139,7 +139,7 @@ public class ExecCommandLogController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除批量执行日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:delete')")
|
||||
public Integer deleteExecCommandLog(@RequestParam("id") Long id) {
|
||||
return execLogService.deleteExecLogById(id, SOURCE);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class ExecCommandLogController {
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "删除批量执行日志")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:delete')")
|
||||
public Integer batchDeleteExecCommandLog(@RequestParam("idList") List<Long> idList) {
|
||||
return execLogService.deleteExecLogByIdList(idList, SOURCE);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class ExecCommandLogController {
|
||||
@DeleteMapping("/delete-host")
|
||||
@Operation(summary = "删除执行主机日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:delete')")
|
||||
public Integer deleteExecCommandHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class ExecCommandLogController {
|
||||
@OperatorLog(ExecCommandLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空批量执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:management:clear')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:management:clear')")
|
||||
public Integer clearExecCommandLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
@@ -174,7 +174,7 @@ public class ExecCommandLogController {
|
||||
@GetMapping("/tail")
|
||||
@Operation(summary = "查看批量执行日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec-command-log:query', 'asset:exec-command:exec')")
|
||||
@PreAuthorize("@ss.hasAnyPermission('exec:exec-command-log:query', 'exec:exec-command:exec')")
|
||||
public String getExecCommandLogTailToken(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLogTailToken(id);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class ExecCommandLogController {
|
||||
@OperatorLog(ExecCommandLogOperatorType.DOWNLOAD)
|
||||
@GetMapping("/download")
|
||||
@Operation(summary = "下载批量执行日志")
|
||||
@PreAuthorize("@ss.hasAnyPermission('asset:exec-command-log:query', 'asset:exec-command:exec')")
|
||||
@PreAuthorize("@ss.hasAnyPermission('exec:exec-command-log:query', 'exec:exec-command:exec')")
|
||||
public void downloadExecCommandLogFile(@RequestParam("id") Long id, HttpServletResponse response) {
|
||||
execLogService.downloadLogFile(id, SOURCE, response);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public class ExecCommandLogController {
|
||||
@OperatorLog(value = ExecCommandLogOperatorType.INTERRUPT)
|
||||
@PutMapping("/interrupt")
|
||||
@Operation(summary = "中断批量执行命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:interrupt')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:interrupt')")
|
||||
public Boolean interruptExecCommand(@RequestBody ExecInterruptRequest request) {
|
||||
Long logId = Valid.notNull(request.getLogId());
|
||||
execLogService.interruptExec(logId, SOURCE);
|
||||
@@ -200,7 +200,7 @@ public class ExecCommandLogController {
|
||||
@OperatorLog(value = ExecCommandLogOperatorType.INTERRUPT_HOST)
|
||||
@PutMapping("/interrupt-host")
|
||||
@Operation(summary = "中断批量执行主机命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:interrupt')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-command-log:interrupt')")
|
||||
public Boolean interruptHostExecCommand(@RequestBody ExecInterruptRequest request) {
|
||||
Long hostLogId = Valid.notNull(request.getHostLogId());
|
||||
execLogService.interruptHostExec(hostLogId, SOURCE);
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -33,10 +33,10 @@ import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import org.dromara.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.asset.define.operator.ExecJobOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.*;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecJobVO;
|
||||
import org.dromara.visor.module.asset.service.ExecJobService;
|
||||
import org.dromara.visor.module.exec.define.operator.ExecJobOperatorType;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.*;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecJobVO;
|
||||
import org.dromara.visor.module.exec.service.ExecJobService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -51,12 +51,12 @@ import java.util.List;
|
||||
* @version 1.0.3
|
||||
* @since 2024-3-28 12:03
|
||||
*/
|
||||
@Tag(name = "asset - 计划任务服务")
|
||||
@Tag(name = "exec - 计划任务服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-job")
|
||||
@RequestMapping("/exec/exec-job")
|
||||
public class ExecJobController {
|
||||
|
||||
@Resource
|
||||
@@ -66,7 +66,7 @@ public class ExecJobController {
|
||||
@OperatorLog(ExecJobOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建计划任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:create')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:create')")
|
||||
public Long createExecJob(@Validated @RequestBody ExecJobCreateRequest request) {
|
||||
return execJobService.createExecJob(request);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class ExecJobController {
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新计划任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:update')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:update')")
|
||||
public Integer updateExecJob(@Validated @RequestBody ExecJobUpdateRequest request) {
|
||||
return execJobService.updateExecJobById(request);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class ExecJobController {
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE_STATUS)
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新计划任务状态")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:update-status')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:update-status')")
|
||||
public Integer updateExecJobStatus(@Validated @RequestBody ExecJobUpdateStatusRequest request) {
|
||||
return execJobService.updateExecJobStatus(request);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class ExecJobController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询计划任务")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:query')")
|
||||
public ExecJobVO getExecJob(@RequestParam("id") Long id) {
|
||||
return execJobService.getExecJobById(id);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class ExecJobController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询全部计划任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:query')")
|
||||
public List<ExecJobVO> getExecJobList() {
|
||||
return execJobService.getExecJobList();
|
||||
}
|
||||
@@ -109,16 +109,23 @@ public class ExecJobController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询计划任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:query')")
|
||||
public DataGrid<ExecJobVO> getExecJobPage(@Validated(Page.class) @RequestBody ExecJobQueryRequest request) {
|
||||
return execJobService.getExecJobPage(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询计划任务数量")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:query')")
|
||||
public Long getExecJobCount(@Validated @RequestBody ExecJobQueryRequest request) {
|
||||
return execJobService.getExecJobCount(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecJobOperatorType.UPDATE_EXEC_USER)
|
||||
@PutMapping("/update-exec-user")
|
||||
@Operation(summary = "修改计划任务执行用户")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:update-exec-user')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:update-exec-user')")
|
||||
public Integer updateExecJobExecUser(@Validated @RequestBody ExecJobUpdateExecUserRequest request) {
|
||||
return execJobService.updateExecJobExecUser(request);
|
||||
}
|
||||
@@ -128,7 +135,7 @@ public class ExecJobController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除计划任务")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:delete')")
|
||||
public Integer deleteExecJob(@RequestParam("id") Long id) {
|
||||
return execJobService.deleteExecJobById(id);
|
||||
}
|
||||
@@ -138,7 +145,7 @@ public class ExecJobController {
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除计划任务")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:delete')")
|
||||
public Integer batchDeleteExecJob(@RequestParam("idList") List<Long> idList) {
|
||||
return execJobService.deleteExecJobByIdList(idList);
|
||||
}
|
||||
@@ -146,7 +153,7 @@ public class ExecJobController {
|
||||
@OperatorLog(ExecJobOperatorType.TRIGGER)
|
||||
@PostMapping("/trigger")
|
||||
@Operation(summary = "手动触发计划任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:trigger')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job:trigger')")
|
||||
public Boolean triggerExecJob(@Validated @RequestBody ExecJobTriggerRequest request) {
|
||||
execJobService.manualTriggerExecJob(request.getId());
|
||||
return true;
|
||||
@@ -20,29 +20,29 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.utils.Valid;
|
||||
import org.dromara.visor.common.validator.group.Page;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.asset.define.operator.ExecJobLogOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecInterruptRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogStatusVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.asset.enums.ExecSourceEnum;
|
||||
import org.dromara.visor.module.asset.service.ExecHostLogService;
|
||||
import org.dromara.visor.module.asset.service.ExecLogService;
|
||||
import org.dromara.visor.module.exec.define.operator.ExecJobLogOperatorType;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecInterruptRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecLogClearRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecLogStatusVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.exec.enums.ExecSourceEnum;
|
||||
import org.dromara.visor.module.exec.service.ExecHostLogService;
|
||||
import org.dromara.visor.module.exec.service.ExecLogService;
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -58,12 +58,12 @@ import java.util.List;
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Tag(name = "asset - 计划任务日志服务")
|
||||
@Tag(name = "exec - 计划任务日志服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-job-log")
|
||||
@RequestMapping("/exec/exec-job-log")
|
||||
public class ExecJobLogController {
|
||||
|
||||
private static final String SOURCE = ExecSourceEnum.JOB.name();
|
||||
@@ -77,7 +77,7 @@ public class ExecJobLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public DataGrid<ExecLogVO> getExecJobLogPage(@Validated(Page.class) @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.getExecLogPage(request);
|
||||
@@ -86,7 +86,7 @@ public class ExecJobLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public ExecLogVO getExecJobLog(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLog(id, SOURCE);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class ExecJobLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-host")
|
||||
@Operation(summary = "查询执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public ExecHostLogVO getExecJobHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.getExecHostLog(id);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class ExecJobLogController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/host-list")
|
||||
@Operation(summary = "查询全部执行主机日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public List<ExecHostLogVO> getExecJobHostLogList(@RequestParam("logId") Long logId) {
|
||||
return execHostLogService.getExecHostLogList(logId);
|
||||
}
|
||||
@@ -111,14 +111,14 @@ public class ExecJobLogController {
|
||||
@GetMapping("/status")
|
||||
@Operation(summary = "查询命令执行状态")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public ExecLogStatusVO getExecJobLogStatus(@RequestParam("idList") List<Long> idList) {
|
||||
return execLogService.getExecLogStatus(idList, SOURCE);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询计划任务日志数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public Long getExecJobLogCount(@Validated @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.queryExecLogCount(request);
|
||||
@@ -128,7 +128,7 @@ public class ExecJobLogController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除计划任务日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:delete')")
|
||||
public Integer deleteExecJobLog(@RequestParam("id") Long id) {
|
||||
return execLogService.deleteExecLogById(id, SOURCE);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class ExecJobLogController {
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "删除计划任务日志")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:delete')")
|
||||
public Integer batchDeleteExecJobLog(@RequestParam("idList") List<Long> idList) {
|
||||
return execLogService.deleteExecLogByIdList(idList, SOURCE);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class ExecJobLogController {
|
||||
@DeleteMapping("/delete-host")
|
||||
@Operation(summary = "删除执行主机日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:delete')")
|
||||
public Integer deleteExecJobHostLog(@RequestParam("id") Long id) {
|
||||
return execHostLogService.deleteExecHostLogById(id);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class ExecJobLogController {
|
||||
@OperatorLog(ExecJobLogOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:management:clear')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:management:clear')")
|
||||
public Integer clearExecJobLog(@Validated @RequestBody ExecLogClearRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
@@ -163,7 +163,7 @@ public class ExecJobLogController {
|
||||
@GetMapping("/tail")
|
||||
@Operation(summary = "查看计划任务日志")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public String getExecJobLogTailToken(@RequestParam("id") Long id) {
|
||||
return execLogService.getExecLogTailToken(id);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class ExecJobLogController {
|
||||
@OperatorLog(ExecJobLogOperatorType.DOWNLOAD)
|
||||
@GetMapping("/download")
|
||||
@Operation(summary = "下载计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
|
||||
public void downloadExecJobLogFile(@RequestParam("id") Long id, HttpServletResponse response) {
|
||||
execLogService.downloadLogFile(id, SOURCE, response);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class ExecJobLogController {
|
||||
@OperatorLog(ExecJobLogOperatorType.INTERRUPT)
|
||||
@PutMapping("/interrupt")
|
||||
@Operation(summary = "中断计划任务命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:interrupt')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:interrupt')")
|
||||
public Boolean interruptExecCommand(@RequestBody ExecInterruptRequest request) {
|
||||
Long logId = Valid.notNull(request.getLogId());
|
||||
execLogService.interruptExec(logId, SOURCE);
|
||||
@@ -189,7 +189,7 @@ public class ExecJobLogController {
|
||||
@OperatorLog(ExecJobLogOperatorType.INTERRUPT_HOST)
|
||||
@PutMapping("/interrupt-host")
|
||||
@Operation(summary = "中断计划任务主机命令")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:interrupt')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:interrupt')")
|
||||
public Boolean interruptHostExecCommand(@RequestBody ExecInterruptRequest request) {
|
||||
Long hostLogId = Valid.notNull(request.getHostLogId());
|
||||
execLogService.interruptHostExec(hostLogId, SOURCE);
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecWorkplaceStatisticsVO;
|
||||
import org.dromara.visor.module.exec.service.ExecStatisticsService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* exec - 统计服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/12/23 16:07
|
||||
*/
|
||||
@Tag(name = "exec - 统计服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/exec/statistics")
|
||||
public class ExecStatisticsController {
|
||||
|
||||
@Resource
|
||||
private ExecStatisticsService execStatisticsService;
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-workplace")
|
||||
@Operation(summary = "查询工作台统计信息")
|
||||
public ExecWorkplaceStatisticsVO getWorkplaceStatisticsData() {
|
||||
return execStatisticsService.getWorkplaceStatisticsData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -33,12 +33,12 @@ import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import org.dromara.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.asset.define.operator.ExecTemplateOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecTemplateQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecTemplateVO;
|
||||
import org.dromara.visor.module.asset.service.ExecTemplateService;
|
||||
import org.dromara.visor.module.exec.define.operator.ExecTemplateOperatorType;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecTemplateCreateRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecTemplateQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecTemplateVO;
|
||||
import org.dromara.visor.module.exec.service.ExecTemplateService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -53,12 +53,12 @@ import java.util.List;
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Tag(name = "asset - 执行模板服务")
|
||||
@Tag(name = "exec - 执行模板服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/exec-template")
|
||||
@RequestMapping("/exec/exec-template")
|
||||
public class ExecTemplateController {
|
||||
|
||||
@Resource
|
||||
@@ -68,7 +68,7 @@ public class ExecTemplateController {
|
||||
@OperatorLog(ExecTemplateOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建执行模板")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:create')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:create')")
|
||||
public Long createExecTemplate(@Validated @RequestBody ExecTemplateCreateRequest request) {
|
||||
return execTemplateService.createExecTemplate(request);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class ExecTemplateController {
|
||||
@OperatorLog(ExecTemplateOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新执行模板")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:update')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:update')")
|
||||
public Integer updateExecTemplate(@Validated @RequestBody ExecTemplateUpdateRequest request) {
|
||||
return execTemplateService.updateExecTemplateById(request);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class ExecTemplateController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询执行模板")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:query')")
|
||||
public ExecTemplateVO getExecTemplate(@RequestParam("id") Long id) {
|
||||
return execTemplateService.getExecTemplateById(id);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class ExecTemplateController {
|
||||
@GetMapping("/get-with-authorized")
|
||||
@Operation(summary = "查询执行模板 (查询认证的主机)")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:query')")
|
||||
public ExecTemplateVO getExecTemplateWithAuthorized(@RequestParam("id") Long id) {
|
||||
return execTemplateService.getExecTemplateWithAuthorized(id);
|
||||
}
|
||||
@@ -103,17 +103,24 @@ public class ExecTemplateController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询执行模板")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:query')")
|
||||
public DataGrid<ExecTemplateVO> getExecTemplatePage(@Validated(Page.class) @RequestBody ExecTemplateQueryRequest request) {
|
||||
return execTemplateService.getExecTemplatePage(request);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询执行模板数量")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:query')")
|
||||
public Long getExecTemplateCount(@Validated @RequestBody ExecTemplateQueryRequest request) {
|
||||
return execTemplateService.getExecTemplateCount(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除执行模板")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:delete')")
|
||||
public Integer deleteExecTemplate(@RequestParam("id") Long id) {
|
||||
return execTemplateService.deleteExecTemplateById(id);
|
||||
}
|
||||
@@ -123,7 +130,7 @@ public class ExecTemplateController {
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除执行模板")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:exec-template:delete')")
|
||||
public Integer batchDeleteExecTemplate(@RequestParam("idList") List<Long> idList) {
|
||||
return execTemplateService.deleteExecTemplateByIdList(idList);
|
||||
}
|
||||
@@ -20,27 +20,27 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.controller;
|
||||
package org.dromara.visor.module.exec.controller;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.validator.group.Page;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import org.dromara.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import org.dromara.visor.framework.web.core.annotation.RestWrapper;
|
||||
import org.dromara.visor.module.asset.define.operator.UploadTaskOperatorType;
|
||||
import org.dromara.visor.module.asset.entity.request.upload.UploadTaskClearRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.upload.UploadTaskCreateRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.upload.UploadTaskQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.upload.UploadTaskRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.UploadTaskCreateVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.UploadTaskStatusVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.UploadTaskVO;
|
||||
import org.dromara.visor.module.asset.service.UploadTaskService;
|
||||
import org.dromara.visor.module.exec.define.operator.UploadTaskOperatorType;
|
||||
import org.dromara.visor.module.exec.entity.request.upload.UploadTaskClearRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.upload.UploadTaskCreateRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.upload.UploadTaskQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.upload.UploadTaskRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.UploadTaskCreateVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.UploadTaskStatusVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.UploadTaskVO;
|
||||
import org.dromara.visor.module.exec.service.UploadTaskService;
|
||||
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -55,12 +55,12 @@ import java.util.List;
|
||||
* @version 1.0.7
|
||||
* @since 2024-5-7 22:15
|
||||
*/
|
||||
@Tag(name = "asset - 上传任务服务")
|
||||
@Tag(name = "exec - 上传任务服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/asset/upload-task")
|
||||
@RequestMapping("/exec/upload-task")
|
||||
public class UploadTaskController {
|
||||
|
||||
@Resource
|
||||
@@ -69,14 +69,14 @@ public class UploadTaskController {
|
||||
@OperatorLog(UploadTaskOperatorType.UPLOAD)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建上传任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:upload')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:upload')")
|
||||
public UploadTaskCreateVO createUploadTask(@Validated @RequestBody UploadTaskCreateRequest request) {
|
||||
return uploadTaskService.createUploadTask(request);
|
||||
}
|
||||
|
||||
@PostMapping("/start")
|
||||
@Operation(summary = "开始上传")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:upload')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:upload')")
|
||||
public Boolean startUploadTask(@Validated @RequestBody UploadTaskRequest request) {
|
||||
uploadTaskService.startUploadTask(request.getId());
|
||||
return true;
|
||||
@@ -85,7 +85,7 @@ public class UploadTaskController {
|
||||
@OperatorLog(UploadTaskOperatorType.CANCEL)
|
||||
@PostMapping("/cancel")
|
||||
@Operation(summary = "取消上传")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:upload')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:upload')")
|
||||
public Boolean cancelUploadTask(@Validated @RequestBody UploadTaskRequest request) {
|
||||
uploadTaskService.cancelUploadTask(request);
|
||||
return true;
|
||||
@@ -95,7 +95,7 @@ public class UploadTaskController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询上传任务")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:query')")
|
||||
public UploadTaskVO getUploadTask(@RequestParam("id") Long id) {
|
||||
return uploadTaskService.getUploadTask(id);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class UploadTaskController {
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询上传任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:query')")
|
||||
public DataGrid<UploadTaskVO> getUploadTaskPage(@Validated(Page.class) @RequestBody UploadTaskQueryRequest request) {
|
||||
return uploadTaskService.getUploadTaskPage(request);
|
||||
}
|
||||
@@ -112,15 +112,15 @@ public class UploadTaskController {
|
||||
@GetMapping("/status")
|
||||
@Operation(summary = "查询上传状态")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:query')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:query')")
|
||||
public List<UploadTaskStatusVO> getUploadTaskStatus(@RequestParam("idList") List<Long> idList, @RequestParam("queryFiles") Boolean queryFiles) {
|
||||
return uploadTaskService.getUploadTaskStatus(idList, queryFiles);
|
||||
}
|
||||
|
||||
@PostMapping("/count")
|
||||
@Operation(summary = "查询上传任务数量")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:query')")
|
||||
public Long getUploadTaskCount(@RequestBody UploadTaskQueryRequest request) {
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:query')")
|
||||
public Long getUploadTaskCount(@Validated @RequestBody UploadTaskQueryRequest request) {
|
||||
return uploadTaskService.getUploadTaskCount(request);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class UploadTaskController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除上传任务")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:delete')")
|
||||
public Integer deleteUploadTask(@RequestParam("id") Long id) {
|
||||
return uploadTaskService.deleteUploadTaskById(id);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class UploadTaskController {
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除上传任务")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:delete')")
|
||||
public Integer batchDeleteUploadTask(@RequestParam("idList") List<Long> idList) {
|
||||
return uploadTaskService.deleteUploadTaskByIdList(idList);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class UploadTaskController {
|
||||
@OperatorLog(UploadTaskOperatorType.CLEAR)
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空上传任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:management:clear')")
|
||||
@PreAuthorize("@ss.hasPermission('exec:upload-task:management:clear')")
|
||||
public Integer clearUploadTask(@Validated @RequestBody UploadTaskClearRequest request) {
|
||||
return uploadTaskService.clearUploadTask(request);
|
||||
}
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.dto.ExecCommandExecDTO;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecCommandRequest;
|
||||
import org.dromara.visor.module.exec.entity.dto.ExecCommandExecDTO;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecCommandRequest;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecHostLogVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecJobDO;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecJobCreateRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecJobQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecJobUpdateRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecJobVO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecJobDO;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecJobCreateRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecJobParseRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecJobQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecJobUpdateRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecJobVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -50,6 +51,8 @@ public interface ExecJobConvert {
|
||||
|
||||
ExecJobDO to(ExecJobQueryRequest request);
|
||||
|
||||
ExecJobDO to(ExecJobParseRequest request);
|
||||
|
||||
ExecJobVO to(ExecJobDO domain);
|
||||
|
||||
List<ExecJobVO> to(List<ExecJobDO> list);
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecLogQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecLogVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecTemplateDO;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.ExecTemplateVO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecTemplateDO;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecTemplateCreateRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecTemplateVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.domain.UploadTaskDO;
|
||||
import org.dromara.visor.module.asset.entity.request.upload.UploadTaskCreateRequest;
|
||||
import org.dromara.visor.module.asset.entity.request.upload.UploadTaskQueryRequest;
|
||||
import org.dromara.visor.module.asset.entity.vo.UploadTaskStatusVO;
|
||||
import org.dromara.visor.module.asset.entity.vo.UploadTaskVO;
|
||||
import org.dromara.visor.module.exec.entity.domain.UploadTaskDO;
|
||||
import org.dromara.visor.module.exec.entity.request.upload.UploadTaskCreateRequest;
|
||||
import org.dromara.visor.module.exec.entity.request.upload.UploadTaskQueryRequest;
|
||||
import org.dromara.visor.module.exec.entity.vo.UploadTaskStatusVO;
|
||||
import org.dromara.visor.module.exec.entity.vo.UploadTaskVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.convert;
|
||||
package org.dromara.visor.module.exec.convert;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.domain.UploadTaskFileDO;
|
||||
import org.dromara.visor.module.asset.entity.vo.UploadTaskFileVO;
|
||||
import org.dromara.visor.module.exec.entity.domain.UploadTaskFileDO;
|
||||
import org.dromara.visor.module.exec.entity.vo.UploadTaskFileVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -20,12 +20,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.exec.entity.po.ExecHostLogCountPO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -68,4 +71,30 @@ public interface ExecHostLogDAO extends IMapper<ExecHostLogDO> {
|
||||
.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 logIdList 查询
|
||||
*
|
||||
* @param logIdList logIdList
|
||||
* @return rows
|
||||
*/
|
||||
default List<ExecHostLogDO> selectByLogIdList(List<Long> logIdList) {
|
||||
return this.of()
|
||||
.createWrapper()
|
||||
.in(ExecHostLogDO::getLogId, logIdList)
|
||||
.then()
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取执行主机日志统计
|
||||
*
|
||||
* @param source source
|
||||
* @param startTime startTime
|
||||
* @param endTime endTime
|
||||
* @return count
|
||||
*/
|
||||
List<ExecHostLogCountPO> selectExecHostLogCount(@Param("source") String source,
|
||||
@Param("startTime") Date startTime,
|
||||
@Param("endTime") Date endTime);
|
||||
|
||||
}
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecJobDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecJobDO;
|
||||
|
||||
/**
|
||||
* 计划任务 Mapper 接口
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecJobHostDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecJobHostDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -78,18 +78,6 @@ public interface ExecJobHostDAO extends IMapper<ExecJobHostDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
* @param hostId hostId
|
||||
* @return effect
|
||||
*/
|
||||
default Integer deleteByHostId(Long hostId) {
|
||||
LambdaQueryWrapper<ExecJobHostDO> wrapper = this.wrapper()
|
||||
.eq(ExecJobHostDO::getHostId, hostId);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
@@ -20,13 +20,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.entity.po.ExecLogCountPO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.exec.entity.po.ExecLogCountPO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecTemplateDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecTemplateDO;
|
||||
|
||||
/**
|
||||
* 执行模板 Mapper 接口
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecTemplateHostDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行模板主机 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.6
|
||||
* @since 2024-4-22 12:13
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExecTemplateHostDAO extends IMapper<ExecTemplateHostDO> {
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @return effect
|
||||
*/
|
||||
default Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||
LambdaQueryWrapper<ExecTemplateHostDO> wrapper = this.lambda()
|
||||
.in(ExecTemplateHostDO::getHostId, hostIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.module.asset.entity.domain.UploadTaskDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.UploadTaskDO;
|
||||
|
||||
/**
|
||||
* 上传任务 Mapper 接口
|
||||
@@ -20,14 +20,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.dao;
|
||||
package org.dromara.visor.module.exec.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import org.dromara.visor.framework.mybatis.core.query.Conditions;
|
||||
import org.dromara.visor.module.asset.entity.domain.UploadTaskFileDO;
|
||||
import org.dromara.visor.module.asset.enums.UploadTaskFileStatusEnum;
|
||||
import org.dromara.visor.module.exec.entity.domain.UploadTaskFileDO;
|
||||
import org.dromara.visor.module.exec.enums.UploadTaskFileStatusEnum;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define;
|
||||
package org.dromara.visor.module.exec.define;
|
||||
|
||||
import cn.orionsec.kit.lang.define.thread.ExecutorBuilder;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
@@ -35,7 +35,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
* @version 1.0.0
|
||||
* @since 2024/1/3 11:21
|
||||
*/
|
||||
public interface AssetThreadPools {
|
||||
public interface ExecThreadPools {
|
||||
|
||||
/**
|
||||
* 超时检查线程池
|
||||
@@ -49,30 +49,6 @@ public interface AssetThreadPools {
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* terminal 标准输出线程池
|
||||
*/
|
||||
ThreadPoolExecutor TERMINAL_STDOUT = ExecutorBuilder.create()
|
||||
.namedThreadFactory("terminal-stdout-")
|
||||
.corePoolSize(1)
|
||||
.maxPoolSize(Integer.MAX_VALUE)
|
||||
.keepAliveTime(Const.MS_S_60)
|
||||
.workQueue(new SynchronousQueue<>())
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* terminal 操作线程池
|
||||
*/
|
||||
ThreadPoolExecutor TERMINAL_OPERATOR = ExecutorBuilder.create()
|
||||
.namedThreadFactory("terminal-operator-")
|
||||
.corePoolSize(1)
|
||||
.maxPoolSize(Integer.MAX_VALUE)
|
||||
.keepAliveTime(Const.MS_S_60)
|
||||
.workQueue(new SynchronousQueue<>())
|
||||
.allowCoreThreadTimeout(true)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 批量执行任务线程池
|
||||
*/
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.cache;
|
||||
package org.dromara.visor.module.exec.define.cache;
|
||||
|
||||
import org.dromara.visor.module.exec.entity.dto.ExecLogTailDTO;
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyBuilder;
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
|
||||
import cn.orionsec.kit.lang.define.cache.key.struct.RedisCacheStruct;
|
||||
import org.dromara.visor.module.asset.entity.dto.ExecLogTailDTO;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -20,30 +20,30 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.cache;
|
||||
package org.dromara.visor.module.exec.define.cache;
|
||||
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyBuilder;
|
||||
import cn.orionsec.kit.lang.define.cache.key.CacheKeyDefine;
|
||||
import cn.orionsec.kit.lang.define.cache.key.struct.RedisCacheStruct;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.dromara.visor.module.exec.entity.vo.ExecWorkplaceStatisticsVO;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* asset 模块统计缓存 key
|
||||
* exec 模块统计缓存 key
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/12/23 16:10
|
||||
*/
|
||||
public interface AssetStatisticsCacheKeyDefine {
|
||||
public interface ExecStatisticsCacheKeyDefine {
|
||||
|
||||
CacheKeyDefine HOST_TYPE_COUNT = new CacheKeyBuilder()
|
||||
.key("data:statistics:host:count")
|
||||
.desc("主机类型数量")
|
||||
.type(JSONObject.class)
|
||||
CacheKeyDefine WORKPLACE_DATA = new CacheKeyBuilder()
|
||||
.key("data:statistics:exec-workplace:{}:{}")
|
||||
.desc("执行模块工作台统计 ${userId} ${time}")
|
||||
.type(ExecWorkplaceStatisticsVO.class)
|
||||
.struct(RedisCacheStruct.STRING)
|
||||
.timeout(1, TimeUnit.DAYS)
|
||||
.timeout(10, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.message;
|
||||
package org.dromara.visor.module.exec.define.message;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.dromara.visor.module.infra.define.SystemMessageDefine;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.message;
|
||||
package org.dromara.visor.module.exec.define.message;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.dromara.visor.module.infra.define.SystemMessageDefine;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.operator;
|
||||
package org.dromara.visor.module.exec.define.operator;
|
||||
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
@@ -35,7 +35,7 @@ import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRi
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Module("asset:exec-command-log")
|
||||
@Module("exec:exec-command-log")
|
||||
public class ExecCommandLogOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String DELETE = "exec-command-log:delete";
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.operator;
|
||||
package org.dromara.visor.module.exec.define.operator;
|
||||
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
@@ -35,7 +35,7 @@ import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRi
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Module("asset:exec-command")
|
||||
@Module("exec:exec-command")
|
||||
public class ExecCommandOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String EXEC = "exec-command:exec";
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.operator;
|
||||
package org.dromara.visor.module.exec.define.operator;
|
||||
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
@@ -35,7 +35,7 @@ import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRi
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-11 11:31
|
||||
*/
|
||||
@Module("asset:exec-job-log")
|
||||
@Module("exec:exec-job-log")
|
||||
public class ExecJobLogOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String DELETE = "exec-job-log:delete";
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.operator;
|
||||
package org.dromara.visor.module.exec.define.operator;
|
||||
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
@@ -35,7 +35,7 @@ import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRi
|
||||
* @version 1.0.3
|
||||
* @since 2024-3-28 12:03
|
||||
*/
|
||||
@Module("asset:exec-job")
|
||||
@Module("exec:exec-job")
|
||||
public class ExecJobOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String CREATE = "exec-job:create";
|
||||
@@ -50,10 +50,6 @@ public class ExecJobOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String DELETE = "exec-job:delete";
|
||||
|
||||
public static final String IMPORT = "exec-job:import";
|
||||
|
||||
public static final String EXPORT = "exec-job:export";
|
||||
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
@@ -63,8 +59,6 @@ public class ExecJobOperatorType extends InitializingOperatorTypes {
|
||||
new OperatorType(M, TRIGGER, "手动触发计划任务 <sb>${name}</sb>"),
|
||||
new OperatorType(M, UPDATE_EXEC_USER, "修改计划任务 <sb>${name}</sb> 执行用户为 <sb>${username}</sb>"),
|
||||
new OperatorType(H, DELETE, "删除计划任务 <sb>${name}</sb>"),
|
||||
new OperatorType(H, IMPORT, "导入计划任务 <sb>${count}</sb> 条"),
|
||||
new OperatorType(H, EXPORT, "导出计划任务 <sb>${count}</sb> 条"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.operator;
|
||||
package org.dromara.visor.module.exec.define.operator;
|
||||
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
@@ -35,7 +35,7 @@ import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRi
|
||||
* @version 1.0.1
|
||||
* @since 2024-3-7 18:08
|
||||
*/
|
||||
@Module("asset:exec-template")
|
||||
@Module("exec:exec-template")
|
||||
public class ExecTemplateOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String CREATE = "exec-template:create";
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.operator;
|
||||
package org.dromara.visor.module.exec.define.operator;
|
||||
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.Module;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
@@ -36,7 +36,7 @@ import static org.dromara.visor.framework.biz.operator.log.core.enums.OperatorRi
|
||||
* @version 1.0.7
|
||||
* @since 2024-5-7 22:15
|
||||
*/
|
||||
@Module("asset:upload-task")
|
||||
@Module("exec:upload-task")
|
||||
public class UploadTaskOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String UPLOAD = "upload-task:upload";
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
* 计划任务 实体对象
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
* 执行模板 实体对象
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
/**
|
||||
* 执行模板主机 实体对象
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.domain;
|
||||
package org.dromara.visor.module.exec.entity.domain;
|
||||
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -30,7 +31,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.dromara.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.dto;
|
||||
package org.dromara.visor.module.exec.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.dto;
|
||||
package org.dromara.visor.module.exec.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.dto;
|
||||
package org.dromara.visor.module.exec.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,14 +20,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.dto;
|
||||
package org.dromara.visor.module.exec.entity.dto;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.dto.host.HostBaseDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.visor.module.asset.entity.vo.HostBaseVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,6 +49,6 @@ public class UploadTaskExtraDTO {
|
||||
private List<Long> hostIdList;
|
||||
|
||||
@Schema(description = "主机信息")
|
||||
private List<HostBaseVO> hosts;
|
||||
private List<HostBaseDTO> hosts;
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.po;
|
||||
package org.dromara.visor.module.exec.entity.po;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -31,23 +31,23 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主机类型数量对象
|
||||
* 执行日志主机数量
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/7/14 15:03
|
||||
* @since 2024/12/23 21:35
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HostTypeCountPO", description = "主机类型数量对象")
|
||||
public class HostTypeCountPO implements Serializable {
|
||||
@Schema(name = "ExecHostLogCountPO", description = "执行日志主机数量")
|
||||
public class ExecHostLogCountPO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer count;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.po;
|
||||
package org.dromara.visor.module.exec.entity.po;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.common.entity.DataClearRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.visor.common.entity.DataClearRequest;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
@@ -20,15 +20,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.Desensitize;
|
||||
import org.dromara.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.exec;
|
||||
package org.dromara.visor.module.exec.entity.request.exec;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.upload;
|
||||
package org.dromara.visor.module.exec.entity.request.upload;
|
||||
|
||||
import org.dromara.visor.common.entity.DataClearRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.visor.common.entity.DataClearRequest;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.upload;
|
||||
package org.dromara.visor.module.exec.entity.request.upload;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.upload;
|
||||
package org.dromara.visor.module.exec.entity.request.upload;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.upload;
|
||||
package org.dromara.visor.module.exec.entity.request.upload;
|
||||
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.dromara.visor.common.entity.BaseQueryRequest;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.request.upload;
|
||||
package org.dromara.visor.module.exec.entity.request.upload;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,8 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import org.dromara.visor.module.asset.entity.dto.host.HostBaseDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -103,6 +104,6 @@ public class ExecJobVO implements Serializable {
|
||||
private List<Long> hostIdList;
|
||||
|
||||
@Schema(description = "执行主机")
|
||||
private List<HostBaseVO> hostList;
|
||||
private List<HostBaseDTO> hostList;
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,19 +20,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import org.dromara.visor.common.entity.chart.LineSingleChartData;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.visor.common.entity.chart.LineSingleChartData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产模块工作台统计响应
|
||||
* 执行模块工作台统计响应
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
@@ -42,8 +42,8 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "AssetWorkplaceStatisticsVO", description = "资产模块工作台统计响应")
|
||||
public class AssetWorkplaceStatisticsVO {
|
||||
@Schema(name = "ExecWorkplaceStatisticsVO", description = "执行模块工作台统计响应")
|
||||
public class ExecWorkplaceStatisticsVO {
|
||||
|
||||
@Schema(description = "执行的计划任务数量")
|
||||
private Integer execJobCount;
|
||||
@@ -54,21 +54,9 @@ public class AssetWorkplaceStatisticsVO {
|
||||
@Schema(description = "7日批量执行次数")
|
||||
private Integer weekExecCommandCount;
|
||||
|
||||
@Schema(description = "今日连接终端次数")
|
||||
private Integer todayTerminalConnectCount;
|
||||
|
||||
@Schema(description = "7日连接终端次数")
|
||||
private Integer weekTerminalConnectCount;
|
||||
|
||||
@Schema(description = "批量执行数量图表")
|
||||
private LineSingleChartData execCommandChart;
|
||||
|
||||
@Schema(description = "连接终端次数图表")
|
||||
private LineSingleChartData terminalConnectChart;
|
||||
|
||||
@Schema(description = "连接终端记录")
|
||||
private List<TerminalConnectLogVO> terminalConnectList;
|
||||
|
||||
@Schema(description = "批量执行记录")
|
||||
private List<ExecLogVO> execLogList;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.entity.vo;
|
||||
package org.dromara.visor.module.exec.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -50,18 +50,30 @@ public enum ExecJobStatusEnum {
|
||||
|
||||
private final Integer status;
|
||||
|
||||
private final String statusName;
|
||||
private final String label;
|
||||
|
||||
public static ExecJobStatusEnum of(Integer status) {
|
||||
if (status == null) {
|
||||
return null;
|
||||
return DISABLED;
|
||||
}
|
||||
for (ExecJobStatusEnum value : values()) {
|
||||
if (value.status.equals(status)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return DISABLED;
|
||||
}
|
||||
|
||||
public static ExecJobStatusEnum of(String label) {
|
||||
if (label == null) {
|
||||
return DISABLED;
|
||||
}
|
||||
for (ExecJobStatusEnum value : values()) {
|
||||
if (value.label.equals(label)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return DISABLED;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
/**
|
||||
* 执行方式
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
/**
|
||||
* 批量执行来源
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -39,28 +39,41 @@ public enum ScriptExecEnum {
|
||||
/**
|
||||
* 不使用
|
||||
*/
|
||||
DISABLED(0),
|
||||
DISABLED(0, "否"),
|
||||
|
||||
/**
|
||||
* 使用
|
||||
*/
|
||||
ENABLED(1),
|
||||
ENABLED(1, "是"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private final String label;
|
||||
|
||||
public static ScriptExecEnum of(Integer value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
return DISABLED;
|
||||
}
|
||||
for (ScriptExecEnum val : values()) {
|
||||
if (val.value.equals(value)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return DISABLED;
|
||||
}
|
||||
|
||||
public static ScriptExecEnum of(String label) {
|
||||
if (label == null) {
|
||||
return DISABLED;
|
||||
}
|
||||
for (ScriptExecEnum val : values()) {
|
||||
if (val.label.equals(label)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return DISABLED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
/**
|
||||
* 上传任务文件状态
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.enums;
|
||||
package org.dromara.visor.module.exec.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command;
|
||||
package org.dromara.visor.module.exec.handler.exec.command;
|
||||
|
||||
import org.dromara.visor.module.asset.define.AssetThreadPools;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.handler.ExecTaskHandler;
|
||||
import org.dromara.visor.module.exec.define.ExecThreadPools;
|
||||
import org.dromara.visor.module.exec.handler.exec.command.handler.ExecTaskHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ExecTaskExecutors {
|
||||
* @param execHostIdList execHostIdList
|
||||
*/
|
||||
public static void start(Long id, List<Long> execHostIdList) {
|
||||
AssetThreadPools.EXEC_TASK.execute(new ExecTaskHandler(id, execHostIdList));
|
||||
ExecThreadPools.EXEC_TASK.execute(new ExecTaskHandler(id, execHostIdList));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
package org.dromara.visor.module.exec.handler.exec.command.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.exception.AuthenticationException;
|
||||
import cn.orionsec.kit.lang.exception.ConnectionRuntimeException;
|
||||
@@ -45,18 +45,18 @@ import org.dromara.visor.common.constant.FileConst;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.common.enums.EndpointDefine;
|
||||
import org.dromara.visor.common.interfaces.FileClient;
|
||||
import org.dromara.visor.common.session.config.SshConnectConfig;
|
||||
import org.dromara.visor.common.session.ssh.SessionStores;
|
||||
import org.dromara.visor.common.utils.PathUtils;
|
||||
import org.dromara.visor.common.utils.Valid;
|
||||
import org.dromara.visor.module.asset.dao.ExecHostLogDAO;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO;
|
||||
import org.dromara.visor.module.asset.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.asset.api.HostConnectApi;
|
||||
import org.dromara.visor.module.asset.enums.HostOsTypeEnum;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.log.manager.ExecLogManager;
|
||||
import org.dromara.visor.module.asset.handler.host.jsch.SessionStores;
|
||||
import org.dromara.visor.module.asset.service.HostConnectService;
|
||||
import org.dromara.visor.module.asset.utils.ExecUtils;
|
||||
import org.dromara.visor.module.exec.dao.ExecHostLogDAO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.exec.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.exec.handler.exec.log.manager.ExecLogManager;
|
||||
import org.dromara.visor.module.exec.utils.ExecUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -79,7 +79,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
|
||||
private static final ExecLogManager execLogManager = SpringHolder.getBean(ExecLogManager.class);
|
||||
|
||||
private static final HostConnectService hostConnectService = SpringHolder.getBean(HostConnectService.class);
|
||||
private static final HostConnectApi hostConnectApi = SpringHolder.getBean(HostConnectApi.class);
|
||||
|
||||
private static final ExecHostLogDAO execHostLogDAO = SpringHolder.getBean(ExecHostLogDAO.class);
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
@Getter
|
||||
protected ExecHostStatusEnum status;
|
||||
|
||||
private TerminalConnectDTO connect;
|
||||
private SshConnectConfig connectConfig;
|
||||
|
||||
private OutputStream logOutputStream;
|
||||
|
||||
@@ -166,7 +166,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
this.status = ExecHostStatusEnum.of(execHostLog.getStatus());
|
||||
Valid.eq(this.status, ExecHostStatusEnum.WAITING, ErrorMessage.TASK_ABSENT, ErrorMessage.ILLEGAL_STATUS);
|
||||
// 获取主机会话
|
||||
this.connect = hostConnectService.getSshConnectInfo(execHostLog.getHostId(), execLog.getUserId());
|
||||
this.connectConfig = hostConnectApi.getSshConnectConfig(execHostLog.getHostId(), execLog.getUserId());
|
||||
// 设置日志路径
|
||||
this.setLogPath();
|
||||
// 设置脚本路径
|
||||
@@ -196,7 +196,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
*/
|
||||
protected void execCommand() throws Exception {
|
||||
// 打开会话
|
||||
this.sessionStore = SessionStores.openSessionStore(connect);
|
||||
this.sessionStore = SessionStores.openSessionStore(connectConfig);
|
||||
if (BooleanBit.toBoolean(execLog.getScriptExec())) {
|
||||
// 上传脚本文件
|
||||
this.uploadScriptFile();
|
||||
@@ -204,7 +204,7 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
this.executor = sessionStore.getCommandExecutor(execHostLog.getScriptPath());
|
||||
} else {
|
||||
// 执行命令
|
||||
byte[] command = execHostLog.getCommand().getBytes(connect.getCharset());
|
||||
byte[] command = execHostLog.getCommand().getBytes(connectConfig.getCharset());
|
||||
this.executor = sessionStore.getCommandExecutor(command);
|
||||
}
|
||||
// 执行命令
|
||||
@@ -232,14 +232,14 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
SftpExecutor sftpExecutor = null;
|
||||
try {
|
||||
// 打开 sftp
|
||||
sftpExecutor = sessionStore.getSftpExecutor(connect.getFileNameCharset());
|
||||
sftpExecutor = sessionStore.getSftpExecutor(connectConfig.getFileNameCharset());
|
||||
sftpExecutor.connect();
|
||||
// 文件上传必须要以 / 开头
|
||||
String scriptPath = PathUtils.prependSeparator(execHostLog.getScriptPath());
|
||||
// 创建文件
|
||||
sftpExecutor.touch(scriptPath);
|
||||
// 写入命令
|
||||
byte[] command = execHostLog.getCommand().getBytes(connect.getFileContentCharset());
|
||||
byte[] command = execHostLog.getCommand().getBytes(connectConfig.getFileContentCharset());
|
||||
sftpExecutor.write(scriptPath, command);
|
||||
// 修改权限
|
||||
sftpExecutor.changeMode(scriptPath, 777);
|
||||
@@ -384,12 +384,12 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
String scriptPath = null;
|
||||
// 获取脚本路径
|
||||
if (BooleanBit.toBoolean(execLog.getScriptExec())) {
|
||||
HostOsTypeEnum os = HostOsTypeEnum.of(connect.getOsType());
|
||||
HostOsTypeEnum os = HostOsTypeEnum.of(connectConfig.getOsType());
|
||||
String name = FileConst.EXEC
|
||||
+ "/" + execHostLog.getLogId()
|
||||
+ "/" + id
|
||||
+ os.getScriptSuffix();
|
||||
scriptPath = PathUtils.buildAppPath(HostOsTypeEnum.WINDOWS.equals(os), connect.getUsername(), FileConst.SCRIPT, name);
|
||||
scriptPath = PathUtils.buildAppPath(HostOsTypeEnum.WINDOWS.equals(os), connectConfig.getUsername(), FileConst.SCRIPT, name);
|
||||
}
|
||||
execHostLog.setScriptPath(scriptPath);
|
||||
}
|
||||
@@ -402,17 +402,17 @@ public abstract class BaseExecCommandHandler implements IExecCommandHandler {
|
||||
// 参数列表
|
||||
Map<String, Object> params = Maps.newMap(builtParams);
|
||||
params.put("execHostId", id);
|
||||
params.put("hostId", connect.getHostId());
|
||||
params.put("hostName", connect.getHostName());
|
||||
params.put("hostCode", connect.getHostCode());
|
||||
params.put("hostAddress", connect.getHostAddress());
|
||||
params.put("hostPort", connect.getHostPort());
|
||||
params.put("hostUsername", connect.getUsername());
|
||||
params.put("hostId", connectConfig.getHostId());
|
||||
params.put("hostName", connectConfig.getHostName());
|
||||
params.put("hostCode", connectConfig.getHostCode());
|
||||
params.put("hostAddress", connectConfig.getHostAddress());
|
||||
params.put("hostPort", connectConfig.getHostPort());
|
||||
params.put("hostUsername", connectConfig.getUsername());
|
||||
params.put("hostUuid", uuid);
|
||||
params.put("hostUuidShort", uuid.replace("-", Strings.EMPTY));
|
||||
params.put("osType", connect.getOsType());
|
||||
params.put("archType", connect.getArchType());
|
||||
params.put("charset", connect.getCharset());
|
||||
params.put("osType", connectConfig.getOsType());
|
||||
params.put("archType", connectConfig.getArchType());
|
||||
params.put("charset", connectConfig.getCharset());
|
||||
params.put("scriptPath", execHostLog.getScriptPath());
|
||||
// 获取实际命令
|
||||
String paramsJson = JSON.toJSONString(params);
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
package org.dromara.visor.module.exec.handler.exec.command.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutChecker;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutEndpoint;
|
||||
@@ -30,8 +30,8 @@ import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import cn.orionsec.kit.net.host.ssh.ExitCode;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.exec.enums.ExecHostStatusEnum;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
package org.dromara.visor.module.exec.handler.exec.command.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutChecker;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutEndpoint;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecLogDO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
package org.dromara.visor.module.exec.handler.exec.command.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.id.UUIds;
|
||||
import cn.orionsec.kit.lang.support.timeout.TimeoutChecker;
|
||||
@@ -39,15 +39,15 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||
import org.dromara.visor.module.asset.dao.ExecLogDAO;
|
||||
import org.dromara.visor.module.asset.define.AssetThreadPools;
|
||||
import org.dromara.visor.module.asset.define.config.AppLogConfig;
|
||||
import org.dromara.visor.module.asset.define.message.ExecMessageDefine;
|
||||
import org.dromara.visor.module.asset.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.asset.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.asset.enums.ExecStatusEnum;
|
||||
import org.dromara.visor.module.asset.handler.host.exec.command.manager.ExecTaskManager;
|
||||
import org.dromara.visor.module.asset.utils.ExecUtils;
|
||||
import org.dromara.visor.module.common.config.AppLogConfig;
|
||||
import org.dromara.visor.module.exec.dao.ExecLogDAO;
|
||||
import org.dromara.visor.module.exec.define.ExecThreadPools;
|
||||
import org.dromara.visor.module.exec.define.message.ExecMessageDefine;
|
||||
import org.dromara.visor.module.exec.entity.domain.ExecLogDO;
|
||||
import org.dromara.visor.module.exec.enums.ExecHostStatusEnum;
|
||||
import org.dromara.visor.module.exec.enums.ExecStatusEnum;
|
||||
import org.dromara.visor.module.exec.handler.exec.command.manager.ExecTaskManager;
|
||||
import org.dromara.visor.module.exec.utils.ExecUtils;
|
||||
import org.dromara.visor.module.infra.api.SystemMessageApi;
|
||||
import org.dromara.visor.module.infra.entity.dto.message.SystemMessageDTO;
|
||||
|
||||
@@ -169,7 +169,7 @@ public class ExecTaskHandler implements IExecTaskHandler {
|
||||
// 超时检查
|
||||
if (execLog.getTimeout() != 0) {
|
||||
this.timeoutChecker = TimeoutCheckers.create();
|
||||
AssetThreadPools.TIMEOUT_CHECK.execute(this.timeoutChecker);
|
||||
ExecThreadPools.TIMEOUT_CHECK.execute(this.timeoutChecker);
|
||||
}
|
||||
// 执行命令
|
||||
if (execHostIdList.size() == 1) {
|
||||
@@ -182,7 +182,7 @@ public class ExecTaskHandler implements IExecTaskHandler {
|
||||
.map(this::createCommandHandler)
|
||||
.forEach(handlers::add);
|
||||
// 多个主机异步阻塞执行
|
||||
Threads.blockRun(handlers, AssetThreadPools.EXEC_HOST);
|
||||
Threads.blockRun(handlers, ExecThreadPools.EXEC_HOST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
package org.dromara.visor.module.exec.handler.exec.command.handler;
|
||||
|
||||
import org.dromara.visor.module.exec.enums.ExecHostStatusEnum;
|
||||
import cn.orionsec.kit.lang.able.SafeCloseable;
|
||||
import org.dromara.visor.module.asset.enums.ExecHostStatusEnum;
|
||||
|
||||
/**
|
||||
* 命令执行器定义
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.handler;
|
||||
package org.dromara.visor.module.exec.handler.exec.command.handler;
|
||||
|
||||
import cn.orionsec.kit.lang.able.SafeCloseable;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user