diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/pom.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/pom.xml new file mode 100644 index 00000000..f462e44e --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/pom.xml @@ -0,0 +1,25 @@ + + + + org.dromara.visor + orion-visor-module-exec + ${revision} + + + 4.0.0 + orion-visor-module-exec-provider + jar + + 项目执行模块 + https://github.com/dromara/orion-visor + + + + org.dromara.visor + orion-visor-common + + + + \ No newline at end of file diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/jsch/SessionMessage.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/src/main/java/org/dromara/visor/module/exec/api/ExecJobApi.java similarity index 72% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/jsch/SessionMessage.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/src/main/java/org/dromara/visor/module/exec/api/ExecJobApi.java index e3783dd1..e2443479 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/jsch/SessionMessage.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/src/main/java/org/dromara/visor/module/exec/api/ExecJobApi.java @@ -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 hostIdList); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecTemplateHostDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/src/main/java/org/dromara/visor/module/exec/api/ExecTemplateApi.java similarity index 68% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecTemplateHostDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/src/main/java/org/dromara/visor/module/exec/api/ExecTemplateApi.java index 540cf00e..cd316bf0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecTemplateHostDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-provider/src/main/java/org/dromara/visor/module/exec/api/ExecTemplateApi.java @@ -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 { +public interface ExecTemplateApi { + + /** + * 通过 hostId 删除模板主机 + * + * @param hostIdList hostIdList + * @return effect + */ + Integer deleteByHostIdList(List hostIdList); } diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/pom.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/pom.xml new file mode 100644 index 00000000..4f265abc --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/pom.xml @@ -0,0 +1,106 @@ + + + + org.dromara.visor + orion-visor-module-exec + ${revision} + + + 4.0.0 + orion-visor-module-exec-service + jar + + 项目执行模块 + https://github.com/dromara/orion-visor + + + + + org.dromara.visor + orion-visor-common + + + + + org.dromara.visor + orion-visor-module-common + ${revision} + + + + + org.dromara.visor + orion-visor-module-infra-provider + ${revision} + + + org.dromara.visor + orion-visor-module-asset-provider + ${revision} + + + org.dromara.visor + orion-visor-module-exec-provider + ${revision} + + + + + org.dromara.visor + orion-visor-spring-boot-starter-web + + + org.dromara.visor + orion-visor-spring-boot-starter-websocket + + + org.dromara.visor + orion-visor-spring-boot-starter-log + + + org.dromara.visor + orion-visor-spring-boot-starter-biz-operator-log + + + org.dromara.visor + orion-visor-spring-boot-starter-desensitize + + + org.dromara.visor + orion-visor-spring-boot-starter-security + + + org.dromara.visor + orion-visor-spring-boot-starter-redis + + + org.dromara.visor + orion-visor-spring-boot-starter-mybatis + + + org.dromara.visor + orion-visor-spring-boot-starter-storage + + + org.dromara.visor + orion-visor-spring-boot-starter-job + + + org.dromara.visor + orion-visor-spring-boot-starter-test + + + + + + + + com.github.wvengen + proguard-maven-plugin + + + + + \ No newline at end of file diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/api/impl/ExecJobApiImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/api/impl/ExecJobApiImpl.java new file mode 100644 index 00000000..a29e02c9 --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/api/impl/ExecJobApiImpl.java @@ -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 hostIdList) { + return execJobHostDAO.deleteByHostIdList(hostIdList); + } + +} diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/api/impl/ExecTemplateApiImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/api/impl/ExecTemplateApiImpl.java new file mode 100644 index 00000000..45d7c5be --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/api/impl/ExecTemplateApiImpl.java @@ -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 hostIdList) { + return execTemplateHostDAO.deleteByHostIdList(hostIdList); + } + +} diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/configuration/ExecWebSocketConfiguration.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/configuration/ExecWebSocketConfiguration.java new file mode 100644 index 00000000..45a9fa0b --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/configuration/ExecWebSocketConfiguration.java @@ -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("*"); + } + +} diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecCommandController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecCommandController.java similarity index 79% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecCommandController.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecCommandController.java index 14d54866..f90c7fb2 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecCommandController.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecCommandController.java @@ -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()); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecCommandLogController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecCommandLogController.java similarity index 77% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecCommandLogController.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecCommandLogController.java index 7ac44880..2108aeb0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecCommandLogController.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecCommandLogController.java @@ -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 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 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 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 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 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); diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecJobController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecJobController.java similarity index 79% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecJobController.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecJobController.java index 265b170e..3c257be4 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecJobController.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecJobController.java @@ -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 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 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 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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecJobLogController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecJobLogController.java similarity index 78% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecJobLogController.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecJobLogController.java index 5c892498..222c6bc6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecJobLogController.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecJobLogController.java @@ -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 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 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 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 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); diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecStatisticsController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecStatisticsController.java new file mode 100644 index 00000000..ebb16b09 --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecStatisticsController.java @@ -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(); + } + +} diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecTemplateController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecTemplateController.java similarity index 75% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecTemplateController.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecTemplateController.java index 6ee91f55..f8bfeb00 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/ExecTemplateController.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/ExecTemplateController.java @@ -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 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 idList) { return execTemplateService.deleteExecTemplateByIdList(idList); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/UploadTaskController.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/UploadTaskController.java similarity index 75% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/UploadTaskController.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/UploadTaskController.java index f1fb7069..346a994d 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/controller/UploadTaskController.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/controller/UploadTaskController.java @@ -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 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 getUploadTaskStatus(@RequestParam("idList") List 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 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); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecConvert.java similarity index 85% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecConvert.java index ac87714b..28c0bddd 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecConvert.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecHostLogConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecHostLogConvert.java similarity index 87% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecHostLogConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecHostLogConvert.java index 07c807cd..1ad287e6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecHostLogConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecHostLogConvert.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecJobConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecJobConvert.java similarity index 71% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecJobConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecJobConvert.java index 3c109593..c47556ef 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecJobConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecJobConvert.java @@ -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 to(List list); diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecLogConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecLogConvert.java similarity index 83% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecLogConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecLogConvert.java index 932d1f91..18e50378 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecLogConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecLogConvert.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecTemplateConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecTemplateConvert.java similarity index 78% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecTemplateConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecTemplateConvert.java index a5bbc1bf..b3b7fce6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/ExecTemplateConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/ExecTemplateConvert.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/UploadTaskConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/UploadTaskConvert.java similarity index 77% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/UploadTaskConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/UploadTaskConvert.java index 75d0b191..3cac3ea6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/UploadTaskConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/UploadTaskConvert.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/UploadTaskFileConvert.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/UploadTaskFileConvert.java similarity index 87% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/UploadTaskFileConvert.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/UploadTaskFileConvert.java index 155c0708..cee178a3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/convert/UploadTaskFileConvert.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/convert/UploadTaskFileConvert.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecHostLogDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecHostLogDAO.java similarity index 64% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecHostLogDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecHostLogDAO.java index 907ca31f..b446fdac 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecHostLogDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecHostLogDAO.java @@ -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 { .get(); } + /** + * 通过 logIdList 查询 + * + * @param logIdList logIdList + * @return rows + */ + default List selectByLogIdList(List logIdList) { + return this.of() + .createWrapper() + .in(ExecHostLogDO::getLogId, logIdList) + .then() + .list(); + } + + /** + * 获取执行主机日志统计 + * + * @param source source + * @param startTime startTime + * @param endTime endTime + * @return count + */ + List selectExecHostLogCount(@Param("source") String source, + @Param("startTime") Date startTime, + @Param("endTime") Date endTime); + } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecJobDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecJobDAO.java similarity index 91% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecJobDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecJobDAO.java index 837a0a2b..88091cd5 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecJobDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecJobDAO.java @@ -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 接口 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecJobHostDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecJobHostDAO.java similarity index 85% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecJobHostDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecJobHostDAO.java index 4e76e235..39ae1874 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecJobHostDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecJobHostDAO.java @@ -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 { return this.delete(wrapper); } - /** - * 通过 hostId 删除 - * - * @param hostId hostId - * @return effect - */ - default Integer deleteByHostId(Long hostId) { - LambdaQueryWrapper wrapper = this.wrapper() - .eq(ExecJobHostDO::getHostId, hostId); - return this.delete(wrapper); - } - /** * 通过 hostId 删除 * diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecLogDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecLogDAO.java similarity index 93% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecLogDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecLogDAO.java index ff2a130b..022706c1 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecLogDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecLogDAO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecTemplateDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecTemplateDAO.java similarity index 90% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecTemplateDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecTemplateDAO.java index d1f92174..ccc77cac 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/ExecTemplateDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecTemplateDAO.java @@ -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 接口 diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecTemplateHostDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecTemplateHostDAO.java new file mode 100644 index 00000000..d16dbd76 --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/ExecTemplateHostDAO.java @@ -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 { + + /** + * 通过 hostId 删除 + * + * @param hostIdList hostIdList + * @return effect + */ + default Integer deleteByHostIdList(List hostIdList) { + LambdaQueryWrapper wrapper = this.lambda() + .in(ExecTemplateHostDO::getHostId, hostIdList); + return this.delete(wrapper); + } + +} diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/UploadTaskDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/UploadTaskDAO.java similarity index 90% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/UploadTaskDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/UploadTaskDAO.java index 7548dbd3..de6979bf 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/UploadTaskDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/UploadTaskDAO.java @@ -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 接口 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/UploadTaskFileDAO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/UploadTaskFileDAO.java similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/UploadTaskFileDAO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/UploadTaskFileDAO.java index 553c4b9c..5f8bc16d 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/dao/UploadTaskFileDAO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/dao/UploadTaskFileDAO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/AssetThreadPools.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/ExecThreadPools.java similarity index 79% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/AssetThreadPools.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/ExecThreadPools.java index ef8eedc6..cfa7362b 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/AssetThreadPools.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/ExecThreadPools.java @@ -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(); - /** * 批量执行任务线程池 */ diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/cache/ExecCacheKeyDefine.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/cache/ExecCacheKeyDefine.java similarity index 92% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/cache/ExecCacheKeyDefine.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/cache/ExecCacheKeyDefine.java index e8036e1a..34ee5d5a 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/cache/ExecCacheKeyDefine.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/cache/ExecCacheKeyDefine.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/cache/AssetStatisticsCacheKeyDefine.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/cache/ExecStatisticsCacheKeyDefine.java similarity index 70% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/cache/AssetStatisticsCacheKeyDefine.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/cache/ExecStatisticsCacheKeyDefine.java index 6eea666c..5f490d87 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/cache/AssetStatisticsCacheKeyDefine.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/cache/ExecStatisticsCacheKeyDefine.java @@ -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(); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/message/ExecMessageDefine.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/message/ExecMessageDefine.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/message/ExecMessageDefine.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/message/ExecMessageDefine.java index f928cc13..0effe933 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/message/ExecMessageDefine.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/message/ExecMessageDefine.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/message/UploadMessageDefine.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/message/UploadMessageDefine.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/message/UploadMessageDefine.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/message/UploadMessageDefine.java index 90dfa490..e8339ee3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/message/UploadMessageDefine.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/message/UploadMessageDefine.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecCommandLogOperatorType.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecCommandLogOperatorType.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecCommandLogOperatorType.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecCommandLogOperatorType.java index a8e05eb0..417d2a4e 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecCommandLogOperatorType.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecCommandLogOperatorType.java @@ -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"; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecCommandOperatorType.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecCommandOperatorType.java similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecCommandOperatorType.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecCommandOperatorType.java index 6d70693e..42811497 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecCommandOperatorType.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecCommandOperatorType.java @@ -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"; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecJobLogOperatorType.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecJobLogOperatorType.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecJobLogOperatorType.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecJobLogOperatorType.java index b4aa1dc2..3b4582c4 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecJobLogOperatorType.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecJobLogOperatorType.java @@ -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"; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecJobOperatorType.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecJobOperatorType.java similarity index 86% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecJobOperatorType.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecJobOperatorType.java index 8b85d3dc..f2d24536 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecJobOperatorType.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecJobOperatorType.java @@ -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, "手动触发计划任务 ${name}"), new OperatorType(M, UPDATE_EXEC_USER, "修改计划任务 ${name} 执行用户为 ${username}"), new OperatorType(H, DELETE, "删除计划任务 ${name}"), - new OperatorType(H, IMPORT, "导入计划任务 ${count} 条"), - new OperatorType(H, EXPORT, "导出计划任务 ${count} 条"), }; } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecTemplateOperatorType.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecTemplateOperatorType.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecTemplateOperatorType.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecTemplateOperatorType.java index 8e4dc0fd..24851c1e 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/ExecTemplateOperatorType.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/ExecTemplateOperatorType.java @@ -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"; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/UploadTaskOperatorType.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/UploadTaskOperatorType.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/UploadTaskOperatorType.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/UploadTaskOperatorType.java index 3a11eb9b..fb67fd6f 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/define/operator/UploadTaskOperatorType.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/define/operator/UploadTaskOperatorType.java @@ -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"; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecHostLogDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecHostLogDO.java similarity index 98% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecHostLogDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecHostLogDO.java index c28f48ac..65a3eeaf 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecHostLogDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecHostLogDO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecJobDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecJobDO.java similarity index 98% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecJobDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecJobDO.java index 06b7e6cd..07fe7e62 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecJobDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecJobDO.java @@ -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; /** * 计划任务 实体对象 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecJobHostDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecJobHostDO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecJobHostDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecJobHostDO.java index 83d62a66..3f08325b 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecJobHostDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecJobHostDO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecLogDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecLogDO.java similarity index 98% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecLogDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecLogDO.java index 528044ac..9c583dc3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecLogDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecLogDO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecTemplateDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecTemplateDO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecTemplateDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecTemplateDO.java index af1dcdb9..aae73166 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecTemplateDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecTemplateDO.java @@ -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; /** * 执行模板 实体对象 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecTemplateHostDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecTemplateHostDO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecTemplateHostDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecTemplateHostDO.java index 5e11ed4d..4776360e 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/ExecTemplateHostDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/ExecTemplateHostDO.java @@ -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; /** * 执行模板主机 实体对象 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/UploadTaskDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/UploadTaskDO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/UploadTaskDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/UploadTaskDO.java index 12bd4015..3d3fc45f 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/UploadTaskDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/UploadTaskDO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/UploadTaskFileDO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/UploadTaskFileDO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/UploadTaskFileDO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/UploadTaskFileDO.java index c696430e..b71f62e6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/domain/UploadTaskFileDO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/domain/UploadTaskFileDO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecCommandExecDTO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecCommandExecDTO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecCommandExecDTO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecCommandExecDTO.java index 9681a5da..1e938325 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecCommandExecDTO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecCommandExecDTO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecLogTailDTO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecLogTailDTO.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecLogTailDTO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecLogTailDTO.java index b3a9cce0..c28316be 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecLogTailDTO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecLogTailDTO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecParameterSchemaDTO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecParameterSchemaDTO.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecParameterSchemaDTO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecParameterSchemaDTO.java index f31847d8..5b88ce5d 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/ExecParameterSchemaDTO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/ExecParameterSchemaDTO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/UploadTaskExtraDTO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/UploadTaskExtraDTO.java similarity index 89% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/UploadTaskExtraDTO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/UploadTaskExtraDTO.java index c5ff44a3..594cc861 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/dto/UploadTaskExtraDTO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/dto/UploadTaskExtraDTO.java @@ -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 hostIdList; @Schema(description = "主机信息") - private List hosts; + private List hosts; } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/po/HostTypeCountPO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/po/ExecHostLogCountPO.java similarity index 79% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/po/HostTypeCountPO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/po/ExecHostLogCountPO.java index b519b8d4..596ad52c 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/po/HostTypeCountPO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/po/ExecHostLogCountPO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/po/ExecLogCountPO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/po/ExecLogCountPO.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/po/ExecLogCountPO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/po/ExecLogCountPO.java index 90ec4df6..65549cc9 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/po/ExecLogCountPO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/po/ExecLogCountPO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecCommandRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecCommandRequest.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecCommandRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecCommandRequest.java index 660568a5..49a414eb 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecCommandRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecCommandRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecInterruptRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecInterruptRequest.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecInterruptRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecInterruptRequest.java index 59d7aa58..c054a169 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecInterruptRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecInterruptRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobCreateRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobCreateRequest.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobCreateRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobCreateRequest.java index a2152e57..7a1f2879 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobCreateRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobCreateRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobQueryRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobQueryRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobQueryRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobQueryRequest.java index 647fb7b4..649dd739 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobQueryRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobQueryRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobTriggerRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobTriggerRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobTriggerRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobTriggerRequest.java index a9f0d75d..3c869c6e 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobTriggerRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobTriggerRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateExecUserRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateExecUserRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateExecUserRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateExecUserRequest.java index 3c55bb04..80134fa7 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateExecUserRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateExecUserRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateRequest.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateRequest.java index a7903afc..49404595 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateStatusRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateStatusRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateStatusRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateStatusRequest.java index 9df3041f..f4adc7f2 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecJobUpdateStatusRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecJobUpdateStatusRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecLogClearRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecLogClearRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecLogClearRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecLogClearRequest.java index c77f6932..2639fe59 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecLogClearRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecLogClearRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecLogQueryRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecLogQueryRequest.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecLogQueryRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecLogQueryRequest.java index 74e4bf42..88110094 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecLogQueryRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecLogQueryRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateCreateRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateCreateRequest.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateCreateRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateCreateRequest.java index 414add03..c276a289 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateCreateRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateCreateRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateQueryRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateQueryRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateQueryRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateQueryRequest.java index 3eea84ce..50a1c909 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateQueryRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateQueryRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateUpdateRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateUpdateRequest.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateUpdateRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateUpdateRequest.java index 04ca70b6..942a3ca8 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ExecTemplateUpdateRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ExecTemplateUpdateRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ReExecCommandRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ReExecCommandRequest.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ReExecCommandRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ReExecCommandRequest.java index 69e3d359..b9b9de86 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/exec/ReExecCommandRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/exec/ReExecCommandRequest.java @@ -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.*; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskClearRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskClearRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskClearRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskClearRequest.java index 87d28dff..7ac89692 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskClearRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskClearRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskCreateRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskCreateRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskCreateRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskCreateRequest.java index ca6111fa..48076eb4 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskCreateRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskCreateRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskFileRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskFileRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskFileRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskFileRequest.java index 93482edd..f0d31946 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskFileRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskFileRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskQueryRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskQueryRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskQueryRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskQueryRequest.java index 65906b4b..49a42ee4 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskQueryRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskQueryRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskRequest.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskRequest.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskRequest.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskRequest.java index 58addd43..d5e348c8 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/request/upload/UploadTaskRequest.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/request/upload/UploadTaskRequest.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecHostLogVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecHostLogVO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecHostLogVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecHostLogVO.java index 52c063b9..99f563d9 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecHostLogVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecHostLogVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecJobHostVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecJobHostVO.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecJobHostVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecJobHostVO.java index 55d93b36..cc6844a0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecJobHostVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecJobHostVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecJobVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecJobVO.java similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecJobVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecJobVO.java index 7108aa44..d2ede11e 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecJobVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecJobVO.java @@ -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 hostIdList; @Schema(description = "执行主机") - private List hostList; + private List hostList; } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecLogStatusVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecLogStatusVO.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecLogStatusVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecLogStatusVO.java index e27f306a..108e49c1 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecLogStatusVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecLogStatusVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecLogVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecLogVO.java similarity index 98% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecLogVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecLogVO.java index 8ad77d43..f86ffbc5 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecLogVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecLogVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecTemplateVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecTemplateVO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecTemplateVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecTemplateVO.java index e728cba1..883eea29 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/ExecTemplateVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecTemplateVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/AssetWorkplaceStatisticsVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecWorkplaceStatisticsVO.java similarity index 72% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/AssetWorkplaceStatisticsVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecWorkplaceStatisticsVO.java index 5b2c5d7d..16179dad 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/AssetWorkplaceStatisticsVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/ExecWorkplaceStatisticsVO.java @@ -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 terminalConnectList; - @Schema(description = "批量执行记录") private List execLogList; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskCreateVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskCreateVO.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskCreateVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskCreateVO.java index 8e2b5c82..e1572501 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskCreateVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskCreateVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskFileVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskFileVO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskFileVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskFileVO.java index 52b7729d..96df7fc6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskFileVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskFileVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskHostVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskHostVO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskHostVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskHostVO.java index 2d64e1de..be2ffec2 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskHostVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskHostVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskStatusVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskStatusVO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskStatusVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskStatusVO.java index 3f0d27ed..4c608ac9 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskStatusVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskStatusVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskVO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskVO.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskVO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskVO.java index f5914f45..c9d5b55f 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/UploadTaskVO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/entity/vo/UploadTaskVO.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecHostStatusEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecHostStatusEnum.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecHostStatusEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecHostStatusEnum.java index 1ac67043..aa1ab646 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecHostStatusEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecHostStatusEnum.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecJobStatusEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecJobStatusEnum.java similarity index 76% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecJobStatusEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecJobStatusEnum.java index 3672dfb0..15dec569 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecJobStatusEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecJobStatusEnum.java @@ -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; } } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecModeEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecModeEnum.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecModeEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecModeEnum.java index d528a718..a8377921 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecModeEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecModeEnum.java @@ -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; /** * 执行方式 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecSourceEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecSourceEnum.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecSourceEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecSourceEnum.java index 6de62721..aee889a1 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecSourceEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecSourceEnum.java @@ -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; /** * 批量执行来源 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecStatusEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecStatusEnum.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecStatusEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecStatusEnum.java index d24d4f68..3d58bcf9 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ExecStatusEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ExecStatusEnum.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ScriptExecEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ScriptExecEnum.java similarity index 76% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ScriptExecEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ScriptExecEnum.java index a7115bf5..bff4fcf3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/ScriptExecEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/ScriptExecEnum.java @@ -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; } /** diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/UploadTaskFileStatusEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/UploadTaskFileStatusEnum.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/UploadTaskFileStatusEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/UploadTaskFileStatusEnum.java index 6bccc890..3582b9a5 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/UploadTaskFileStatusEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/UploadTaskFileStatusEnum.java @@ -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; /** * 上传任务文件状态 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/UploadTaskStatusEnum.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/UploadTaskStatusEnum.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/UploadTaskStatusEnum.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/UploadTaskStatusEnum.java index 6ed939fc..b62ec7cf 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/enums/UploadTaskStatusEnum.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/enums/UploadTaskStatusEnum.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/ExecTaskExecutors.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/ExecTaskExecutors.java similarity index 79% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/ExecTaskExecutors.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/ExecTaskExecutors.java index ce7754e6..c1653f90 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/ExecTaskExecutors.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/ExecTaskExecutors.java @@ -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 execHostIdList) { - AssetThreadPools.EXEC_TASK.execute(new ExecTaskHandler(id, execHostIdList)); + ExecThreadPools.EXEC_TASK.execute(new ExecTaskHandler(id, execHostIdList)); } } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/BaseExecCommandHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/BaseExecCommandHandler.java similarity index 89% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/BaseExecCommandHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/BaseExecCommandHandler.java index 4c1c57f5..f40411cc 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/BaseExecCommandHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/BaseExecCommandHandler.java @@ -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 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); diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecCommandDetailHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecCommandDetailHandler.java similarity index 97% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecCommandDetailHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecCommandDetailHandler.java index c3daff88..a5cc89e6 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecCommandDetailHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecCommandDetailHandler.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecCommandOriginHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecCommandOriginHandler.java similarity index 91% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecCommandOriginHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecCommandOriginHandler.java index 9d9548c8..612a8414 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecCommandOriginHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecCommandOriginHandler.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecTaskHandler.java similarity index 92% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecTaskHandler.java index 382f60c0..ad127cf0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/ExecTaskHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/ExecTaskHandler.java @@ -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); } } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/IExecCommandHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/IExecCommandHandler.java similarity index 91% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/IExecCommandHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/IExecCommandHandler.java index 0acfcdae..f104bf56 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/IExecCommandHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/IExecCommandHandler.java @@ -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; /** * 命令执行器定义 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/IExecTaskHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/IExecTaskHandler.java similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/IExecTaskHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/IExecTaskHandler.java index 765663e4..0805923a 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/handler/IExecTaskHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/handler/IExecTaskHandler.java @@ -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; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/manager/ExecTaskManager.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/manager/ExecTaskManager.java similarity index 90% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/manager/ExecTaskManager.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/manager/ExecTaskManager.java index f81fa92a..fc2839bc 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/command/manager/ExecTaskManager.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/command/manager/ExecTaskManager.java @@ -20,9 +20,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.handler.host.exec.command.manager; +package org.dromara.visor.module.exec.handler.exec.command.manager; -import org.dromara.visor.module.asset.handler.host.exec.command.handler.IExecTaskHandler; +import org.dromara.visor.module.exec.handler.exec.command.handler.IExecTaskHandler; import org.springframework.stereotype.Component; import java.util.concurrent.ConcurrentHashMap; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/job/ExecCommandJob.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/job/ExecCommandJob.java similarity index 85% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/job/ExecCommandJob.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/job/ExecCommandJob.java index d380a170..5cadf130 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/job/ExecCommandJob.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/job/ExecCommandJob.java @@ -20,17 +20,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.handler.host.exec.job; +package org.dromara.visor.module.exec.handler.exec.job; -import cn.orionsec.kit.spring.SpringHolder; -import lombok.extern.slf4j.Slf4j; import org.dromara.visor.common.constant.FieldConst; import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; -import org.dromara.visor.module.asset.dao.ExecJobDAO; -import org.dromara.visor.module.asset.entity.domain.ExecJobDO; -import org.dromara.visor.module.asset.entity.request.exec.ExecJobTriggerRequest; -import org.dromara.visor.module.asset.enums.ExecModeEnum; -import org.dromara.visor.module.asset.service.ExecJobService; +import org.dromara.visor.module.exec.dao.ExecJobDAO; +import org.dromara.visor.module.exec.entity.domain.ExecJobDO; +import org.dromara.visor.module.exec.entity.request.exec.ExecJobTriggerRequest; +import org.dromara.visor.module.exec.enums.ExecModeEnum; +import org.dromara.visor.module.exec.service.ExecJobService; +import cn.orionsec.kit.spring.SpringHolder; +import lombok.extern.slf4j.Slf4j; import org.quartz.Job; import org.quartz.JobExecutionContext; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/ExecLogTailHandler.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/ExecLogTailHandler.java similarity index 85% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/ExecLogTailHandler.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/ExecLogTailHandler.java index 84e2a226..fc2f2e12 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/ExecLogTailHandler.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/ExecLogTailHandler.java @@ -20,17 +20,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.handler.host.exec.log; +package org.dromara.visor.module.exec.handler.exec.log; -import cn.orionsec.kit.lang.utils.Strings; -import lombok.extern.slf4j.Slf4j; import org.dromara.visor.common.constant.ExtraFieldConst; import org.dromara.visor.framework.websocket.core.utils.WebSockets; -import org.dromara.visor.module.asset.define.AssetThreadPools; -import org.dromara.visor.module.asset.entity.dto.ExecLogTailDTO; -import org.dromara.visor.module.asset.handler.host.exec.log.constant.LogConst; -import org.dromara.visor.module.asset.handler.host.exec.log.manager.ExecLogManager; -import org.dromara.visor.module.asset.handler.host.exec.log.tracker.ExecLogTracker; +import org.dromara.visor.module.exec.define.ExecThreadPools; +import org.dromara.visor.module.exec.entity.dto.ExecLogTailDTO; +import org.dromara.visor.module.exec.handler.exec.log.constant.LogConst; +import org.dromara.visor.module.exec.handler.exec.log.manager.ExecLogManager; +import org.dromara.visor.module.exec.handler.exec.log.tracker.ExecLogTracker; +import cn.orionsec.kit.lang.utils.Strings; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; @@ -68,7 +68,7 @@ public class ExecLogTailHandler extends AbstractWebSocketHandler { execHostId, WebSockets.createSyncSession(session)); // 执行追踪器 - AssetThreadPools.EXEC_LOG.execute(tracker); + ExecThreadPools.EXEC_LOG.execute(tracker); // 添加追踪器 execLogManager.addTracker(id, tracker); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/constant/LogConst.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/constant/LogConst.java similarity index 93% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/constant/LogConst.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/constant/LogConst.java index b3e323f0..e28d8f65 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/constant/LogConst.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/constant/LogConst.java @@ -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.log.constant; +package org.dromara.visor.module.exec.handler.exec.log.constant; /** * 日志常量 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/manager/ExecLogManager.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/manager/ExecLogManager.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/manager/ExecLogManager.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/manager/ExecLogManager.java index 74f4f4e0..63a814ec 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/manager/ExecLogManager.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/manager/ExecLogManager.java @@ -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.log.manager; +package org.dromara.visor.module.exec.handler.exec.log.manager; +import org.dromara.visor.common.constant.Const; +import org.dromara.visor.module.exec.handler.exec.log.tracker.IExecLogTracker; import cn.orionsec.kit.lang.utils.Threads; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.common.constant.Const; -import org.dromara.visor.module.asset.handler.host.exec.log.tracker.IExecLogTracker; import org.springframework.stereotype.Component; import java.util.ArrayList; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/tracker/ExecLogTracker.java similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/tracker/ExecLogTracker.java index 1278bdb1..d1158921 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/tracker/ExecLogTracker.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/tracker/ExecLogTracker.java @@ -20,8 +20,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.handler.host.exec.log.tracker; +package org.dromara.visor.module.exec.handler.exec.log.tracker; +import org.dromara.visor.common.constant.Const; +import org.dromara.visor.common.constant.ErrorMessage; +import org.dromara.visor.common.interfaces.FileClient; +import org.dromara.visor.common.utils.Valid; +import org.dromara.visor.framework.websocket.core.utils.WebSockets; +import org.dromara.visor.module.common.config.AppLogConfig; +import org.dromara.visor.module.exec.dao.ExecHostLogDAO; +import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO; +import org.dromara.visor.module.exec.enums.ExecHostStatusEnum; +import org.dromara.visor.module.exec.handler.exec.log.constant.LogConst; import cn.orionsec.kit.ext.tail.Tracker; import cn.orionsec.kit.ext.tail.delay.DelayTrackerListener; import cn.orionsec.kit.ext.tail.mode.FileNotFoundMode; @@ -36,16 +46,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.common.constant.Const; -import org.dromara.visor.common.constant.ErrorMessage; -import org.dromara.visor.common.interfaces.FileClient; -import org.dromara.visor.common.utils.Valid; -import org.dromara.visor.framework.websocket.core.utils.WebSockets; -import org.dromara.visor.module.asset.dao.ExecHostLogDAO; -import org.dromara.visor.module.asset.define.config.AppLogConfig; -import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO; -import org.dromara.visor.module.asset.enums.ExecHostStatusEnum; -import org.dromara.visor.module.asset.handler.host.exec.log.constant.LogConst; import org.springframework.web.socket.WebSocketSession; import java.io.IOException; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/tracker/IExecLogTracker.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/tracker/IExecLogTracker.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/tracker/IExecLogTracker.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/tracker/IExecLogTracker.java index bc19e817..6da4e260 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/exec/log/tracker/IExecLogTracker.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/exec/log/tracker/IExecLogTracker.java @@ -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.log.tracker; +package org.dromara.visor.module.exec.handler.exec.log.tracker; import cn.orionsec.kit.ext.tail.handler.DataHandler; import cn.orionsec.kit.lang.able.SafeCloseable; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/FileUploadTasks.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/FileUploadTasks.java similarity index 79% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/FileUploadTasks.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/FileUploadTasks.java index 6a3e6131..e32dba92 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/FileUploadTasks.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/FileUploadTasks.java @@ -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.upload; +package org.dromara.visor.module.exec.handler.upload; -import org.dromara.visor.module.asset.define.AssetThreadPools; -import org.dromara.visor.module.asset.handler.host.upload.task.FileUploadTask; +import org.dromara.visor.module.exec.define.ExecThreadPools; +import org.dromara.visor.module.exec.handler.upload.task.FileUploadTask; /** * 批量上传执行器 @@ -43,7 +43,7 @@ public class FileUploadTasks { * @param taskId taskId */ public static void start(Long taskId) { - AssetThreadPools.UPLOAD_TASK.execute(new FileUploadTask(taskId)); + ExecThreadPools.UPLOAD_TASK.execute(new FileUploadTask(taskId)); } } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/manager/FileUploadTaskManager.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/manager/FileUploadTaskManager.java similarity index 91% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/manager/FileUploadTaskManager.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/manager/FileUploadTaskManager.java index 0febe7d8..5fe2d403 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/manager/FileUploadTaskManager.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/manager/FileUploadTaskManager.java @@ -20,9 +20,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.handler.host.upload.manager; +package org.dromara.visor.module.exec.handler.upload.manager; -import org.dromara.visor.module.asset.handler.host.upload.task.IFileUploadTask; +import org.dromara.visor.module.exec.handler.upload.task.IFileUploadTask; import org.springframework.stereotype.Component; import java.util.concurrent.ConcurrentHashMap; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/model/FileUploadConfigDTO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/model/FileUploadConfigDTO.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/model/FileUploadConfigDTO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/model/FileUploadConfigDTO.java index 0444f296..c112d648 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/model/FileUploadConfigDTO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/model/FileUploadConfigDTO.java @@ -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.upload.model; +package org.dromara.visor.module.exec.handler.upload.model; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/model/FileUploadFileItemDTO.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/model/FileUploadFileItemDTO.java similarity index 95% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/model/FileUploadFileItemDTO.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/model/FileUploadFileItemDTO.java index f22b2725..198f5aee 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/model/FileUploadFileItemDTO.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/model/FileUploadFileItemDTO.java @@ -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.upload.model; +package org.dromara.visor.module.exec.handler.upload.model; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/task/FileUploadTask.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/task/FileUploadTask.java similarity index 87% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/task/FileUploadTask.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/task/FileUploadTask.java index 3e4dbbec..33a5ae75 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/task/FileUploadTask.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/task/FileUploadTask.java @@ -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.upload.task; +package org.dromara.visor.module.exec.handler.upload.task; import cn.orionsec.kit.lang.utils.Threads; import cn.orionsec.kit.lang.utils.io.Streams; @@ -29,20 +29,20 @@ import cn.orionsec.kit.spring.SpringHolder; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.dromara.visor.common.constant.ExtraFieldConst; -import org.dromara.visor.module.asset.dao.UploadTaskDAO; -import org.dromara.visor.module.asset.dao.UploadTaskFileDAO; -import org.dromara.visor.module.asset.define.AssetThreadPools; -import org.dromara.visor.module.asset.define.message.UploadMessageDefine; -import org.dromara.visor.module.asset.entity.domain.UploadTaskDO; -import org.dromara.visor.module.asset.entity.domain.UploadTaskFileDO; -import org.dromara.visor.module.asset.enums.UploadTaskFileStatusEnum; -import org.dromara.visor.module.asset.enums.UploadTaskStatusEnum; -import org.dromara.visor.module.asset.handler.host.upload.manager.FileUploadTaskManager; -import org.dromara.visor.module.asset.handler.host.upload.model.FileUploadConfigDTO; -import org.dromara.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO; -import org.dromara.visor.module.asset.handler.host.upload.uploader.FileUploader; -import org.dromara.visor.module.asset.handler.host.upload.uploader.IFileUploader; -import org.dromara.visor.module.asset.service.UploadTaskService; +import org.dromara.visor.module.exec.dao.UploadTaskDAO; +import org.dromara.visor.module.exec.dao.UploadTaskFileDAO; +import org.dromara.visor.module.exec.define.ExecThreadPools; +import org.dromara.visor.module.exec.define.message.UploadMessageDefine; +import org.dromara.visor.module.exec.entity.domain.UploadTaskDO; +import org.dromara.visor.module.exec.entity.domain.UploadTaskFileDO; +import org.dromara.visor.module.exec.enums.UploadTaskFileStatusEnum; +import org.dromara.visor.module.exec.enums.UploadTaskStatusEnum; +import org.dromara.visor.module.exec.handler.upload.manager.FileUploadTaskManager; +import org.dromara.visor.module.exec.handler.upload.model.FileUploadConfigDTO; +import org.dromara.visor.module.exec.handler.upload.model.FileUploadFileItemDTO; +import org.dromara.visor.module.exec.handler.upload.uploader.FileUploader; +import org.dromara.visor.module.exec.handler.upload.uploader.IFileUploader; +import org.dromara.visor.module.exec.service.UploadTaskService; import org.dromara.visor.module.infra.api.SystemMessageApi; import org.dromara.visor.module.infra.entity.dto.message.SystemMessageDTO; @@ -198,7 +198,7 @@ public class FileUploadTask implements IFileUploadTask { handler.run(); } else { // 多个主机异步阻塞执行 - Threads.blockRun(uploaderList, AssetThreadPools.UPLOAD_HOST); + Threads.blockRun(uploaderList, ExecThreadPools.UPLOAD_HOST); } } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/task/IFileUploadTask.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/task/IFileUploadTask.java similarity index 89% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/task/IFileUploadTask.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/task/IFileUploadTask.java index 1582cd38..290b01d0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/task/IFileUploadTask.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/task/IFileUploadTask.java @@ -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.upload.task; +package org.dromara.visor.module.exec.handler.upload.task; +import org.dromara.visor.module.exec.handler.upload.uploader.IFileUploader; import cn.orionsec.kit.lang.able.SafeCloseable; -import org.dromara.visor.module.asset.handler.host.upload.uploader.IFileUploader; import java.util.List; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/uploader/FileUploader.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/uploader/FileUploader.java similarity index 90% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/uploader/FileUploader.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/uploader/FileUploader.java index 3d901c69..c18b7080 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/uploader/FileUploader.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/uploader/FileUploader.java @@ -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.upload.uploader; +package org.dromara.visor.module.exec.handler.upload.uploader; import cn.orionsec.kit.lang.utils.Strings; import cn.orionsec.kit.lang.utils.collect.Maps; @@ -36,17 +36,17 @@ import org.dromara.visor.common.constant.ErrorMessage; import org.dromara.visor.common.constant.ExtraFieldConst; 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.module.asset.dao.UploadTaskFileDAO; -import org.dromara.visor.module.asset.entity.domain.UploadTaskFileDO; -import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO; +import org.dromara.visor.module.asset.api.HostConnectApi; import org.dromara.visor.module.asset.enums.HostOsTypeEnum; -import org.dromara.visor.module.asset.enums.UploadTaskFileStatusEnum; -import org.dromara.visor.module.asset.handler.host.jsch.SessionStores; -import org.dromara.visor.module.asset.handler.host.upload.model.FileUploadConfigDTO; -import org.dromara.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO; -import org.dromara.visor.module.asset.service.HostConnectService; -import org.dromara.visor.module.asset.utils.SftpUtils; +import org.dromara.visor.module.common.utils.SftpUtils; +import org.dromara.visor.module.exec.dao.UploadTaskFileDAO; +import org.dromara.visor.module.exec.entity.domain.UploadTaskFileDO; +import org.dromara.visor.module.exec.enums.UploadTaskFileStatusEnum; +import org.dromara.visor.module.exec.handler.upload.model.FileUploadConfigDTO; +import org.dromara.visor.module.exec.handler.upload.model.FileUploadFileItemDTO; import java.io.InputStream; import java.io.OutputStream; @@ -65,13 +65,15 @@ import java.util.stream.Collectors; @Slf4j public class FileUploader implements IFileUploader { - private static final HostConnectService hostConnectService = SpringHolder.getBean(HostConnectService.class); + private static final int ERROR_MESSAGE_LEN = 1024; + + private static final HostConnectApi hostConnectApi = SpringHolder.getBean(HostConnectApi.class); private static final UploadTaskFileDAO uploadTaskFileDAO = SpringHolder.getBean(UploadTaskFileDAO.class); private static final FileClient localFileClient = SpringHolder.getBean("localFileClient"); - private TerminalConnectDTO connectInfo; + private SshConnectConfig connectConfig; private SessionStore sessionStore; @@ -136,9 +138,9 @@ public class FileUploader implements IFileUploader { log.info("HostFileUploader.initSession start taskId: {}, hostId: {}", taskId, hostId); try { // 打开会话 - this.connectInfo = hostConnectService.getSshConnectInfo(hostId, config.getUserId()); - this.sessionStore = SessionStores.openSessionStore(connectInfo); - this.executor = sessionStore.getSftpExecutor(connectInfo.getFileNameCharset()); + this.connectConfig = hostConnectApi.getSshConnectConfig(hostId, config.getUserId()); + this.sessionStore = SessionStores.openSessionStore(connectConfig); + this.executor = sessionStore.getSftpExecutor(connectConfig.getFileNameCharset()); executor.connect(); log.info("HostFileUploader.initSession success taskId: {}, hostId: {}", taskId, hostId); return true; @@ -160,8 +162,8 @@ public class FileUploader implements IFileUploader { boolean containsEnv = remotePath.contains(Const.DOLLAR); if (containsEnv) { // 替换占位符 - String username = connectInfo.getUsername(); - String home = PathUtils.getHomePath(HostOsTypeEnum.WINDOWS.is(connectInfo.getOsType()), username); + String username = connectConfig.getUsername(); + String home = PathUtils.getHomePath(HostOsTypeEnum.WINDOWS.is(connectConfig.getOsType()), username); // 替换环境变量路径 Map env = Maps.newMap(4); env.put(ExtraFieldConst.USERNAME, username); diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/uploader/IFileUploader.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/uploader/IFileUploader.java similarity index 88% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/uploader/IFileUploader.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/uploader/IFileUploader.java index 0ea4c21e..f773878d 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/host/upload/uploader/IFileUploader.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/handler/upload/uploader/IFileUploader.java @@ -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.upload.uploader; +package org.dromara.visor.module.exec.handler.upload.uploader; +import org.dromara.visor.module.exec.handler.upload.model.FileUploadFileItemDTO; import cn.orionsec.kit.lang.able.SafeCloseable; -import org.dromara.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO; import java.util.List; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/interceptor/ExecLogTailInterceptor.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/interceptor/ExecLogTailInterceptor.java similarity index 92% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/interceptor/ExecLogTailInterceptor.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/interceptor/ExecLogTailInterceptor.java index 35b05cab..e77424f3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/interceptor/ExecLogTailInterceptor.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/interceptor/ExecLogTailInterceptor.java @@ -20,13 +20,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.interceptor; +package org.dromara.visor.module.exec.interceptor; +import org.dromara.visor.common.constant.ExtraFieldConst; +import org.dromara.visor.module.exec.entity.dto.ExecLogTailDTO; +import org.dromara.visor.module.exec.service.ExecLogService; import cn.orionsec.kit.lang.utils.Urls; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.common.constant.ExtraFieldConst; -import org.dromara.visor.module.asset.entity.dto.ExecLogTailDTO; -import org.dromara.visor.module.asset.service.ExecLogService; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; import org.springframework.stereotype.Component; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecCommandService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecCommandService.java similarity index 85% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecCommandService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecCommandService.java index 6b13bbce..b7fc7453 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecCommandService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecCommandService.java @@ -20,11 +20,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; -import org.dromara.visor.module.asset.entity.dto.ExecCommandExecDTO; -import org.dromara.visor.module.asset.entity.request.exec.ExecCommandRequest; -import org.dromara.visor.module.asset.entity.vo.ExecLogVO; +import org.dromara.visor.module.exec.entity.dto.ExecCommandExecDTO; +import org.dromara.visor.module.exec.entity.request.exec.ExecCommandRequest; +import org.dromara.visor.module.exec.entity.vo.ExecLogVO; /** * 批量执行服务 diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecHostLogService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecHostLogService.java similarity index 93% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecHostLogService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecHostLogService.java index 1999551e..1ff64078 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecHostLogService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecHostLogService.java @@ -20,9 +20,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; -import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO; +import org.dromara.visor.module.exec.entity.vo.ExecHostLogVO; import java.util.List; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecJobHostService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecJobHostService.java similarity index 81% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecJobHostService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecJobHostService.java index 4013d488..05df51d4 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecJobHostService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecJobHostService.java @@ -20,7 +20,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; import java.util.List; @@ -65,20 +65,4 @@ public interface ExecJobHostService { */ Integer deleteByJobIdList(List jobIdList); - /** - * 通过 hostId 删除 - * - * @param hostId hostId - * @return effect - */ - Integer deleteByHostId(Long hostId); - - /** - * 通过 hostId 删除 - * - * @param hostIdList hostIdList - * @return effect - */ - Integer deleteByHostIdList(List hostIdList); - } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecJobService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecJobService.java similarity index 81% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecJobService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecJobService.java index 71308680..0694f104 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecJobService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecJobService.java @@ -20,12 +20,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; import cn.orionsec.kit.lang.define.wrapper.DataGrid; -import org.dromara.visor.module.asset.entity.domain.ExecJobDO; -import org.dromara.visor.module.asset.entity.request.exec.*; -import org.dromara.visor.module.asset.entity.vo.ExecJobVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.dromara.visor.module.exec.entity.domain.ExecJobDO; +import org.dromara.visor.module.exec.entity.request.exec.*; +import org.dromara.visor.module.exec.entity.vo.ExecJobVO; import java.util.List; @@ -93,6 +94,14 @@ public interface ExecJobService { */ DataGrid getExecJobPage(ExecJobQueryRequest request); + /** + * 查询计划任务数量 + * + * @param request request + * @return count + */ + Long getExecJobCount(ExecJobQueryRequest request); + /** * 获取下一个执行序列 * @@ -132,4 +141,12 @@ public interface ExecJobService { */ void triggerExecJob(ExecJobTriggerRequest request, ExecJobDO job); + /** + * 构建查询 wrapper + * + * @param request request + * @return wrapper + */ + LambdaQueryWrapper buildQueryWrapper(ExecJobQueryRequest request); + } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecLogService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecLogService.java similarity index 89% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecLogService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecLogService.java index 6ad04bc6..05c3206d 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecLogService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecLogService.java @@ -20,16 +20,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; +import org.dromara.visor.module.exec.entity.domain.ExecLogDO; +import org.dromara.visor.module.exec.entity.dto.ExecLogTailDTO; +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.ExecLogStatusVO; +import org.dromara.visor.module.exec.entity.vo.ExecLogVO; import cn.orionsec.kit.lang.define.wrapper.DataGrid; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.dromara.visor.module.asset.entity.domain.ExecLogDO; -import org.dromara.visor.module.asset.entity.dto.ExecLogTailDTO; -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.ExecLogStatusVO; -import org.dromara.visor.module.asset.entity.vo.ExecLogVO; import javax.servlet.http.HttpServletResponse; import java.util.List; diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecStatisticsService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecStatisticsService.java new file mode 100644 index 00000000..f0c56a81 --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecStatisticsService.java @@ -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.service; + +import org.dromara.visor.common.entity.chart.LineSingleChartData; +import org.dromara.visor.module.exec.entity.vo.ExecWorkplaceStatisticsVO; +import org.dromara.visor.module.exec.enums.ExecSourceEnum; + +/** + * 执行模块统计服务 + * + * @author Jiahang Li + * @version 1.0.0 + * @since 2024/12/23 20:45 + */ +public interface ExecStatisticsService { + + /** + * 获取执行模块工作台统计信息 + * + * @return data + */ + ExecWorkplaceStatisticsVO getWorkplaceStatisticsData(); + + /** + * 获取用户执行日志数量图表 + * + * @param userId userId + * @param source source + * @return chart + */ + LineSingleChartData getUserExecLogCountChart(Long userId, ExecSourceEnum source); + +} diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecTemplateHostService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecTemplateHostService.java similarity index 84% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecTemplateHostService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecTemplateHostService.java index ccd21448..102a96ec 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecTemplateHostService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecTemplateHostService.java @@ -20,7 +20,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; import java.util.List; import java.util.Map; @@ -75,20 +75,4 @@ public interface ExecTemplateHostService { */ Integer deleteByTemplateIdList(List templateIdList); - /** - * 通过 hostId 删除 - * - * @param hostId hostId - * @return effect - */ - Integer deleteByHostId(Long hostId); - - /** - * 通过 hostId 删除 - * - * @param hostIdList hostIdList - * @return effect - */ - Integer deleteByHostIdList(List hostIdList); - } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecTemplateService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecTemplateService.java similarity index 71% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecTemplateService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecTemplateService.java index 37024845..9f9290c3 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/ExecTemplateService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/ExecTemplateService.java @@ -20,13 +20,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; import cn.orionsec.kit.lang.define.wrapper.DataGrid; -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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.ExecTemplateQueryRequest; +import org.dromara.visor.module.exec.entity.request.exec.ExecTemplateUpdateRequest; +import org.dromara.visor.module.exec.entity.vo.ExecTemplateVO; import java.util.List; @@ -79,6 +81,14 @@ public interface ExecTemplateService { */ DataGrid getExecTemplatePage(ExecTemplateQueryRequest request); + /** + * 查询执行模板数量 + * + * @param request request + * @return count + */ + Long getExecTemplateCount(ExecTemplateQueryRequest request); + /** * 删除执行模板 * @@ -95,4 +105,12 @@ public interface ExecTemplateService { */ Integer deleteExecTemplateByIdList(List idList); + /** + * 构建查询 wrapper + * + * @param request request + * @return wrapper + */ + LambdaQueryWrapper buildQueryWrapper(ExecTemplateQueryRequest request); + } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/UploadTaskFileService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/UploadTaskFileService.java similarity index 92% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/UploadTaskFileService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/UploadTaskFileService.java index 0e02c79b..cedfd676 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/UploadTaskFileService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/UploadTaskFileService.java @@ -20,9 +20,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; -import org.dromara.visor.module.asset.entity.vo.UploadTaskFileVO; +import org.dromara.visor.module.exec.entity.vo.UploadTaskFileVO; import java.util.List; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/UploadTaskService.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/UploadTaskService.java similarity index 82% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/UploadTaskService.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/UploadTaskService.java index dff6b825..8e5b89fd 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/UploadTaskService.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/UploadTaskService.java @@ -20,18 +20,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service; +package org.dromara.visor.module.exec.service; +import org.dromara.visor.module.exec.entity.domain.UploadTaskDO; +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 cn.orionsec.kit.lang.define.wrapper.DataGrid; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.dromara.visor.module.asset.entity.domain.UploadTaskDO; -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 java.util.List; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecCommandServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecCommandServiceImpl.java similarity index 80% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecCommandServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecCommandServiceImpl.java index 1111cf02..f3922aac 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecCommandServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecCommandServiceImpl.java @@ -20,10 +20,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; import cn.orionsec.kit.lang.utils.Strings; -import cn.orionsec.kit.lang.utils.Valid; import cn.orionsec.kit.lang.utils.collect.Lists; import cn.orionsec.kit.spring.SpringHolder; import com.alibaba.fastjson.JSON; @@ -31,25 +30,30 @@ import lombok.extern.slf4j.Slf4j; import org.dromara.visor.common.constant.Const; import org.dromara.visor.common.constant.ErrorMessage; import org.dromara.visor.common.security.LoginUser; +import org.dromara.visor.common.utils.Valid; import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; import org.dromara.visor.framework.security.core.utils.SecurityUtils; -import org.dromara.visor.module.asset.convert.ExecConvert; -import org.dromara.visor.module.asset.convert.ExecHostLogConvert; -import org.dromara.visor.module.asset.convert.ExecLogConvert; -import org.dromara.visor.module.asset.dao.ExecHostLogDAO; -import org.dromara.visor.module.asset.dao.ExecLogDAO; -import org.dromara.visor.module.asset.dao.HostDAO; -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.domain.HostDO; -import org.dromara.visor.module.asset.entity.dto.ExecCommandExecDTO; -import org.dromara.visor.module.asset.entity.request.exec.ExecCommandRequest; -import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO; -import org.dromara.visor.module.asset.entity.vo.ExecLogVO; -import org.dromara.visor.module.asset.enums.*; -import org.dromara.visor.module.asset.handler.host.exec.command.ExecTaskExecutors; -import org.dromara.visor.module.asset.service.AssetAuthorizedDataService; -import org.dromara.visor.module.asset.service.ExecCommandService; +import org.dromara.visor.module.asset.api.AssetAuthorizedDataApi; +import org.dromara.visor.module.asset.api.HostApi; +import org.dromara.visor.module.asset.entity.dto.host.HostDTO; +import org.dromara.visor.module.asset.enums.HostTypeEnum; +import org.dromara.visor.module.exec.convert.ExecConvert; +import org.dromara.visor.module.exec.convert.ExecHostLogConvert; +import org.dromara.visor.module.exec.convert.ExecLogConvert; +import org.dromara.visor.module.exec.dao.ExecHostLogDAO; +import org.dromara.visor.module.exec.dao.ExecLogDAO; +import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO; +import org.dromara.visor.module.exec.entity.domain.ExecLogDO; +import org.dromara.visor.module.exec.entity.dto.ExecCommandExecDTO; +import org.dromara.visor.module.exec.entity.request.exec.ExecCommandRequest; +import org.dromara.visor.module.exec.entity.vo.ExecHostLogVO; +import org.dromara.visor.module.exec.entity.vo.ExecLogVO; +import org.dromara.visor.module.exec.enums.ExecHostStatusEnum; +import org.dromara.visor.module.exec.enums.ExecModeEnum; +import org.dromara.visor.module.exec.enums.ExecSourceEnum; +import org.dromara.visor.module.exec.enums.ExecStatusEnum; +import org.dromara.visor.module.exec.handler.exec.command.ExecTaskExecutors; +import org.dromara.visor.module.exec.service.ExecCommandService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -78,10 +82,10 @@ public class ExecCommandServiceImpl implements ExecCommandService { private ExecHostLogDAO execHostLogDAO; @Resource - private HostDAO hostDAO; + private HostApi hostApi; @Resource - private AssetAuthorizedDataService assetAuthorizedDataService; + private AssetAuthorizedDataApi assetAuthorizedDataApi; @Override public ExecLogVO execCommand(ExecCommandRequest request) { @@ -90,7 +94,7 @@ public class ExecCommandServiceImpl implements ExecCommandService { Long userId = user.getId(); List hostIdList = request.getHostIdList(); // 检查主机权限 - List authorizedHostIdList = assetAuthorizedDataService.getUserAuthorizedEnabledHostId(userId, HostTypeEnum.SSH.name()); + List authorizedHostIdList = assetAuthorizedDataApi.getUserAuthorizedEnabledHostId(userId, HostTypeEnum.SSH); hostIdList.removeIf(s -> !authorizedHostIdList.contains(s)); log.info("ExecService.startExecCommand host hostList: {}", hostIdList); Valid.notEmpty(hostIdList, ErrorMessage.CHECK_AUTHORIZED_HOST); @@ -145,7 +149,7 @@ public class ExecCommandServiceImpl implements ExecCommandService { String command = request.getCommand(); List hostIdList = request.getHostIdList(); // 查询主机信息 - List hosts = hostDAO.selectBatchIds(hostIdList); + List hosts = hostApi.selectByIdList(hostIdList); // 插入日志 ExecLogDO execLog = ExecLogDO.builder() .userId(request.getUserId()) diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecHostLogServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecHostLogServiceImpl.java similarity index 86% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecHostLogServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecHostLogServiceImpl.java index 58546310..5dcbf73a 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecHostLogServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecHostLogServiceImpl.java @@ -20,22 +20,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; -import cn.orionsec.kit.lang.utils.collect.Lists; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import lombok.extern.slf4j.Slf4j; import org.dromara.visor.common.constant.ErrorMessage; import org.dromara.visor.common.utils.Valid; import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; -import org.dromara.visor.module.asset.convert.ExecHostLogConvert; -import org.dromara.visor.module.asset.dao.ExecHostLogDAO; -import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO; -import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO; -import org.dromara.visor.module.asset.handler.host.exec.command.handler.IExecCommandHandler; -import org.dromara.visor.module.asset.handler.host.exec.command.handler.IExecTaskHandler; -import org.dromara.visor.module.asset.handler.host.exec.command.manager.ExecTaskManager; -import org.dromara.visor.module.asset.service.ExecHostLogService; +import org.dromara.visor.module.exec.convert.ExecHostLogConvert; +import org.dromara.visor.module.exec.dao.ExecHostLogDAO; +import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO; +import org.dromara.visor.module.exec.entity.vo.ExecHostLogVO; +import org.dromara.visor.module.exec.handler.exec.command.handler.IExecCommandHandler; +import org.dromara.visor.module.exec.handler.exec.command.handler.IExecTaskHandler; +import org.dromara.visor.module.exec.handler.exec.command.manager.ExecTaskManager; +import org.dromara.visor.module.exec.service.ExecHostLogService; +import cn.orionsec.kit.lang.utils.collect.Lists; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecJobHostServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecJobHostServiceImpl.java similarity index 81% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecJobHostServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecJobHostServiceImpl.java index 24fd97ec..07d69454 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecJobHostServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecJobHostServiceImpl.java @@ -20,12 +20,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; +import org.dromara.visor.module.exec.dao.ExecJobHostDAO; +import org.dromara.visor.module.exec.entity.domain.ExecJobHostDO; +import org.dromara.visor.module.exec.service.ExecJobHostService; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.module.asset.dao.ExecJobHostDAO; -import org.dromara.visor.module.asset.entity.domain.ExecJobHostDO; -import org.dromara.visor.module.asset.service.ExecJobHostService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -76,14 +76,4 @@ public class ExecJobHostServiceImpl implements ExecJobHostService { return execJobHostDAO.deleteByJobIdList(jobIdList); } - @Override - public Integer deleteByHostId(Long hostId) { - return execJobHostDAO.deleteByHostId(hostId); - } - - @Override - public Integer deleteByHostIdList(List hostIdList) { - return execJobHostDAO.deleteByHostIdList(hostIdList); - } - } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecJobServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecJobServiceImpl.java similarity index 88% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecJobServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecJobServiceImpl.java index 61ac992d..e1c4f421 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecJobServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecJobServiceImpl.java @@ -20,7 +20,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; import cn.orionsec.kit.lang.define.wrapper.DataGrid; import cn.orionsec.kit.lang.utils.Booleans; @@ -38,27 +38,26 @@ import org.dromara.visor.common.utils.Valid; import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; import org.dromara.visor.framework.job.core.utils.QuartzUtils; import org.dromara.visor.framework.security.core.utils.SecurityUtils; -import org.dromara.visor.module.asset.convert.ExecJobConvert; -import org.dromara.visor.module.asset.convert.HostConvert; -import org.dromara.visor.module.asset.dao.ExecJobDAO; -import org.dromara.visor.module.asset.dao.ExecLogDAO; -import org.dromara.visor.module.asset.dao.HostDAO; -import org.dromara.visor.module.asset.entity.domain.ExecJobDO; -import org.dromara.visor.module.asset.entity.domain.ExecLogDO; -import org.dromara.visor.module.asset.entity.dto.ExecCommandExecDTO; -import org.dromara.visor.module.asset.entity.request.exec.*; -import org.dromara.visor.module.asset.entity.vo.ExecJobVO; -import org.dromara.visor.module.asset.entity.vo.ExecLogVO; -import org.dromara.visor.module.asset.entity.vo.HostBaseVO; -import org.dromara.visor.module.asset.enums.ExecJobStatusEnum; -import org.dromara.visor.module.asset.enums.ExecModeEnum; -import org.dromara.visor.module.asset.enums.ExecSourceEnum; +import org.dromara.visor.module.asset.api.AssetAuthorizedDataApi; +import org.dromara.visor.module.asset.api.HostApi; +import org.dromara.visor.module.asset.entity.dto.host.HostDTO; import org.dromara.visor.module.asset.enums.HostTypeEnum; -import org.dromara.visor.module.asset.handler.host.exec.job.ExecCommandJob; -import org.dromara.visor.module.asset.service.AssetAuthorizedDataService; -import org.dromara.visor.module.asset.service.ExecCommandService; -import org.dromara.visor.module.asset.service.ExecJobHostService; -import org.dromara.visor.module.asset.service.ExecJobService; +import org.dromara.visor.module.exec.convert.ExecJobConvert; +import org.dromara.visor.module.exec.dao.ExecJobDAO; +import org.dromara.visor.module.exec.dao.ExecLogDAO; +import org.dromara.visor.module.exec.entity.domain.ExecJobDO; +import org.dromara.visor.module.exec.entity.domain.ExecLogDO; +import org.dromara.visor.module.exec.entity.dto.ExecCommandExecDTO; +import org.dromara.visor.module.exec.entity.request.exec.*; +import org.dromara.visor.module.exec.entity.vo.ExecJobVO; +import org.dromara.visor.module.exec.entity.vo.ExecLogVO; +import org.dromara.visor.module.exec.enums.ExecJobStatusEnum; +import org.dromara.visor.module.exec.enums.ExecModeEnum; +import org.dromara.visor.module.exec.enums.ExecSourceEnum; +import org.dromara.visor.module.exec.handler.exec.job.ExecCommandJob; +import org.dromara.visor.module.exec.service.ExecCommandService; +import org.dromara.visor.module.exec.service.ExecJobHostService; +import org.dromara.visor.module.exec.service.ExecJobService; import org.dromara.visor.module.infra.api.SystemUserApi; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -91,7 +90,7 @@ public class ExecJobServiceImpl implements ExecJobService { private ExecLogDAO execLogDAO; @Resource - private HostDAO hostDAO; + private HostApi hostApi; @Resource private SystemUserApi systemUserApi; @@ -103,7 +102,7 @@ public class ExecJobServiceImpl implements ExecJobService { private ExecCommandService execCommandService; @Resource - private AssetAuthorizedDataService assetAuthorizedDataService; + private AssetAuthorizedDataApi assetAuthorizedDataApi; @Override @Transactional(rollbackFor = Exception.class) @@ -178,7 +177,7 @@ public class ExecJobServiceImpl implements ExecJobService { int effect = execJobDAO.updateById(update); // 设置日志参数 OperatorLogs.add(OperatorLogs.NAME, record.getName()); - OperatorLogs.add(OperatorLogs.STATUS_NAME, status.getStatusName()); + OperatorLogs.add(OperatorLogs.STATUS_NAME, status.getLabel()); // 设置 quartz 状态 this.setQuartzJobStatus(record, true, ExecJobStatusEnum.ENABLED.equals(status)); return effect; @@ -221,11 +220,8 @@ public class ExecJobServiceImpl implements ExecJobService { vo.setHostIdList(hostIdList); // 查询主机列表 if (!Lists.isEmpty(hostIdList)) { - List hosts = hostDAO.selectBatchIds(hostIdList) - .stream() - .map(HostConvert.MAPPER::toBase) - .collect(Collectors.toList()); - vo.setHostList(hosts); + List hosts = hostApi.selectByIdList(hostIdList); + vo.setHostList(Lists.map(hosts, HostDTO::toBase)); } else { vo.setHostList(Lists.empty()); } @@ -280,6 +276,16 @@ public class ExecJobServiceImpl implements ExecJobService { return dataGrid; } + @Override + public Long getExecJobCount(ExecJobQueryRequest request) { + // 条件 + LambdaQueryWrapper wrapper = this.buildQueryWrapper(request); + // 查询数量 + return execJobDAO.of() + .wrapper(wrapper) + .countMax(request.getLimit()); + } + @Override public Integer getNextExecSeq(Long id) { // 自增 @@ -382,6 +388,16 @@ public class ExecJobServiceImpl implements ExecJobService { execJobDAO.updateById(updateRecent); } + @Override + public LambdaQueryWrapper buildQueryWrapper(ExecJobQueryRequest request) { + return execJobDAO.wrapper() + .eq(ExecJobDO::getId, request.getId()) + .like(ExecJobDO::getName, request.getName()) + .like(ExecJobDO::getCommand, request.getCommand()) + .eq(ExecJobDO::getStatus, request.getStatus()) + .eq(ExecJobDO::getExecUserId, request.getExecUserId()); + } + /** * 检查对象是否存在 * @@ -399,21 +415,6 @@ public class ExecJobServiceImpl implements ExecJobService { Valid.isFalse(present, ErrorMessage.DATA_PRESENT); } - /** - * 构建查询 wrapper - * - * @param request request - * @return wrapper - */ - private LambdaQueryWrapper buildQueryWrapper(ExecJobQueryRequest request) { - return execJobDAO.wrapper() - .eq(ExecJobDO::getId, request.getId()) - .like(ExecJobDO::getName, request.getName()) - .like(ExecJobDO::getCommand, request.getCommand()) - .eq(ExecJobDO::getStatus, request.getStatus()) - .eq(ExecJobDO::getExecUserId, request.getExecUserId()); - } - /** * 设置 quartz 任务状态 * @@ -440,7 +441,7 @@ public class ExecJobServiceImpl implements ExecJobService { */ private void checkHostPermission(List hostIdList) { // 查询有权限的主机 - List authorizedHostIdList = assetAuthorizedDataService.getUserAuthorizedEnabledHostId(SecurityUtils.getLoginUserId(), HostTypeEnum.SSH.name()); + List authorizedHostIdList = assetAuthorizedDataApi.getUserAuthorizedEnabledHostId(SecurityUtils.getLoginUserId(), HostTypeEnum.SSH); for (Long hostId : hostIdList) { Valid.isTrue(authorizedHostIdList.contains(hostId), Strings.format(ErrorMessage.PLEASE_CHECK_HOST_SSH, hostId)); } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecLogServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecLogServiceImpl.java similarity index 92% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecLogServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecLogServiceImpl.java index c0749085..499332d2 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecLogServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecLogServiceImpl.java @@ -20,8 +20,38 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; +import org.dromara.visor.common.constant.Const; +import org.dromara.visor.common.constant.ErrorMessage; +import org.dromara.visor.common.constant.FileConst; +import org.dromara.visor.common.enums.EndpointDefine; +import org.dromara.visor.common.interfaces.FileClient; +import org.dromara.visor.common.utils.SqlUtils; +import org.dromara.visor.common.utils.Valid; +import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; +import org.dromara.visor.framework.redis.core.utils.RedisStrings; +import org.dromara.visor.framework.security.core.utils.SecurityUtils; +import org.dromara.visor.module.exec.convert.ExecHostLogConvert; +import org.dromara.visor.module.exec.convert.ExecLogConvert; +import org.dromara.visor.module.exec.dao.ExecHostLogDAO; +import org.dromara.visor.module.exec.dao.ExecLogDAO; +import org.dromara.visor.module.exec.define.cache.ExecCacheKeyDefine; +import org.dromara.visor.module.exec.entity.domain.ExecHostLogDO; +import org.dromara.visor.module.exec.entity.domain.ExecLogDO; +import org.dromara.visor.module.exec.entity.dto.ExecLogTailDTO; +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.ExecHostStatusEnum; +import org.dromara.visor.module.exec.enums.ExecStatusEnum; +import org.dromara.visor.module.exec.handler.exec.command.handler.IExecCommandHandler; +import org.dromara.visor.module.exec.handler.exec.command.handler.IExecTaskHandler; +import org.dromara.visor.module.exec.handler.exec.command.manager.ExecTaskManager; +import org.dromara.visor.module.exec.service.ExecHostLogService; +import org.dromara.visor.module.exec.service.ExecLogService; import cn.orionsec.kit.lang.annotation.Keep; import cn.orionsec.kit.lang.define.wrapper.DataGrid; import cn.orionsec.kit.lang.id.UUIds; @@ -35,36 +65,6 @@ import cn.orionsec.kit.web.servlet.web.Servlets; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.common.constant.Const; -import org.dromara.visor.common.constant.ErrorMessage; -import org.dromara.visor.common.constant.FileConst; -import org.dromara.visor.common.enums.EndpointDefine; -import org.dromara.visor.common.interfaces.FileClient; -import org.dromara.visor.common.utils.SqlUtils; -import org.dromara.visor.common.utils.Valid; -import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; -import org.dromara.visor.framework.redis.core.utils.RedisStrings; -import org.dromara.visor.framework.security.core.utils.SecurityUtils; -import org.dromara.visor.module.asset.convert.ExecHostLogConvert; -import org.dromara.visor.module.asset.convert.ExecLogConvert; -import org.dromara.visor.module.asset.dao.ExecHostLogDAO; -import org.dromara.visor.module.asset.dao.ExecLogDAO; -import org.dromara.visor.module.asset.define.cache.ExecCacheKeyDefine; -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.ExecLogTailDTO; -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.ExecHostStatusEnum; -import org.dromara.visor.module.asset.enums.ExecStatusEnum; -import org.dromara.visor.module.asset.handler.host.exec.command.handler.IExecCommandHandler; -import org.dromara.visor.module.asset.handler.host.exec.command.handler.IExecTaskHandler; -import org.dromara.visor.module.asset.handler.host.exec.command.manager.ExecTaskManager; -import org.dromara.visor.module.asset.service.ExecHostLogService; -import org.dromara.visor.module.asset.service.ExecLogService; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecStatisticsServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecStatisticsServiceImpl.java new file mode 100644 index 00000000..f876c57d --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecStatisticsServiceImpl.java @@ -0,0 +1,130 @@ +/* + * 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.service.impl; + +import cn.orionsec.kit.lang.utils.collect.Lists; +import cn.orionsec.kit.lang.utils.time.Dates; +import org.dromara.visor.common.entity.chart.LineSingleChartData; +import org.dromara.visor.common.enums.StatisticsRange; +import org.dromara.visor.framework.redis.core.utils.RedisStrings; +import org.dromara.visor.framework.security.core.utils.SecurityUtils; +import org.dromara.visor.module.exec.convert.ExecLogConvert; +import org.dromara.visor.module.exec.dao.ExecJobDAO; +import org.dromara.visor.module.exec.dao.ExecLogDAO; +import org.dromara.visor.module.exec.define.cache.ExecStatisticsCacheKeyDefine; +import org.dromara.visor.module.exec.entity.domain.ExecJobDO; +import org.dromara.visor.module.exec.entity.domain.ExecLogDO; +import org.dromara.visor.module.exec.entity.po.ExecLogCountPO; +import org.dromara.visor.module.exec.entity.vo.ExecLogVO; +import org.dromara.visor.module.exec.entity.vo.ExecWorkplaceStatisticsVO; +import org.dromara.visor.module.exec.enums.ExecSourceEnum; +import org.dromara.visor.module.exec.service.ExecStatisticsService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 执行模块统计服务实现 + * + * @author Jiahang Li + * @version 1.0.0 + * @since 2024/12/23 20:47 + */ +@Service +public class ExecStatisticsServiceImpl implements ExecStatisticsService { + + @Resource + private ExecJobDAO execJobDAO; + + @Resource + private ExecLogDAO execLogDAO; + + @Override + public ExecWorkplaceStatisticsVO getWorkplaceStatisticsData() { + Long userId = SecurityUtils.getLoginUserId(); + // 读取缓存 + String cacheKey = ExecStatisticsCacheKeyDefine.WORKPLACE_DATA.format(userId, Dates.current(Dates.YMD2)); + ExecWorkplaceStatisticsVO data = RedisStrings.getJson(cacheKey, ExecStatisticsCacheKeyDefine.WORKPLACE_DATA); + if (data == null) { + // 查询执行的计划任务数量 + int execJobCount = execJobDAO.of() + .createWrapper() + .eq(ExecJobDO::getExecUserId, userId) + .then() + .count() + .intValue(); + // 查询批量执行次数图表 + LineSingleChartData execLogCountChart = this.getUserExecLogCountChart(userId, ExecSourceEnum.BATCH); + List execLogCountData = execLogCountChart.getData(); + int execLogCount = execLogCountData.stream() + .mapToInt(Integer::intValue) + .sum(); + data = ExecWorkplaceStatisticsVO.builder() + .execJobCount(execJobCount) + .todayExecCommandCount(Lists.last(execLogCountData)) + .weekExecCommandCount(execLogCount) + .execCommandChart(execLogCountChart) + .build(); + // 设置缓存 + RedisStrings.setJson(cacheKey, ExecStatisticsCacheKeyDefine.WORKPLACE_DATA, data); + } + // 查询命令执行记录 + List execLogList = execLogDAO.of() + .createWrapper() + .eq(ExecLogDO::getUserId, userId) + .eq(ExecLogDO::getSource, ExecSourceEnum.BATCH.name()) + .orderByDesc(ExecLogDO::getId) + .then() + .limit(10) + .list(ExecLogConvert.MAPPER::to); + data.setExecLogList(execLogList); + return data; + } + + @Override + public LineSingleChartData getUserExecLogCountChart(Long userId, ExecSourceEnum source) { + Date endTime = new Date(); + Date startTime = Dates.stream() + .clearHms() + .addDay(-6) + .get(); + List rangeDays = StatisticsRange.WEEK.getDateRanges(startTime); + // 查询连接数量 + Map countMap = execLogDAO.selectExecLogCount(userId, source.name(), startTime, endTime) + .stream() + .collect(Collectors.toMap(ExecLogCountPO::getExecDate, ExecLogCountPO::getCount)); + // 构建每天的数据 + List data = rangeDays.stream() + .map(s -> countMap.getOrDefault(s, 0)) + .collect(Collectors.toList()); + return LineSingleChartData.builder() + .x(rangeDays) + .data(data) + .build(); + } + +} diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecTemplateHostServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecTemplateHostServiceImpl.java similarity index 81% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecTemplateHostServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecTemplateHostServiceImpl.java index 04349855..e622994c 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecTemplateHostServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecTemplateHostServiceImpl.java @@ -20,15 +20,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; +import org.dromara.visor.module.exec.dao.ExecTemplateHostDAO; +import org.dromara.visor.module.exec.entity.domain.ExecTemplateHostDO; +import org.dromara.visor.module.exec.service.ExecTemplateHostService; import cn.orionsec.kit.lang.function.Functions; import cn.orionsec.kit.lang.utils.collect.Lists; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.module.asset.dao.ExecTemplateHostDAO; -import org.dromara.visor.module.asset.entity.domain.ExecTemplateHostDO; -import org.dromara.visor.module.asset.service.ExecTemplateHostService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -135,24 +135,4 @@ public class ExecTemplateHostServiceImpl implements ExecTemplateHostService { return effect; } - @Override - public Integer deleteByHostId(Long hostId) { - LambdaQueryWrapper wrapper = execTemplateHostDAO.lambda() - .eq(ExecTemplateHostDO::getHostId, hostId); - log.info("ExecTemplateHostService-deleteByHostId id: {}", hostId); - int effect = execTemplateHostDAO.delete(wrapper); - log.info("ExecTemplateHostService-deleteByHostId effect: {}", effect); - return effect; - } - - @Override - public Integer deleteByHostIdList(List hostIdList) { - LambdaQueryWrapper wrapper = execTemplateHostDAO.lambda() - .in(ExecTemplateHostDO::getHostId, hostIdList); - log.info("ExecTemplateHostService-deleteByHostIdList id: {}", hostIdList); - int effect = execTemplateHostDAO.delete(wrapper); - log.info("ExecTemplateHostService-deleteByHostIdList effect: {}", effect); - return effect; - } - } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecTemplateServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecTemplateServiceImpl.java similarity index 83% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecTemplateServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecTemplateServiceImpl.java index ca37ab2d..f420bae2 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/ExecTemplateServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/ExecTemplateServiceImpl.java @@ -20,7 +20,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; import cn.orionsec.kit.lang.define.wrapper.DataGrid; import cn.orionsec.kit.lang.utils.collect.Lists; @@ -32,18 +32,17 @@ import org.dromara.visor.common.constant.ErrorMessage; import org.dromara.visor.common.utils.Valid; import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; import org.dromara.visor.framework.security.core.utils.SecurityUtils; -import org.dromara.visor.module.asset.convert.ExecTemplateConvert; -import org.dromara.visor.module.asset.dao.ExecTemplateDAO; -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.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.api.AssetAuthorizedDataApi; import org.dromara.visor.module.asset.enums.HostTypeEnum; -import org.dromara.visor.module.asset.enums.ScriptExecEnum; -import org.dromara.visor.module.asset.service.AssetAuthorizedDataService; -import org.dromara.visor.module.asset.service.ExecTemplateHostService; -import org.dromara.visor.module.asset.service.ExecTemplateService; +import org.dromara.visor.module.exec.convert.ExecTemplateConvert; +import org.dromara.visor.module.exec.dao.ExecTemplateDAO; +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.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.ExecTemplateHostService; +import org.dromara.visor.module.exec.service.ExecTemplateService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -70,12 +69,11 @@ public class ExecTemplateServiceImpl implements ExecTemplateService { private ExecTemplateHostService execTemplateHostService; @Resource - private AssetAuthorizedDataService assetAuthorizedDataService; + private AssetAuthorizedDataApi assetAuthorizedDataApi; @Override public Long createExecTemplate(ExecTemplateCreateRequest request) { log.info("ExecTemplateService-createExecTemplate request: {}", JSON.toJSONString(request)); - Valid.valid(ScriptExecEnum::of, request.getScriptExec()); // 转换 ExecTemplateDO record = ExecTemplateConvert.MAPPER.to(request); // 查询数据是否冲突 @@ -92,7 +90,6 @@ public class ExecTemplateServiceImpl implements ExecTemplateService { @Override public Integer updateExecTemplateById(ExecTemplateUpdateRequest request) { Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING); - Valid.valid(ScriptExecEnum::of, request.getScriptExec()); log.info("ExecTemplateService-updateExecTemplateById id: {}, request: {}", id, JSON.toJSONString(request)); // 查询 ExecTemplateDO record = execTemplateDAO.selectById(id); @@ -135,7 +132,7 @@ public class ExecTemplateServiceImpl implements ExecTemplateService { return template; } // 过滤认证的主机 - List authorizedHostIdList = assetAuthorizedDataService.getUserAuthorizedEnabledHostId(SecurityUtils.getLoginUserId(), HostTypeEnum.SSH.name()); + List authorizedHostIdList = assetAuthorizedDataApi.getUserAuthorizedEnabledHostId(SecurityUtils.getLoginUserId(), HostTypeEnum.SSH); hostIdList.removeIf(s -> !authorizedHostIdList.contains(s)); template.setHostIdList(hostIdList); return template; @@ -153,6 +150,16 @@ public class ExecTemplateServiceImpl implements ExecTemplateService { .dataGrid(ExecTemplateConvert.MAPPER::to); } + @Override + public Long getExecTemplateCount(ExecTemplateQueryRequest request) { + // 条件 + LambdaQueryWrapper wrapper = this.buildQueryWrapper(request); + // 查询模板 + return execTemplateDAO.of() + .wrapper(wrapper) + .countMax(request.getLimit()); + } + @Override @Transactional(rollbackFor = Exception.class) public Integer deleteExecTemplateById(Long id) { @@ -179,6 +186,14 @@ public class ExecTemplateServiceImpl implements ExecTemplateService { return effect; } + @Override + public LambdaQueryWrapper buildQueryWrapper(ExecTemplateQueryRequest request) { + return execTemplateDAO.wrapper() + .eq(ExecTemplateDO::getId, request.getId()) + .like(ExecTemplateDO::getName, request.getName()) + .like(ExecTemplateDO::getCommand, request.getCommand()); + } + /** * 检查对象是否存在 * @@ -196,17 +211,4 @@ public class ExecTemplateServiceImpl implements ExecTemplateService { Valid.isFalse(present, ErrorMessage.DATA_PRESENT); } - /** - * 构建查询 wrapper - * - * @param request request - * @return wrapper - */ - private LambdaQueryWrapper buildQueryWrapper(ExecTemplateQueryRequest request) { - return execTemplateDAO.wrapper() - .eq(ExecTemplateDO::getId, request.getId()) - .like(ExecTemplateDO::getName, request.getName()) - .like(ExecTemplateDO::getCommand, request.getCommand()); - } - } diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/UploadTaskFileServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/UploadTaskFileServiceImpl.java similarity index 86% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/UploadTaskFileServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/UploadTaskFileServiceImpl.java index 2a89e176..3ef8872b 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/UploadTaskFileServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/UploadTaskFileServiceImpl.java @@ -20,15 +20,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; +import org.dromara.visor.module.exec.convert.UploadTaskFileConvert; +import org.dromara.visor.module.exec.dao.UploadTaskFileDAO; +import org.dromara.visor.module.exec.entity.domain.UploadTaskFileDO; +import org.dromara.visor.module.exec.entity.vo.UploadTaskFileVO; +import org.dromara.visor.module.exec.service.UploadTaskFileService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.module.asset.convert.UploadTaskFileConvert; -import org.dromara.visor.module.asset.dao.UploadTaskFileDAO; -import org.dromara.visor.module.asset.entity.domain.UploadTaskFileDO; -import org.dromara.visor.module.asset.entity.vo.UploadTaskFileVO; -import org.dromara.visor.module.asset.service.UploadTaskFileService; import org.springframework.stereotype.Service; import javax.annotation.Resource; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/UploadTaskServiceImpl.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/UploadTaskServiceImpl.java similarity index 89% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/UploadTaskServiceImpl.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/UploadTaskServiceImpl.java index 5b461152..26e1531a 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/UploadTaskServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/service/impl/UploadTaskServiceImpl.java @@ -20,14 +20,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.service.impl; +package org.dromara.visor.module.exec.service.impl; import cn.orionsec.kit.lang.annotation.Keep; import cn.orionsec.kit.lang.define.wrapper.DataGrid; -import cn.orionsec.kit.lang.utils.Arrays1; -import cn.orionsec.kit.lang.utils.Booleans; -import cn.orionsec.kit.lang.utils.Strings; -import cn.orionsec.kit.lang.utils.Threads; +import cn.orionsec.kit.lang.utils.*; import cn.orionsec.kit.lang.utils.collect.Lists; import cn.orionsec.kit.lang.utils.collect.Maps; import cn.orionsec.kit.lang.utils.io.Files1; @@ -41,34 +38,32 @@ import org.dromara.visor.common.enums.EndpointDefine; import org.dromara.visor.common.interfaces.FileClient; import org.dromara.visor.common.security.LoginUser; import org.dromara.visor.common.utils.SqlUtils; -import org.dromara.visor.common.utils.Valid; import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs; import org.dromara.visor.framework.mybatis.core.query.Conditions; import org.dromara.visor.framework.security.core.utils.SecurityUtils; -import org.dromara.visor.module.asset.convert.HostConvert; -import org.dromara.visor.module.asset.convert.UploadTaskConvert; -import org.dromara.visor.module.asset.convert.UploadTaskFileConvert; -import org.dromara.visor.module.asset.dao.HostDAO; -import org.dromara.visor.module.asset.dao.UploadTaskDAO; -import org.dromara.visor.module.asset.dao.UploadTaskFileDAO; -import org.dromara.visor.module.asset.entity.domain.HostDO; -import org.dromara.visor.module.asset.entity.domain.UploadTaskDO; -import org.dromara.visor.module.asset.entity.domain.UploadTaskFileDO; -import org.dromara.visor.module.asset.entity.dto.UploadTaskExtraDTO; -import org.dromara.visor.module.asset.entity.request.upload.*; -import org.dromara.visor.module.asset.entity.vo.*; +import org.dromara.visor.module.asset.api.AssetAuthorizedDataApi; +import org.dromara.visor.module.asset.api.HostApi; +import org.dromara.visor.module.asset.entity.dto.host.HostDTO; import org.dromara.visor.module.asset.enums.HostStatusEnum; import org.dromara.visor.module.asset.enums.HostTypeEnum; -import org.dromara.visor.module.asset.enums.UploadTaskFileStatusEnum; -import org.dromara.visor.module.asset.enums.UploadTaskStatusEnum; -import org.dromara.visor.module.asset.handler.host.upload.FileUploadTasks; -import org.dromara.visor.module.asset.handler.host.upload.manager.FileUploadTaskManager; -import org.dromara.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO; -import org.dromara.visor.module.asset.handler.host.upload.task.IFileUploadTask; -import org.dromara.visor.module.asset.handler.host.upload.uploader.IFileUploader; -import org.dromara.visor.module.asset.service.AssetAuthorizedDataService; -import org.dromara.visor.module.asset.service.UploadTaskFileService; -import org.dromara.visor.module.asset.service.UploadTaskService; +import org.dromara.visor.module.exec.convert.UploadTaskConvert; +import org.dromara.visor.module.exec.convert.UploadTaskFileConvert; +import org.dromara.visor.module.exec.dao.UploadTaskDAO; +import org.dromara.visor.module.exec.dao.UploadTaskFileDAO; +import org.dromara.visor.module.exec.entity.domain.UploadTaskDO; +import org.dromara.visor.module.exec.entity.domain.UploadTaskFileDO; +import org.dromara.visor.module.exec.entity.dto.UploadTaskExtraDTO; +import org.dromara.visor.module.exec.entity.request.upload.*; +import org.dromara.visor.module.exec.entity.vo.*; +import org.dromara.visor.module.exec.enums.UploadTaskFileStatusEnum; +import org.dromara.visor.module.exec.enums.UploadTaskStatusEnum; +import org.dromara.visor.module.exec.handler.upload.FileUploadTasks; +import org.dromara.visor.module.exec.handler.upload.manager.FileUploadTaskManager; +import org.dromara.visor.module.exec.handler.upload.model.FileUploadFileItemDTO; +import org.dromara.visor.module.exec.handler.upload.task.IFileUploadTask; +import org.dromara.visor.module.exec.handler.upload.uploader.IFileUploader; +import org.dromara.visor.module.exec.service.UploadTaskFileService; +import org.dromara.visor.module.exec.service.UploadTaskService; import org.dromara.visor.module.infra.api.FileUploadApi; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -95,24 +90,24 @@ public class UploadTaskServiceImpl implements UploadTaskService { @Resource private UploadTaskDAO uploadTaskDAO; - @Resource - private HostDAO hostDAO; - @Resource private UploadTaskFileDAO uploadTaskFileDAO; @Resource private UploadTaskFileService uploadTaskFileService; + @Keep @Resource - private AssetAuthorizedDataService assetAuthorizedDataService; + private FileClient localFileClient; @Resource private FileUploadTaskManager fileUploadTaskManager; - @Keep @Resource - private FileClient localFileClient; + private HostApi hostApi; + + @Resource + private AssetAuthorizedDataApi assetAuthorizedDataApi; @Resource private FileUploadApi fileUploadApi; @@ -127,7 +122,7 @@ public class UploadTaskServiceImpl implements UploadTaskService { // 检查主机是否有权限 this.checkHostPermission(hostIdList); // 查询主机信息 - List hosts = this.getUploadTaskHosts(hostIdList); + List hosts = this.getUploadTaskHosts(hostIdList); // 转换 UploadTaskDO record = UploadTaskConvert.MAPPER.to(request); record.setUserId(user.getId()); @@ -138,7 +133,7 @@ public class UploadTaskServiceImpl implements UploadTaskService { record.setHostCount(hostIdList.size()); UploadTaskExtraDTO extra = UploadTaskExtraDTO.builder() .hostIdList(hostIdList) - .hosts(HostConvert.MAPPER.toBaseList(hosts)) + .hosts(Lists.map(hosts, HostDTO::toBase)) .build(); record.setExtraInfo(JSON.toJSONString(extra)); // 插入任务表 @@ -359,7 +354,7 @@ public class UploadTaskServiceImpl implements UploadTaskService { */ private void checkHostPermission(List hostIdList) { // 查询有权限的主机 - List authorizedHostIdList = assetAuthorizedDataService.getUserAuthorizedEnabledHostId(SecurityUtils.getLoginUserId(), HostTypeEnum.SSH.name()); + List authorizedHostIdList = assetAuthorizedDataApi.getUserAuthorizedEnabledHostId(SecurityUtils.getLoginUserId(), HostTypeEnum.SSH); for (Long hostId : hostIdList) { Valid.isTrue(authorizedHostIdList.contains(hostId), Strings.format(ErrorMessage.PLEASE_CHECK_HOST_SSH, hostId)); } @@ -371,14 +366,14 @@ public class UploadTaskServiceImpl implements UploadTaskService { * @param hostIdList hostIdList * @return hosts */ - public List getUploadTaskHosts(List hostIdList) { + public List getUploadTaskHosts(List hostIdList) { // 查询主机信息 - List hosts = hostDAO.selectBatchIds(hostIdList); + List hosts = hostApi.selectByIdList(hostIdList); // 检查主机数量 Valid.eq(hosts.size(), hostIdList.size(), ErrorMessage.HOST_ABSENT); // 检查主机状态 boolean allEnabled = hosts.stream() - .map(HostDO::getStatus) + .map(HostDTO::getStatus) .allMatch(s -> HostStatusEnum.ENABLED.name().equals(s)); Valid.isTrue(allEnabled, ErrorMessage.HOST_NOT_ENABLED); return hosts; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/task/ExecLogFileAutoClearTask.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/task/ExecLogFileAutoClearTask.java similarity index 90% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/task/ExecLogFileAutoClearTask.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/task/ExecLogFileAutoClearTask.java index 22cdf761..ac5426d0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/task/ExecLogFileAutoClearTask.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/task/ExecLogFileAutoClearTask.java @@ -20,17 +20,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.task; +package org.dromara.visor.module.exec.task; +import org.dromara.visor.common.constant.Const; +import org.dromara.visor.common.utils.LockerUtils; +import org.dromara.visor.module.common.config.AppAutoClearConfig; +import org.dromara.visor.module.exec.entity.request.exec.ExecLogClearRequest; +import org.dromara.visor.module.exec.enums.ExecStatusEnum; +import org.dromara.visor.module.exec.service.ExecLogService; import cn.orionsec.kit.lang.utils.Booleans; import cn.orionsec.kit.lang.utils.time.Dates; import lombok.extern.slf4j.Slf4j; -import org.dromara.visor.common.constant.Const; -import org.dromara.visor.common.utils.LockerUtils; -import org.dromara.visor.module.asset.define.config.AppAutoClearConfig; -import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest; -import org.dromara.visor.module.asset.enums.ExecStatusEnum; -import org.dromara.visor.module.asset.service.ExecLogService; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/utils/ExecUtils.java b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/utils/ExecUtils.java similarity index 96% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/utils/ExecUtils.java rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/utils/ExecUtils.java index a84becd9..05cb7ef4 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/utils/ExecUtils.java +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/java/org/dromara/visor/module/exec/utils/ExecUtils.java @@ -20,8 +20,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.asset.utils; +package org.dromara.visor.module.exec.utils; +import org.dromara.visor.common.constant.Const; +import org.dromara.visor.module.exec.entity.dto.ExecParameterSchemaDTO; import cn.orionsec.kit.lang.function.Functions; import cn.orionsec.kit.lang.utils.Strings; import cn.orionsec.kit.lang.utils.collect.Lists; @@ -30,8 +32,6 @@ import cn.orionsec.kit.lang.utils.json.matcher.NoMatchStrategy; import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatter; import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatters; import com.alibaba.fastjson.JSON; -import org.dromara.visor.common.constant.Const; -import org.dromara.visor.module.asset.entity.dto.ExecParameterSchemaDTO; import java.util.List; import java.util.Map; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecHostLogMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecHostLogMapper.xml similarity index 68% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecHostLogMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecHostLogMapper.xml index 22b5bb30..c9c7b691 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecHostLogMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecHostLogMapper.xml @@ -1,9 +1,9 @@ - + - + @@ -25,9 +25,26 @@ + + + + + + id, log_id, host_id, host_name, host_address, status, command, parameter, exit_code, log_path, script_path, error_message, start_time, finish_time, create_time, update_time, creator, updater, deleted + + diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecJobHostMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecJobHostMapper.xml similarity index 88% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecJobHostMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecJobHostMapper.xml index 371eadf5..b490d8f9 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecJobHostMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecJobHostMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecJobMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecJobMapper.xml similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecJobMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecJobMapper.xml index dc415613..9b753df8 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecJobMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecJobMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecLogMapper.xml similarity index 94% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecLogMapper.xml index fe2074ca..bad98585 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecLogMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecLogMapper.xml @@ -1,9 +1,9 @@ - + - + @@ -27,7 +27,7 @@ - + @@ -42,7 +42,7 @@ FROM exec_log e RIGHT JOIN ( - SELECT MAX(id) AS max_id + SELECT MAX(id) max_id FROM exec_log WHERE deleted = 0 AND source = #{source} diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecTemplateHostMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecTemplateHostMapper.xml similarity index 88% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecTemplateHostMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecTemplateHostMapper.xml index b0b64f00..8c7a8976 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecTemplateHostMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecTemplateHostMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecTemplateMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecTemplateMapper.xml similarity index 90% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecTemplateMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecTemplateMapper.xml index a18fb081..0b892579 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/ExecTemplateMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/ExecTemplateMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/UploadTaskFileMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/UploadTaskFileMapper.xml similarity index 92% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/UploadTaskFileMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/UploadTaskFileMapper.xml index 37ac2c1f..bce95721 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/UploadTaskFileMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/UploadTaskFileMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/UploadTaskMapper.xml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/UploadTaskMapper.xml similarity index 93% rename from orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/UploadTaskMapper.xml rename to orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/UploadTaskMapper.xml index 89c45d2e..a82b31c0 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/resources/mapper/UploadTaskMapper.xml +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/main/resources/mapper/UploadTaskMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/java/org/dromara/visor/module/exec/api/impl/.gitkeep b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/java/org/dromara/visor/module/exec/api/impl/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/java/org/dromara/visor/module/exec/service/impl/.gitkeep b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/java/org/dromara/visor/module/exec/service/impl/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/resources/application-unit-test.yaml b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/resources/application-unit-test.yaml new file mode 100644 index 00000000..f349f31e --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/resources/application-unit-test.yaml @@ -0,0 +1,30 @@ +spring: + main: + lazy-initialization: true + banner-mode: OFF + datasource: + druid: + name: orion_visor + url: jdbc:h2:mem:memdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; + driver-class-name: org.h2.Driver + username: sa + password: + max-active: 1 + async-init: true + initial-size: 1 + test-while-idle: false + sql: + init: + schema-locations: + - classpath:/sql/create-table-h2-*.sql + redis: + host: 127.0.0.1 + port: 16379 + database: 0 + redisson: + threads: 2 + netty-threads: 2 + minimum-idle-size: 2 + +mybatis-plus: + lazy-initialization: true diff --git a/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/resources/sql/.gitkeep b/orion-visor-modules/orion-visor-module-exec/orion-visor-module-exec-service/src/test/resources/sql/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/orion-visor-modules/orion-visor-module-exec/pom.xml b/orion-visor-modules/orion-visor-module-exec/pom.xml new file mode 100644 index 00000000..9a6a0dfd --- /dev/null +++ b/orion-visor-modules/orion-visor-module-exec/pom.xml @@ -0,0 +1,22 @@ + + + + org.dromara.visor + orion-visor-modules + ${revision} + + + 4.0.0 + orion-visor-module-exec + pom + + 项目执行模块 + https://github.com/dromara/orion-visor + + + orion-visor-module-exec-provider + orion-visor-module-exec-service + + \ No newline at end of file