Ejemplo n.º 1
0
  /**
   * MOS native 从sysconfig中取得MOS需要的缓存
   *
   * @return
   * @throws SysException
   * @throws AppException
   */
  public String getSysConfig4MOS() throws SysException, AppException {

    IM4MOSServicesService service = new IM4MOSServicesServiceLocator();
    IM4MOSServices_PortType client = null;
    // String urlStr = "http://127.0.0.1:7001/web/services/";

    String urlStr = "";
    // 如果初始化缓存则使用缓存地址
    if (!StringUtil.isBlank(
            SysConfigData.getSysConfigCurValue(
                SysConstants.SYS_CONFIG_MOS_INIT_CONFIG, null, null, null, null, null))
        && SysConstants.TRUE.equals(
            SysConfigData.getSysConfigCurValue(
                SysConstants.SYS_CONFIG_MOS_INIT_CONFIG, null, null, null, null, null))) {
      urlStr =
          SysConfigData.getSysConfigCurValue(
              SysConstants.SYS_CONFIG_MOS_LOCAL_SERVER_ADDR, null, null, null, null, null);
    } else {
      // 没有初始化则使用常量
      urlStr = SysConstants.MOS_SELF_SERVER_ADDR_FOR_ACTION;
    }

    //		String urlStr = SysConfigData.getSysConfigCurValue(
    //				SysConstants.SYS_CONFIG_MOS_SERVER_ADDR, null, null, null,
    //				null, null);
    urlStr = urlStr + "IM4MOSServices";
    URL url;
    String vesion = null;
    try {
      url = new URL(urlStr);
      client = service.getIM4MOSServices(url);
      vesion =
          client.svcCallIOMByMosNative(SysConstants.SYS_CONFIG_MOS_QUERY_SYS_CONFIG, null, null);
    } catch (RemoteException e) {
      throw new AppException("", "调用远程webservice方法失败!");
    } catch (MalformedURLException e1) {
      throw new AppException("", "调用远程webservice方法失败!");
    } catch (ServiceException e) {
      throw new AppException("", "调用远程webservice方法失败!");
    }
    log.debug("client: " + client);

    if (StringUtil.isExcetionInfo(vesion)) {
      throw new AppException("", "调用远程webservice方法失败!" + StringUtil.getExcetionInfo(vesion));
    }

    return vesion;
  }
Ejemplo n.º 2
0
  public String resChange(String paramStr) throws AppException, SysException {
    String urlStr = "";
    try {
      RmsServiceForMos service = new RmsServiceForMosLocator();
      RmsServiceForMosDelegate client = null;

      // 如果初始化缓存则使用缓存地址
      if (!StringUtil.isBlank(
              SysConfigData.getSysConfigCurValue(
                  SysConstants.SYS_CONFIG_MOS_INIT_CONFIG, null, null, null, null, null))
          && SysConstants.TRUE.equals(
              SysConfigData.getSysConfigCurValue(
                  SysConstants.SYS_CONFIG_MOS_INIT_CONFIG, null, null, null, null, null))) {
        urlStr =
            SysConfigData.getSysConfigCurValue(
                SysConstants.SYS_CONFIG_MOS_SERVER_ADDR, null, null, null, null, null);
      } else {
        // 没有初始化则使用常量
        urlStr = SysConstants.MOS_SERVER_ADDR_FOR_ACTION;
      }

      URL url = new URL(urlStr);
      client = service.getRmsServiceForMosPort(url);
      String mosCallLog = client.resChange(paramStr);
      return mosCallLog;
    } catch (RemoteException e) {
      throw new AppException("", "调用远程webservice方法失败!" + urlStr + e.getMessage());
    } catch (MalformedURLException e) {
      log.info(e.toString());
      throw new AppException("", "webserviceURL地址错误!" + urlStr + e.getMessage());
    } catch (ServiceException e) {
      log.info(e.toString());
      throw new AppException("", "调用远程webservice方法失败!" + urlStr + e.getMessage());
    }
  }
