You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.7 KiB
125 lines
3.7 KiB
<?php
|
|
/**
|
|
* Created by u73376.
|
|
* User: user
|
|
* Date: 2018/8/16
|
|
* Time: 8:28
|
|
*/
|
|
|
|
class LogicNode extends CommonFlowNode
|
|
{
|
|
|
|
function __construct($param)
|
|
{
|
|
parent::__construct($param);
|
|
}
|
|
|
|
|
|
public function getRouteMethod()
|
|
{
|
|
$methodString = $this->nodeProperty['routeMethod'];
|
|
if (!empty($methodString)) {
|
|
|
|
return MethodLoader::getInstanceByMethodString($methodString);
|
|
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
*获取流程FLowCode
|
|
* @return mixed
|
|
*/
|
|
public function getFlowCode()
|
|
{
|
|
$flowContext = unserialize($_SESSION['flowContext']);
|
|
$workFlowParser = $flowContext->getWorkFLowParser();
|
|
$prevNodes = $workFlowParser->getPrevLevelNodes(parent::getNodeId(), Node::FLOW_NODE);
|
|
$tmpNode = $prevNodes[Node::FLOW_NODE][0];
|
|
$tmpNodeFlowCode = $tmpNode->getFlowCode();
|
|
return $tmpNodeFlowCode;
|
|
}
|
|
|
|
/**
|
|
* 1.检查逻辑节点下层节点,并获取下层节点的assigner
|
|
* @param $flowchart
|
|
* @return array
|
|
*/
|
|
public function getAssignerList($flowchart)
|
|
{
|
|
|
|
|
|
$nodes = $flowchart->getNextLevelNodes(parent::getNodeId());
|
|
$assigner = array();
|
|
foreach (Node::$nodeTypes as $type) {
|
|
if (!array_key_exists($type, $nodes)) continue;
|
|
foreach ($nodes[$type] as $node) {
|
|
if (method_exists($node, 'getAssignerList')) {
|
|
$assigner = array_merge((array)$assigner, $node->getAssignerList($flowchart));
|
|
}
|
|
}
|
|
}
|
|
/* $methodString = $this->getMethod();
|
|
if (!empty($methodString)) {
|
|
|
|
$_methodInstance = MethodLoader::getInstanceByMethodString($methodString);
|
|
|
|
}*/
|
|
return $assigner;
|
|
}
|
|
|
|
/**
|
|
* 获取附加的签核人员
|
|
* @param $userId
|
|
* @return array
|
|
*/
|
|
public function getDepartmentalAssignerList($userId)
|
|
{
|
|
$leader = Employee::leader($userId);
|
|
$nextAssignerStr = Employee::get_employee($leader, $format = "employee_no-name");
|
|
$nextAssigner = array(0 => array(0 => "F6", 1 => $nextAssignerStr));
|
|
return $nextAssigner;
|
|
}
|
|
|
|
/**
|
|
* 检查是否满足流转下一关条件
|
|
* @param $assignClass
|
|
* @param $leadCode
|
|
* @return bool
|
|
*/
|
|
function checkTrust($assignClass, $leadCode)
|
|
{
|
|
$_flag = false;
|
|
switch ($assignClass) {
|
|
case 'A': //无需审核
|
|
$_flag = true;
|
|
break;
|
|
case 'B': //审核至科长
|
|
$_flag = (in_array($leadCode, array('50', '20', '19', '18', '17', '16', '12', '10')) ? true : false);
|
|
|
|
break;
|
|
case 'C': //审核至经理
|
|
$_flag = in_array($leadCode, array('20', '19', '18', '17', '16', '12', '10')) ? true : false;
|
|
break;
|
|
case 'D': //审核至 协理/厂长/总监
|
|
$_flag = in_array($leadCode, array('19', '18', '17', '16', '12', '10')) ? true : false;
|
|
break;
|
|
case 'E': //审核至副总
|
|
$_flag = in_array($leadCode, array('12', '10')) ? true : false;
|
|
break;
|
|
case 'F': //审核至总经理
|
|
$_flag = substr($leadCode, 0, 2) == '10' ? true : false;
|
|
break;
|
|
case 'X':
|
|
|
|
$method = MethodLoader::getInstanceByMethodString(strip_tags($this->getAssignClassMethod()));
|
|
$_assignClass = $method->invokeMethod($this->getFlow(), $this->getFormData());
|
|
$_flag = $this->checkTrust($_assignClass, $leadCode);
|
|
break;
|
|
default:
|
|
$_flag = false;
|
|
break;
|
|
}
|
|
return $_flag;
|
|
}
|
|
}
|
|
|