Commit 84bf1c3b904f19658e7984ec018dff02e187fde0
1 parent
2bc25223
【功能调整】工作流:工作流程的流转记录,不区分父子任务
Showing
2 changed files
with
8 additions
and
29 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmTaskController.java
| ... | ... | @@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; |
| 8 | 8 | import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert; |
| 9 | 9 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; |
| 10 | 10 | import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService; |
| 11 | -import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; | |
| 12 | 11 | import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; |
| 13 | 12 | import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService; |
| 14 | 13 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| ... | ... | @@ -20,7 +19,6 @@ import io.swagger.v3.oas.annotations.Parameter; |
| 20 | 19 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 21 | 20 | import jakarta.annotation.Resource; |
| 22 | 21 | import jakarta.validation.Valid; |
| 23 | -import org.flowable.bpmn.model.BpmnModel; | |
| 24 | 22 | import org.flowable.bpmn.model.UserTask; |
| 25 | 23 | import org.flowable.engine.history.HistoricProcessInstance; |
| 26 | 24 | import org.flowable.engine.runtime.ProcessInstance; |
| ... | ... | @@ -30,7 +28,10 @@ import org.springframework.security.access.prepost.PreAuthorize; |
| 30 | 28 | import org.springframework.validation.annotation.Validated; |
| 31 | 29 | import org.springframework.web.bind.annotation.*; |
| 32 | 30 | |
| 33 | -import java.util.*; | |
| 31 | +import java.util.Collections; | |
| 32 | +import java.util.List; | |
| 33 | +import java.util.Map; | |
| 34 | +import java.util.Set; | |
| 34 | 35 | import java.util.stream.Stream; |
| 35 | 36 | |
| 36 | 37 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| ... | ... | @@ -49,8 +50,6 @@ public class BpmTaskController { |
| 49 | 50 | private BpmProcessInstanceService processInstanceService; |
| 50 | 51 | @Resource |
| 51 | 52 | private BpmFormService formService; |
| 52 | - @Resource | |
| 53 | - private BpmProcessDefinitionService bpmProcessDefinitionService; | |
| 54 | 53 | |
| 55 | 54 | @Resource |
| 56 | 55 | private AdminUserApi adminUserApi; |
| ... | ... | @@ -135,10 +134,8 @@ public class BpmTaskController { |
| 135 | 134 | // 获得 Form Map |
| 136 | 135 | Map<Long, BpmFormDO> formMap = formService.getFormMap( |
| 137 | 136 | convertSet(taskList, task -> NumberUtils.parseLong(task.getFormKey()))); |
| 138 | - // 获得 BpmnModel | |
| 139 | - BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(processInstance.getProcessDefinitionId()); | |
| 140 | 137 | return success(BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList, processInstance, |
| 141 | - formMap, userMap, deptMap, bpmnModel)); | |
| 138 | + formMap, userMap, deptMap)); | |
| 142 | 139 | } |
| 143 | 140 | |
| 144 | 141 | @PutMapping("/approve") | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java
| ... | ... | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.convert.task; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | -import cn.hutool.core.util.StrUtil; | |
| 6 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 8 | 7 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| ... | ... | @@ -10,13 +9,10 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 10 | 9 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO; |
| 11 | 10 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO; |
| 12 | 11 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; |
| 13 | -import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; | |
| 14 | -import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; | |
| 15 | 12 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; |
| 16 | 13 | import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; |
| 17 | 14 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| 18 | 15 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 19 | -import org.flowable.bpmn.model.BpmnModel; | |
| 20 | 16 | import org.flowable.engine.history.HistoricProcessInstance; |
| 21 | 17 | import org.flowable.engine.runtime.ProcessInstance; |
| 22 | 18 | import org.flowable.task.api.Task; |
| ... | ... | @@ -29,7 +25,7 @@ import java.util.Date; |
| 29 | 25 | import java.util.List; |
| 30 | 26 | import java.util.Map; |
| 31 | 27 | |
| 32 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | |
| 28 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 33 | 29 | import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; |
| 34 | 30 | |
| 35 | 31 | /** |
| ... | ... | @@ -85,9 +81,8 @@ public interface BpmTaskConvert { |
| 85 | 81 | HistoricProcessInstance processInstance, |
| 86 | 82 | Map<Long, BpmFormDO> formMap, |
| 87 | 83 | Map<Long, AdminUserRespDTO> userMap, |
| 88 | - Map<Long, DeptRespDTO> deptMap, | |
| 89 | - BpmnModel bpmnModel) { | |
| 90 | - List<BpmTaskRespVO> taskVOList = CollectionUtils.convertList(taskList, task -> { | |
| 84 | + Map<Long, DeptRespDTO> deptMap) { | |
| 85 | + return CollectionUtils.convertList(taskList, task -> { | |
| 91 | 86 | BpmTaskRespVO taskVO = BeanUtils.toBean(task, BpmTaskRespVO.class); |
| 92 | 87 | Integer taskStatus = FlowableUtils.getTaskStatus(task); |
| 93 | 88 | taskVO.setStatus(taskStatus).setReason(FlowableUtils.getTaskReason(task)); |
| ... | ... | @@ -104,21 +99,8 @@ public interface BpmTaskConvert { |
| 104 | 99 | // 用户信息 |
| 105 | 100 | buildTaskAssignee(taskVO, task.getAssignee(), userMap, deptMap); |
| 106 | 101 | buildTaskOwner(taskVO, task.getOwner(), userMap, deptMap); |
| 107 | - if (BpmTaskStatusEnum.RUNNING.getStatus().equals(taskStatus)) { | |
| 108 | - // 操作按钮设置 | |
| 109 | - taskVO.setButtonsSetting(BpmnModelUtils.parseButtonsSetting(bpmnModel, task.getTaskDefinitionKey())); | |
| 110 | - } | |
| 111 | 102 | return taskVO; |
| 112 | 103 | }); |
| 113 | - | |
| 114 | - // 拼接父子关系 | |
| 115 | - Map<String, List<BpmTaskRespVO>> childrenTaskMap = convertMultiMap( | |
| 116 | - filterList(taskVOList, r -> StrUtil.isNotEmpty(r.getParentTaskId())), | |
| 117 | - BpmTaskRespVO::getParentTaskId); | |
| 118 | - for (BpmTaskRespVO taskVO : taskVOList) { | |
| 119 | - taskVO.setChildren(childrenTaskMap.get(taskVO.getId())); | |
| 120 | - } | |
| 121 | - return filterList(taskVOList, r -> StrUtil.isEmpty(r.getParentTaskId())); | |
| 122 | 104 | } |
| 123 | 105 | |
| 124 | 106 | default List<BpmTaskRespVO> buildTaskListByParentTaskId(List<Task> taskList, | ... | ... |