currentNode = $node; $this->flowContext = $Context; $this->formData = $formData; } /** * 判断传入的assignStatus,在下层节点中找出含有该assignStatus的节点 */ function doWork() { #停留在当前节点 if ( in_array($this->flowContext->assignStatus, AssignStatus::$same_level_status) or in_array($this->flowContext->assignStatus, AssignStatus::$back_status) ) { $flowHandler = new FlowNodeHandler($this->currentNode, $this->flowContext, $this->formData); $flowHandler->doWork(); return; } $formKey = $this->flowContext->getFormKey(); #检查是否有下节点是否定routeMethod $routeMethod = $this->currentNode->getRouteMethod(); $nextFlowCode = ""; $assignClass = $this->flowContext->getCurrentNode()->getAssignClass(); if (!empty($routeMethod)) { $nextFlowCode = $routeMethod->invokeMethod($this->flowContext, $this->formData); } else { #根据下层节点的assign_status 匹配 $workFlowParser = $this->flowContext->getWorkFLowParser(); //解析下层节点\WorkFlowParser::getNextLevelNodes $nextFlowNodes = $workFlowParser->getNextLevelNodes($this->currentNode->getNodeId()); foreach (Node::$nodeTypes as $type) { if (!array_key_exists($type, $nextFlowNodes)) continue; foreach ($nextFlowNodes[$type] as $node) { if (method_exists($node, 'getAssignerList')) { $assigner = $node->getAssignerList($workFlowParser); $assign_status = $assigner[0][0]; if ($assign_status == $this->flowContext->getAssignStatus()) { $nextFlowCode = $node->getFlowCode(); break 2; } } } } } #当前签核者 $currentAssignerId = $this->flowContext->getCurrentUser(); if ($this->flowContext->currentNode->checkTrust($assignClass, Employee::lead_code($currentAssignerId))) { Flow::updateFlowCode($formKey, $nextFlowCode); } Subflow::updateCurrentUser($formKey, $this->flowContext->getNextAssigner()); } }