Search in sources :

Example 16 with ConclusaoDTO

use of com.tomasio.projects.trainning.dto.ConclusaoDTO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method findAllConcluidos.

@Override
@Transactional(readOnly = true)
public ConclusaoDTO[] findAllConcluidos(Long[] organizacoesIds, Long capacitacaoId, Long turmaId, Long pessoaId, boolean aproveitamento) {
    ConclusaoDAO dao = factory.getConclusaoDAO();
    ConclusaoDTO[] concluidosArray = null;
    try {
        List<Conclusao> concluidos = dao.findAllConcluidos(organizacoesIds, capacitacaoId, turmaId, pessoaId, aproveitamento);
        concluidosArray = new ConclusaoDTO[concluidos.size()];
        for (int i = 0; i < concluidosArray.length; i++) {
            concluidosArray[i] = concluidos.get(i).createDTO();
        }
        return concluidosArray;
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CertificadoConclusaoDTO(com.tomasio.projects.trainning.dto.CertificadoConclusaoDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) ConclusaoDAO(com.tomasio.projects.trainning.dao.ConclusaoDAO) CertificadoConclusaoDAO(com.tomasio.projects.trainning.dao.CertificadoConclusaoDAO) CertificadoConclusao(com.tomasio.projects.trainning.model.CertificadoConclusao) Conclusao(com.tomasio.projects.trainning.model.Conclusao) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with ConclusaoDTO

use of com.tomasio.projects.trainning.dto.ConclusaoDTO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method createConclusao.

@Override
@Transactional
public void createConclusao(ConclusaoDTO[] conclusoes) {
    ConclusaoDAO dao = factory.getConclusaoDAO();
    List<Conclusao> conclusoesList = new ArrayList<Conclusao>();
    for (ConclusaoDTO conclusao : conclusoes) {
        Conclusao _conclusao = new Conclusao(conclusao);
        conclusoesList.add(_conclusao);
    }
    try {
        dao.create(conclusoesList);
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CertificadoConclusaoDTO(com.tomasio.projects.trainning.dto.CertificadoConclusaoDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) ConclusaoDAO(com.tomasio.projects.trainning.dao.ConclusaoDAO) CertificadoConclusaoDAO(com.tomasio.projects.trainning.dao.CertificadoConclusaoDAO) CertificadoConclusao(com.tomasio.projects.trainning.model.CertificadoConclusao) Conclusao(com.tomasio.projects.trainning.model.Conclusao) ArrayList(java.util.ArrayList) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 18 with ConclusaoDTO

use of com.tomasio.projects.trainning.dto.ConclusaoDTO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method findAllConcluidosTurmasOresp.

@Override
@Transactional(readOnly = true)
public ConclusaoDTO[] findAllConcluidosTurmasOresp(Long organizacaoRespId, Date exercicio, boolean aproveitamento, String searchTerm) {
    ConclusaoDAO dao = factory.getConclusaoDAO();
    ConclusaoDTO[] concluidosArray = null;
    try {
        // busca todas as conclusões das turmas de uma determinada ORESP
        // em um determinado exercício
        List<Conclusao> concluidos = dao.findAllConcluidosTurmasOresp(organizacaoRespId, exercicio, aproveitamento, searchTerm);
        concluidosArray = new ConclusaoDTO[concluidos.size()];
        for (int i = 0; i < concluidosArray.length; i++) {
            concluidosArray[i] = concluidos.get(i).createDTO();
        }
        return concluidosArray;
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CertificadoConclusaoDTO(com.tomasio.projects.trainning.dto.CertificadoConclusaoDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) ConclusaoDAO(com.tomasio.projects.trainning.dao.ConclusaoDAO) CertificadoConclusaoDAO(com.tomasio.projects.trainning.dao.CertificadoConclusaoDAO) CertificadoConclusao(com.tomasio.projects.trainning.model.CertificadoConclusao) Conclusao(com.tomasio.projects.trainning.model.Conclusao) Transactional(org.springframework.transaction.annotation.Transactional)

Example 19 with ConclusaoDTO

use of com.tomasio.projects.trainning.dto.ConclusaoDTO in project trainning by fernandotomasio.

the class EXC014CSV method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    Writer writter = null;
    try {
        writter = new OutputStreamWriter(os, "UTF-8");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(EXC014CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
    BufferedWriter bufferedWriter = new BufferedWriter(writter);
    // recuperar paramentro
    Date exercicio = (Date) params.get("exercicio");
    Long organizacaoId = (Long) params.get("organizacaoId");
    String status = "";
    status += (String) params.get("status");
    String search = "";
    // search += (String) params.get("search");
    List<MatriculaDTO> alunos = new ArrayList<MatriculaDTO>();
    MatriculaDTO[] matriculas = service.findAllMatriculasAlunosDaOM(organizacaoId, exercicio, search);
    alunos.addAll(Arrays.asList(matriculas));
    // verificar se vai filtrar pelo status
    List<MatriculaDTO> alunosFiltrado = new ArrayList<MatriculaDTO>();
    if (status.equals("")) {
        alunosFiltrado.addAll(alunos);
    } else {
        for (MatriculaDTO aluno : alunos) {
            CancelamentoMatriculaDTO cancelada = service.findCancelamentoMatriculaByMatricula(aluno.getId());
            ConclusaoDTO conclusao = service.findConclusaoByMatricula(aluno.getId());
            // se for diferente do status passado não inclui na lista
            switch(status) {
                case "CANCELADO":
                    // preencher o status
                    if (cancelada != null) {
                        // tem cancelamento
                        alunosFiltrado.add(aluno);
                    }
                    break;
                case "APROVADO":
                    if (cancelada == null && conclusao != null && conclusao.isComAproveitamento()) {
                        alunosFiltrado.add(aluno);
                    }
                    break;
                case "DESLIGADO":
                    if (cancelada == null && conclusao != null && !conclusao.isComAproveitamento()) {
                        alunosFiltrado.add(aluno);
                    }
                    break;
                case "CURSANDO":
                    if (cancelada == null && conclusao == null) {
                        // nao tem cancelamento e nem conclusão
                        // em andamento
                        alunosFiltrado.add(aluno);
                    }
                    break;
            }
        }
    }
    for (MatriculaDTO matricula : alunosFiltrado) {
        try {
            OrganizacaoDTO omAlunos = organizationalService.findOrganizacao(organizacaoId);
            TurmaEfetivaDTO turmaEfetiva = service.findTurmaEfetiva(matricula.getTurma().getId());
            OrganizacaoDTO responsavel = organizationalService.findOrganizacao(turmaEfetiva.getResponsavelId());
            CancelamentoMatriculaDTO cancelada = service.findCancelamentoMatriculaByMatricula(matricula.getId());
            ConclusaoDTO conclusao = service.findConclusaoByMatricula(matricula.getId());
            // OM DOS ALUNOS
            bufferedWriter.write(omAlunos.getSigla());
            bufferedWriter.write("|");
            // turma
            String turma = turmaEfetiva.getCurso().getCodigo() + "-" + turmaEfetiva.getNumeroTurma();
            String extra = "";
            // verificar se é extra
            if (turmaEfetiva.isExtra())
                extra = " EXTRA";
            bufferedWriter.write(turma + extra);
            bufferedWriter.write("|");
            // local
            if (turmaEfetiva.getLocal() != null) {
                bufferedWriter.write(turmaEfetiva.getLocal());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            // ORESP
            bufferedWriter.write(responsavel.getSigla());
            bufferedWriter.write("|");
            // dt inicia
            if (turmaEfetiva.getDataInicioFormatted() != null) {
                bufferedWriter.write(turmaEfetiva.getDataInicioFormatted());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            // dt termino
            if (turmaEfetiva.getDataTerminoFormatted() != null) {
                bufferedWriter.write(turmaEfetiva.getDataTerminoFormatted());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            // aluno
            if (matricula.getPessoa().getTargetaCompleta() != null) {
                bufferedWriter.write(matricula.getPessoa().getTargetaCompleta());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            // saram
            if (matricula.getPessoa().getSaram() != null) {
                bufferedWriter.write(matricula.getPessoa().getSaram());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            // STATUS e MOTIVO (caso tenha)
            if (cancelada != null) {
                // status
                bufferedWriter.write("CANCELADO");
                bufferedWriter.write("|");
                // motivo
                if (cancelada.getObservacao() != null) {
                    bufferedWriter.write(cancelada.getObservacao());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write("|");
                // parecer
                bufferedWriter.write("");
                bufferedWriter.write("|");
            } else {
                // verificar se tem conclusão
                if (conclusao != null) {
                    // verificar se é com aproveitamento ou sem
                    if (conclusao.isComAproveitamento()) {
                        // status
                        bufferedWriter.write("APROVADO");
                        bufferedWriter.write("|");
                        // motivo
                        bufferedWriter.write("");
                        bufferedWriter.write("|");
                        // parecer
                        bufferedWriter.write("");
                        bufferedWriter.write("|");
                    } else {
                        // status
                        bufferedWriter.write("DESLIGADO");
                        bufferedWriter.write("|");
                        // motivo
                        if (conclusao.getObservacao() != null) {
                            bufferedWriter.write(conclusao.getObservacao());
                        } else {
                            bufferedWriter.write("");
                            bufferedWriter.write("|");
                        }
                        // parecer
                        if (conclusao.getParecer() != null) {
                            bufferedWriter.write(conclusao.getParecer());
                        } else {
                            bufferedWriter.write("");
                            bufferedWriter.write("|");
                        }
                    }
                } else {
                    // nao tem cancelamento e nem conclusão
                    // em andamento
                    // status
                    bufferedWriter.write("CURSANDO");
                    bufferedWriter.write("|");
                    // motivo
                    bufferedWriter.write("");
                    bufferedWriter.write("|");
                    // parecer
                    bufferedWriter.write("");
                    bufferedWriter.write("|");
                }
            }
            bufferedWriter.newLine();
        } catch (IOException ex) {
            Logger.getLogger(EXC014CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    try {
        bufferedWriter.flush();
        bufferedWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(EXC014CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) ArrayList(java.util.ArrayList) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) Date(java.util.Date) BufferedWriter(java.io.BufferedWriter) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OutputStreamWriter(java.io.OutputStreamWriter) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) BufferedWriter(java.io.BufferedWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Example 20 with ConclusaoDTO

use of com.tomasio.projects.trainning.dto.ConclusaoDTO in project trainning by fernandotomasio.

the class EXC013CSV method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    Writer writter = null;
    try {
        writter = new OutputStreamWriter(os, "UTF-8");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(EXC013CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
    BufferedWriter bufferedWriter = new BufferedWriter(writter);
    // recuperar paramentro
    Date exercicio = (Date) params.get("exercicio");
    Long orespId = (Long) params.get("orespId");
    Boolean comAproveitamento = (Boolean) params.get("comAproveitamento");
    // Recuperar parametro sobre filtro
    String search = "";
    search += (String) params.get("search");
    List<ConclusaoDTO> conclusoes = new ArrayList<ConclusaoDTO>();
    ConclusaoDTO[] concluidos = service.findAllConcluidosTurmasOresp(orespId, exercicio, comAproveitamento, search);
    conclusoes.addAll(Arrays.asList(concluidos));
    for (ConclusaoDTO conclusao : conclusoes) {
        try {
            MatriculaDTO matricula = service.findMatricula(conclusao.getMatricula().getId());
            // ORESP
            OrganizacaoDTO responsavel = organizationalService.findOrganizacao(matricula.getTurma().getResponsavelId());
            bufferedWriter.write(responsavel.getSigla());
            bufferedWriter.write("|");
            String turma = matricula.getTurma().getCurso().getCodigo() + "-" + matricula.getTurma().getNumeroTurma();
            String extra = "";
            // verificar se é extra
            if (matricula.getTurma().isExtra())
                extra = " EXTRA";
            bufferedWriter.write(turma + extra);
            bufferedWriter.write("|");
            if (matricula.getTurma().getLocal() != null) {
                bufferedWriter.write(matricula.getTurma().getLocal());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            if (matricula.getTurma().getDataInicioFormatted() != null) {
                bufferedWriter.write(matricula.getTurma().getDataInicioFormatted());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            if (matricula.getTurma().getDataTerminoFormatted() != null) {
                bufferedWriter.write(matricula.getTurma().getDataTerminoFormatted());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            if (conclusao.getPessoa().getOrganizacao() != null && conclusao.getPessoa().getOrganizacao().getId() != null) {
                OrganizacaoDTO omDoAluno = organizationalService.findOrganizacao(conclusao.getPessoa().getOrganizacao().getId());
                bufferedWriter.write(omDoAluno.getSigla());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            if (conclusao.getPessoa().getTargetaCompleta() != null) {
                bufferedWriter.write(conclusao.getPessoa().getTargetaCompleta());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            if (conclusao.getPessoa().getSaram() != null) {
                bufferedWriter.write(conclusao.getPessoa().getSaram());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            // motivo
            if (conclusao.getObservacao() != null) {
                bufferedWriter.write(conclusao.getObservacao());
            } else {
                bufferedWriter.write("");
            }
            // parecer
            if (conclusao.getParecer() != null) {
                bufferedWriter.write(conclusao.getParecer());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write("|");
            bufferedWriter.newLine();
        } catch (IOException ex) {
            Logger.getLogger(EXC013CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    try {
        bufferedWriter.flush();
        bufferedWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(EXC013CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) ArrayList(java.util.ArrayList) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) Date(java.util.Date) BufferedWriter(java.io.BufferedWriter) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OutputStreamWriter(java.io.OutputStreamWriter) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) BufferedWriter(java.io.BufferedWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Aggregations

ConclusaoDTO (com.tomasio.projects.trainning.dto.ConclusaoDTO)36 ArrayList (java.util.ArrayList)20 CertificadoConclusaoDTO (com.tomasio.projects.trainning.dto.CertificadoConclusaoDTO)18 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)18 CoreException (com.tomasio.projects.trainning.exeption.CoreException)12 HashMap (java.util.HashMap)11 Map (java.util.Map)11 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)10 CancelamentoMatriculaDTO (com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO)9 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)9 SimpleDateFormat (java.text.SimpleDateFormat)9 CertificadoConclusaoDAO (com.tomasio.projects.trainning.dao.CertificadoConclusaoDAO)7 ConclusaoDAO (com.tomasio.projects.trainning.dao.ConclusaoDAO)7 PreMatriculaDTO (com.tomasio.projects.trainning.dto.PreMatriculaDTO)7 DAOException (com.tomasio.projects.trainning.exception.DAOException)7 CertificadoConclusao (com.tomasio.projects.trainning.model.CertificadoConclusao)7 Conclusao (com.tomasio.projects.trainning.model.Conclusao)7 Transactional (org.springframework.transaction.annotation.Transactional)7 NotificacaoMatriculaDTO (com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO)6 List (java.util.List)6