Ejemplo n.º 3
0
  public String queryDevice(String paramStr) throws AppException, SysException {
    String urlStr = "";
    try {
      RmsServiceForMos service = new RmsServiceForMosLocator();
      RmsServiceForMosDelegate client = null;
      // String urlStr = SysConfigData.getSysConfigCurValue(
      // SysConstants.SYS_CONFIG_MOS_SERVER_ADDR, null, null, null,
      // null, null);

      // 如果初始化缓存则使用缓存地址
      if (!StringUtil.isBlank(
              SysConfigData.getSysConfigCurValue(
                  SysConstants.SYS_CONFIG_MOS_INIT_CONFIG, null, null, null, null, null))
          && SysConstants.TRUE.equals(
              SysConfigData.getSysConfigCurValue(
                  SysConstants.SYS_CONFIG_MOS_INIT_CONFIG, null, null, null, null, null))) {
        urlStr =
            SysConfigData.getSysConfigCurValue(
                SysConstants.SYS_CONFIG_MOS_SERVER_ADDR, null, null, null, null, null);
      } else {
        // 没有初始化则使用常量
        urlStr = SysConstants.MOS_SERVER_ADDR_FOR_ACTION;
      }

      // String urlStr = SysConstants.SYS_CONFIG_MOS_SERVER_ADDR;
      //			urlStr = "http://10.22.1.41:8080/trms/services/RmsForMosService";
      URL url = new URL(urlStr);
      client = service.getRmsServiceForMosPort(url);
      String mosLoginRep = client.deviceQuery(paramStr);

      return mosLoginRep;
    } catch (RemoteException e) {
      throw new AppException("", "调用远程webservice方法失败!" + urlStr + e.getMessage());
    } catch (MalformedURLException e) {
      log.info(e.toString());
      throw new AppException("", "webserviceURL地址错误!" + urlStr + e.getMessage());
    } catch (ServiceException e) {
      log.info(e.toString());
      throw new AppException("", "调用远程webservice方法失败!" + urlStr + e.getMessage());
    }
  }
  public PagView findByLocalNet(GenericVO svo, String localNetId, PagInfo pagInfo)
      throws AppException, SysException {
    SysAreaConfigMVO vo = (SysAreaConfigMVO) svo;
    List results = null;
    Sql sql = new Sql("select");
    sql.append(
        " a.SYS_AREA_CONFIG_ID,a.CONFIG_ID,a.SP_AREA_ID,a.CUR_VALUE,a.VALUE_DESC,b.name,b.system_name,b.config_type ");
    sql.append(
        " from SYS_AREA_CONFIG a,sys_config b where 1=1 and a.config_id=b.config_id  and b.config_type='L'");

    //		if (vo.getSysAreaConfigId() != null) {
    //			sql.append(" and a.SYS_AREA_CONFIG_ID=:sysAreaConfigId");
    //			sql.setInteger("sysAreaConfigId", StringUtil.toString(vo.getSysAreaConfigId()).trim());
    //		}

    if (vo.getSysAreaConfigId() != null) {
      sql.append(" and a.SYS_AREA_CONFIG_ID like :sysAreaConfigId");
      sql.setString(
          "sysAreaConfigId", "%" + StringUtil.toString(vo.getSysAreaConfigId()).trim() + "%");
    }

    if (vo.getConfigId() != null) {
      sql.append(" and b.CONFIG_ID like :configId");
      sql.setString("configId", "%" + vo.getConfigId() + "%");
    }
    if (vo.getSpAreaId() != null) {
      sql.append(" and a.SP_AREA_ID=:spAreaId");
      sql.setString("spAreaId", vo.getSpAreaId());
    }
    if (vo.getCurValue() != null) {
      sql.append(" and a.CUR_VALUE=:curValue");
      sql.setString("curValue", vo.getCurValue());
    }
    if (vo.getValueDesc() != null) {
      sql.append(" and a.VALUE_DESC like :valueDesc");
      sql.setString("valueDesc", "%" + vo.getValueDesc() + "%");
    }
    if (vo.getName() != null) {
      sql.append(" and b.name like :name");
      sql.setString("name", "%" + vo.getName() + "%");
    }
    if (vo.getConfigType() != null) {
      sql.append(" and b.config_type=:configType");
      sql.setString("configType", vo.getConfigType());
    }
    if (localNetId != null) {
      sql.append(" and a.sp_area_id=:spId");
      sql.setString("spId", localNetId);
    }
    sql.append(" union select ");
    sql.append(
        " a.SYS_AREA_CONFIG_ID,a.CONFIG_ID,a.SP_AREA_ID,a.CUR_VALUE,a.VALUE_DESC,b.name,b.system_name,b.config_type ");
    sql.append(
        " from SYS_AREA_CONFIG a,sys_config b,AREA C where 1=1 and a.config_id=b.config_id  and b.config_type='A' ");
    sql.append(" and c.area_id=a.sp_area_id and c.sts='A' ");

    //		if (vo.getSysAreaConfigId() != null) {
    //			sql.append(" and a.SYS_AREA_CONFIG_ID=:sysAreaConfigId");
    //			sql.setInteger("sysAreaConfigId", StringUtil.toString(vo.getSysAreaConfigId()).trim());
    //		}

    if (vo.getSysAreaConfigId() != null) {
      sql.append(" and a.SYS_AREA_CONFIG_ID like :sysAreaConfigId");
      sql.setString(
          "sysAreaConfigId", "%" + StringUtil.toString(vo.getSysAreaConfigId()).trim() + "%");
    }

    //		if (vo.getConfigId() != null) {
    //			sql.append(" and a.CONFIG_ID=:configId");
    //			sql.setInteger("configId", vo.getConfigId());
    //		}

    if (vo.getConfigId() != null) {
      sql.append(" and b.CONFIG_ID like :configId");
      sql.setString("configId", "%" + vo.getConfigId() + "%");
    }
    if (vo.getSpAreaId() != null) {
      sql.append(" and a.SP_AREA_ID=:spAreaId");
      sql.setString("spAreaId", vo.getSpAreaId());
    }
    if (vo.getCurValue() != null) {
      sql.append(" and a.CUR_VALUE=:curValue");
      sql.setString("curValue", vo.getCurValue());
    }
    if (vo.getValueDesc() != null) {
      sql.append(" and a.VALUE_DESC like :valueDesc");
      sql.setString("valueDesc", "%" + vo.getValueDesc() + "%");
    }
    if (vo.getName() != null) {
      sql.append(" and b.name like :name");
      sql.setString("name", "%" + vo.getName() + "%");
    }
    if (vo.getConfigType() != null) {
      sql.append(" and b.config_type=:configType");
      sql.setString("configType", vo.getConfigType());
    }
    if (localNetId != null) {
      sql.append(" and c.local_NET_ID=:localNetId");
      sql.setString("localNetId", localNetId);
    }
    sql.append(" union select ");
    sql.append(
        " a.SYS_AREA_CONFIG_ID,a.CONFIG_ID,a.SP_AREA_ID,a.CUR_VALUE,a.VALUE_DESC,b.name,b.system_name,b.config_type ");
    sql.append(
        " from SYS_AREA_CONFIG a,sys_config b,exch c where 1=1 and a.config_id=b.config_id  and b.config_type='A' ");
    sql.append(" and c.exch_id=a.sp_area_id and c.sts='A' ");

    //		if (vo.getSysAreaConfigId() != null) {
    //			sql.append(" and a.SYS_AREA_CONFIG_ID=:sysAreaConfigId");
    //			sql.setInteger("sysAreaConfigId", StringUtil.toString(vo.getSysAreaConfigId()).trim());
    //		}
    if (vo.getSysAreaConfigId() != null) {
      sql.append(" and a.SYS_AREA_CONFIG_ID like :sysAreaConfigId");
      sql.setString(
          "sysAreaConfigId", "%" + StringUtil.toString(vo.getSysAreaConfigId()).trim() + "%");
    }
    //		if (vo.getConfigId() != null) {
    //			sql.append(" and a.CONFIG_ID=:configId");
    //			sql.setInteger("configId", vo.getConfigId());
    //		}
    if (vo.getConfigId() != null) {
      sql.append(" and b.CONFIG_ID like :configId");
      sql.setString("configId", "%" + vo.getConfigId() + "%");
    }
    if (vo.getSpAreaId() != null) {
      sql.append(" and a.SP_AREA_ID=:spAreaId");
      sql.setString("spAreaId", vo.getSpAreaId());
    }
    if (vo.getCurValue() != null) {
      sql.append(" and a.CUR_VALUE=:curValue");
      sql.setString("curValue", vo.getCurValue());
    }
    if (vo.getValueDesc() != null) {
      sql.append(" and a.VALUE_DESC like :valueDesc");
      sql.setString("valueDesc", "%" + vo.getValueDesc() + "%");
    }
    if (vo.getName() != null) {
      sql.append(" and b.name like :name");
      sql.setString("name", "%" + vo.getName() + "%");
    }
    if (vo.getConfigType() != null) {
      sql.append(" and b.config_type=:configType");
      sql.setString("configType", vo.getConfigType());
    }
    if (localNetId != null) {
      sql.append(" and c.local_NET_ID=:localNetId");
      sql.setString("localNetId", localNetId);
    }
    sql.append(" union select ");
    sql.append(
        " a.SYS_AREA_CONFIG_ID,a.CONFIG_ID,a.SP_AREA_ID,a.CUR_VALUE,a.VALUE_DESC,b.name,b.system_name,b.config_type ");
    sql.append(
        " from SYS_AREA_CONFIG a,sys_config b,work_area c where 1=1 and a.config_id=b.config_id  and b.config_type='A' ");
    sql.append(" and c.work_area_id=a.sp_area_id and c.sts='A' ");

    //		if (vo.getSysAreaConfigId() != null) {
    //			sql.append(" and a.SYS_AREA_CONFIG_ID=:sysAreaConfigId");
    //			sql.setInteger("sysAreaConfigId", StringUtil.toString(vo.getSysAreaConfigId()).trim());
    //		}

    if (vo.getSysAreaConfigId() != null) {
      sql.append(" and a.SYS_AREA_CONFIG_ID like :sysAreaConfigId");
      sql.setString(
          "sysAreaConfigId", "%" + StringUtil.toString(vo.getSysAreaConfigId()).trim() + "%");
    }

    //		if (vo.getConfigId() != null) {
    //			sql.append(" and a.CONFIG_ID=:configId");
    //			sql.setInteger("configId", vo.getConfigId());
    //		}
    if (vo.getConfigId() != null) {
      sql.append(" and b.CONFIG_ID like :configId");
      sql.setString("configId", "%" + vo.getConfigId() + "%");
    }
    if (vo.getSpAreaId() != null) {
      sql.append(" and a.SP_AREA_ID=:spAreaId");
      sql.setString("spAreaId", vo.getSpAreaId());
    }
    if (vo.getCurValue() != null) {
      sql.append(" and a.CUR_VALUE=:curValue");
      sql.setString("curValue", vo.getCurValue());
    }
    if (vo.getValueDesc() != null) {
      sql.append(" and a.VALUE_DESC like :valueDesc");
      sql.setString("valueDesc", "%" + vo.getValueDesc() + "%");
    }
    if (vo.getName() != null) {
      sql.append(" and b.name like :name");
      sql.setString("name", "%" + vo.getName() + "%");
    }
    if (vo.getConfigType() != null) {
      sql.append(" and b.config_type=:configType");
      sql.setString("configType", vo.getConfigType());
    }
    if (localNetId != null) {
      sql.append(" and c.local_NET_ID=:localNetId");
      sql.setString("localNetId", localNetId);
    }

    Connection connection = null;
    ResultSet rs = null;
    PagView pagView = null;
    try {
      connection = ConnectionFactory.getConnection();
      sql.logPartition(null, this.getClass());
      pagView = PagUtil.InitPagViewJDBC(connection, sql, pagInfo);
      pagView.getPagCount();
      rs = PagUtil.queryOracle(connection, sql, pagInfo);
      results = (List) ResultSetUtil.convertToList(rs, SysAreaConfigMVO.class);
      pagView.setViewList(results);
    } catch (Exception e) {
      throw new SysException("", "findByVO error..", e);
    } finally {
      try {
        if (rs != null) {
          rs.close();
        }
      } catch (SQLException e) {
      }
    }
    return pagView;
  }