/**
   * Do obtiene Fecha branch.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doObtieneFechaBranch(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    String branch = request.getParameter("branch");

    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    final ReporteConciliacionService service =
        (ReporteConciliacionService)
            getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);
    form.setFechaBranch(formateaFechaBranch(service.getFechaBranch(branch)));
    res.setResponseError(null);
    res.setResponseContent(jsonize(form));

    res.commit();

    return null;
  }
  /**
   * Do ini reporte conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doIniReporteConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;

    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    final ReporteConciliacionService service =
        (ReporteConciliacionService)
            getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);
    form = service.datosIniciales();
    res.setResponseError(null);
    res.setResponseContent(jsonize(form));

    res.commit();

    return null;
  }
  /**
   * Do ini editar conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doIniEditarConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    int registro = Integer.parseInt(request.getParameter("registro"));
    final Boolean repBoletas =
        (request.getParameter(REP_BOLETAS) == null)
            ? false
            : Boolean.parseBoolean(request.getParameter(REP_BOLETAS));
    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    SantanderSecurityContext sc = null;
    try {
      sc = getSecurityContext(request);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      throw new FrontClientException(GralErrorKeys.PPINV_ERR_GRAL.toString(), e);
    }
    String perfilOper = sc.getPrivilegiosUsuario().getPrivilegiosPerfil().getPerfil().getNombre();
    final ReporteConciliacionService service =
        (ReporteConciliacionService)
            getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);

    String errorValida = "";

    if ("TOTALTOTAL".equals(perfilOper.toUpperCase().trim())
        || "FCADMIN".equals(perfilOper.toUpperCase().trim())
        || "FCPROMOTORBP".equals(perfilOper.toUpperCase().trim())) {
      errorValida = service.validaEditarConciliacion(form, registro, repBoletas);
    } else {
      errorValida = ConciliaErrorKeys.PPINV_ERR_CONCILIACION_EDICION_DENEGADA.toString();
    }

    if ("".equals(errorValida)) {
      form = service.obtieneDatosEditarConciliacion(form, registro, repBoletas);
      res.setResponseError(null);
      res.setResponseContent(jsonize(form));
    } else {
      res.setResponseError(errorValida);
    }

    res.commit();

    return null;
  }
Example #4
0
  public final ActionForward doObtieneDatosContrato(
      final ActionMapping mapping,
      final ActionForm form,
      final HttpServletRequest request,
      final HttpServletResponse response) {
    SantanderSecurityContext sc;
    try {
      sc = getSecurityContext(request);
    } catch (Exception e) {
      sc = null;
      e.printStackTrace();
    }
    log.debug("Inicia - doObtieneDatosContrato();");
    BeneficiariosForm bean;
    if (form instanceof BeneficiariosForm) {
      bean = (BeneficiariosForm) form;
    } else {
      bean = new BeneficiariosForm();
    }
    bean.init();
    PseudoResponse resp = new PseudoResponse(request, response);

    BeneficiariosService service =
        (BeneficiariosService) getWebApplicationContext().getBean(BENEFICIARIOS_SERVICE_REF);

    String contratoHardCode = "42572"; // TODO eliminarLinea
    bean.setMensajeError(service.validarContrato(contratoHardCode));
    if (bean.getMensajeError().length() > 0) {
      // TODO error
    } else {
      bean.setDatosContrato(service.obtenerDatosContrato(contratoHardCode, sc));
      bean.setListaBeneficiarios(service.obtenerListaBeneficiarios(contratoHardCode, sc));
      resp.setResponseError(null);
      resp.setResponseContent(jsonize(bean));
      try {
        resp.commit();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return null;
  }
  /**
   * Do pagina primera.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doPaginaPrimera(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    String error = "";
    int pagActual = Integer.parseInt(request.getParameter(PAG_ACTUAL));
    final Boolean repBoletas =
        (request.getParameter(REP_BOLETAS) == null)
            ? false
            : Boolean.parseBoolean(request.getParameter(REP_BOLETAS));
    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    try {
      final ReporteConciliacionService service =
          (ReporteConciliacionService)
              getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);

      if (form.getPaginacion() == null) {
        form = new ReporteConciliacionForm();
        error = ConciliaErrorKeys.PPINV_ERR_CONCILIACION_CONSULTA_REPORTE.toString();
        res.setResponseContent(jsonize(form));
      }

      if ("".equals(error)) {
        form = service.consultaOperConciliacion(form, "paginaPrimera", pagActual, repBoletas);
        res.setResponseError(null);
        res.setResponseContent(jsonize(form));
      } else {
        res.setResponseError(error);
      }
    } catch (FrontClientException e) {
      LOG.error(e.getMessage(), e);
      res.setResponseError(e.getMessage());
    } catch (BeansException e) {
      LOG.error(e.getMessage(), e);
      res.setResponseError(GralErrorKeys.PPINV_ERR_GRAL.toString());
    } finally {
      res.commit();
    }

    return null;
  }
  /**
   * Llama sp conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward llamaSPConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {
    PseudoResponse res = new PseudoResponse(request, response);
    final String fechaCarga = request.getParameter("fechaCarga");
    if (null != fechaCarga || "".equals(fechaCarga)) {
      try {
        final ReporteConciliacionService service =
            (ReporteConciliacionService)
                getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);
        res.setResponseError(null);
        res.setResponseContent(jsonize(service.llamaSPConciliacion(fechaCarga)));
      } catch (FrontClientException e) {
        res.setResponseError(e.getMessage());
      }
    } else {
      res.setResponseError("Error al ejecutar proceso de ConciliaciĆ³n");
    }
    res.commit();

    return null;
  }
  /**
   * Do limpia conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doLimpiaConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;

    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    form.reiniciaForm();
    res.setResponseError(null);
    res.setResponseContent(jsonize(form));
    res.commit();

    return null;
  }
  /**
   * Do consulta reporte conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doConsultaReporteConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    final Boolean repBoletas =
        (request.getParameter(REP_BOLETAS) == null)
            ? false
            : Boolean.parseBoolean(request.getParameter(REP_BOLETAS));

    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    final ReporteConciliacionService service =
        (ReporteConciliacionService)
            getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);
    String errorFechas = validaFechas(form.getFechaIni(), form.getFehcaFin(), form.isHistorico());
    if ("".equals(errorFechas)) {
      form = service.consultaOperConciliacion(form, "paginaPrimera", 1, repBoletas);
      res.setResponseError(null);
      res.setResponseContent(jsonize(form));
    } else {
      res.setResponseError(errorFechas);
    }

    res.commit();

    return null;
  }
  /**
   * Do editar conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doEditarConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    String ejecucionNuevo = request.getParameter("ejecucionNuevo");
    String ejecucionAnterior = request.getParameter("ejecucionAnterior");
    String folioNuevo = request.getParameter("folioNuevo");
    String folioAnterior = request.getParameter("folioAnterior");
    final Boolean repBoletas =
        (request.getParameter(REP_BOLETAS) == null)
            ? false
            : Boolean.parseBoolean(request.getParameter(REP_BOLETAS));
    boolean isParcialidad = false;
    boolean isParcialidadAnt = false;
    boolean isFondeo = false;
    boolean isFondeoAnt = false;
    String error = "";

    if (TRUE.equals(request.getParameter("isParcialidad").trim())) {
      isParcialidad = true;
    }
    if (TRUE.equals(request.getParameter("isParcialidadAnt").trim())) {
      isParcialidadAnt = true;
    }
    if (TRUE.equals(request.getParameter("isFondeo").trim())) {
      isFondeo = true;
    }
    if (TRUE.equals(request.getParameter("isFondeoAnt").trim())) {
      isFondeoAnt = true;
    }

    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    final ReporteConciliacionService service =
        (ReporteConciliacionService)
            getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);

    if (ejecucionNuevo.trim().equals(ejecucionAnterior.trim())
        && folioNuevo.trim().equals(folioAnterior.trim())
        && isParcialidad == isParcialidadAnt
        && isFondeo == isFondeoAnt) {
      error = ConciliaErrorKeys.PPINV_ERR_CONCILIACION_EDICION_NOCAMBIOS.toString();
    } else if ("".equals(folioNuevo.trim())) {
      error = ConciliaErrorKeys.PPINV_ERR_CONCILIACION_EDICION_FOLIO.toString();
    } else if ("".equals(ejecucionNuevo.trim())) {
      error = ConciliaErrorKeys.PPINV_ERR_CONCILIACION_EDICION_TIPOEJEC.toString();
    }

    if ("".equals(error)) {
      EditarConciliacionForm datosEditConciliacion = form.getDatosEditConciliacion();
      datosEditConciliacion.setFolio(folioNuevo.trim());
      datosEditConciliacion.setFolioAnt(folioAnterior.trim());
      datosEditConciliacion.setEjecucion(ejecucionNuevo.trim());
      datosEditConciliacion.setEjecucionAnt(ejecucionAnterior.trim());
      datosEditConciliacion.setCompraParcial(isParcialidad);
      datosEditConciliacion.setCompraParcialAnt(isParcialidadAnt);
      datosEditConciliacion.setFondeo(isFondeo);
      datosEditConciliacion.setFondeoAnt(isFondeoAnt);

      SantanderSecurityContext sc = null;
      try {
        sc = getSecurityContext(request);
      } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new FrontClientException(GralErrorKeys.PPINV_ERR_GRAL.toString(), e);
      }

      datosEditConciliacion.setMsjRespuesta(
          service.editarConciliacion(datosEditConciliacion, sc, repBoletas));
      res.setResponseError(null);
      res.setResponseContent(jsonize(form));

    } else {
      res.setResponseError(error);
    }
    res.commit();

    return null;
  }