/**
   * 申请节点
   *
   * @param mainVo
   * @param userInfo
   * @param params_dc
   * @throws Exception
   */
  public boolean flowApply() {
    // UserVo userVo = params.userVo;

    String processName = StringUtil.getNotNullValueString(mainBo.getProcessname());
    String incidentNo = StringUtil.getNotNullValueString(mainBo.getIncidentno());
    // String summary = StringUtil.getNotNullValueString(mainBo.getTheme());
    String summary = FlowUtil.getSummaryByProcessInfo(processName, incidentNo);

    Map<String, Object> map = new HashMap<String, Object>();

    String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);

    /** Ultimus签发节点信息 */
    String sign_leader =
        StringUtil.getNotNullValueString(
            params.getParamObject(DeptContactConstants.PARAMS_KEY_SIGN_LEADER));

    // log.debug(params.getParamObject(DeptcontactConstants.PARAMS_KEY_SIGN_LEADER));
    // log.debug("param.size()="+params.param.size());
    // log.debug("sign_leader:"+sign_leader);

    map.put(DeptContactFlowConstants.USER_SIGN, sign_leader);

    /** 签发 */
    if (DeptContactConstants.CHOICE_APPLY_TO_SIGN.equals(operateVo.getChoice())) {
      map.put(DeptContactFlowConstants.TARGET, DeptContactFlowConstants.STEPNAME_SIGN);
    }
    /** 取消 */
    if (DeptContactConstants.CHOICE_APPLY_TO_CANCEL.equals(operateVo.getChoice())) {
      map.put(DeptContactFlowConstants.TARGET, DeptContactFlowConstants.STEPNAME_END);
    }
    /**/
    boolean flag =
        PWSUtil.completeStepTest(
            processName,
            taskUserLoginName,
            Integer.parseInt(incidentNo),
            operateVo.getSteplabel(),
            summary,
            "",
            map);

    return flag;

    // return false;
  }
  @Override
  public void flowStepApply(DeptContactParamVo params) {
    if (resultInfo.getOperateFlag()) {
      String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);
      // mainBo = (TDeptContactMain) params.get("mainBo");
      mainBo = (TDeptContactMain) commonService.load(operateVo.getId(), TDeptContactMain.class);
      params.addProcessParam("cname", mainBo.getProcessname());
      params.addProcessParam("cincident", mainBo.getIncidentno());

      boolean flag = flowApply();

      if (flag) {
        /** 相关资料 */
        params.mainBo = mainBo;
        deptContactCommonService.saveReferences(params);

        /** 取消 */
        if (DeptContactConstants.CHOICE_APPLY_TO_CANCEL.equals(operateVo.getChoice())) {
          mainBo.setRemoved(1);
        }

        /** 更新操作人及更新信息 */
        mainBo.setUpdateTime(time);
        mainBo.setOperateDate(time);
        mainBo.setOperateUser(taskUserLoginName);
        mainBo.setOperateName(userInfo.getUserName());
        commonService.update(mainBo);

        /** 保存意见 */
        deptContactCommonService.saveApprovedInfo(params);

        /** 更新待办事项状态 */
        updateTaskStatus(params.operateVo.getTaskId());

        /** 跳转URL */
        resultInfo.url = TextUtil.generateDeptContactUrl(mainBo, operateVo.getSteplabel());
      } else {
        resultInfo.addErrors(DeptContactMessage.FAIL_TO_COMPLETE_STEP);
        throw new RuntimeException(DeptContactMessage.FAIL_TO_COMPLETE_STEP.textCn);
      }
    }
  }
  /**
   * 签发节点
   *
   * @param mainVo
   * @param userInfo
   * @param params_dc
   * @throws Exception
   */
  public boolean flowSign() {

    String processName = StringUtil.getNotNullValueString(mainBo.getProcessname());
    String incidentNo = StringUtil.getNotNullValueString(mainBo.getIncidentno());
    // String summary = StringUtil.getNotNullValueString(mainBo.getTheme());
    String summary = FlowUtil.getSummaryByProcessInfo(processName, incidentNo);

    Map<String, Object> map = new HashMap<String, Object>();
    String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);

    /** 同意签发 */
    if (DeptContactConstants.CHOICE_SIGN_AGREE.equals(operateVo.getChoice())) {
      map.put(DeptContactFlowConstants.TARGET, DeptContactFlowConstants.STEP_LOWER_SUB);

      /*签发后生成编号*/
      mainBo.setSerial(deptContactCommonService.getNextSerialNumber(mainBo));
    }
    /** 返回修改 */
    if (DeptContactConstants.CHOICE_SIGN_TO_APPLY.equals(operateVo.getChoice())) {
      map.put(DeptContactFlowConstants.TARGET, DeptContactFlowConstants.STEP_APPLY);
    }
    /** 结束下级流程 */
    if (DeptContactConstants.CHOICE_SIGN_FINISH.equals(operateVo.getChoice())) {
      map.put(DeptContactFlowConstants.TARGET, DeptContactFlowConstants.STEP_END);
    }

    // boolean flag = false;

    boolean flag =
        this.launchProcessStep(
            processName,
            taskUserLoginName,
            Integer.parseInt(incidentNo),
            operateVo.getSteplabel(),
            summary,
            "",
            map);

    return flag;
  }
  @Override
  public void flowStepSign(DeptContactParamVo params) {
    if (resultInfo.getOperateFlag()) {
      mainBo = (TDeptContactMain) commonService.load(operateVo.getId(), TDeptContactMain.class);

      // log.debug("id:"+operateVo.getId());
      // log.debug(params);

      params.addProcessParam("cname", mainBo.getProcessname());
      params.addProcessParam("cincident", mainBo.getIncidentno());

      boolean flag = flowSign();

      if (flag) {
        String taskUserLoginName = LoginUtil.getUserLoginName(userInfo);

        /** 更新操作人及更新信息 */
        mainBo.setUpdateTime(time);
        mainBo.setOperateDate(time);
        mainBo.setOperateUser(taskUserLoginName);
        mainBo.setOperateName(userInfo.getUserName());
        commonService.update(mainBo);

        /** 保存意见 */
        deptContactCommonService.saveApprovedInfo(params);

        /** 更新待办事项状态 */
        updateTaskStatus(params.operateVo.getTaskId());

        /** 跳转URL */
        resultInfo.url = TextUtil.generateDeptContactUrl(mainBo, operateVo.getSteplabel());
      } else {
        resultInfo.addErrors(DeptContactMessage.FAIL_TO_COMPLETE_STEP);
        throw new RuntimeException(DeptContactMessage.FAIL_TO_COMPLETE_STEP.textCn);
      }
    }
  }