国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
任務歷史查詢
1.分析幾張歷史表,查詢某用戶涉及的所有已辦流程實例列表,通過對每個流程實例進行分析。
一種方法是通過jBPM HistoryService歷史服務進行操作(參照用戶手冊5.8. HistoryService歷史服務),
另一種方法是自己編寫HQL語句實現(xiàn)歷史表的查詢。

2.自己設計歷史記錄表,在需要記錄的節(jié)點使用event-listener進行監(jiān)聽,實現(xiàn)記錄。

這里以經(jīng)典的請假為例子。請假成功,人事可以入庫查詢。具體流程如下圖所示
 
leaveListener是一個事件監(jiān)聽,配置在app-service.xml中,方便leave.jpdl.xml進行調(diào)用
App-service.xml代碼
  1. <bean id="leaveListener" class="com.javaeye.oa.web.listener.LeaveListener" >   
  2.         <property name="leaveService" ref="leaveService"/>   
  3. </bean>   
  4. <bean id="leaveService" class="com.javaeye.oa.service.task.impl.LeaveServiceImpl">   
  5. </bean>  
Leave.jpdl.xml代碼
  1. <?xml version="1.0" encoding="UTF-8"?>   
  2.   
  3. <process name="leave" xmlns="http://jbpm.org/4.3/jpdl">   
  •    <start g="201,14,48,48" name="開始">   
  •       <transition g="-42,-10" name="請假" to="填寫請假單"/>   
  •    </start>   
  •    <task assignee="#{applyName}" g="178,87,92,52" name="填寫請假單">   
  •       <transition g="-97,2" name="判斷是不是經(jīng)理" to="是不是經(jīng)理"/>   
  •    </task>   
  •    <decision expr="#{manager}" g="204,158,48,48" name="是不是經(jīng)理">   
  •       <transition g="-23,-11" name="否" to="經(jīng)理審核"/>   
  •       <transition g="14,-11" name="是" to="老板審批"/>   
  •    </decision>   
  •    <task assignee="#{approvingOfficer}" g="103,252,92,52" name="經(jīng)理審核">   
  •       <transition g="150,450:10,-21" name="經(jīng)理批準" to="結束">   
  •             <event-listener expr="#{leaveListener}">   
  •                 <field name="endMsg">   
  •                     <string value="批準請假,人事入庫" />   
  •                 </field>   
  •             </event-listener>   
  •       </transition>   
  •       <transition g="-22,-22" name="請假天數(shù)>3" to="老板審批"/>   
  •       <transition g="-61,-1" name="經(jīng)理不批準" to="終止"/>   
  •       <transition g="149,114:-55,82" name="經(jīng)理駁回" to="填寫請假單"/>   
  •    </task>   
  •    <task assignee="#{approvingOfficer}" g="278,251,92,52" name="老板審批">   
  •       <transition g="326,450:-58,-24" name="老板批準" to="結束">   
  •             <event-listener expr="#{leaveListener}">   
  •                 <field name="endMsg">   
  •                     <string value="批準請假,人事入庫" />   
  •                 </field>   
  •             </event-listener>   
  •       </transition>   
  •       <transition g="7,0" name="老板不批準" to="終止"/>   
  •       <transition g="323,114:13,61" name="老板駁回" to="填寫請假單"/>   
  •    </task>   
  •    <end g="219,429,48,48" name="結束" state="confirm"/>   
  •    <end g="220,360,48,48" name="終止" state="dissent"/>   
  • </process>  

  • applyName、manager、approvingOfficer幾個變量在實際操作中進行設置
    endMsg測試時候使用,實際應用中可以刪除

    當經(jīng)理批準申請或老板批準申請的時候,事件響應,進行請假申請入庫。
    Leavelistener.java代碼

    1. package com.javaeye.oa.web.listener;   
    2.   
    3. import org.jbpm.api.listener.EventListener;   
    4. import org.jbpm.api.listener.EventListenerExecution;   
    5.   
    6. import com.javaeye.oa.entity.task.Leave;   
    7. import com.javaeye.oa.service.task.LeaveService;   
    8.   
    9. public class LeaveListener implements EventListener {   
    10.   
    11.     private static final long serialVersionUID = 7098294717133900660L;   
    12.     private String endMsg;//endMsg測試時候使用,實際應用中可以刪除   
    13.     private LeaveService leaveService;   
    14.        
    15.     public void setEndMsg(String endMsg) {   
    16.         this.endMsg = endMsg;   
    17.     }   
    18.     //leaveService進行set注入   
    19.     public void setLeaveService(LeaveService leaveService) {   
    20.         this.leaveService = leaveService;   
    21.     }   
    22.        
    23.     public void notify(EventListenerExecution execution) throws Exception {   
    24.   
    25.         System.out.println("==============leaveListener:endMsg="+endMsg);   
    26.         String applyName = (String) execution.getVariable("applyName");   
    27.         String leaveDay = (String) execution.getVariable("leaveDay");   
    28.         String applyTime = (String) execution.getVariable("applyTime");   
    29.         String position = (String) execution.getVariable("position");   
    30.         String content = (String) execution.getVariable("content");   
    31.         String approvingOfficer = (String) execution.getVariable("approvingOfficer");   
    32.            
    33.         Leave leave = new Leave();   
    34.         leave.setApplyName(applyName);   
    35.         leave.setApplyTime(applyTime);   
    36.         leave.setApprovingOfficer(approvingOfficer);   
    37.         leave.setContent(content);   
    38.         leave.setPosition(position);   
    39.         leave.setLeaveDay(leaveDay);   
    40.            
    41.         leaveService.addLeave(leave);   
    42.     }   
    43. }  

    Leave.java代碼

    1. package com.javaeye.oa.entity.task;   
    2.   
    3. public class Leave implements java.io.Serializable {   
    4.   
    5.     private static final long serialVersionUID = -3289821345085237147L;   
    6.     private Long id;   
    7.     private String applyName;   
    8.     private String leaveDay;   
    9.     private String position;   
    10.     private String applyTime;   
    11.     private String content;   
    12.     private String approvingOfficer;   
    13.   
    14.     // Constructors   
    15.   
    16.     /** default constructor */   
    17.     public Leave() {   
    18.     }   
    19. ...  

    當一切就緒,我們便開始進行實際操作。
     
     
     
    --------------------------------------------------------------------------------------------------------
    一。員工dylan點擊請假鏈接
    Java代碼
    1. public String leave() {   
    2.   
    3.      Map<String, Object> variables = new HashMap<String, Object>();   
    4.      //applyName對應leave.jpdl.xml中相應變量,這里applyName為dylan   
    5.      variables.put("applyName""dylan");   
    6.      ExecutionService executionService = processEngine.getExecutionService();   
    7.      ProcessInstance processInstance = executionService.startProcessInstanceByKey("leave",variables);   
    8.            
    9.      if (processInstance.isActive("填寫請假單")) {   
    10.          url = "apply";   
    11.      }   
    12.      return url;   
    13. }  

    二。dylan在請假頁面填寫請假申請單

    Apply.jsp代碼
    1. <%@page contentType="text/html;charset=UTF-8" %>   
    2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
  • <html xmlns="http://www.w3.org/1999/xhtml">   
  •     <head>   
  •         <title>填寫申請單</title>   
  •     </head>   
  •     <body>   
  •         <form action="apply.action" method="POST">   
  •           <table width="300" border=1>   
  •             <tr>   
  •               <td><label>申請人</label></td>   
  •               <td><input type="text" value="dylan" name="applyName"></td>   
  •             </tr>   
  •             <tr>   
  •               <td><label>職位</label></td>   
  •               <td><input type="text" value="員工" name="position"></td>   
  •             </tr>   
  •             <tr>   
  •               <td><label>申請時間</label></td>   
  •               <td><input type="text" value="2010-01-10" name="applyTime"></td>   
  •             </tr>   
  •             <tr>   
  •               <td><label>請假天數(shù)</label></td>   
  •               <td><input type="text" value="1" name="leaveDay"></td>   
  •             </tr>   
  •             <tr>   
  •               <td><label>請假原因</label></td>   
  •               <td><textarea name="content" rows=3 cols=200>病假</textarea></td>   
  •             </tr>   
  •             <tr>   
  •               <td><input type="submit" value="申請"></td>   
  •               <td><input type="reset" value="取消"></td>   
  •             </tr>   
  •           </table>   
  •         </form>   
  •     </body>   
  • </html>  
  • 三。dylan填寫完成,提交請假單

    Java代碼
    1. public String apply() {   
    2.         Map<String,Object> variables = new HashMap<String,Object>();   
  •     String applyName = getRequest().getParameter("applyName");   
  •     String applyTime = getRequest().getParameter("applyTime");   
  •     String leaveDay = getRequest().getParameter("leaveDay");   
  •     String content = getRequest().getParameter("content");   
  •     String position = getRequest().getParameter("position");   
  •   
  •     variables.put("applyName", applyName);   
  •     variables.put("applyTime", applyTime);   
  •     variables.put("leaveDay", leaveDay);   
  •     variables.put("content", content);   
  •     variables.put("position", position);   
  •     if (position.trim().equals("經(jīng)理")) {   
  •         variables.put("manager""是");   
  •                 variables.put("approvingOfficer""S老板");   
  •     } else {   
  •         variables.put("manager""否");   
  •                 variables.put("approvingOfficer""T經(jīng)理");   
  •     }   
  •         TaskService taskService = processEngine.getTaskService();   
  •         //dylan即請假啟動的時候applyName的值   
  •     taskList = taskService.findPersonalTasks("dylan");   
  •     task = taskList.get(0);   
  •     taskService.setVariables(task.getId(), variables);   
  •     taskService.completeTask(task.getId());   
  •         return SUCCESS;   
  • }  
  •  四。請假1天,職位為員工,直接經(jīng)理進行審批,審批通過,即入庫
    Java代碼
    1. public String confirm() {   
    2.         Map<String, Object> variables = new HashMap<String, Object>();   
  •         TaskService taskService = processEngine.getTaskService();   
  •         ExecutionService executionService = processEngine   
  •         .getExecutionService();   
  •         task = taskService.getTask(taskId);   
  •         execution = executionService.findExecutionById(task.getExecutionId());   
  •         if (execution.getProcessInstance().isActive("老板審批")) {   
  •             //approvingOfficer如果已存在值,則把之前值覆蓋   
  •             variables.put("approvingOfficer""S老板");   
  •         taskService.completeTask(taskId, "老板批準");   
  •     } else if (execution.getProcessInstance().isActive("經(jīng)理審核")) {   
  •     String variable = (String) taskService.getVariable(taskId, "leaveDay");   
  •          if (Integer.valueOf(variable) > 3) {   
  •             taskService.completeTask(taskId, "請假天數(shù)>3");   
  •          } else {   
  •         taskService.completeTask(taskId, "經(jīng)理批準");   
  •              }   
  •     }   
  •         return SUCCESS;   
  • }  

  • 入庫之后,人事即可對請假情況進行查看考核=。=

     
    本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊舉報
    打開APP,閱讀全文并永久保存 查看更多類似文章
    猜你喜歡
    類似文章
    Activiti流程變量
    CAS自定義客戶端登錄界面
    jbpm - jPDL
    工作流學習---Activiti流程變量五步曲
    SpringBoot整合Flowable快速實現(xiàn)工作流,so easy!
    史上最全的工作流引擎 Activiti 進階學習教程(值得收藏)
    更多類似文章 >>
    生活服務
    分享 收藏 導長圖 關注 下載文章
    綁定賬號成功
    后續(xù)可登錄賬號暢享VIP特權!
    如果VIP功能使用有故障,
    可點擊這里聯(lián)系客服!

    聯(lián)系客服