业务用例描述
核心工作流:
1、员工填写请假申请单,包括“请假原因”和“请假天数”,填写后进行提交;
2、部门主管对员工请假申请进行审批,同意员工请假;
3、人力资源主管对员工请假申请进行审批,同意员工请假;
4、系统发送邮件通知员工请假申请已获得批准;
转:http://www.iteye.com/topic/100499
核心工作流:
1、员工填写请假申请单,包括“请假原因”和“请假天数”,填写后进行提交;
2、部门主管对员工请假申请进行审批,同意员工请假;
3、人力资源主管对员工请假申请进行审批,同意员工请假;
4、系统发送邮件通知员工请假申请已获得批准;
5、用例结束;
工作流定义文件说明
依据本业务需求的工作流定义文件如下
定义中包括6个step
step1是员工请假申请的步骤,本步骤的action在执行时将回调业务方法类ApplyFunction,将申请单数据插入到数据库中,同时处理结果将根据请假申请天数dayCount进行判断,如果请假申请天数大于3天,将跳到step2让部门主管审批,如果不大于3天,将直接跳到step3让人力资源主管审批;
step2 是部门主管审批,如果审批同意(opinion!=2)将跳到step3再由人力资源主管审批,如果审批不同意(opinion==2)将跳到step5自动发“申请未批准”邮件通知步骤;
step3 是人力资源主管审批,如果审批同意(opinion!=2)将跳到step4自动发“申请批准”邮件通知步骤,如果审批不同意(opinion==2)将跳到step5自动发“申请未批准”邮件通知步骤;
step4和step5都是自动发送邮件通知步骤,执行完之后跳到空步骤step6结束该工作流实例。
工作流定义文件
- <?xml version="1.0" encoding="GBK"?>
- <!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
- <workflow>
- <initial-actions>
- <action id="100" name="启动请假申请工作流">
- <results>
- <unconditional-result old-status="Finished" status="Underway" step="1"/>
- </results>
- </action>
- </initial-actions>
- <steps>
- <step id="1" name="请假申请">
- <actions>
- <action id="1" name="提交需求申请">
- <restrict-to>
- <conditions type="AND">
- <condition type="class">
- <arg name="class.name">com.opensymphony.workflow.util.OSUserGroupCondition</arg>
- <arg name="group">employee</arg>
- </condition>
- </conditions>
- </restrict-to>
- <pre-functions>
- <function type="class">
- <arg name="class.name">com.qiny.leave.ApplyFunction</arg>
- </function>
- </pre-functions>
- <results>
- <result old-status="Finished" status="Underway" step="2" owner="manager1">
- <conditions type="AND">
- <condition type="beanshell">
- <arg name="script">
- propertySet.getInt("dayCount")>3
- </arg>
- </condition>
- </conditions>
- <post-functions>
- <function type="beanshell">
- <arg name="script">
- System.out.println("步骤 1 提交需求申请 满足条件结果 需部门经理审批...");
- </arg>
- </function>
- </post-functions>
- </result>
- <unconditional-result old-status="Finished" status="Underway" step="3" owner="hr1"/>
- </results>
- </action>
- </actions>
- </step>
- <step id="2" name="请假申请审核">
- <actions>
- <action id="2" name="部门主管审批请假申请">
- <restrict-to>
- <conditions type="AND">
- <condition type="beanshell">
- <arg name="script">true</arg>
- </condition>
- <condition type="class">
- <arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
- <arg name="status">Underway</arg>
- </condition>
- <condition type="class">
- <arg name="class.name">com.opensymphony.workflow.util.OSUserGroupCondition</arg>
- <arg name="group">manager</arg>
- </condition>
- </conditions>
- </restrict-to>
- <pre-functions>
- <function type="class">
- <arg name="class.name">com.qiny.leave.ApproveFunction</arg>
- </function>
- </pre-functions>
- <results>
- <result old-status="Finished" status="Underway" step="5">
- <conditions type="AND">
- <condition type="beanshell">
- <arg name="script">
- propertySet.getInt("opinion")==2
- </arg>
- </condition>
- </conditions>
- <post-functions>
- <function type="beanshell">
- <arg name="script">
- System.out.println("步骤 2 请假申请审核 部门经理审批没有通过 ...");
- </arg>
- </function>
- </post-functions>
- </result>
- <unconditional-result old-status="Finished" status="Underway" step="3" owner="hr1"/>
- </results>
- </action>
- </actions>
- </step>
- <step id="3" name="请假申请审核">
- <actions>
- <action id="3" name="人力资源主管审批请假申请">
- <pre-functions>
- <function type="class">
- <arg name="class.name">com.qiny.leave.ApproveFunction</arg>
- </function>
- </pre-functions>
- <results>
- <result old-status="Finished" status="Underway" step="5">
- <conditions type="AND">
- <condition type="beanshell">
- <arg name="script">
- propertySet.getInt("opinion")==2
- </arg>
- </condition>
- </conditions>
- </result>
- <unconditional-result old-status="Finished" status="Underway" step="5"/>
- </results>
- </action>
- </actions>
- </step>
- <step id="4" name="请假申请结果通知">
- <actions>
- <action id="4" auto="true" name="请假申请获准邮件通知">
- <pre-functions>
- <function type="beanshell">
- <arg name="script">
- System.out.println("步骤 4 自动动作 请假申请获准邮件通知 Send mail 祝贺你$$$$$$$");
- </arg>
- </function>
- </pre-functions>
- <results>
- <unconditional-result old-status="Finished" status="Finished" step="6"/>
- </results>
- </action>
- </actions>
- </step>
- <step id="5" name="请假申请结果通知">
- <actions>
- <action id="5" auto="true" name="请假申请没能获准邮件通知">
- <pre-functions>
- <function type="beanshell">
- <arg name="script">
- System.out.println("步骤 5 自动动作 请假申请没能获准邮件通知 Send mail 很抱歉$$$$$$$");
- </arg>
- </function>
- </pre-functions>
- <results>
- <unconditional-result old-status="Finished" status="Finished" step="6"/>
- </results>
- </action>
- </actions>
- </step>
- <step id="6" name="flow over">
- </step>
- </steps>
- </workflow>
转:http://www.iteye.com/topic/100499