<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:flowable="http://flowable.org/bpmn"
             typeLanguage="http://www.w3.org/2001/XMLSchema"
             expressionLanguage="http://www.w3.org/1999/XPath"
             targetNamespace="http://www.flowable.org/processdef">

  <process id="asset_return_order" name="还车单审批" isExecutable="true">

    <startEvent id="startEvent" name="开始"/>

    <sequenceFlow sourceRef="startEvent" targetRef="deptManagerApproval"/>

    <!-- 部门主管审批 -->
    <userTask id="deptManagerApproval" name="部门主管审批" flowable:candidateGroups="dept_manager">
      <extensionElements>
        <flowable:formProperty id="approved" name="是否同意" type="boolean" required="true"/>
        <flowable:formProperty id="comment" name="审批意见" type="string"/>
      </extensionElements>
    </userTask>

    <sequenceFlow sourceRef="deptManagerApproval" targetRef="gateway1"/>

    <!-- 网关：判断部门主管是否同意 -->
    <exclusiveGateway id="gateway1"/>

    <sequenceFlow sourceRef="gateway1" targetRef="endEventApprove">
      <conditionExpression xsi:type="tFormalExpression">${approved == true}</conditionExpression>
    </sequenceFlow>

    <sequenceFlow sourceRef="gateway1" targetRef="endEventReject">
      <conditionExpression xsi:type="tFormalExpression">${approved == false}</conditionExpression>
    </sequenceFlow>

    <!-- 审批通过结束 -->
    <endEvent id="endEventApprove" name="审批通过"/>

    <!-- 审批拒绝结束 -->
    <endEvent id="endEventReject" name="审批拒绝"/>

  </process>

</definitions>
