| @@ -35,25 +35,22 @@ public class ComponentController { | |||||
| */ | */ | ||||
| @GetMapping | @GetMapping | ||||
| @ApiOperation("分页查询") | @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 查询结果 | * @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 | @PostMapping | ||||
| @ApiOperation("添加组件") | @ApiOperation("添加组件") | ||||
| public AjaxResult add(@RequestBody ComponentVo component) { | 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 | @PutMapping | ||||
| @ApiOperation("编辑组件") | @ApiOperation("编辑组件") | ||||
| public AjaxResult edit(@RequestBody ComponentVo component) { | 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}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("根据id删除组件") | @ApiOperation("根据id删除组件") | ||||
| public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception { | public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception { | ||||
| return AjaxResult.success(this.componentService.removeById(id)); | |||||
| return AjaxResult.success(this.componentService.removeById(id)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -40,7 +40,7 @@ public class WorkflowController extends BaseController { | |||||
| */ | */ | ||||
| @GetMapping | @GetMapping | ||||
| @ApiOperation("分页查询") | @ApiOperation("分页查询") | ||||
| public GenericsAjaxResult<Page<Workflow>> queryByPage(Workflow workflow, int page, int size) { | |||||
| public GenericsAjaxResult<Page<WorkflowVo>> queryByPage(Workflow workflow, int page, int size) throws IOException { | |||||
| PageRequest pageRequest = PageRequest.of(page, size); | PageRequest pageRequest = PageRequest.of(page, size); | ||||
| return genericsSuccess(this.workflowService.queryByPage(workflow, pageRequest)); | return genericsSuccess(this.workflowService.queryByPage(workflow, pageRequest)); | ||||
| } | } | ||||
| @@ -32,7 +32,7 @@ public interface WorkflowService { | |||||
| * @param pageRequest 分页对象 | * @param pageRequest 分页对象 | ||||
| * @return 查询结果 | * @return 查询结果 | ||||
| */ | */ | ||||
| Page<Workflow> queryByPage(Workflow workflow, PageRequest pageRequest); | |||||
| Page<WorkflowVo> queryByPage(Workflow workflow, PageRequest pageRequest) throws IOException; | |||||
| /** | /** | ||||
| * 新增数据 | * 新增数据 | ||||
| @@ -7,6 +7,7 @@ import com.ruoyi.platform.domain.Component; | |||||
| import com.ruoyi.platform.service.ComponentService; | import com.ruoyi.platform.service.ComponentService; | ||||
| import com.ruoyi.platform.mapper.ComponentDao; | import com.ruoyi.platform.mapper.ComponentDao; | ||||
| import com.ruoyi.platform.utils.ConvertUtil; | import com.ruoyi.platform.utils.ConvertUtil; | ||||
| import com.ruoyi.platform.utils.JacksonUtil; | |||||
| import com.ruoyi.platform.utils.JsonUtils; | import com.ruoyi.platform.utils.JsonUtils; | ||||
| import com.ruoyi.platform.vo.ComponentVo; | import com.ruoyi.platform.vo.ComponentVo; | ||||
| import com.ruoyi.system.api.constant.Constant; | import com.ruoyi.system.api.constant.Constant; | ||||
| @@ -151,6 +152,19 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| component.setEnvVirables(envVariable); | component.setEnvVirables(envVariable); | ||||
| component.setInParameters(inParameters); | component.setInParameters(inParameters); | ||||
| component.setOutParameters(outParameters); | component.setOutParameters(outParameters); | ||||
| Map<String, Object> taskInfo = componentVo.getTaskInfo(); | |||||
| Map<String, Object> image = (Map<String, Object>) taskInfo.get("image"); | |||||
| Map<String, Object> workingDirectory = (Map<String, Object>) taskInfo.get("working_directory"); | |||||
| Map<String, Object> command = (Map<String, Object>) taskInfo.get("command"); | |||||
| Map<String, Object> runArgs = (Map<String, Object>) taskInfo.get("run_args"); | |||||
| Map<String, Object> resourcesStandard = (Map<String, Object>) 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(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| component.setCreateBy(loginUser.getUsername()); | component.setCreateBy(loginUser.getUsername()); | ||||
| component.setUpdateBy(loginUser.getUsername()); | component.setUpdateBy(loginUser.getUsername()); | ||||
| @@ -195,6 +209,19 @@ public class ComponentServiceImpl implements ComponentService { | |||||
| component.setEnvVirables(envVariable); | component.setEnvVirables(envVariable); | ||||
| component.setInParameters(inParameters); | component.setInParameters(inParameters); | ||||
| component.setOutParameters(outParameters); | component.setOutParameters(outParameters); | ||||
| Map<String, Object> taskInfo = componentVo.getTaskInfo(); | |||||
| Map<String, Object> image = (Map<String, Object>) taskInfo.get("image"); | |||||
| Map<String, Object> workingDirectory = (Map<String, Object>) taskInfo.get("working_directory"); | |||||
| Map<String, Object> command = (Map<String, Object>) taskInfo.get("command"); | |||||
| Map<String, Object> runArgs = (Map<String, Object>) taskInfo.get("run_args"); | |||||
| Map<String, Object> resourcesStandard = (Map<String, Object>) 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(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| component.setUpdateBy(loginUser.getUsername()); | component.setUpdateBy(loginUser.getUsername()); | ||||
| component.setUpdateTime(new Date()); | component.setUpdateTime(new Date()); | ||||
| @@ -96,9 +96,20 @@ public class WorkflowServiceImpl implements WorkflowService { | |||||
| * @return 查询结果 | * @return 查询结果 | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| public Page<Workflow> queryByPage(Workflow workflow, PageRequest pageRequest) { | |||||
| public Page<WorkflowVo> queryByPage(Workflow workflow, PageRequest pageRequest) throws IOException { | |||||
| long total = this.workflowDao.count(workflow); | long total = this.workflowDao.count(workflow); | ||||
| return new PageImpl<>(this.workflowDao.queryAllByLimit(workflow, pageRequest), pageRequest, total); | |||||
| List<Workflow> workflows = this.workflowDao.queryAllByLimit(workflow, pageRequest); | |||||
| List<WorkflowVo> 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); | |||||
| } | } | ||||
| /** | /** | ||||