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.
426 lines
8.6 KiB
426 lines
8.6 KiB
<?php
|
|
|
|
/**
|
|
* User: u73376
|
|
* Date: 2018/9/8
|
|
* Time: 19:27
|
|
*/
|
|
|
|
class NodeTask
|
|
{
|
|
/* select 'public $'||lower(COLUMN_NAME)||';' from user_tab_columns
|
|
where table_name='WORKFLOW_TASK' */
|
|
public $task_id;
|
|
public $task_type;
|
|
public $flow_code;
|
|
public $form_key;
|
|
public $necessary;
|
|
public $completion_condition;
|
|
public $state;
|
|
public $join_role;
|
|
public $error_info;
|
|
public $remark;
|
|
public $create_date;
|
|
public $finish_date;
|
|
public $role_type;
|
|
public $wf_condition;
|
|
public $creator;
|
|
public $create_code;
|
|
public $phase;
|
|
|
|
const TASK_CLOSE_STATE = "CLOSE";
|
|
const TASK_OPEN_STATE = "OPEN";
|
|
const TASK_FINISH_STATE = "FINISH";
|
|
|
|
const ALL_TASK = "10000000";
|
|
const COUNTER_SIGN_SUBTASK = "01000000";
|
|
const NEXT_ASSIGNER_MODIFY_TASK = "00100000";
|
|
const FH_TASK = "00010000";
|
|
const B4_TASK = "00001000";
|
|
const B7_TASK = "00000100";
|
|
|
|
static $handlerClasses = array(
|
|
self::COUNTER_SIGN_SUBTASK => "CounterSignSubtaskHandler",
|
|
self::NEXT_ASSIGNER_MODIFY_TASK => "NextAssignerModifyTaskHandler",
|
|
self::FH_TASK => "FhTaskHandler",
|
|
self::B4_TASK => "B4TaskHandler",
|
|
self::B7_TASK => "B7TaskHandler"
|
|
);
|
|
|
|
public function update()
|
|
{
|
|
$where = "task_id = '" . $this->task_id . "'";
|
|
DB::update_table("workflow_task", array(
|
|
"form_key" => $this->getFormKey(),
|
|
"flow_code" => $this->getFlowCode(),
|
|
"task_type" => $this->getTaskType(),
|
|
"completion_condition" => $this->getCompletionCondition(),
|
|
"state" => $this->getState(),
|
|
"join_role" => $this->getJoinRole(),
|
|
"role_type" => $this->getRoleType(),
|
|
"necessary" => $this->getNecessary(),
|
|
"creator" => $this->getCreator(),
|
|
"error_info" => $this->getErrorInfo(),
|
|
"create_code" => $this->getCreateCode(),
|
|
"wf_condition" => $this->getWfCondition(),
|
|
"remark" => $this->getRemark()
|
|
), $where);
|
|
}
|
|
|
|
public function delete()
|
|
{
|
|
DB::query("delete from workflow_task where task_id='" . $this->task_id . "' ", $db = 'default');
|
|
}
|
|
|
|
function parseRole()
|
|
{
|
|
$function = "_roleIs" . $this->getRoleType();
|
|
if (!method_exists('NodeTask', $function)) {
|
|
return self::processUndefined($function);
|
|
}
|
|
return $this->$function();
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getCreator()
|
|
{
|
|
return $this->creator;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $creator
|
|
* @return NodeTask
|
|
*/
|
|
public function setCreator($creator)
|
|
{
|
|
$this->creator = $creator;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getCreateCode()
|
|
{
|
|
return $this->create_code;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $create_code
|
|
* @return NodeTask
|
|
*/
|
|
public function setCreateCode($create_code)
|
|
{
|
|
$this->create_code = $create_code;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getWfCondition()
|
|
{
|
|
return $this->wf_condition;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $condition
|
|
* @return NodeTask
|
|
*/
|
|
public function setWfCondition($condition)
|
|
{
|
|
$this->wf_condition = $condition;
|
|
return $this;
|
|
}
|
|
|
|
private function _roleIsString()
|
|
{
|
|
#以下为专人
|
|
$strAssign = $this->getJoinRole();
|
|
$assignEmps = array();
|
|
$arr_a = explode('|', $strAssign);
|
|
foreach ($arr_a as $key => $value) {
|
|
if (empty($value)) {
|
|
continue;
|
|
}
|
|
$arr_b = explode(':', $value);
|
|
$val = explode('-', $arr_b[0]);
|
|
$arr_c = explode(',', $arr_b[1]);
|
|
$str_next_user = "";
|
|
foreach ($arr_c as $key => $value) {
|
|
if (empty($value)) {
|
|
continue;
|
|
}
|
|
if ($value == '00000') {
|
|
$str_next_user .= '00000' . '-' . "00000,";
|
|
} else {
|
|
$str_next_user .= AssignerStringParser::process($value);
|
|
}
|
|
}
|
|
array_push($assignEmps, array(
|
|
'assign_status' => $val[0], //assign_status
|
|
'assigner_string' => $str_next_user
|
|
));
|
|
}
|
|
return $assignEmps;
|
|
}
|
|
|
|
private function _roleIsSQL()
|
|
{
|
|
return DB::result($this->getJoinRole());
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getTaskId()
|
|
{
|
|
return $this->task_id;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $task_id
|
|
* @return NodeTask
|
|
*/
|
|
public function setTaskId($task_id)
|
|
{
|
|
$this->task_id = $task_id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getTaskType()
|
|
{
|
|
return $this->task_type;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $task_type
|
|
* @return NodeTask
|
|
*/
|
|
public function setTaskType($task_type)
|
|
{
|
|
$this->task_type = $task_type;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFlowCode()
|
|
{
|
|
return $this->flow_code;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $flow_code
|
|
* @return NodeTask
|
|
*/
|
|
public function setFlowCode($flow_code)
|
|
{
|
|
$this->flow_code = $flow_code;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFormKey()
|
|
{
|
|
return $this->form_key;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $form_key
|
|
* @return NodeTask
|
|
*/
|
|
public function setFormKey($form_key)
|
|
{
|
|
$this->form_key = $form_key;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getNecessary()
|
|
{
|
|
return $this->necessary;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $necessary
|
|
* @return NodeTask
|
|
*/
|
|
public function setNecessary($necessary)
|
|
{
|
|
$this->necessary = $necessary;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getCompletionCondition()
|
|
{
|
|
return $this->completion_condition;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $completion_condition
|
|
* @return NodeTask
|
|
*/
|
|
public function setCompletionCondition($completion_condition)
|
|
{
|
|
$this->completion_condition = $completion_condition;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getState()
|
|
{
|
|
return $this->state;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $state
|
|
* @return NodeTask
|
|
*/
|
|
public function setState($state)
|
|
{
|
|
$this->state = $state;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getJoinRole()
|
|
{
|
|
return $this->join_role;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $join_role
|
|
* @return NodeTask
|
|
*/
|
|
public function setJoinRole($join_role)
|
|
{
|
|
$this->join_role = $join_role;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getErrorInfo()
|
|
{
|
|
return $this->error_info;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $error_info
|
|
* @return NodeTask
|
|
*/
|
|
public function setErrorInfo($error_info)
|
|
{
|
|
$this->error_info = $error_info;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getRemark()
|
|
{
|
|
return $this->remark;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $remark
|
|
* @return NodeTask
|
|
*/
|
|
public function setRemark($remark)
|
|
{
|
|
$this->remark = $remark;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getCreateDate()
|
|
{
|
|
return $this->create_date;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $create_date
|
|
* @return NodeTask
|
|
*/
|
|
public function setCreateDate($create_date)
|
|
{
|
|
$this->create_date = $create_date;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getFinishDate()
|
|
{
|
|
return $this->finish_date;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $finish_date
|
|
* @return NodeTask
|
|
*/
|
|
public function setFinishDate($finish_date)
|
|
{
|
|
$this->finish_date = $finish_date;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getPhase()
|
|
{
|
|
return $this->phase;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $phase
|
|
* @return NodeTask
|
|
*/
|
|
public function setPhase($phase)
|
|
{
|
|
$this->phase = $phase;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getRoleType()
|
|
{
|
|
return $this->role_type;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $role_type
|
|
* @return NodeTask
|
|
*/
|
|
public function setRoleType($role_type)
|
|
{
|
|
$this->role_type = $role_type;
|
|
return $this;
|
|
}
|
|
}
|
|
|