コード例 #1
0
  public List<Map<String, String>> doStartFlow(String key, Long[] ids) throws Exception {
    // 声明返回的信息
    List<Map<String, String>> returnValue = new ArrayList<Map<String, String>>();

    Map<String, String> returnMap;

    // 循环Id数组
    for (Long id : ids) {
      returnMap = new HashMap<String, String>();
      Case4InfractBusiness cib = this.caseBusinessDao.load(id);
      // 声明变量
      Map<String, Object> variables = new HashMap<String, Object>();

      // 设置任务能够完成办理的条件控制值                                                    车队长任务
      variables.put("completeTaskCodition", "t020MotorcadeLeaderCheck_s");

      // 发起流程
      String procInstId =
          this.workflowService.startFlowByKey(key, this.returnParam(cib, variables));

      // 完成第一步办理
      Task task = this.taskService.createTaskQuery().processInstanceId(procInstId).singleResult();
      this.workflowService.completeTask(task.getId());
      // 同步附件到第一个任务
      this.syscAttach(cib, procInstId, task.getId());

      // 保存流程与营运违章信息的关系
      WorkflowModuleRelation workflowModuleRelation = new WorkflowModuleRelation();
      workflowModuleRelation.setMid(id);
      workflowModuleRelation.setPid(procInstId);
      workflowModuleRelation.setMtype(Case4InfractBusiness.class.getSimpleName());
      this.workflowModuleRelationService.save(workflowModuleRelation);
      // 将状态更改为处理中
      cib.setStatus(CaseBase.STATUS_HANDLING);
      this.caseBusinessDao.save(cib);

      // 记录发起的流程信息
      returnMap.put("moduleId", String.valueOf(id));
      returnMap.put("procInstId", procInstId);
      returnValue.add(returnMap);
    }

    return returnValue;
  }
コード例 #2
0
  /**
   * 结案操作
   *
   * @param fromBusinessId
   * @param closeDate
   * @return
   */
  public Case4InfractBusiness doCloseFile(Long fromBusinessId, Calendar closeDate) {
    Case4InfractBusiness business = this.caseBusinessDao.load(fromBusinessId);
    if (business == null) throw new CoreException("要处理的营运违章已不存在!businessId=" + fromBusinessId);

    // 更新营运违章相关信息
    business.setStatus(CaseBase.STATUS_CLOSED);

    // 设置创建人信息和最后修改人信息
    SystemContext context = SystemContextHolder.get();
    business.setModifier(context.getUserHistory());
    business.setModifiedDate(Calendar.getInstance());

    // 设置结案人,结案日期
    business.setCloserId(context.getUserHistory().getId());
    business.setCloserName(context.getUserHistory().getName());
    business.setCloseDate(closeDate);

    return this.caseBusinessDao.save(business);
  }