3 changed files with 450 additions and 447 deletions
@ -1,445 +1,445 @@ |
|||||
<?php |
<?php |
||||
class WorkFlow |
class WorkFlow |
||||
{ |
{ |
||||
private $formId; |
private $formId; |
||||
private $systemId; |
private $systemId; |
||||
private $flowId; |
private $flowId; |
||||
private $mainFlow; //主线流程对象 |
private $mainFlow; //主线流程对象 |
||||
public $currentFlow; //当前流程对象 |
public $currentFlow; //当前流程对象 |
||||
private $workFlowParser; |
private $workFlowParser; |
||||
public $flowContext; |
public $flowContext; |
||||
private $currentAssigner; |
private $currentAssigner; |
||||
private static $logPath = "log/workflow"; |
private static $logPath = "log/workflow"; |
||||
private $log; |
private $log; |
||||
private $formData; |
private $formData; |
||||
private $nextAssignList; |
private $nextAssignList; |
||||
private $tester; #测试人员数组 |
private $tester; #测试人员数组 |
||||
|
|
||||
function __construct($systemId, $flowId, $formId, $formKey = null) |
function __construct($systemId, $flowId, $formId, $formKey = null) |
||||
{ |
{ |
||||
#实例化日志 |
#实例化日志 |
||||
$this->log = new Logger(dirname(__FILE__) . "/" |
$this->log = new Logger(dirname(__FILE__) . "/" |
||||
. (self::$logPath), Logger::DEBUG); |
. (self::$logPath), Logger::DEBUG); |
||||
|
|
||||
$this->systemId = $systemId; |
$this->systemId = $systemId; |
||||
$this->flowId = $flowId; |
$this->flowId = $flowId; |
||||
$this->formId = $formId; |
$this->formId = $formId; |
||||
|
|
||||
$this->currentFlow = new Flow($formKey); |
$this->currentFlow = new Flow($formKey); |
||||
|
|
||||
$_parentKey = $this->currentFlow->getParentKey(); |
$_parentKey = $this->currentFlow->getParentKey(); |
||||
//当流程不是处 于会签和子流程状态时 $mainFlow 和 $currentFlow是一个对象 |
//当流程不是处 于会签和子流程状态时 $mainFlow 和 $currentFlow是一个对象 |
||||
$this->mainFlow = ($_parentKey == null or empty($_parentKey)) |
$this->mainFlow = ($_parentKey == null or empty($_parentKey)) |
||||
? $this->currentFlow : new Flow($_parentKey); |
? $this->currentFlow : new Flow($_parentKey); |
||||
$this->workFlowParser = new WorkFlowParser($systemId, $flowId); |
$this->workFlowParser = new WorkFlowParser($systemId, $flowId); |
||||
$this->flowContext = new FlowContext(); |
$this->flowContext = new FlowContext(); |
||||
# var_dump( $this->flowContext); |
# var_dump( $this->flowContext); |
||||
// echo " WorkFLow 31:".$this->currentFlow->getFormKey(); |
// echo " WorkFLow 31:".$this->currentFlow->getFormKey(); |
||||
|
|
||||
$this->flowContext->setFormKey($this->currentFlow->getFormKey()) |
$this->flowContext->setFormKey($this->currentFlow->getFormKey()) |
||||
->setSystemId($this->systemId) |
->setSystemId($this->systemId) |
||||
->setFlowId($this->flowId) |
->setFlowId($this->flowId) |
||||
->setFormId($this->formId) |
->setFormId($this->formId) |
||||
->setWorkFLowParser($this->workFlowParser); |
->setWorkFLowParser($this->workFlowParser); |
||||
|
|
||||
$_SESSION['flowContext'] = serialize($this->flowContext); |
$_SESSION['flowContext'] = serialize($this->flowContext); |
||||
// var_dump($this); |
// var_dump($this); |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* |
* |
||||
* @param $userId 流程初始化人员 |
* @param $userId 流程初始化人员 |
||||
*/ |
*/ |
||||
public function initWorkFlow($userId) |
public function initWorkFlow($userId) |
||||
{ //var_dump($this->formId); |
{ //var_dump($this->formId); |
||||
|
|
||||
// var_dump($this); |
// var_dump($this); |
||||
$this->currentFlow->setSystemId($this->systemId) |
$this->currentFlow->setSystemId($this->systemId) |
||||
->setFlowId($this->flowId) |
->setFlowId($this->flowId) |
||||
->setFormId($this->formId) |
->setFormId($this->formId) |
||||
->setFlowCode($this->getFirstFlowCode()) |
->setFlowCode($this->getFirstFlowCode()) |
||||
->save(); |
->save(); |
||||
// var_dump($userId); |
// var_dump($userId); |
||||
$this->flowContext->setNextAssigner($userId) |
$this->flowContext->setNextAssigner($userId) |
||||
->setAssignStatus('S'); |
->setAssignStatus('S'); |
||||
|
|
||||
$start = new StartNodeHandler($this->workFlowParser->getFirstNode(), $this->flowContext, $this->formData); |
$start = new StartNodeHandler($this->workFlowParser->getFirstNode(), $this->flowContext, $this->formData); |
||||
// var_dump( $this->flowContext); |
// var_dump( $this->flowContext); |
||||
#执行开始节点预置的操作 |
#执行开始节点预置的操作 |
||||
$start->doWork(); |
$start->doWork(); |
||||
#写入日志 |
#写入日志 |
||||
// $this->log->logInfo("$userId 启动了流程 system:'" . $this->systemId . ";flow:" . $this->formId); |
// $this->log->logInfo("$userId 启动了流程 system:'" . $this->systemId . ";flow:" . $this->formId); |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 设置多个签核接受人员 |
* 设置多个签核接受人员 |
||||
* @param array $members |
* @param array $members |
||||
*/ |
*/ |
||||
function setSplitMembers($members = array()) |
function setSplitMembers($members = array()) |
||||
{ |
{ |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
*1.先检查是否满足签核下 |
*1.先检查是否满足签核下 |
||||
*/ |
*/ |
||||
public function submit() |
public function submit() |
||||
{ |
{ |
||||
#获取FlowContext的值 |
#获取FlowContext的值 |
||||
$nextAssigner = $this->flowContext->getNextAssigner(); |
$nextAssigner = $this->flowContext->getNextAssigner(); |
||||
$assignStatus = $this->flowContext->getAssignStatus(); |
$assignStatus = $this->flowContext->getAssignStatus(); |
||||
$assignOpinion = $this->flowContext->getAssignOpinion(); |
$assignOpinion = $this->flowContext->getAssignOpinion(); |
||||
#获取所有下层Node数组 |
#获取所有下层Node数组 |
||||
$nodes = $this->workFlowParser |
$nodes = $this->workFlowParser |
||||
->getNextNodes($this->currentFlow->getFlowCode()); |
->getNextNodes($this->currentFlow->getFlowCode()); |
||||
#设置当前节点数据 |
#设置当前节点数据 |
||||
$this->flowContext->setCurrentNode($this->workFlowParser |
$this->flowContext->setCurrentNode($this->workFlowParser |
||||
->getNodeByCode($this->currentFlow->getFlowCode())); |
->getNodeByCode($this->currentFlow->getFlowCode())); |
||||
#设置要传入 Handler实例的Context 实例 |
#设置要传入 Handler实例的Context 实例 |
||||
|
|
||||
$this->flowContext->getCurrentNode()->setFlow($this->flowContext) |
$this->flowContext->getCurrentNode()->setFlow($this->flowContext) |
||||
->setformData($this->formData); |
->setformData($this->formData); |
||||
// $this->flowContext->getCurrentNode()->setformData($this->formData); |
// $this->flowContext->getCurrentNode()->setformData($this->formData); |
||||
|
|
||||
$asg = new Assign($this->currentFlow->getFormKey()); |
$asg = new Assign($this->currentFlow->getFormKey()); |
||||
if ( |
if ( |
||||
$this->flowContext->getCurrentNode()->getType() == 'start_node' |
$this->flowContext->getCurrentNode()->getType() == 'start_node' |
||||
and $asg->getSeq() == '0' |
and $asg->getSeq() == '0' |
||||
) { |
) { |
||||
$this->flowContext->setAssignStatus('S'); |
$this->flowContext->setAssignStatus('S'); |
||||
} |
} |
||||
//var_dump(Subflow::getCurrentUser($this->currentFlow->getFormKey())); |
//var_dump(Subflow::getCurrentUser($this->currentFlow->getFormKey())); |
||||
$asg->setAssigner(Subflow::getCurrentUser($this->currentFlow->getFormKey())) |
$asg->setAssigner(Subflow::getCurrentUser($this->currentFlow->getFormKey())) |
||||
->setAssignStatus($this->flowContext->getAssignStatus()) |
->setAssignStatus($this->flowContext->getAssignStatus()) |
||||
->setAssignOpinion($assignOpinion) |
->setAssignOpinion($assignOpinion) |
||||
->setFlowCode($this->currentFlow->getFlowCode()) |
->setFlowCode($this->currentFlow->getFlowCode()) |
||||
->setFlowCodeSeq(0)->insert(); |
->setFlowCodeSeq(0)->insert(); |
||||
|
|
||||
#记录日志 |
#记录日志 |
||||
$_log_array = array( |
$_log_array = array( |
||||
"nextAssigner" => $nextAssigner, |
"nextAssigner" => $nextAssigner, |
||||
"assignStatus" => $assignStatus, |
"assignStatus" => $assignStatus, |
||||
"nextAssigner" => $nextAssigner, |
"nextAssigner" => $nextAssigner, |
||||
"currentAssigner" => Subflow::getCurrentUser($this->currentFlow->getFormKey()), |
"currentAssigner" => Subflow::getCurrentUser($this->currentFlow->getFormKey()), |
||||
"flow_code" => $this->currentFlow->getFlowCode() |
"flow_code" => $this->currentFlow->getFlowCode() |
||||
); |
); |
||||
$this->log->logInfo("" . ID . " 提交了流程 system:'" . $this->systemId . ";flow:" . $this->flowId, $_log_array); |
$this->log->logInfo("" . ID . " 提交了流程 system:'" . $this->systemId . ";flow:" . $this->flowId, $_log_array); |
||||
|
|
||||
#插入assign表信息 |
#插入assign表信息 |
||||
|
|
||||
$_SESSION['flowContext'] = serialize($this->flowContext); |
$_SESSION['flowContext'] = serialize($this->flowContext); |
||||
// var_dump($nodes); |
// var_dump($nodes); |
||||
foreach (Node::$nodeTypes as $type) { |
foreach (Node::$nodeTypes as $type) { |
||||
if (!array_key_exists($type, $nodes)) continue; |
if (!array_key_exists($type, $nodes)) continue; |
||||
foreach ($nodes[$type] as $node) { |
foreach ($nodes[$type] as $node) { |
||||
$handleClass = get_class($node) . "Handler"; |
$handleClass = get_class($node) . "Handler"; |
||||
$obj = new $handleClass($node, $this->flowContext, $this->formData); |
$obj = new $handleClass($node, $this->flowContext, $this->formData); |
||||
$obj->doWork(); |
$obj->doWork(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
/* |
/* |
||||
*获取签核人员列表 |
*获取签核人员列表 |
||||
*/ |
*/ |
||||
public function getAssignerList() |
public function getAssignerList() |
||||
{ |
{ |
||||
$currentNode = $this->workFlowParser |
$currentNode = $this->workFlowParser |
||||
->getNodeByCode($this->currentFlow->getFlowCode()); |
->getNodeByCode($this->currentFlow->getFlowCode()); |
||||
#获取当前签核者 |
#获取当前签核者 |
||||
$currentFormKey = $this->currentFlow->getFormKey(); |
$currentFormKey = $this->currentFlow->getFormKey(); |
||||
$currentAssigner = Subflow::getCurrentUser($currentFormKey); |
$currentAssigner = Subflow::getCurrentUser($currentFormKey); |
||||
#读取签核类别 A是专人的签核 |
#读取签核类别 A是专人的签核 |
||||
|
|
||||
#遍历下层节点读取下层节点的签核人员 |
#遍历下层节点读取下层节点的签核人员 |
||||
$currentNode->setFlow($this->flowContext) |
$currentNode->setFlow($this->flowContext) |
||||
->setFormData($this->formData); |
->setFormData($this->formData); |
||||
$assignClass = $currentNode->getAssignClass(); |
$assignClass = $currentNode->getAssignClass(); |
||||
|
|
||||
if ($currentNode->checkTrust($assignClass, Employee::lead_code($currentAssigner))) { |
if ($currentNode->checkTrust($assignClass, Employee::lead_code($currentAssigner))) { |
||||
|
|
||||
#获取所有下层Node数组,并遍历,调用其中getAssignerList 方法 |
#获取所有下层Node数组,并遍历,调用其中getAssignerList 方法 |
||||
$nodes = $this->workFlowParser->getNextNodes($this->currentFlow->getFlowCode()); |
$nodes = $this->workFlowParser->getNextNodes($this->currentFlow->getFlowCode()); |
||||
// var_dump($nodes); |
// var_dump($nodes); |
||||
|
|
||||
$assigner = array(); |
$assigner = array(); |
||||
foreach (Node::$nodeTypes as $type) { |
foreach (Node::$nodeTypes as $type) { |
||||
if (!array_key_exists($type, $nodes)) continue; |
if (!array_key_exists($type, $nodes)) continue; |
||||
foreach ($nodes[$type] as $node) { |
foreach ($nodes[$type] as $node) { |
||||
if (method_exists($node, 'getAssignerList')) { |
if (method_exists($node, 'getAssignerList')) { |
||||
$assigner = array_merge( |
$assigner = array_merge( |
||||
(array)$assigner, |
(array)$assigner, |
||||
$node->getAssignerList($this->workFlowParser) |
$node->getAssignerList($this->workFlowParser) |
||||
); |
); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
#检查退回选项 |
#检查退回选项 |
||||
$backOption = $currentNode->getBackOption(); |
$backOption = $currentNode->getBackOption(); |
||||
//B4 退回上一个节点 |
//B4 退回上一个节点 |
||||
if ($backOption == 'B4') { |
if ($backOption == 'B4') { |
||||
$prevNodes = $this->flowContext->workFlowParser->getPrevLevelNodes( |
$prevNodes = $this->flowContext->workFlowParser->getPrevLevelNodes( |
||||
$currentNode->getNodeId(), |
$currentNode->getNodeId(), |
||||
[Node::FLOW_NODE, Node::LOGIC_NODE] |
[Node::FLOW_NODE, Node::LOGIC_NODE] |
||||
); |
); |
||||
foreach ($prevNodes as $key => $prevNode) { |
foreach ($prevNodes as $key => $prevNode) { |
||||
$tmpNode = $prevNode[0]; |
$tmpNode = $prevNode[0]; |
||||
$backAssign = Assign::get_lastest_record($currentFormKey, $tmpNode->getFlowCode()); |
$backAssign = Assign::get_lastest_record($currentFormKey, $tmpNode->getFlowCode()); |
||||
$backUser = $backAssign['assigner']; |
$backUser = $backAssign['assigner']; |
||||
if (empty($backUser)) continue; |
if (empty($backUser)) continue; |
||||
$nextAssignerStr = ""; |
$nextAssignerStr = ""; |
||||
$nextAssignerStr .= Employee::get_employee($backUser, $format = "employee_no-name") . ','; |
$nextAssignerStr .= Employee::get_employee($backUser, $format = "employee_no-name") . ','; |
||||
array_push($assigner, array(0 => 'B4', 1 => $nextAssignerStr)); |
array_push($assigner, array(0 => 'B4', 1 => $nextAssignerStr)); |
||||
} |
} |
||||
} |
} |
||||
#B7 退回申请人 |
#B7 退回申请人 |
||||
if ($backOption == 'B7') { |
if ($backOption == 'B7') { |
||||
$assign = Assign::get_records($currentFormKey, true, '%', 'S'); |
$assign = Assign::get_records($currentFormKey, true, '%', 'S'); |
||||
// var_dump($assign); |
// var_dump($assign); |
||||
$applicant = $assign[0]['assigner']; |
$applicant = $assign[0]['assigner']; |
||||
$nextAssignerStr = ""; |
$nextAssignerStr = ""; |
||||
$nextAssignerStr .= Employee::get_employee($applicant, $format = "employee_no-name") . ','; |
$nextAssignerStr .= Employee::get_employee($applicant, $format = "employee_no-name") . ','; |
||||
array_push($assigner, array(0 => 'B7', 1 => $nextAssignerStr)); |
array_push($assigner, array(0 => 'B7', 1 => $nextAssignerStr)); |
||||
} |
} |
||||
|
|
||||
#获取任务节点,查看是否有修改签核者的的任务 |
#获取任务节点,查看是否有修改签核者的的任务 |
||||
$task = new NodeTask(); |
$task = new NodeTask(); |
||||
$task->setFormKey($this->currentFlow->getFormKey()) |
$task->setFormKey($this->currentFlow->getFormKey()) |
||||
->setFlowCode($this->currentFlow->getFlowCode()) |
->setFlowCode($this->currentFlow->getFlowCode()) |
||||
->setState("OPEN") |
->setState("OPEN") |
||||
->setPhase("LOAD"); |
->setPhase("LOAD"); |
||||
$tasks = TaskManager::getTasks($task); |
$tasks = TaskManager::getTasks($task); |
||||
if (count($tasks) > 0) { |
if (count($tasks) > 0) { |
||||
foreach ($tasks as $task) { |
foreach ($tasks as $task) { |
||||
$handlerClass = NodeTask::$handlerClasses[constant("NodeTask::" . $task->getTaskType())]; |
$handlerClass = NodeTask::$handlerClasses[constant("NodeTask::" . $task->getTaskType())]; |
||||
$handler = new $handlerClass($this->flowContext, $this->formData); |
$handler = new $handlerClass($this->flowContext, $this->formData); |
||||
if (method_exists($handler, 'setNextAssignerList')) { |
if (method_exists($handler, 'setNextAssignerList')) { |
||||
|
|
||||
$assigner = $handler->setNextAssignerList($assigner, $task); |
$assigner = $handler->setNextAssignerList($assigner, $task); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
#也可以指派给自己的下属 |
#也可以指派给自己的下属 |
||||
$subordinates = Employee::subordinates($currentAssigner); |
$subordinates = Employee::subordinates($currentAssigner); |
||||
if (count($subordinates) > 0) { |
if (count($subordinates) > 0) { |
||||
$nextAssignerStr = ""; |
$nextAssignerStr = ""; |
||||
foreach ($subordinates as $emp) { |
foreach ($subordinates as $emp) { |
||||
$nextAssignerStr .= Employee::get_employee($emp, $format = "employee_no-name") . ','; |
$nextAssignerStr .= Employee::get_employee($emp, $format = "employee_no-name") . ','; |
||||
} |
} |
||||
array_push($assigner, array(0 => 'FH', 1 => $nextAssignerStr)); |
array_push($assigner, array(0 => 'FH', 1 => $nextAssignerStr)); |
||||
} |
} |
||||
|
|
||||
$nextAssigner = $assigner; |
$nextAssigner = $assigner; |
||||
} else { |
} else { |
||||
#需要签给上级领导审 |
#需要签给上级领导审 |
||||
$nextAssigner = $currentNode->getDepartmentalAssignerList($currentAssigner); |
$nextAssigner = $currentNode->getDepartmentalAssignerList($currentAssigner); |
||||
# 获取任务节点,查看是否有修改签核者的的任务 |
# 获取任务节点,查看是否有修改签核者的的任务 |
||||
$task = new NodeTask(); |
$task = new NodeTask(); |
||||
$task->setFormKey($this->currentFlow->getFormKey()) |
$task->setFormKey($this->currentFlow->getFormKey()) |
||||
->setFlowCode($this->currentFlow->getFlowCode()) |
->setFlowCode($this->currentFlow->getFlowCode()) |
||||
->setState("OPEN") |
->setState("OPEN") |
||||
->setPhase("LOAD") |
->setPhase("LOAD") |
||||
->setWfCondition('SAME'); |
->setWfCondition('SAME'); |
||||
$tasks = TaskManager::getTasks($task); |
$tasks = TaskManager::getTasks($task); |
||||
if (count($tasks) > 0) { |
if (count($tasks) > 0) { |
||||
foreach ($tasks as $task) { |
foreach ($tasks as $task) { |
||||
$handlerClass = NodeTask::$handlerClasses[constant("NodeTask::" . $task->getTaskType())]; |
$handlerClass = NodeTask::$handlerClasses[constant("NodeTask::" . $task->getTaskType())]; |
||||
$handler = new $handlerClass($this->flowContext, $this->formData); |
$handler = new $handlerClass($this->flowContext, $this->formData); |
||||
if (method_exists($handler, 'setNextAssignerList')) { |
if (method_exists($handler, 'setNextAssignerList')) { |
||||
$nextAssigner = $handler->setNextAssignerList($nextAssigner, $task); |
$nextAssigner = $handler->setNextAssignerList($nextAssigner, $task); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
$this->nextAssignList = $nextAssigner; |
$this->nextAssignList = $nextAssigner; |
||||
|
|
||||
return $nextAssigner; |
return $nextAssigner; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
*提交前测试表单数据是否满足表达提交条件 |
*提交前测试表单数据是否满足表达提交条件 |
||||
* 1.检测FlowContext对象的以下属性,为空不可提交 |
* 1.检测FlowContext对象的以下属性,为空不可提交 |
||||
*/ |
*/ |
||||
public function submitTest() |
public function submitTest() |
||||
{ |
{ |
||||
$errorArray = array(); |
$errorArray = array(); |
||||
#1.检查FlowContext的属性是否都被设置 |
#1.检查FlowContext的属性是否都被设置 |
||||
$flowContextRequiredProperty = array( |
$flowContextRequiredProperty = array( |
||||
"systemId", "flowId", "formId", "currentAssigner", "flowCode", "nextAssigner", "assignStatus", "assignOpinion", "formKey" |
"systemId", "flowId", "formId", "currentAssigner", "flowCode", "nextAssigner", "assignStatus", "assignOpinion", "formKey" |
||||
); |
); |
||||
foreach ($this->flowContext as $key => $value) { |
foreach ($this->flowContext as $key => $value) { |
||||
if (in_array($key, $flowContextRequiredProperty) and empty($value)) { |
if (in_array($key, $flowContextRequiredProperty) and empty($value)) { |
||||
array_push($errorArray, "FlowContext:" . $key . " 属性异常. Value:" . $value); |
array_push($errorArray, "FlowContext:" . $key . " 属性异常. Value:" . $value); |
||||
} |
} |
||||
} |
} |
||||
#2. 当前登陆人员与Sublfow:Current_user 不符合时,不允许提交 |
#2. 当前登陆人员与Sublfow:Current_user 不符合时,不允许提交 |
||||
|
|
||||
$currentAssignerId = $this->flowContext->getCurrentUser(); |
$currentAssignerId = $this->flowContext->getCurrentUser(); |
||||
if (!empty($currentAssignerId) and ID == $currentAssignerId) { |
if (!empty($currentAssignerId) and ID == $currentAssignerId) { |
||||
array_push($errorArray, "签核已提交,请勿重复操作."); |
array_push($errorArray, "签核已提交,请勿重复操作."); |
||||
} |
} |
||||
return $errorArray; |
return $errorArray; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
*返回assignStatus |
*返回assignStatus |
||||
* @param $nextAssigner |
* @param $nextAssigner |
||||
* @return string |
* @return string |
||||
*/ |
*/ |
||||
public function getAssignStatus($nextAssigner) |
public function getAssignStatus($nextAssigner) |
||||
{ |
{ |
||||
|
|
||||
$htmlOption = "'<option value=00000 >请选择</option>'"; |
$htmlOption = "'<option value=00000 >請選擇</option>'"; |
||||
foreach ($nextAssigner as $assigner) { |
foreach ($nextAssigner as $assigner) { |
||||
|
|
||||
$htmlOption .= "<option value=" . $assigner[0] . ">" |
$htmlOption .= "<option value=" . $assigner[0] . ">" |
||||
. Code::getContent('assign_status', $assigner[0]) . "</option>"; |
. Code::getContent('assign_status', $assigner[0]) . "</option>"; |
||||
} |
} |
||||
|
|
||||
return $htmlOption; |
return $htmlOption; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
*获取会签部门 |
*获取会签部门 |
||||
* @param null $flowCode 当前流程的流程码 |
* @param null $flowCode 当前流程的流程码 |
||||
* @return array |
* @return array |
||||
*/ |
*/ |
||||
public function getCounterSignDepart($flowCode = null) |
public function getCounterSignDepart($flowCode = null) |
||||
{ |
{ |
||||
$flowCode = empty($flowCode) ? $this->flowContext->getFlowCode() : $flowCode; |
$flowCode = empty($flowCode) ? $this->flowContext->getFlowCode() : $flowCode; |
||||
/* TODO 从会签节点读取配置的会签属性,并返回成员数组*/ |
/* TODO 从会签节点读取配置的会签属性,并返回成员数组*/ |
||||
return null; |
return null; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 是否允许拆分 |
* 是否允许拆分 |
||||
* @return bool |
* @return bool |
||||
*/ |
*/ |
||||
public function isSplitable() |
public function isSplitable() |
||||
{ |
{ |
||||
$nodes = $this->workFlowParser->getNextNodes( |
$nodes = $this->workFlowParser->getNextNodes( |
||||
$this->currentFlow->getFlowCode(), |
$this->currentFlow->getFlowCode(), |
||||
[Node::COUNTER_SIGN_TASK] |
[Node::COUNTER_SIGN_TASK] |
||||
); |
); |
||||
if (count($nodes) == 0) { |
if (count($nodes) == 0) { |
||||
return false; |
return false; |
||||
} |
} |
||||
return true; |
return true; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
*1.检查下个节点的类型,为Split节点时 ,返回Split节点下各层节点人员 |
*1.检查下个节点的类型,为Split节点时 ,返回Split节点下各层节点人员 |
||||
*/ |
*/ |
||||
public function getSubflowMembers() |
public function getSubflowMembers() |
||||
{ |
{ |
||||
$nodes = $this->workFlowParser->getNextNodes( |
$nodes = $this->workFlowParser->getNextNodes( |
||||
$this->currentFlow->getFlowCode(), |
$this->currentFlow->getFlowCode(), |
||||
[Node::SPLIT_NODE] |
[Node::SPLIT_NODE] |
||||
); |
); |
||||
if (count($nodes) == 0) { |
if (count($nodes) == 0) { |
||||
return null; |
return null; |
||||
} |
} |
||||
$splitNode = $nodes[Node::SPLIT_NODE][0]; |
$splitNode = $nodes[Node::SPLIT_NODE][0]; |
||||
$assigner = $splitNode->getSplitMembers($this->workFlowParser); |
$assigner = $splitNode->getSplitMembers($this->workFlowParser); |
||||
return $assigner; |
return $assigner; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 获取第一个流程节点 |
* 获取第一个流程节点 |
||||
* @return mixed |
* @return mixed |
||||
*/ |
*/ |
||||
public function getFirstFlowCode() |
public function getFirstFlowCode() |
||||
{ |
{ |
||||
|
|
||||
$node = $this->workFlowParser->getFirstNode(); |
$node = $this->workFlowParser->getFirstNode(); |
||||
return $node->getFlowCode(); |
return $node->getFlowCode(); |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 获取流程的名称 |
* 获取流程的名称 |
||||
* @return mixed |
* @return mixed |
||||
*/ |
*/ |
||||
public function getFlowName() |
public function getFlowName() |
||||
{ |
{ |
||||
$flowInfo = $this->workFlowParser->getFlowInfo(); |
$flowInfo = $this->workFlowParser->getFlowInfo(); |
||||
return $flowInfo['flowName']; |
return $flowInfo['flowName']; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
*获取流程版本 |
*获取流程版本 |
||||
*/ |
*/ |
||||
function getFlowVersion() |
function getFlowVersion() |
||||
{ |
{ |
||||
$flowInfo = $this->workFlowParser->getFlowInfo(); |
$flowInfo = $this->workFlowParser->getFlowInfo(); |
||||
return $flowInfo['version']; |
return $flowInfo['version']; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 获取流程需要的调单数据 |
* 获取流程需要的调单数据 |
||||
* @return mixed |
* @return mixed |
||||
*/ |
*/ |
||||
public function getFormData() |
public function getFormData() |
||||
{ |
{ |
||||
return $this->formData; |
return $this->formData; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 设置表单里面的值 |
* 设置表单里面的值 |
||||
* @param mixed $formData |
* @param mixed $formData |
||||
*/ |
*/ |
||||
public function setFormData($formData) |
public function setFormData($formData) |
||||
{ |
{ |
||||
$this->formData = $formData; |
$this->formData = $formData; |
||||
$nextUser = empty($formData['next_users']) ? "" : $formData['next_users']; |
$nextUser = empty($formData['next_users']) ? "" : $formData['next_users']; |
||||
$assignStatus = empty($formData['assign_status']) ? "" : $formData['assign_status']; |
$assignStatus = empty($formData['assign_status']) ? "" : $formData['assign_status']; |
||||
$assignOpinion = empty($formData['assign_opinion']) ? "" : $formData['assign_opinion']; |
$assignOpinion = empty($formData['assign_opinion']) ? "" : $formData['assign_opinion']; |
||||
$currentAssignerId = empty($formData['current_assigner']) ? ID : $formData['current_assigner']; |
$currentAssignerId = empty($formData['current_assigner']) ? ID : $formData['current_assigner']; |
||||
$this->flowContext->setAssignOpinion($assignOpinion) |
$this->flowContext->setAssignOpinion($assignOpinion) |
||||
->setNextAssigner($nextUser) |
->setNextAssigner($nextUser) |
||||
->setAssignStatus($assignStatus) |
->setAssignStatus($assignStatus) |
||||
->setFormKey($this->currentFlow->getFormKey()) |
->setFormKey($this->currentFlow->getFormKey()) |
||||
->setFlowCode($this->currentFlow->getFlowCode()) |
->setFlowCode($this->currentFlow->getFlowCode()) |
||||
->setCurrentUser($currentAssignerId); |
->setCurrentUser($currentAssignerId); |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 获取节点的 |
* 获取节点的 |
||||
* @param $flowCode |
* @param $flowCode |
||||
* @return String |
* @return String |
||||
*/ |
*/ |
||||
public function getNodeDescriptions($flowCode) |
public function getNodeDescriptions($flowCode) |
||||
{ |
{ |
||||
$node = $this->workFlowParser->getNodeByCode($flowCode); |
$node = $this->workFlowParser->getNodeByCode($flowCode); |
||||
return $node->getNodeDescription(); |
return $node->getNodeDescription(); |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 获取节点的节点 |
* 获取节点的节点 |
||||
* @param $flowCode |
* @param $flowCode |
||||
* @return String |
* @return String |
||||
*/ |
*/ |
||||
public function getCurrentNode($flowCode = null) |
public function getCurrentNode($flowCode = null) |
||||
{ |
{ |
||||
$flowCode = empty($flowCode) ? $this->currentFlow->getFlowCode() : $flowCode; |
$flowCode = empty($flowCode) ? $this->currentFlow->getFlowCode() : $flowCode; |
||||
$node = $this->workFlowParser->getNodeByCode($flowCode); |
$node = $this->workFlowParser->getNodeByCode($flowCode); |
||||
return $node; |
return $node; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* @return mixed |
* @return mixed |
||||
*/ |
*/ |
||||
public function getTester() |
public function getTester() |
||||
{ |
{ |
||||
return $this->tester; |
return $this->tester; |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* @param mixed $tester |
* @param mixed $tester |
||||
*/ |
*/ |
||||
public function setTester($tester) |
public function setTester($tester) |
||||
{ |
{ |
||||
$this->tester = $tester; |
$this->tester = $tester; |
||||
} |
} |
||||
} |
} |
||||
|
Loading…
Reference in new issue