diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java index 937bd7c9..000101af 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java @@ -35,25 +35,22 @@ public class ComponentController { */ @GetMapping @ApiOperation("分页查询") - public AjaxResult queryByPage( Component component, int page, int size) { - PageRequest pageRequest = PageRequest.of(page,size); - return AjaxResult.success(this.componentService.queryByPage(component, pageRequest)); + public AjaxResult queryByPage(Component component, int page, int size) { + PageRequest pageRequest = PageRequest.of(page, size); + return AjaxResult.success(this.componentService.queryByPage(component, pageRequest)); } /** * 查询全部 * - * - * * @return 查询结果 */ - @GetMapping("/components/all") - @ApiOperation("查询全部") - public AjaxResult queryAll() throws Exception { - return AjaxResult.success(this.componentService.queryAllGroupedByCategory()); - } - + @GetMapping("/components/all") + @ApiOperation("查询全部") + public AjaxResult queryAll() throws Exception { + return AjaxResult.success(this.componentService.queryAllGroupedByCategory()); + } /** @@ -77,7 +74,7 @@ public class ComponentController { @PostMapping @ApiOperation("添加组件") public AjaxResult add(@RequestBody ComponentVo component) { - return AjaxResult.success(this.componentService.insert(component)); + return AjaxResult.success(this.componentService.insert(component)); } /** @@ -89,7 +86,7 @@ public class ComponentController { @PutMapping @ApiOperation("编辑组件") public AjaxResult edit(@RequestBody ComponentVo component) { - return AjaxResult.success(this.componentService.update(component)); + return AjaxResult.success(this.componentService.update(component)); } /** @@ -101,7 +98,7 @@ public class ComponentController { @DeleteMapping("{id}") @ApiOperation("根据id删除组件") public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception { - return AjaxResult.success(this.componentService.removeById(id)); + return AjaxResult.success(this.componentService.removeById(id)); } } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java index a0ee3427..463fc4ee 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java @@ -40,7 +40,7 @@ public class WorkflowController extends BaseController { */ @GetMapping @ApiOperation("分页查询") - public GenericsAjaxResult> queryByPage(Workflow workflow, int page, int size) { + public GenericsAjaxResult> queryByPage(Workflow workflow, int page, int size) throws IOException { PageRequest pageRequest = PageRequest.of(page, size); return genericsSuccess(this.workflowService.queryByPage(workflow, pageRequest)); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java index 856990e3..44b1f42c 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java @@ -32,7 +32,7 @@ public interface WorkflowService { * @param pageRequest 分页对象 * @return 查询结果 */ - Page queryByPage(Workflow workflow, PageRequest pageRequest); + Page queryByPage(Workflow workflow, PageRequest pageRequest) throws IOException; /** * 新增数据 diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java index e07632f5..9830fe15 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.platform.domain.Component; import com.ruoyi.platform.service.ComponentService; import com.ruoyi.platform.mapper.ComponentDao; import com.ruoyi.platform.utils.ConvertUtil; +import com.ruoyi.platform.utils.JacksonUtil; import com.ruoyi.platform.utils.JsonUtils; import com.ruoyi.platform.vo.ComponentVo; import com.ruoyi.system.api.constant.Constant; @@ -151,6 +152,19 @@ public class ComponentServiceImpl implements ComponentService { component.setEnvVirables(envVariable); component.setInParameters(inParameters); component.setOutParameters(outParameters); + + Map taskInfo = componentVo.getTaskInfo(); + Map image = (Map) taskInfo.get("image"); + Map workingDirectory = (Map) taskInfo.get("working_directory"); + Map command = (Map) taskInfo.get("command"); + Map runArgs = (Map) taskInfo.get("run_args"); + Map resourcesStandard = (Map) taskInfo.get("resources_standard"); + component.setImage(JacksonUtil.toJSONString(image)); + component.setWorkingDirectory(JacksonUtil.toJSONString(workingDirectory)); + component.setCommand(JacksonUtil.toJSONString(command)); + component.setRunArgs(JacksonUtil.toJSONString(runArgs)); + component.setResourcesStandard(JacksonUtil.toJSONString(resourcesStandard)); + LoginUser loginUser = SecurityUtils.getLoginUser(); component.setCreateBy(loginUser.getUsername()); component.setUpdateBy(loginUser.getUsername()); @@ -195,6 +209,19 @@ public class ComponentServiceImpl implements ComponentService { component.setEnvVirables(envVariable); component.setInParameters(inParameters); component.setOutParameters(outParameters); + + Map taskInfo = componentVo.getTaskInfo(); + Map image = (Map) taskInfo.get("image"); + Map workingDirectory = (Map) taskInfo.get("working_directory"); + Map command = (Map) taskInfo.get("command"); + Map runArgs = (Map) taskInfo.get("run_args"); + Map resourcesStandard = (Map) taskInfo.get("resources_standard"); + component.setImage(JacksonUtil.toJSONString(image)); + component.setWorkingDirectory(JacksonUtil.toJSONString(workingDirectory)); + component.setCommand(JacksonUtil.toJSONString(command)); + component.setRunArgs(JacksonUtil.toJSONString(runArgs)); + component.setResourcesStandard(JacksonUtil.toJSONString(resourcesStandard)); + LoginUser loginUser = SecurityUtils.getLoginUser(); component.setUpdateBy(loginUser.getUsername()); component.setUpdateTime(new Date()); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java index eeae51cc..96e3577c 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java @@ -96,9 +96,20 @@ public class WorkflowServiceImpl implements WorkflowService { * @return 查询结果 */ @Override - public Page queryByPage(Workflow workflow, PageRequest pageRequest) { + public Page queryByPage(Workflow workflow, PageRequest pageRequest) throws IOException { long total = this.workflowDao.count(workflow); - return new PageImpl<>(this.workflowDao.queryAllByLimit(workflow, pageRequest), pageRequest, total); + List workflows = this.workflowDao.queryAllByLimit(workflow, pageRequest); + List WorkflowVos = new ArrayList<>(); + for (Workflow workflow1 : workflows) { + WorkflowVo workflowVo = new WorkflowVo(); + BeanUtils.copyProperties(workflow1, workflowVo); + workflowVo.setGlobalParam(JacksonUtil.parseJSONStr2MapList(workflow1.getGlobalParam())); + if (StringUtils.isNotEmpty(workflow.getDag())) { + workflowVo.setDag(JsonUtils.jsonToMap(workflow.getDag())); + } + WorkflowVos.add(workflowVo); + } + return new PageImpl<>(WorkflowVos, pageRequest, total); } /**