| | |
| | | package cn.iocoder.yudao.module.bpm.controller.admin.definition; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO; |
| | |
| | | import org.flowable.common.engine.impl.db.SuspensionState; |
| | | import org.flowable.engine.repository.Deployment; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得流程定义分页") |
| | | @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')") |
| | | public CommonResult<PageResult<BpmProcessDefinitionRespVO>> getProcessDefinitionPage( |
| | | BpmProcessDefinitionPageReqVO pageReqVO) { |
| | | PageResult<ProcessDefinition> pageResult = processDefinitionService.getProcessDefinitionPage(pageReqVO); |
| | |
| | | public CommonResult<BpmProcessDefinitionRespVO> getProcessDefinition( |
| | | @RequestParam(value = "id", required = false) String id, |
| | | @RequestParam(value = "key", required = false) String key) { |
| | | ProcessDefinition processDefinition = id != null ? processDefinitionService.getProcessDefinition(id) |
| | | // id 与 key 都为空时直接返回 null:否则会调用 getActiveProcessDefinition(null), |
| | | // 由 Flowable 抛 "key is null" 的 IllegalArgumentException 变成 500 |
| | | if (StrUtil.isBlank(id) && StrUtil.isBlank(key)) { |
| | | return success(null); |
| | | } |
| | | ProcessDefinition processDefinition = StrUtil.isNotBlank(id) |
| | | ? processDefinitionService.getProcessDefinition(id) |
| | | : processDefinitionService.getActiveProcessDefinition(key); |
| | | if (processDefinition == null) { |
| | | return success(null); |