Search in sources :

Example 6 with IndicacaoDTO

use of com.tomasio.projects.trainning.dto.IndicacaoDTO 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 7 with IndicacaoDTO

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

the class TurmasEfetivasController method listIndicacoesAjax.

@RequestMapping("/detail/indicacoes/ajax")
@ResponseBody
public List listIndicacoesAjax(Model model, WebRequest request, @ModelAttribute("turma") TurmaEfetivaDTO turma, @ModelAttribute("permissionsManager") BusinessPermissionsManager permissionManager, @ModelAttribute("userOrganization") OrganizacaoDTO userOrganization) {
    List<Map> result = new ArrayList<Map>();
    IndicacaoDTO[] indicacoes = atividadesEnsinoService.findAllIndicacoesAlunos(turma.getId());
    OrganizacaoDTO[] organizacoesSubordinadas = organizationalService.findAllOrganizacoesSubordinadas(userOrganization.getId());
    List subordinadasList = new ArrayList();
    for (int i = 0; i < organizacoesSubordinadas.length; i++) {
        subordinadasList.add(organizacoesSubordinadas[i]);
    }
    subordinadasList.add(userOrganization);
    for (IndicacaoDTO indicacaoDTO : indicacoes) {
        // PessoaDTO pessoa = organizationalService.findPessoa(indicacaoDTO.getPessoa().getId());
        Map item = new HashMap();
        item.put("pessoa", indicacaoDTO.getPessoa().getTargetaCompletaOM());
        item.put("prioridade", indicacaoDTO.getPrioridade());
        item.put("data", indicacaoDTO.getDataCriacaoFormatted());
        // OrganizacaoDTO beneficiada = organizationalService.findOrganizacao(indicacaoDTO.getOrganizacaoBeneficiada().getId());
        item.put("beneficiada", indicacaoDTO.getOrganizacaoBeneficiada().getSigla());
        // OrganizacaoDTO responsavel = organizationalService.findOrganizacao(indicacaoDTO.getOrganizacao().getId());
        item.put("responsavel", indicacaoDTO.getOrganizacao().getSigla());
        item.put("objectId", indicacaoDTO.getObjectId());
        item.put("id", indicacaoDTO.getId());
        item.put("organizacao", indicacaoDTO.getOrganizacao().getSigla());
        item.put("status", indicacaoDTO.getStatus());
        for (OrganizacaoDTO organizacaoDTO : organizacoesSubordinadas) {
            if (indicacaoDTO.getOrganizacao().getId().equals(organizacaoDTO.getId()) || indicacaoDTO.getOrganizacaoBeneficiada().getId().equals(organizacaoDTO.getId())) {
                item.put("rowClass", "warning");
            }
        }
        if (indicacaoDTO.getOrganizacao().getId().equals(userOrganization.getId()) || indicacaoDTO.getOrganizacaoBeneficiada().getId().equals(userOrganization.getId())) {
            item.put("rowClass", "warning");
        }
        if (userOrganization.equals(indicacaoDTO.getNextWorkflowActor())) {
            item.put("alert", true);
            item.put("rowClass", "danger");
        } else {
            item.put("alert", false);
        }
        Map distribuicaoStatus = new HashMap();
        int statusInt = indicacaoDTO.getDistribuicaoStatus();
        switch(statusInt) {
            case 0:
                distribuicaoStatus.put("cssClass", "");
                distribuicaoStatus.put("label", "");
                break;
            case 1:
                distribuicaoStatus.put("cssClass", "label-success arrowed");
                distribuicaoStatus.put("label", "Dentro das Vagas");
                break;
            case 2:
                distribuicaoStatus.put("cssClass", "label-warning arrowed");
                distribuicaoStatus.put("label", "Vagas Reserva");
                break;
            case 3:
                distribuicaoStatus.put("cssClass", "label-grey arrowed");
                distribuicaoStatus.put("label", "Fora da Distribuição de Vagas. Não impede a Matrícula!");
                break;
            case 4:
                distribuicaoStatus.put("cssClass", "label-danger arrowed");
                distribuicaoStatus.put("label", "Não aprovado");
                break;
            case 5:
                distribuicaoStatus.put("cssClass", "label-info arrowed");
                distribuicaoStatus.put("label", "Aguardando Aprovação");
                break;
            default:
                distribuicaoStatus.put("cssClass", "label-danger arrowed");
                distribuicaoStatus.put("label", "INDEFINIDO");
        }
        item.put("distribuicaoStatus", distribuicaoStatus);
        Map grants = new HashMap();
        boolean indicacaoSubordinada = subordinadasList.contains(indicacaoDTO.getOrganizacao());
        boolean edit = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.EDIT, indicacaoDTO, userOrganization)) {
            edit = true;
        }
        grants.put("edit", edit);
        boolean remove = false;
        if (indicacaoSubordinada && (permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.REMOVE, indicacaoDTO, userOrganization) || turma.getOrganizacaoGestoraId().equals(userOrganization.getId()))) {
            remove = true;
        }
        grants.put("remove", remove);
        boolean aprove = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.APROVE, indicacaoDTO, userOrganization)) {
            aprove = true;
        }
        grants.put("aprove", aprove);
        boolean cancelAprove = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.CANCEL_APROVE, indicacaoDTO, userOrganization)) {
            cancelAprove = true;
        }
        grants.put("cancelAprove", cancelAprove);
        boolean reject = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.REJECT, indicacaoDTO, userOrganization)) {
            reject = true;
        }
        grants.put("reject", reject);
        boolean cancelReject = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.CANCEL_REJECT, indicacaoDTO, userOrganization)) {
            cancelReject = true;
        }
        grants.put("cancelReject", cancelReject);
        item.put("grants", grants);
        result.add(item);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Map(java.util.Map) HashMap(java.util.HashMap) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with IndicacaoDTO

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

