Browse Source

跳转日志调整

caixiaofeng 10 months ago
parent
commit
7fd910a48b

+ 13 - 13
flow-workflow/flow-workflow-biz/src/main/java/com/flow/delegate/JumpDelegate.java

@@ -43,19 +43,6 @@ public class JumpDelegate implements JavaDelegate {
         FlowDefine define = flowDefineService.getDefine(entity.getProcessDefinitionId());
         JumpNode jumpNode = define.getNode(execution.getCurrentActivityId(), JumpNode.class);
         String targetNode = jumpNode.getTargetNode();
-        log.info("跳转节点:{}", targetNode);
-        List<String> executionIds = managementService.executeCommand(new JumpActivityCmd(
-                execution.getProcessInstanceId(),
-                targetNode
-        ));
-        // 删除当前节点的活动记录
-        if (CollectionUtils.isNotEmpty(executionIds)) {
-            flowActivityService.lambdaUpdate()
-                    .eq(FlowActivity::getInstanceId, execution.getProcessInstanceId())
-                    .eq(FlowActivity::getStatus,  ProcessStatus.RUNNING)
-                    .in(FlowActivity::getParentId, executionIds)
-                    .remove();
-        }
         // 记录日志
         Node target = define.getNode(jumpNode.getTargetNode(), Node.class);
         FlowElement flowElement = entity.getCurrentFlowElement();
@@ -74,5 +61,18 @@ public class JumpDelegate implements JavaDelegate {
         comment.setAttachments(Lists.newArrayList());
         flowActivity.setComment(Lists.newArrayList(comment));
         flowActivityService.save(flowActivity);
+        log.info("跳转节点:{}", targetNode);
+        List<String> executionIds = managementService.executeCommand(new JumpActivityCmd(
+                execution.getProcessInstanceId(),
+                targetNode
+        ));
+        // 删除当前节点的活动记录
+        if (CollectionUtils.isNotEmpty(executionIds)) {
+            flowActivityService.lambdaUpdate()
+                    .eq(FlowActivity::getInstanceId, execution.getProcessInstanceId())
+                    .eq(FlowActivity::getStatus,  ProcessStatus.RUNNING)
+                    .in(FlowActivity::getParentId, executionIds)
+                    .remove();
+        }
     }
 }