caseworkflowhelper.java

来自「公司自己开发的工作流引擎」· Java 代码 · 共 457 行 · 第 1/2 页

JAVA
457
字号
   */
  public NextActivityInfo getCurrentWorkitemInfo(HttpServletRequest request)
      throws Exception{
    //取得工作项id
    String workItemId=request.getParameter("work_item_id");
    if(workItemId==null||workItemId.equals("")){
      throw new WorkItemEmptyException("工作项id为空");
    }
    //取得当前及下一活动信息
    WorkflowHelper helper=new WorkflowHelper();
    //返回活动节点的对象NextActivityInfod对象(根据userinfo和工作项的ID:workItemID查询)
    return helper.getNextActivityInfo(userInfo,Long.parseLong(workItemId));
  }

  /**
   * 取得已经选中的流向的参与者信息
   * @param request HttpServletRequest
   * @return List 返回由Activity组成的list
   */
  private List getActivityParticipator(HttpServletRequest request)
      throws Exception{
    //取得用户信息
    HttpSession session=request.getSession(false);
    UserInfo userInfo=(UserInfo)session.getAttribute(FlowWebKeys.USER_SESSION);
    //取得工作项id
    String workItemId=request.getParameter("work_item_id");
    if(workItemId==null||workItemId.equals("")){
      throw new WorkItemEmptyException("工作项id为空");
    }
    //取得当前及下一活动信息
    WorkflowHelper helper=new WorkflowHelper();
    NextActivityInfo nextActInfo=helper.getNextActivityInfo(userInfo,
        Long.parseLong(workItemId));

    //取得参与者
    ParseRquestParameter parseParam=new ParseRquestParameter();
    List actParticipator=parseParam.getActivityParticipator(request,nextActInfo);
    return actParticipator;
  }

  /**
   * 分案中取得已经选中的参与者所在的部门id
   * @param request HttpServletRequest
   * @return String 部门id
   */
  public String getCaseActorOrgId(HttpServletRequest request)
      throws Exception{
    logger.info("begin getCaseActorOrgId...");
    String orgId="";
    List actList=getActivityParticipator(request);
    if(actList!=null&&actList.size()>0){
      Activity act=(Activity)actList.get(0);
      List prtiList=act.getParticipatorList();
      if(prtiList!=null&&prtiList.size()>0){
        Participator prti=(Participator)prtiList.get(0);
        orgId=prti.getOrgId();
      }
    }
    return orgId;
  }

  /**
   * 启动流程时暂存工作流。创建工作流后对工作流进行保存,将业务与工作流建立起关联
   * @param wfProInfo 工作流处理信息对象
   * @param businessId 业务id
   * @throws Exception
   */
  public void newAndSaveWorkflow(WorkflowProcessInfo wfProInfo,
      String businessId)
      throws Exception{
    if(wfProInfo.getStartWorkflowTag()!=null&&
        wfProInfo.getStartWorkflowTag().equals("0")&&wfProInfo.getAidSubflowTag()!=null&&
        wfProInfo.getAidSubflowTag().equals("0")){
      logger.info("is not new workflow.");
      return;
    }
    if(businessId==null||businessId.equals("")){
      throw new UserInfoEmptyException("业务id为空。");
    }

    WorkflowHelper helper=new WorkflowHelper();
    helper.newAndSaveWorkflow(wfProInfo,businessId);

  }

  /**
   * 启动流程时暂存工作流(系列案专用)
   * @param request HttpServletRequest http请求
   * @param registerIds String[] 多个案件登记号
   */
  public void newAndSaveWorkflowBySeriesCase(HttpServletRequest request,
      String[] registerIds)
      throws Exception{
    logger.info("begin newAndSaveWorkflowBySeriesCase...");
    long startTime=System.currentTimeMillis();
    if(registerIds!=null&&registerIds.length>0){
      //保存第一条记录
      ////// this.newAndSaveWorkflow(request,registerIds[0]);
      //创建线程保存其他记录
      if(registerIds.length>1){
        HttpSession session=request.getSession(false);
        UserInfo userInfo=(UserInfo)session.getAttribute(FlowWebKeys.
            USER_SESSION);
        String workitemId=request.getParameter("work_item_id");
        WorkflowHelper helper=new WorkflowHelper();
        NextActivityInfo nextActInfo=helper.getNextActivityInfo(userInfo,
            Long.parseLong(workitemId));
        SeriesCaseTempThread thread1=new SeriesCaseTempThread(userInfo,
            nextActInfo,registerIds);
        thread1.start();
      }
    }
    logger.info("Execution newAndSaveWorkflowBySeriesCase time: "+
        (System.currentTimeMillis()-startTime)+" ms.");
  }

  /**
   * 往时效监控表中增加自动撤诉监控信息
   * @param request HttpServletRequest http请求
   * @param startDate Date 开始时间(调解成功日期)
   * @param caseRegisterId String 申诉登记号
   * @param countDate int 规定的时限
   */
  public void insertAutoRecallSuitInfo(HttpServletRequest request,
      java.sql.Date startDate,String caseRegisterId,int countDate)
      throws Exception{

  }

  /**
   * 根据用户(所在行政区)取得案件移交的交接部门
   * @param userInfo UserInfo
   * @return List 返回由LaOrganization组成的list
   */
  public List queryCaseConnectOrganization(UserInfo userInfo)
      throws Exception{
    logger.info("begin queryCaseConnectOrganization...");
    String areaId="";
    if(userInfo.getLaAreaList()!=null&&userInfo.getLaAreaList().size()>0){
      //暂时取得第一个分区
      areaId=((WfArea)userInfo.getLaAreaList().get(0)).getAreaId();
    }
    else{
      logger.debug("areaId is null...");
      return null;
    }
    WorkflowHelper helper=new WorkflowHelper();
    WfOrganization org=new WfOrganization();
    org.setOrgCode("SHEN_LI");
    org.setAreaId(areaId);
    return helper.queryOrgnization(org);
  }

  public boolean getWorkItemHasForwardPrivilege(long workItemId)
      throws Exception{
    long startTime=System.currentTimeMillis();

    WorkflowEJBHandle handle=new WorkflowEJBHandle();
    EngineEJB ejb=handle.getEngineEJB();

    boolean hasPrivilege=ejb.getWorkItemHasForwardPrivilege(workItemId);
    logger.info("Execution getWorkItemHasForwardPrivilege time:"+
        (System.currentTimeMillis()-startTime)+" ms.");

    return hasPrivilege;
  }

  public void reassignWorkitem(long workitemId,String newExecutor,
      UserInfo userInfo)
      throws Exception{
    long startTime=System.currentTimeMillis();

    WorkflowEJBHandle handle=new WorkflowEJBHandle();
    EngineEJB ejb=handle.getEngineEJB();
    ejb.reassignWorkitem(workitemId,newExecutor,userInfo);

    logger.info("Execution reassignWorkitem cost time:"+
        (System.currentTimeMillis()-startTime)+" ms.");
  }

  public List getAllProcess()
      throws Exception{
    long startTime=System.currentTimeMillis();

    WorkflowEJBHandle handle=new WorkflowEJBHandle();
    EngineEJB ejb=handle.getEngineEJB();
    List processList=ejb.getAllProcess();

    logger.info("Execution reassignWorkitem cost time:"+
        (System.currentTimeMillis()-startTime)+" ms.");

    return processList;
  }

  public int getSignInVar(long actId)
      throws Exception{
    long startTime=System.currentTimeMillis();

    WorkflowEJBHandle handle=new WorkflowEJBHandle();
    EngineEJB ejb=handle.getEngineEJB();
    int signInVar=ejb.getSignInVar(actId);

    logger.info("Execution getSignInVar cost time:"+
        (System.currentTimeMillis()-startTime)+" ms.");

    return signInVar;
  }

  /**
   * 人工修改工作项的属性值
   *
   * @param workitemId long        工作项ID
   * @param vars ActivityVariable[]将要修改的属性数组
   * @throws Exception
   */
  public void updateWorkitemReleData(long workitemId,ActivityVariable[] vars)
      throws Exception{
    long startTime=System.currentTimeMillis();

    WorkflowEJBHandle handle=new WorkflowEJBHandle();
    EngineEJB ejb=handle.getEngineEJB();
    ejb.updateWorkitemReleData(workitemId,vars,userInfo);

    logger.info("Execution updateWorkitemReleDate cost time:"+
        (System.currentTimeMillis()-startTime)+" ms.");
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?