Search in sources :

Example 16 with TurmaDTO

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

the class MainPlanejamentoController method detailTurma.

@RequestMapping("/detail_turma")
public String detailTurma(Model model, WebRequest request) {
    Long turmaPlanejadaId = Long.parseLong(request.getParameter("turmaPlanejadaId"));
    TurmaDTO turma = planningService.findTurma(turmaPlanejadaId);
    model.addAttribute("organizacoes", organizationalService.findAllOrganizacoes());
    model.addAttribute("turma", turma);
    return "planejamento/detail_turma";
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with TurmaDTO

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

the class CommonsController method getTurmaData.

public Map<Object, Object> getTurmaData(SelectTurmaForm form) {
    Map<Object, Object> result = new HashMap<>();
    TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(form.getTurmaId());
    result.put("curso", turma.getCurso().getCodigo());
    result.put("id", turma.getId());
    result.put("numero", turma.getNumeroTurma());
    result.put("periodo", turma.getPeriodoFormatted());
    result.put("cursoId", turma.getCurso().getId());
    return result;
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO)

Example 18 with TurmaDTO

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

the class StatisticalServiceSimpleImpl method getTotalVagas.

@Override
public int getTotalVagas(Long cursoId, Long planejamentoId) {
    TurmaDTO[] turmas = planningService.findAllTurmasPlanejadas(planejamentoId, null, cursoId, null);
    int totalVagas = 0;
    for (TurmaDTO turmaDTO : turmas) {
        totalVagas += turmaDTO.getQuantidadeVagas();
    }
    return totalVagas;
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO)

Example 19 with TurmaDTO

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

the class EXC001IReport method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    document = documentManager.getDocumentPortrait();
    os = documentManager.prepareDocument(document);
    writer = documentManager.getWritter();
    document.open();
    Long turmaId = (Long) params.get("turmaId");
    TurmaDTO turma = service.findTurmaEfetiva(turmaId);
    IndicacaoDTO[] indicacoes = service.findAllIndicacoesAlunos(turmaId);
    try {
        Paragraph p = null;
        p = new Paragraph(ReportUtil.convertEncode(turma.getCurso().getCodigo()) + " - " + ReportUtil.convertEncode(turma.getCurso().getDescricao()), fontManager.getH1Font());
        p.setAlignment(Element.ALIGN_LEFT);
        document.add(p);
        PdfPTable tableIndicacoes = new PdfPTable(4);
        tableIndicacoes.addCell(tableManager.getHeaderCell("Nome"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("Nome de Guerra"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("SARAM"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("CPF"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("Organização"));
        for (IndicacaoDTO indicacao : indicacoes) {
            PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
            String nomeGuerra = pessoa.getNomeGuerra();
            if (nomeGuerra == null) {
                nomeGuerra = "";
            }
            tableIndicacoes.addCell(tableManager.getPhraseCellLeft(pessoa.getTargetaCompleta()));
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(nomeGuerra));
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(pessoa.getSaram()));
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(pessoa.getCpf()));
            OrganizacaoDTO organizacao = organizationalService.findOrganizacao(indicacao.getOrganizacao().getId());
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(organizacao.getSigla()));
        }
        document.add(tableIndicacoes);
    } catch (DocumentException ex) {
        Logger.getLogger(EXC001IReport.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        document.close();
    }
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Paragraph(com.itextpdf.text.Paragraph) PdfPTable(com.itextpdf.text.pdf.PdfPTable) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) DocumentException(com.itextpdf.text.DocumentException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Example 20 with TurmaDTO

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

the class EXC002CSV 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(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
    BufferedWriter bufferedWriter = new BufferedWriter(writter);
    // recuperar paramentro turmaId
    Long turmaId = (Long) params.get("turmaId");
    TurmaDTO turma = service.findTurmaEfetiva(turmaId);
    // Recuperar parametro sobre filtro por status da indicação
    String statusIndicacao = "";
    statusIndicacao += (String) params.get("status");
    if ("CONC".equals(statusIndicacao)) {
        // mostrar conclusoes
        List<ConclusaoDTO> conclusoes = new ArrayList<ConclusaoDTO>();
        ConclusaoDTO[] concluidosComComparecimento = service.findAllConcluidosByTurma(turmaId, true);
        conclusoes.addAll(Arrays.asList(concluidosComComparecimento));
        ConclusaoDTO[] concluidosSemComparecimento = service.findAllConcluidosByTurma(turmaId, false);
        conclusoes.addAll(Arrays.asList(concluidosSemComparecimento));
        for (ConclusaoDTO conclusao : conclusoes) {
            try {
                MatriculaDTO matricula = service.findMatricula(conclusao.getMatricula().getId());
                PessoaDTO pessoa = organizationalService.findPessoa(matricula.getPessoa().getId());
                /*
                     if (apresentacao instanceof ApresentacaoDTO) {
                     bufferedWriter.write("ALUNO");
                     } else {
                     bufferedWriter.write("INSTRUTOR");
                     }
                     */
                bufferedWriter.write("ALUNO");
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getPosto() != null) {
                    bufferedWriter.write(matricula.getPessoa().getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getQuadro() != null) {
                    bufferedWriter.write(matricula.getPessoa().getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getEspecialidade() != null) {
                    bufferedWriter.write(matricula.getPessoa().getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getNome() != null) {
                    bufferedWriter.write(matricula.getPessoa().getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getNomeGuerra() != null) {
                    bufferedWriter.write(matricula.getPessoa().getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getEmail() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getTelefone() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getTelefoneCelular() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getSaram() != null) {
                    bufferedWriter.write(matricula.getPessoa().getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getCpf() != null) {
                    bufferedWriter.write(matricula.getPessoa().getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (conclusao.isComAproveitamento()) {
                    bufferedWriter.write("CONCLUIU COM APROVEITAMENTO");
                } else {
                    bufferedWriter.write("NÃO CONCLUIU");
                }
                bufferedWriter.write(",");
                // obs
                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(",");
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (matricula.getIndicacao().getChefia() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getEmailChefia() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getTelefoneChefia() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (matricula.getIndicacao().getTelefoneOM() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException ex) {
            Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else if ("APRE".equals(statusIndicacao)) {
        // mostrar apenas os apresentados
        List<ApresentacaoDTO> apresentacoes = new ArrayList<ApresentacaoDTO>();
        // IndicacaoDTO[] indicacoesInstrutores = service.findAllIndicacoesInstrutoresSelecionados(turmaId);
        // indicacoes.addAll(Arrays.asList(indicacoesInstrutores));
        ApresentacaoDTO[] indicacoesAlunosApresentados = service.findAllApresentadosByTurmaId(turmaId);
        apresentacoes.addAll(Arrays.asList(indicacoesAlunosApresentados));
        ApresentacaoDTO[] indicacoesAlunosNaoApresentados = service.findAllNaoApresentadosByTurma(turmaId);
        apresentacoes.addAll(Arrays.asList(indicacoesAlunosNaoApresentados));
        for (ApresentacaoDTO apresentacao : apresentacoes) {
            try {
                PessoaDTO pessoa = organizationalService.findPessoa(apresentacao.getMatricula().getPessoa().getId());
                /*
                     if (apresentacao instanceof ApresentacaoDTO) {
                     bufferedWriter.write("ALUNO");
                     } else {
                     bufferedWriter.write("INSTRUTOR");
                     }
                     */
                bufferedWriter.write("ALUNO");
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getPosto() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getQuadro() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getEspecialidade() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getNome() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getNomeGuerra() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getIndicacao().getEmail() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getIndicacao().getTelefone() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getIndicacao().getTelefoneCelular() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getSaram() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getPessoa().getCpf() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getPessoa().getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.isComparecimento()) {
                    bufferedWriter.write("COMPARECEU");
                } else {
                    bufferedWriter.write("NÃO COMPARECEU");
                }
                bufferedWriter.write(",");
                // obs
                if (apresentacao.getObservacao() != null) {
                    bufferedWriter.write(apresentacao.getObservacao());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (apresentacao.getMatricula().getIndicacao().getChefia() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getIndicacao().getEmailChefia() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (apresentacao.getMatricula().getIndicacao().getTelefoneChefia() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (apresentacao.getMatricula().getIndicacao().getTelefoneOM() != null) {
                    bufferedWriter.write(apresentacao.getMatricula().getIndicacao().getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException ex) {
            Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else if ("MTCL".equals(statusIndicacao)) {
        // mostrar apenas os matriculados
        List<MatriculaDTO> matriculas = new ArrayList<MatriculaDTO>();
        MatriculaDTO[] matriculasInstrutores = service.findAllMatriculasInstrutores(turmaId);
        matriculas.addAll(Arrays.asList(matriculasInstrutores));
        MatriculaDTO[] matriculasAlunos = service.findAllMatriculasAlunos(turmaId);
        matriculas.addAll(Arrays.asList(matriculasAlunos));
        for (MatriculaDTO matricula : matriculas) {
            try {
                PessoaDTO pessoa = organizationalService.findPessoa(matricula.getPessoa().getId());
                if (matricula instanceof MatriculaAlunoDTO) {
                    bufferedWriter.write("ALUNO");
                } else {
                    bufferedWriter.write("INSTRUTOR");
                }
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getPosto() != null) {
                    bufferedWriter.write(matricula.getPessoa().getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getQuadro() != null) {
                    bufferedWriter.write(matricula.getPessoa().getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getEspecialidade() != null) {
                    bufferedWriter.write(matricula.getPessoa().getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getNome() != null) {
                    bufferedWriter.write(matricula.getPessoa().getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getNomeGuerra() != null) {
                    bufferedWriter.write(matricula.getPessoa().getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getEmail() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getTelefone() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getTelefoneCelular() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getSaram() != null) {
                    bufferedWriter.write(matricula.getPessoa().getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getPessoa().getCpf() != null) {
                    bufferedWriter.write(matricula.getPessoa().getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (matricula.getIndicacao().getStatus() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getStatus());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                CancelamentoMatriculaDTO cancelamento = new CancelamentoMatriculaDTO();
                if (matricula.isCancelada()) {
                    bufferedWriter.write("MATRICULA CANCELADA");
                    // buscar cancelamento
                    cancelamento = service.findCancelamentoMatriculaByMatricula(matricula.getId());
                } else {
                    bufferedWriter.write("MATRICULADO NO CURSO ");
                }
                bufferedWriter.write(",");
                // data cancelameno
                if (matricula.isCancelada()) {
                    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
                    bufferedWriter.write(df.format(cancelamento.getDataCancelamento()));
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // obs cancelamento
                if (matricula.isCancelada()) {
                    bufferedWriter.write(cancelamento.getObservacao());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (matricula.getIndicacao().getChefia() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getEmailChefia() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (matricula.getIndicacao().getTelefoneChefia() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (matricula.getIndicacao().getTelefoneOM() != null) {
                    bufferedWriter.write(matricula.getIndicacao().getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException ex) {
            Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else if ("PRE MTCL".equals(statusIndicacao)) {
        // mostrar apenas os PRE matriculados
        // listar instrutores
        PreMatriculaDTO[] preMatriculasInstrutores = service.findAllPreMatriculasInstrutores(turmaId);
        for (PreMatriculaDTO preMatricula : preMatriculasInstrutores) {
            try {
                PessoaDTO pessoa = organizationalService.findPessoa(preMatricula.getPessoa().getId());
                bufferedWriter.write("INSTRUTOR");
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getPosto() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getQuadro() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getEspecialidade() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getNome() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getNomeGuerra() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getEmail() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefone() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefoneCelular() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getSaram() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getCpf() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getStatus() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getStatus());
                } else {
                    bufferedWriter.write("PRE MTCL");
                }
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (preMatricula.getIndicacao().getChefia() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getEmailChefia() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefoneChefia() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefoneOM() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        // listar alunos
        PreMatriculaDTO[] preMatriculasAlunos = service.findAllPreMatriculasAlunos(turmaId);
        for (PreMatriculaDTO preMatricula : preMatriculasAlunos) {
            try {
                PessoaDTO pessoa = organizationalService.findPessoa(preMatricula.getPessoa().getId());
                bufferedWriter.write("ALUNO");
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getPosto() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getQuadro() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getEspecialidade() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getNome() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getNomeGuerra() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getEmail() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefone() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefoneCelular() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getSaram() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getPessoa().getCpf() != null) {
                    bufferedWriter.write(preMatricula.getPessoa().getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (preMatricula.getIndicacao().getStatus() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getStatus());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (preMatricula.getIndicacao().getChefia() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getEmailChefia() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (preMatricula.getIndicacao().getTelefoneChefia() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (preMatricula.getIndicacao().getTelefoneOM() != null) {
                    bufferedWriter.write(preMatricula.getIndicacao().getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException ex) {
            Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else if ("SLC".equals(statusIndicacao)) {
        // mostrar apenas os selecionados
        List<IndicacaoDTO> indicacoes = new ArrayList<IndicacaoDTO>();
        IndicacaoDTO[] indicacoesInstrutores = service.findAllIndicacoesInstrutoresSelecionados(turmaId);
        indicacoes.addAll(Arrays.asList(indicacoesInstrutores));
        IndicacaoDTO[] indicacoesAlunos = service.findAllIndicacoesAlunosSelecionadosForOrdemMatricula(turmaId);
        indicacoes.addAll(Arrays.asList(indicacoesAlunos));
        for (IndicacaoDTO indicacao : indicacoes) {
            try {
                PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
                if (indicacao instanceof IndicacaoAlunoDTO) {
                    bufferedWriter.write("ALUNO");
                } else {
                    bufferedWriter.write("INSTRUTOR");
                }
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getPosto() != null) {
                    bufferedWriter.write(pessoa.getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getQuadro() != null) {
                    bufferedWriter.write(pessoa.getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getEspecialidade() != null) {
                    bufferedWriter.write(pessoa.getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getNome() != null) {
                    bufferedWriter.write(pessoa.getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getNomeGuerra() != null) {
                    bufferedWriter.write(pessoa.getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getEmail() != null) {
                    bufferedWriter.write(indicacao.getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getTelefone() != null) {
                    bufferedWriter.write(indicacao.getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getTelefoneCelular() != null) {
                    bufferedWriter.write(indicacao.getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getSaram() != null) {
                    bufferedWriter.write(pessoa.getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getCpf() != null) {
                    bufferedWriter.write(pessoa.getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getStatus() != null) {
                    bufferedWriter.write(indicacao.getStatus());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (indicacao.getChefia() != null) {
                    bufferedWriter.write(indicacao.getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getEmailChefia() != null) {
                    bufferedWriter.write(indicacao.getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getTelefoneChefia() != null) {
                    bufferedWriter.write(indicacao.getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (indicacao.getTelefoneOM() != null) {
                    bufferedWriter.write(indicacao.getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException ex) {
            Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else {
        // mostrar indicados em geral
        List<IndicacaoDTO> indicacoes = new ArrayList<IndicacaoDTO>();
        IndicacaoDTO[] indicacoesInstrutores = service.findAllIndicacoesInstrutores(turmaId);
        indicacoes.addAll(Arrays.asList(indicacoesInstrutores));
        IndicacaoDTO[] indicacoesAlunos = service.findAllIndicacoesAlunos(turmaId);
        indicacoes.addAll(Arrays.asList(indicacoesAlunos));
        for (IndicacaoDTO indicacao : indicacoes) {
            try {
                PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
                if (indicacao instanceof IndicacaoAlunoDTO) {
                    bufferedWriter.write("ALUNO");
                } else {
                    bufferedWriter.write("INSTRUTOR");
                }
                bufferedWriter.write(",");
                if (turma != null) {
                    bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getPosto() != null) {
                    bufferedWriter.write(pessoa.getPosto());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getQuadro() != null) {
                    bufferedWriter.write(pessoa.getQuadro());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getEspecialidade() != null) {
                    bufferedWriter.write(pessoa.getEspecialidade());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getNome() != null) {
                    bufferedWriter.write(pessoa.getNome());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getNomeGuerra() != null) {
                    bufferedWriter.write(pessoa.getNomeGuerra());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                    bufferedWriter.write(pessoa.getOrganizacao().getSigla());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getEmail() != null) {
                    bufferedWriter.write(indicacao.getEmail());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getTelefone() != null) {
                    bufferedWriter.write(indicacao.getTelefone());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getTelefoneCelular() != null) {
                    bufferedWriter.write(indicacao.getTelefoneCelular());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getSaram() != null) {
                    bufferedWriter.write(pessoa.getSaram());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (pessoa.getCpf() != null) {
                    bufferedWriter.write(pessoa.getCpf());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getStatus() != null) {
                    bufferedWriter.write(indicacao.getStatus());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // solicitação da Seção de Avaliação do ILA
                if (indicacao.getChefia() != null) {
                    bufferedWriter.write(indicacao.getChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getEmailChefia() != null) {
                    bufferedWriter.write(indicacao.getEmailChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                if (indicacao.getTelefoneChefia() != null) {
                    bufferedWriter.write(indicacao.getTelefoneChefia());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.write(",");
                // não está retornando
                if (indicacao.getTelefoneOM() != null) {
                    bufferedWriter.write(indicacao.getTelefoneOM());
                } else {
                    bufferedWriter.write("");
                }
                bufferedWriter.newLine();
            } catch (IOException ex) {
                Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException ex) {
            Logger.getLogger(EXC002CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
// fim do if de filtro dos indicados pelo STATUS
}
Also used : CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) ArrayList(java.util.ArrayList) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) BufferedWriter(java.io.BufferedWriter) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) MatriculaAlunoDTO(com.tomasio.projects.trainning.dto.MatriculaAlunoDTO) IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) ArrayList(java.util.ArrayList) List(java.util.List) ApresentacaoDTO(com.tomasio.projects.trainning.dto.ApresentacaoDTO) PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OutputStreamWriter(java.io.OutputStreamWriter) SimpleDateFormat(java.text.SimpleDateFormat) BufferedWriter(java.io.BufferedWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Aggregations

TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)23 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)8 HashMap (java.util.HashMap)8 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)7 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)7 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)5 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 AnotacaoDTO (com.tomasio.projects.trainning.dto.AnotacaoDTO)3 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)3 FolhaRostoDTO (com.tomasio.projects.trainning.dto.FolhaRostoDTO)3 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)3 IndicacaoInstrutorDTO (com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)3 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)3 TurmaPlanejadaDTO (com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO)3 IOException (java.io.IOException)3 SimpleDateFormat (java.text.SimpleDateFormat)3