Esempio n. 1
0
  /**
   * Metodo que obtiene la consulta de un fondo de inversión.
   *
   * @param branch Número del branch.
   * @param strDeal Número de operación.
   * @param sc Contexto de seguridad.
   * @return respFondosVO Contiene los datos a mostrar.
   * @throws Exception En caso que ocurra un error.
   */
  public final RespuestaFondosVO consultaFondos(
      final String branch, final String strDeal, final SantanderSecurityContext sc)
      throws Exception {

    RespuestaFondosVO respFondosVO = new RespuestaFondosVO();
    RespuestaFondosVO respDAO = new RespuestaFondosVO();

    respDAO = capturaFondosDAO.consultaFondos(branch, strDeal, sc);

    if (respDAO != null) {

      log.debug("MutFundind " + respDAO.getMutFundind());
      log.debug("Fixincind " + respDAO.getFixincind());
      log.debug("Revdate " + respDAO.getRevDate());
      log.debug("Cuenta " + respDAO.getContrato());

      if (respDAO.getMutFundind().trim().equals("0") || respDAO.getFixincind().trim().equals("1")) {
        log.debug("La operación no es un fondo de inversión.");
        respFondosVO.setError(ErrorKeys.ERR_NO_ES_FONDO_INVERSION);
        return respFondosVO;
      }

      if (respDAO.getRevDate() == null) {
        log.debug("La operacion ha sido cancelada.");
        respFondosVO.setError(ErrorKeys.ERR_OPERACION_CANCELADA);
        return respFondosVO;
      }

      respFondosVO.setOperacion(respDAO.getOperacion().trim());
      respFondosVO.setContrato(respDAO.getContrato().trim());
      respFondosVO.setInstitucion(respDAO.getInstitucion());
      respFondosVO.setMoneda(respDAO.getMoneda().trim());
      respFondosVO.setFechaValor(respDAO.getFechaValor());
      respFondosVO.setMonto(Math.abs(respDAO.getMonto()));
      respFondosVO.setTitulos(Math.abs(respDAO.getTitulos()));
      respFondosVO.setEmisora(respDAO.getEmisora().trim());
      respFondosVO.setCompraVenta(respDAO.getCompraVenta().trim());
      respFondosVO.setBitacora(respDAO.getBitacora().trim());
      respFondosVO.setEjecucion(respDAO.getEjecucion());
      respFondosVO.setFolio(respDAO.getFolio());

      /*
       * Se valida el contrato que se obtuvo en la consulta.
       */
      String ctaContrato = respFondosVO.getContrato();
      String user = sc.getPrivilegiosUsuario().getTrad();

      respFondosVO.setStatus(commonDAO.validaContrato(branch, ctaContrato, user).getStatus());

      return respFondosVO;
    } else {
      respFondosVO.setError(ErrorKeys.ERR_REGISTRO_NO_ENCONTRADO);
      return respFondosVO;
    }
  }
Esempio n. 2
0
  /**
   * Valida la emisora capturada.
   *
   * @param fondosVO Parametros para filtrar la consulta.
   * @throws Exception En caso que ocurra un error.
   */
  public final RespuestaFondosVO validaEmisoras(final ParFondosVO fondosVO) throws Exception {

    RespuestaFondosVO respFondos = new RespuestaFondosVO();
    RespuestaFondosVO respDAOFon = new RespuestaFondosVO();
    Date strFecha = null;
    long interv = 0;

    respDAOFon = capturaFondosDAO.validaEmisora(fondosVO.getEmisora());

    if (respDAOFon.getError() != null) {
      respFondos.setError(ErrorKeys.ERR_EMISORA_INVALIDA);
      return respFondos;
    } else {
      int dias = respDAOFon.getDias();
      DatosTabulares dt = capturaFondosDAO.validaEmisoraFondos(fondosVO);

      Date fechaFormateada = fondosVO.getFechaProc();

      if (!dt.isEmpty()) {
        log.debug("colFsettdate " + dt.get(0, colFsettdate));
        if (dt.get(0, colFsettdate) == null
            || dt.get(0, colFsettdate).toString().trim().length() == 0) {
          if (respDAOFon.getDias() == 0) {
            respFondos.setFechaValor(fechaFormateada);
          } else {
            respFondos.setSettDate(
                commonDAO.sumaDiasHabiles(fechaFormateada, fondosVO.getMoneda().trim(), dias));
            respFondos.setFechaValor(respFondos.getSettDate());
            log.debug("respFondos.getSettDate" + respFondos.getSettDate());
            log.debug("respFondos.getFechaValor" + respFondos.getFechaValor());
          }
        } else {

          strFecha = commonDAO.sumaDiasHabiles(fechaFormateada, fondosVO.getMoneda().trim(), dias);

          if (strFecha == null) {
            strFecha = fondosVO.getFechaProc();
          }

          interv = commonDAO.diffDates(strFecha, (Date) dt.get(0, colFsettdate), "Fondos");

          log.debug("Valor de interv " + interv);

          if (interv < 0) {
            respFondos.setError(ErrorKeys.ERR_FECHA_EMISORA_MAL_ACTUALIZADA);
            return respFondos;
          } else {
            respFondos.setFechaValor((Date) dt.get(0, colFsettdate));
            log.debug("Fecha valor " + respFondos.getFechaValor());
          }
        }
      } else {
        /**
         * Se cambia la validacion de compraVenta a false porque el envio de compra venta se esta
         * haciendo de manera inversa, es decir, cuando es compra se esta enviando en false y venta
         * como true, se modifica aqui la validacion para no afectar otros procedimientos. Error
         * Interno 636
         */
        if (fondosVO.getCompraVenta().trim().equals("false")) {
          respFondos.setError(ErrorKeys.ERR_EMISORA_INVALIDA_SEMF);
        } else {
          respFondos.setError("-20113");
        }
        return respFondos;
      }
      return respFondos;
    }
  }