Commit 04fc7404e1241a56e2aee16bd7d7272d1d066e59
Committed by
Gitee
!1234 BPM-办理人
Merge pull request !1234 from Lesan/feature/bpm-办理人
Showing
6 changed files
with
38 additions
and
3 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java
| @@ -85,6 +85,9 @@ public class BpmTaskRespVO { | @@ -85,6 +85,9 @@ public class BpmTaskRespVO { | ||
| 85 | @Schema(description = "是否填写审批意见", example = "false") | 85 | @Schema(description = "是否填写审批意见", example = "false") |
| 86 | private Boolean reasonRequire; | 86 | private Boolean reasonRequire; |
| 87 | 87 | ||
| 88 | + @Schema(description = "节点类型", example = "10") // 只有Simple设计器的场景下才会使用此字段 | ||
| 89 | + private Integer nodeType; | ||
| 90 | + | ||
| 88 | @Data | 91 | @Data |
| 89 | @Schema(description = "流程实例") | 92 | @Schema(description = "流程实例") |
| 90 | public static class ProcessInstance { | 93 | public static class ProcessInstance { |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
| @@ -129,4 +129,9 @@ public interface BpmnModelConstants { | @@ -129,4 +129,9 @@ public interface BpmnModelConstants { | ||
| 129 | */ | 129 | */ |
| 130 | String REASON_REQUIRE = "reasonRequire"; | 130 | String REASON_REQUIRE = "reasonRequire"; |
| 131 | 131 | ||
| 132 | + /** | ||
| 133 | + * 节点类型 | ||
| 134 | + */ | ||
| 135 | + String NODE_TYPE = "nodeType"; | ||
| 136 | + | ||
| 132 | } | 137 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
| @@ -410,6 +410,26 @@ public class BpmnModelUtils { | @@ -410,6 +410,26 @@ public class BpmnModelUtils { | ||
| 410 | return parseExtensionElement(flowElement, TRIGGER_PARAM); | 410 | return parseExtensionElement(flowElement, TRIGGER_PARAM); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | + /** | ||
| 414 | + * 给节点添加节点类型 | ||
| 415 | + * | ||
| 416 | + * @param nodeType 节点类型 | ||
| 417 | + * @param flowElement 节点 | ||
| 418 | + */ | ||
| 419 | + public static void addNodeType(Integer nodeType, FlowElement flowElement) { | ||
| 420 | + addExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE, nodeType); | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + /** | ||
| 424 | + * 解析节点类型 | ||
| 425 | + * | ||
| 426 | + * @param flowElement 节点 | ||
| 427 | + * @return 节点类型 | ||
| 428 | + */ | ||
| 429 | + public static Integer parseNodeType(FlowElement flowElement) { | ||
| 430 | + return NumberUtils.parseInt(parseExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE)); | ||
| 431 | + } | ||
| 432 | + | ||
| 413 | // ========== BPM 简单查找相关的方法 ========== | 433 | // ========== BPM 简单查找相关的方法 ========== |
| 414 | 434 | ||
| 415 | /** | 435 | /** |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| @@ -445,6 +445,8 @@ public class SimpleModelUtils { | @@ -445,6 +445,8 @@ public class SimpleModelUtils { | ||
| 445 | addSignEnable(node.getSignEnable(), userTask); | 445 | addSignEnable(node.getSignEnable(), userTask); |
| 446 | // 审批意见 | 446 | // 审批意见 |
| 447 | addReasonRequire(node.getReasonRequire(), userTask); | 447 | addReasonRequire(node.getReasonRequire(), userTask); |
| 448 | + // 节点类型 | ||
| 449 | + addNodeType(node.getType(), userTask); | ||
| 448 | return userTask; | 450 | return userTask; |
| 449 | } | 451 | } |
| 450 | 452 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| @@ -67,6 +67,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | @@ -67,6 +67,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | ||
| 67 | import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode; | 67 | import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode; |
| 68 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | 68 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; |
| 69 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID; | 69 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID; |
| 70 | +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseNodeType; | ||
| 70 | import static java.util.Arrays.asList; | 71 | import static java.util.Arrays.asList; |
| 71 | import static java.util.Collections.singletonList; | 72 | import static java.util.Collections.singletonList; |
| 72 | import static org.flowable.bpmn.constants.BpmnXMLConstants.*; | 73 | import static org.flowable.bpmn.constants.BpmnXMLConstants.*; |
| @@ -325,7 +326,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -325,7 +326,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 325 | ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName()) | 326 | ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName()) |
| 326 | .setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey()) | 327 | .setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey()) |
| 327 | ? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType() | 328 | ? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType() |
| 328 | - : BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) | 329 | + : ObjectUtil.isNull(parseNodeType(flowNode)) ? |
| 330 | + BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType() : parseNodeType(flowNode)) | ||
| 329 | .setStatus(FlowableUtils.getTaskStatus(task)) | 331 | .setStatus(FlowableUtils.getTaskStatus(task)) |
| 330 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) | 332 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) |
| 331 | .setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime())) | 333 | .setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime())) |
| @@ -402,7 +404,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -402,7 +404,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 402 | HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同 | 404 | HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同 |
| 403 | ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId()) | 405 | ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId()) |
| 404 | .setName(firstActivity.getActivityName()) | 406 | .setName(firstActivity.getActivityName()) |
| 405 | - .setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) | 407 | + .setNodeType(ObjectUtil.isNull(parseNodeType(flowNode)) ? |
| 408 | + BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType() : parseNodeType(flowNode)) | ||
| 406 | .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()) | 409 | .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()) |
| 407 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) | 410 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) |
| 408 | .setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime())) | 411 | .setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime())) |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -162,6 +162,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -162,6 +162,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 162 | bpmnModel, todoTask.getTaskDefinitionKey()); | 162 | bpmnModel, todoTask.getTaskDefinitionKey()); |
| 163 | Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey()); | 163 | Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey()); |
| 164 | Boolean reasonRequire = parseReasonRequire(bpmnModel, todoTask.getTaskDefinitionKey()); | 164 | Boolean reasonRequire = parseReasonRequire(bpmnModel, todoTask.getTaskDefinitionKey()); |
| 165 | + Integer nodeType = parseNodeType(BpmnModelUtils.getFlowElementById(bpmnModel, todoTask.getTaskDefinitionKey())); | ||
| 165 | 166 | ||
| 166 | // 4. 任务表单 | 167 | // 4. 任务表单 |
| 167 | BpmFormDO taskForm = null; | 168 | BpmFormDO taskForm = null; |
| @@ -171,7 +172,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -171,7 +172,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 171 | 172 | ||
| 172 | return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm) | 173 | return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm) |
| 173 | .setSignEnable(signEnable) | 174 | .setSignEnable(signEnable) |
| 174 | - .setReasonRequire(reasonRequire); | 175 | + .setReasonRequire(reasonRequire) |
| 176 | + .setNodeType(nodeType); | ||
| 175 | } | 177 | } |
| 176 | 178 | ||
| 177 | @Override | 179 | @Override |