the class HomeController method listListIndicacoes.

@RequestMapping("/list_indicacoes_ajax")
@ResponseBody
public Object listListIndicacoes(Model model, @ModelAttribute("userOrganization") OrganizacaoDTO userOrganization, WebRequest request) {
    Map<Object, Object> result = new HashMap<Object, Object>();
    List<Map<Object, Object>> dataList = new ArrayList<Map<Object, Object>>();
    Set<Long> turmasIds = new HashSet<Long>();
    IndicacaoDTO[] indicacoes = atividadesEnsinoService.findAllIndicacoesAlunos(null, userOrganization.getId(), null, new Date());
    for (IndicacaoDTO indicacao : indicacoes) {
        turmasIds.add(indicacao.getTurma().getId());
    }
    Long[] turmasIdsArray = new Long[turmasIds.size()];
    int i = 0;
    for (Long id : turmasIds) {
        turmasIdsArray[i] = id;
        i++;
    }
    Map<Long, TurmaDTO> turmasMap = new HashMap<Long, TurmaDTO>();
    TurmaDTO[] turmas = atividadesEnsinoService.findAllTurmas(turmasIdsArray);
    for (TurmaDTO turmaDTO : turmas) {
        turmasMap.put(turmaDTO.getId(), turmaDTO);
    }
    for (IndicacaoDTO indicacao : indicacoes) {
        Map<Object, Object> item = new HashMap<Object, Object>();
        PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
        // TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
        item.put("pessoa", pessoa.getTargetaCompletaOM());
        TurmaDTO turma = turmasMap.get(indicacao.getTurma().getId());
        item.put("turma", turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getPeriodoFormatted() + ")");
        item.put("status", indicacao.getStatus());
        dataList.add(item);
    }
    result.put("data", dataList);
    return result;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) Date(java.util.Date) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with IndicacaoDTO

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

the class HomeController method listMinhasIndicacoes.

@RequestMapping("/minhas_indicacoes_ajax")
@ResponseBody
public List listMinhasIndicacoes(Model model, @ModelAttribute("userOrganization") OrganizacaoDTO userOrganization, WebRequest request) {
    List<Map> result = new ArrayList<Map>();
    List<IndicacaoAlunoDTO> indicacoes = Arrays.asList(atividadesEnsinoService.findAllIndicacoesAlunos(null, userOrganization.getId(), null, new Date()));
    Collections.sort(indicacoes, new Comparator<IndicacaoAlunoDTO>() {

        @Override
        public int compare(IndicacaoAlunoDTO o1, IndicacaoAlunoDTO o2) {
            return o1.getDataCriacao().compareTo(o2.getDataCriacao());
        }
    });
    for (IndicacaoDTO indicacao : indicacoes) {
        TurmaEfetivaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
        Map item = new HashMap();
        item.put("turma", turma.getCurso().getCodigo() + " - " + turma.getNumeroTurma());
        item.put("id", turma.getId());
        item.put("pessoa", indicacao.getPessoa().getTargetaCompletaOM());
        item.put("status", indicacao.getStatus());
        result.add(item);
    }
    return Lists.reverse(result);
}
Also used : IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) Date(java.util.Date) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 10 with IndicacaoDTO

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

the class AtividadesEnsinoCacheAdvice method removeIndicacaoMethodInterceptor.

@Around("removeIndicacao()")
public Object removeIndicacaoMethodInterceptor(ProceedingJoinPoint joinPoint) throws Throwable {
    Object[] args = joinPoint.getArgs();
    Long indicacaoId = (Long) args[0];
    IndicacaoDTO indicacao = atividadesEnsinoService.findIndicacao(indicacaoId);
    TurmaEfetivaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
    SimpleDateFormat df = new SimpleDateFormat("yyyy");
    String exercicio = df.format(turma.getExercicio());
    String organizacao = turma.getOrganizacaoGestoraId().toString();
    String key = exercicio + "-" + organizacao;
    clearChacheTurmas(key);
    clearChachePendencias(key);
    return joinPoint.proceed();
}
Also used : TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) SimpleDateFormat(java.text.SimpleDateFormat) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Around(org.aspectj.lang.annotation.Around)

Aggregations

IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)36 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)19 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)15 ArrayList (java.util.ArrayList)13 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)12 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)11 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)11 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)11 SimpleDateFormat (java.text.SimpleDateFormat)10 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)8 Date (java.util.Date)7 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)6 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)6 IndicacaoInstrutorDTO (com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)6 BufferedWriter (java.io.BufferedWriter)5 IOException (java.io.IOException)5 OutputStreamWriter (java.io.OutputStreamWriter)5 Writer (java.io.Writer)5 ParseException (java.text.ParseException)5 HashMap (java.util.HashMap)5