Search in sources :

Example 1 with IndicacaoInstrutorDTO

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

the class IndicacaoInstrutor method createDTOMinimal.

@Override
public IndicacaoInstrutorDTO createDTOMinimal() {
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    IndicacaoInstrutorDTO dto = new IndicacaoInstrutorDTO();
    dto.setDataCriacao(dataCriacao);
    dto.setPrioridade(prioridade);
    dto.setSelecionado(selecionado);
    dto.setId(id);
    dto.setObservacao(observacao);
    dto.setEmail(email);
    dto.setEmailChefia(emailChefia);
    dto.setTelefone(telefone);
    dto.setJustificativa(justificativa);
    dto.setAprovado(isAprovado());
    dto.setReprovado(reprovado);
    dto.setForaDoPrazo(foraDoPrazo);
    dto.setDataCriacaoFormatted(df.format(dataCriacao));
    dto.setObjectId(getObjectId());
    if (custo != null) {
        dto.setCusto(custo.createDTO());
    }
    dto.setStatus(status);
    dto.setMatriculado(matriculado);
    dto.setPreMatriculado(preMatriculado);
    dto.setChefia(chefia);
    dto.setTelefoneChefia(telefoneChefia);
    dto.setDistribuicaoStatus(distribuicaoStatus);
    dto.setCoordenador(coordenador);
    dto.setSombra(sombra);
    if (periodo != null) {
        dto.setPeriodo(periodo.createDTO());
    }
    if (local != null) {
        dto.setLocal(local.createDTOMinimal());
    }
    return dto;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) IndicacaoInstrutorDTO(com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)

Example 2 with IndicacaoInstrutorDTO

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

the class TurmasEfetivasController method saveInstrutor.

