@SuppressWarnings("unchecked")
  @Override
  public DeptContactMainVo view(String pname, String pincident, DeptContactParamVo params) {

    TDeptContactMain mainBo = new TDeptContactMain();
    DeptContactMainVo mainVo = new DeptContactMainVo();
    mainBo = this.deptContactDao.getMainBo(pname, pincident);
    try {
      BeanUtils.copyProperties(mainVo, mainBo);
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    params.mainBo = mainBo;
    params.treeBo = deptContactDao.getTreeBoByMainBoId(mainBo.getId());

    params.addParam("mainBo.initiatorName", mainBo.getInitiatorName());
    params.addParam("mainBo.createDeptname", mainBo.getCreateDeptname());
    params.addParam("mainBo.serial", deptContactCommonService.getSerialNumberText(mainBo));

    params.addParam(
        DeptContactConstants.PARAMS_KEY_REF_ID,
        deptContactCommonService.getReferenceIds(mainBo.getId()));
    return mainVo;
  }
  /**
   * forward 业务逻辑
   *
   * @param list
   * @param params
   * @return
   */
  private DeptContactMainVo forward(List<Map<String, Object>> list, DeptContactParamVo params) {
    if (list.size() > 0) {
      String id = "";
      Map<String, Object> map = list.get(0);

      String pid = StringUtil.getNotNullValueString(map.get("p_id"));
      String cid = StringUtil.getNotNullValueString(map.get("c_id"));
      String type = StringUtil.getNotNullValueString(map.get("type"));

      // log.debug(pid + "_" +cid + "_"+ type );

      if (type.length() == 0 && cid.length() == 0 && pid.length() == 0) {
        resultInfo.addErrors(DeptContactMessage.CHECK_WRONG_PROCESS_INFO);
      } else {

        String[] c_array =
            new String[] {
              DeptContactConstants.STATUS_MAIN_STR, DeptContactConstants.STATUS_LOWER_STR
            };
        String[] p_array =
            new String[] {
              DeptContactConstants.STATUS_SUB_STR, DeptContactConstants.STATUS_MAIN_BACKSUB_STR
            };

        if (CommonUtil.targetIsInArray(type, c_array)) {
          id = cid;
        } else if (CommonUtil.targetIsInArray(type, p_array)) {
          id = pid;
        } else {
          // log.debug("no type"+type);
        }

        params.addProcessParam(DeptContactConstants.PARAMS_FLOW_TYPE, type);

        if (id.length() == 0) {
          resultInfo.addErrors(DeptContactMessage.CHECK_WRONG_PROCESS_INFO);
        } else {

          try {
            TDeptContactMain mainBo = new TDeptContactMain();
            DeptContactMainVo mainVo = new DeptContactMainVo();

            mainBo = (TDeptContactMain) commonService.load(id, TDeptContactMain.class);

            params.mainBo = mainBo;
            params.treeBo = deptContactDao.getTreeBoByMainBoId(id);

            BeanUtils.copyProperties(mainVo, mainBo);

            params.addParam("mainBo.initiatorName", mainBo.getInitiatorName());
            params.addParam("mainBo.createDeptname", mainBo.getCreateDeptname());
            params.addParam("mainBo.serial", deptContactCommonService.getSerialNumberText(mainBo));

            params.addParam(
                DeptContactConstants.PARAMS_KEY_REF_ID,
                deptContactCommonService.getReferenceIds(mainBo.getId()));

            return mainVo;
          } catch (Exception e) {
            resultInfo.addErrors(DeptContactMessage.CHECK_WRONG_PROCESS_INFO);
          }
        }
      }
    } else {
      resultInfo.addErrors(DeptContactMessage.CHECK_WRONG_PROCESS_INFO);
    }

    return null;
  }