Example #1
0
  public String StCommit(String id) {
    String result = "Y";
    Object operatorID = LfwRuntimeEnvironment.getPkUser();
    DzcgMainAuthority dma = new DzcgMainAuthority();
    String corp = LfwRuntimeEnvironment.getCorp().getUnitcode();

    if (!dma.isExRole("administrator", operatorID.toString())
        && !id.equals(operatorID.toString())) {
      result = "N";
    }
    return result;
  }
Example #2
0
  /**
   * 复写查询表头方法
   *
   * @user zhengcy
   * @datetime 2009-12-9上午09:19:13
   * @see
   *     nc.lfw.billtemplate.delegator.deft.DefaultBusinessDelegator#queryHeadAllData(nc.md.model.IBusinessEntity,
   *     java.lang.String, java.lang.String, nc.lfw.data.PaginationInfo)
   */
  public NCObject[] queryHeadAllData(
      IBusinessEntity headEntity, String strBillType, String strWhere, PaginationInfo info)
      throws BusinessException {
    // 分页用的查询service
    IPageSizeQueryService service = NCLocator.getInstance().lookup(IPageSizeQueryService.class);
    // 合同主键
    String key = "pk_ht_contract";
    // 合同数据库表
    String tableName = "ebs_ht_contract";
    // 调用分页查询Service接口,并将PaginationInfo对象传入
    // key 查询表的主键
    // tableName 查询的表名
    // type SuperVo类名
    // strWhere 查询的条件
    // info dataset分页托管

    Object operatorID = LfwRuntimeEnvironment.getPkUser();
    DzcgMainAuthority dma = new DzcgMainAuthority();
    DzcgMainAuthority dz = new DzcgMainAuthority();
    String corp = LfwRuntimeEnvironment.getCorp().getUnitcode();
    String corpCode = LfwRuntimeEnvironment.getPkCorp();
    if (dz.isExRole(corp + "E058A", operatorID.toString())) {
      strWhere += " and 1=1 ";
    } else if (dz.isExRole(corp + "E058S", operatorID.toString())) {
      strWhere += "  and pk_corp='" + corpCode + "' ";
    } else {
      if (dma.isExRole(
          corp + "MANAGER", operatorID.toString())) // 季凌峰2012/11/22   当为部门头的角色的时候则走此方法
      {
        strWhere +=
            ""
                + (strWhere.trim() == "" ? "" : " and")
                + " ( pk_dept in( "
                + dma.dzcgMainAuthority(operatorID.toString())
                + ") or operatorid = '"
                + operatorID
                + "') ";
      } else {
        strWhere +=
            "" + (strWhere.trim() == "" ? "" : " and") + " operatorid = '" + operatorID + "'";
      }
    }

    if (strWhere != null && "".equals(strWhere.trim())) {

      strWhere =
          "ct_type = "
              + EbsOperaitonConst.OPERATION_STOCK_TYPE_COMMON_CONTRACT
              + " and srcpkcontract is null ";
    } else {

      strWhere +=
          " and ct_type = "
              + EbsOperaitonConst.OPERATION_STOCK_TYPE_COMMON_CONTRACT
              + " and srcpkcontract is null ";
    }

    NCObject[] ncobjects = service.queryWithPage(key, tableName, ContractVO.class, strWhere, info);
    return ncobjects;
    // TODO Auto-generated method stub
    // return super.queryHeadAllData(headEntity, strBillType, strWhere, info);
  }
Example #3
0
  /**
   * 实现通过子表条件查到主表的信息
   *
   * @author liweiqiang 2009-11-11
   */
  public NCObject[] queryHeadAllData(
      IBusinessEntity headEntity, String strBillType, String strWhere, PaginationInfo info)
      throws BusinessException {

    //		// 对子表的Where条件封装处理
    //		if (strWhere != null && strWhere.length() > 0) {
    //			String[] strWhereGroup = strWhere.split("AND");
    //			int forInt = 0;
    //			forInt = strWhereGroup.length;
    //			for (int i = 0; i < forInt; i++) {
    //				if (strWhereGroup[i].indexOf(childTable) > -1) {
    //					String str = strWhereGroup[i];
    //					strWhereGroup[i] = "pk_xq_req_main in (SELECT req_prod_array.pk_xq_req_main "
    //							+ "FROM ebs_xq_req_item_prod as req_prod_array WHERE "
    //							+ str + ")";
    //				}
    //			}
    //
    //			// 重新给WHERE条件赋值
    //			strWhere = "";
    //
    //			for (int i = 0; i < forInt; i++) {
    //				if (i == 0) {
    //					strWhere = " " + strWhereGroup[0];
    //				} else {
    //					strWhere = strWhere + " AND " + strWhereGroup[i];
    //				}
    //			}
    //
    //		}

    // 单行刷新或由待办进入时不走下面的过滤条件 wangyea

    String corp = LfwRuntimeEnvironment.getCorp().getUnitcode();

    // 审批流状态时,为空
    if (info != null) {
      // 在session中获取用户所在部门ID
      Object userDeptID =
          LfwRuntimeEnvironment.getWebContext()
              .getRequest()
              .getSession()
              .getAttribute(LoginSessionConstant.LOGIN_SESSION_USER_DEPT);
      Object operatorID = LfwRuntimeEnvironment.getPkUser();
      DzcgMainAuthority dma = new DzcgMainAuthority();
      if (strWhere == null || strWhere.trim().length() == 0) {
        strWhere = " 1 = 1 ";
      }
      if (dma.isExRole("HQ01ADMIN", operatorID.toString())) {
        strWhere += " and " + " 1 = 1 ";
      } else if (dma.isExRole(
          corp + "MANAGER", operatorID.toString())) // 当为部门头的角色的时候则走此方法   季凌峰2012/11/22
      {
        strWhere +=
            ""
                + (strWhere.trim() == "" ? "" : " and")
                + "( pk_dept in( "
                + dma.dzcgMainAuthority(operatorID.toString())
                + ") or operatorid = '"
                + operatorID
                + "'  )";
      } else {
        strWhere +=
            "" + (strWhere.trim() == "" ? "" : " and") + " operatorid = '" + operatorID + "'";
      }
    }

    // 分页用的查询service
    IPageSizeQueryService service = NCLocator.getInstance().lookup(IPageSizeQueryService.class);

    String key = "pk_xq_req_main";
    String tableName = "ebs_xq_req_main";

    // 调用分页查询Service接口,并将PaginationInfo对象传入
    NCObject[] ncobjects =
        service.queryWithPage(
            key, tableName, ReqMainVO.class, strWhere, info, " order by operatedate desc");

    return ncobjects;
    // return super.queryHeadAllData(headEntity, strBillType, strWhere,
    // info);
  }