@RequestMapping("/save_instrutor")
public String saveInstrutor(Model model, @Valid IndicacaoInstrutor indicacao, BindingResult bindingResult, WebRequest request) {
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    if (bindingResult.hasErrors()) {
        model.addAttribute("pessoa", organizationalService.findPessoa(indicacao.getPessoaId()));
        return "turmas_efetivas/form_instrutor";
    }
    IndicacaoInstrutorDTO dto = new IndicacaoInstrutorDTO();
    dto.setId(indicacao.getId());
    dto.setDataCriacao(new Date());
    // dto.setStatus(indicacao.getStatus());
    dto.setMatriculado(indicacao.isMatriculado());
    dto.setEmail(indicacao.getEmail());
    dto.setEmailChefia(indicacao.getEmailChefia());
    dto.setJustificativa(indicacao.getJustificativa());
    dto.setObservacao(indicacao.getObservacao());
    dto.setOrganizacao(organizationalService.findOrganizacao(indicacao.getOrganizacaoId()));
    dto.setPessoa(organizationalService.findPessoa(indicacao.getPessoaId()));
    dto.setPrioridade(indicacao.getPrioridade());
    dto.setTelefone(indicacao.getTelefone());
    dto.setTurma(atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurmaId()));
    dto.setTelefoneChefia(indicacao.getTelefoneChefia());
    dto.setChefia(indicacao.getChefia());
    if (indicacao.getLocalId() != null) {
        OrganizacaoDTO local = organizationalService.findOrganizacao(indicacao.getLocalId());
        dto.setLocal(local);
    }
    CustoDTO custo = new CustoDTO();
    custo.setAjudaCustoPlanejado(indicacao.getAjudaCustoPlanejado());
    custo.setDiariasPlanejado(indicacao.getDiariasPlanejado());
    custo.setPassagensPlanejado(indicacao.getPassagensPlanejado());
    dto.setCusto(custo);
    PeriodoDTO periodo = new PeriodoDTO();
    if (indicacao.getDataInicio() != null && !indicacao.getDataInicio().equals("")) {
        try {
            periodo.setDataInicio(df.parse(indicacao.getDataInicio()));
        } catch (ParseException ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
        }
    }
    if (indicacao.getDataTermino() != null && !indicacao.getDataTermino().equals("")) {
        try {
            periodo.setDataTermino(df.parse(indicacao.getDataTermino()));
        } catch (ParseException ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
        }
    }
    dto.setPeriodo(periodo);
    if (dto.getId() != null && dto.getId() > 0) {
        atividadesEnsinoService.updateIndicacao(dto);
    } else {
        atividadesEnsinoService.createIndicacao(dto);
    }
    return "redirect:detail/instrutores";
}
Also used : PeriodoDTO(com.tomasio.projects.trainning.dto.PeriodoDTO) CustoDTO(com.tomasio.projects.trainning.dto.CustoDTO) ParseException(java.text.ParseException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) SimpleDateFormat(java.text.SimpleDateFormat) IndicacaoInstrutorDTO(com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with IndicacaoInstrutorDTO

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

the class CommonsController method listEvents.

@RequestMapping("/events")
@ResponseBody
public List listEvents(WebRequest request) {
    String pessoaIdParam = request.getParameter("pessoaId");
    Long pessoaId = Long.parseLong(pessoaIdParam);
    SimpleDateFormat dfDay = new SimpleDateFormat("d");
    SimpleDateFormat dfMonth = new SimpleDateFormat("M");
    SimpleDateFormat dfYear = new SimpleDateFormat("yyyy");
    List result = new ArrayList();
    ItemConviteInstrutorIndividualDTO[] itensConvite = atividadesEnsinoService.findAllItensConviteInstrutorIndividualByPessoaId(pessoaId);
    for (ItemConviteInstrutorIndividualDTO item : itensConvite) {
        ConviteInstrutorIndividualDTO convite = item.getConviteInstrutorIndividual();
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(convite.getTurma().getId());
        Map map = new HashMap();
        map.put("title", "Convite Instrutor " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getLocal() + ")");
        map.put("className", "label-warning");
        map.put("startDay", dfDay.format(item.getPeriodo().getDataInicio()));
        map.put("startMonth", dfMonth.format(item.getPeriodo().getDataInicio()));
        map.put("startYear", dfYear.format(item.getPeriodo().getDataInicio()));
        map.put("endDay", dfDay.format(item.getPeriodo().getDataTermino()));
        map.put("endMonth", dfMonth.format(item.getPeriodo().getDataTermino()));
        map.put("endYear", dfYear.format(item.getPeriodo().getDataTermino()));
        result.add(map);
    }
    ConfirmacaoConviteInstrutorDTO[] confirmacoes = atividadesEnsinoService.findAllConfirmacoesConvitesInstrutoresByPessoaId(pessoaId);
    for (ConfirmacaoConviteInstrutorDTO confirmacao : confirmacoes) {
        ConviteInstrutorDTO convite = atividadesEnsinoService.findConviteInstrutor(confirmacao.getConviteInstrutor().getId());
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(convite.getTurma().getId());
        Map map = new HashMap();
        map.put("title", "Convite Instrutor " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getLocal() + ")");
        map.put("className", "label-important");
        map.put("startDay", dfDay.format(confirmacao.getPeriodo().getDataInicio()));
        map.put("startMonth", dfMonth.format(confirmacao.getPeriodo().getDataInicio()));
        map.put("startYear", dfYear.format(confirmacao.getPeriodo().getDataInicio()));
        map.put("endDay", dfDay.format(confirmacao.getPeriodo().getDataTermino()));
        map.put("endMonth", dfMonth.format(confirmacao.getPeriodo().getDataTermino()));
        map.put("endYear", dfYear.format(confirmacao.getPeriodo().getDataTermino()));
        result.add(map);
    }
    IndicacaoDTO[] indicacoesInstrutor = atividadesEnsinoService.findAllIndicacoesInstrutorByPessoaId(new Date(), pessoaId);
    for (IndicacaoDTO indicacao : indicacoesInstrutor) {
        IndicacaoInstrutorDTO indicacaoInstrutor = (IndicacaoInstrutorDTO) indicacao;
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
        Map map = new HashMap();
        map.put("title", "Indicação Instrutor " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getLocal() + ")");
        map.put("className", "label-purple");
        map.put("startDay", dfDay.format(indicacaoInstrutor.getPeriodo().getDataInicio()));
        map.put("startMonth", dfMonth.format(indicacaoInstrutor.getPeriodo().getDataInicio()));
        map.put("startYear", dfYear.format(indicacaoInstrutor.getPeriodo().getDataInicio()));
        map.put("endDay", dfDay.format(indicacaoInstrutor.getPeriodo().getDataTermino()));
        map.put("endMonth", dfMonth.format(indicacaoInstrutor.getPeriodo().getDataTermino()));
        map.put("endYear", dfYear.format(indicacaoInstrutor.getPeriodo().getDataTermino()));
        result.add(map);
    }
    IndicacaoDTO[] indicacoesAluno = atividadesEnsinoService.findAllIndicacoesAlunoByPessoaId(new Date(), pessoaId);
    for (IndicacaoDTO indicacao : indicacoesAluno) {
        IndicacaoAlunoDTO indicacaoInstrutor = (IndicacaoAlunoDTO) indicacao;
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
        Map map = new HashMap();
        map.put("title", "Indicação Aluno " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getLocal() + ")");
        map.put("className", "label-success");
        map.put("startDay", dfDay.format(turma.getDataInicio()));
        map.put("startMonth", dfMonth.format(turma.getDataInicio()));
        map.put("startYear", dfYear.format(turma.getDataInicio()));
        map.put("endDay", dfDay.format(turma.getDataTermino()));
        map.put("endMonth", dfMonth.format(turma.getDataTermino()));
        map.put("endYear", dfYear.format(turma.getDataTermino()));
        result.add(map);
    }
    MatriculaDTO[] matriculasInstrutor = atividadesEnsinoService.findAllMatriculasInstrutoresByPessoaId(pessoaId);
    for (MatriculaDTO matricula : matriculasInstrutor) {
        MatriculaInstrutorDTO matriculaInstrutor = (MatriculaInstrutorDTO) matricula;
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(matriculaInstrutor.getTurma().getId());
        Map map = new HashMap();
        map.put("title", "Matricula Instrutor " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getLocal() + ")");
        map.put("className", "label-info");
        IndicacaoInstrutorDTO indicacao = (IndicacaoInstrutorDTO) matriculaInstrutor.getIndicacao();
        map.put("startDay", dfDay.format(indicacao.getPeriodo().getDataInicio()));
        map.put("startMonth", dfMonth.format(indicacao.getPeriodo().getDataInicio()));
        map.put("startYear", dfYear.format(indicacao.getPeriodo().getDataInicio()));
        map.put("endDay", dfDay.format(indicacao.getPeriodo().getDataTermino()));
        map.put("endMonth", dfMonth.format(indicacao.getPeriodo().getDataTermino()));
        map.put("endYear", dfYear.format(indicacao.getPeriodo().getDataTermino()));
        result.add(map);
    }
    MatriculaDTO[] matriculasAluno = atividadesEnsinoService.findAllMatriculasInstrutoresByPessoaId(pessoaId);
    for (MatriculaDTO matricula : matriculasAluno) {
        MatriculaInstrutorDTO matriculaInstrutor = (MatriculaInstrutorDTO) matricula;
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(matriculaInstrutor.getTurma().getId());
        Map map = new HashMap();
        map.put("title", "Matricula Aluno " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getLocal() + ")");
        map.put("className", "label-pink");
        map.put("startDay", dfDay.format(turma.getDataInicio()));
        map.put("startMonth", dfMonth.format(turma.getDataInicio()));
        map.put("startYear", dfYear.format(turma.getDataInicio()));
        map.put("endDay", dfDay.format(turma.getDataTermino()));
        map.put("endMonth", dfMonth.format(turma.getDataTermino()));
        map.put("endYear", dfYear.format(turma.getDataTermino()));
        result.add(map);
    }
    Map map2 = new HashMap();
    map2.put("title", "Curso ATM003");
    map2.put("className", "label-inverse");
    map2.put("startDay", dfDay.format(new Date()));
    map2.put("startMonth", dfMonth.format(new Date()));
    map2.put("startYear", dfYear.format(new Date()));
    result.add(map2);
    return result;
}
Also used : MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) ItemConviteInstrutorIndividualDTO(com.tomasio.projects.trainning.dto.ItemConviteInstrutorIndividualDTO) ConfirmacaoConviteInstrutorDTO(com.tomasio.projects.trainning.dto.ConfirmacaoConviteInstrutorDTO) ConviteInstrutorDTO(com.tomasio.projects.trainning.dto.ConviteInstrutorDTO) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) MatriculaInstrutorDTO(com.tomasio.projects.trainning.dto.MatriculaInstrutorDTO) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) ConfirmacaoConviteInstrutorDTO(com.tomasio.projects.trainning.dto.ConfirmacaoConviteInstrutorDTO) ItemConviteInstrutorIndividualDTO(com.tomasio.projects.trainning.dto.ItemConviteInstrutorIndividualDTO) ConviteInstrutorIndividualDTO(com.tomasio.projects.trainning.dto.ConviteInstrutorIndividualDTO) SimpleDateFormat(java.text.SimpleDateFormat) IndicacaoInstrutorDTO(com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with IndicacaoInstrutorDTO

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

the class TurmasEfetivasController method listMatriculas.

@RequestMapping("/detail/matriculas")
public String listMatriculas(Model model, WebRequest request, @ModelAttribute("turma") TurmaEfetivaDTO turma) {
    int countMatriculas = 0;
    MatriculaDTO[] matriculasInstrutores = atividadesEnsinoService.findAllMatriculasInstrutores(turma.getId());
    MatriculaDTO[] matriculasAlunos = atividadesEnsinoService.findAllMatriculasAlunos(turma.getId());
    Arrays.sort(matriculasAlunos, new Comparator<MatriculaDTO>() {

        @Override
        public int compare(MatriculaDTO o1, MatriculaDTO o2) {
            return o1.getPessoa().getNome().compareTo(o2.getPessoa().getNome());
        }
    });
    Arrays.sort(matriculasInstrutores, new Comparator<MatriculaDTO>() {

        @Override
        public int compare(MatriculaDTO o1, MatriculaDTO o2) {
            return o1.getPessoa().getNome().compareTo(o2.getPessoa().getNome());
        }
    });
    // montar dataList
    List<Map<Object, Object>> alunosDataList = new ArrayList<Map<Object, Object>>();
    for (MatriculaDTO matricula : matriculasAlunos) {
        Map<Object, Object> item = new HashMap<Object, Object>();
        item.put("id", matricula.getId());
        item.put("indicacao", matricula.getIndicacao().getId());
        item.put("targetaCompletaOM", matricula.getPessoa().getTargetaCompletaOM());
        item.put("cancelada", matricula.isCancelada());
        item.put("desligado", matricula.isDesligado());
        item.put("notificacao", atividadesEnsinoService.hasNotificacoesMatriculaILAVIRTUAL(matricula.getId()));
        alunosDataList.add(item);
        if (matricula.isCancelada() == false) {
            countMatriculas++;
        }
    }
    List<Map<Object, Object>> instrutoresDataList = new ArrayList<Map<Object, Object>>();
    for (MatriculaDTO matricula : matriculasInstrutores) {
        Map<Object, Object> item = new HashMap<Object, Object>();
        item.put("id", matricula.getId());
        item.put("indicacao", matricula.getIndicacao().getId());
        item.put("targetaCompletaOM", matricula.getPessoa().getTargetaCompletaOM());
        item.put("cancelada", matricula.isCancelada());
        item.put("desligado", matricula.isDesligado());
        IndicacaoInstrutorDTO indicacao = (IndicacaoInstrutorDTO) atividadesEnsinoService.findIndicacao(matricula.getIndicacao().getId());
        item.put("periodoinic", indicacao.getPeriodo().getDataInicioFormated());
        item.put("periodofim", indicacao.getPeriodo().getDataTerminoFormated());
        instrutoresDataList.add(item);
    }
    model.addAttribute("matriculasAlunos", alunosDataList);
    model.addAttribute("matriculasInstrutores", instrutoresDataList);
    model.addAttribute("total", alunosDataList.size() + instrutoresDataList.size());
    model.addAttribute("totalAlunos", countMatriculas);
    model.addAttribute("totalInstrutores", instrutoresDataList.size());
    model.addAttribute("tab", "matriculas");
    return "turmas_efetivas/detail/matriculas";
}
Also used : PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) NotificacaoMatriculaDTO(com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO) MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) IndicacaoInstrutorDTO(com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with IndicacaoInstrutorDTO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesInstrutores.

@Override
@Transactional(readOnly = true)
public IndicacaoInstrutorDTO[] findAllIndicacoesInstrutores(Long turmaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoInstrutorDTO[] indicacoesArray = null;
    try {
        List<IndicacaoInstrutor> indicacoes = dao.findAllInstrutores(turmaId);
        if (indicacoes != null) {
            indicacoesArray = new IndicacaoInstrutorDTO[indicacoes.size()];
            for (int i = 0; i < indicacoes.size(); i++) {
                indicacoesArray[i] = indicacoes.get(i).createDTOWithoutDependencies();
            }
        }
    } 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());
    }
    return indicacoesArray;
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) IndicacaoInstrutor(com.tomasio.projects.trainning.model.IndicacaoInstrutor) IndicacaoInstrutorDTO(com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IndicacaoInstrutorDTO (com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)16 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)6 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)6 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)6 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)6 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)6 DAOException (com.tomasio.projects.trainning.exception.DAOException)6 ParseException (java.text.ParseException)6 Transactional (org.springframework.transaction.annotation.Transactional)6 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)5 CoreException (com.tomasio.projects.trainning.exeption.CoreException)5 IndicacaoInstrutor (com.tomasio.projects.trainning.model.IndicacaoInstrutor)5 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)4 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)4 SimpleDateFormat (java.text.SimpleDateFormat)4 HashSet (java.util.HashSet)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)3 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)3 OrganizacaoDAO (com.tomasio.projects.trainning.dao.OrganizacaoDAO)2