コード例 #1
0
  public void generarReporteEvaluador() {
    HttpServletRequest request =
        (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();

    ByteArrayOutputStream outReporte = new ByteArrayOutputStream();
    String pathJasperReporte =
        request.getSession().getServletContext().getRealPath("")
            + "/reportesJasper/variables/cuantitativasPorInformacionIes.jasper";

    Map<String, Object> parametrosReporte = new HashMap<>();

    String pathLogo =
        request.getSession().getServletContext().getRealPath("") + "/images/logo_ceaaces.png";
    parametrosReporte.put("par_logo", pathLogo);
    parametrosReporte.put("ies", informacionIesDTO.getIes().getNombre());

    // parametrosReporte.put("SUBREPORT_DIR", request.getSession()
    // .getServletContext().getRealPath("")
    // + "/reportesJasper/mallasGrafico/");
    try {

      JRDataSource dataSourceMallas =
          new JRBeanCollectionDataSource(listaValoresVariablesEvaluador);
      if (dataSourceMallas != null) {
        JRXlsExporter exporter = new JRXlsExporter();
        cargarPropiedadesReporte(exporter);

        JasperPrint jasperPrint =
            JasperFillManager.fillReport(pathJasperReporte, parametrosReporte, dataSourceMallas);
        exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
        exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outReporte));

        exporter.exportReport();
        reporteBytes = outReporte.toByteArray();
      }
    } catch (Exception e) {
      e.printStackTrace();
      JsfUtil.msgError("Error al generar el reporte, comuníquese con el administrador del sistema");
    }
  }
コード例 #2
0
  public void generarValoresInicial() {

    try {
      listaVariablesProceso =
          catalogoServicio.obtenerVariablesProcesoTipo(procesoActual.getId(), "CUANTITATIVA");
      AuditoriaDTO auditoriaDTO = new AuditoriaDTO();
      auditoriaDTO.setFechaModificacion(new Date());
      auditoriaDTO.setUsuarioModificacion(usuario);
      ValorVariableDTO valorVariableDTO = new ValorVariableDTO();
      for (VariableProcesoDTO variableProcesoDTO : listaVariablesProceso) {
        // if (!variableProcesoDTO.getId().equals(30L)) {
        LOG.info("idVAriableProcesoDTO:" + variableProcesoDTO.getId());
        if (variableProcesoDTO.getInforme() != null && variableProcesoDTO.getInforme()) {
          if (variableProcesoDTO.getSqlValorInicial() != null
              || variableProcesoDTO.getSqlListaId() != null
              || variableProcesoDTO.getMuestraEstratificada()) {
            // ESTUDIANTES
            if (variableProcesoDTO.getVariableDTO().getVariableGrupoDTO() != null) {
              if (GrupoVariableEnum.GRADUADOS
                      .getValue()
                      .equals(
                          variableProcesoDTO.getVariableDTO().getVariableGrupoDTO().getNemonico())
                  && GrupoVariableEnum.ESTUDIANTES
                      .getValue()
                      .equals(
                          variableProcesoDTO
                              .getVariableDTO()
                              .getVariableGrupoDTO()
                              .getNemonico())) {
                continue;
              }
            }

            if (variableProcesoDTO.getMuestraEstratificada()) {
              List<VariableProcesoDTO> variablesHijas =
                  catalogoServicio.obtenerVariablesHijas(variableProcesoDTO.getId());
              boolean estudiantes = false;
              for (VariableProcesoDTO varProcesoDTO : variablesHijas) {
                if (GrupoVariableEnum.ESTUDIANTES
                    .getValue()
                    .equals(varProcesoDTO.getVariableDTO().getVariableGrupoDTO().getNemonico())) {
                  estudiantes = true;
                  break;
                }
              }
              if (estudiantes) {
                continue;
              }
              List<ValorVariableDTO> resultado =
                  evaluacionServicio.obtenerValorVariableMuestraEstratificada(
                      variableProcesoDTO,
                      variablesHijas,
                      this.informacionIesDTO.getId(),
                      auditoriaDTO,
                      faseIesDTO);
              listaValoresVariablesEvaluador.addAll(resultado);

            } else if (variableProcesoDTO.getVariablePadreDTO() == null) {

              valorVariableDTO =
                  evaluacionServicio.calcularValorVariableYMuestra(
                      variableProcesoDTO, informacionIesDTO.getId(), faseIesDTO, auditoriaDTO);

            } else {
              if (variableProcesoDTO.getVariablePadreDTO().getId() != null) {
                continue;
              }
            }
            // if
            // (variableProcesoDTO.getMuestraEvidencia())
            // {

            // } else {
            // valorVariableDTO = evaluacionServicio
            // .obtenerValorVariable(
            // variableProcesoDTO,
            // faseIesDTO,
            // informacionIesDTO.getId(),
            // auditoriaDTO);
            // }
            listaValoresVariablesEvaluador.add(valorVariableDTO);

          } else {
            valorVariableDTO = new ValorVariableDTO();
            valorVariableDTO.setValorInicial("0");
            valorVariableDTO.setIdInformacionIes(informacionIesDTO.getId());
            valorVariableDTO.setActivo(true);
            valorVariableDTO.setFaseIesDTO(faseIesDTO);
            valorVariableDTO.setVariableProcesoDTO(variableProcesoDTO);
            valorVariableDTO.setAuditoriaDTO(auditoriaDTO);
            valorVariableDTO.setValor("0");
            valorVariableDTO.setValorVerificado(0.0);
            valorVariableDTO.setRegistrosNoAceptados(0);
            valorVariableDTO = evaluacionServicio.registrarValorVariable(valorVariableDTO);
            listaValoresVariablesEvaluador.add(valorVariableDTO);
          }
        }
      }
      listaValoresVariablesEvaluador.addAll(
          evaluacionServicio.obtenerInformacionVariables(
              GrupoVariableEnum.ESTUDIANTES.getValue(),
              informacionIesDTO.getIes().getId(),
              TipoVariableEnum.CUANTITATIVA.getValue(),
              null));
      // }
    } catch (ServicioException e) {
      e.printStackTrace();
      JsfUtil.msgError("Error al obtener datos de variables. Comuníquese con el administrador.");
    } catch (Exception e) {
      e.printStackTrace();
      JsfUtil.msgError("Error al obtener datos de variables. Comuníquese con el administrador.");
    }
  }