Search in sources :

Example 1 with ConsultaInstrutorDTO

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

the class InstrutoresController method detailConsulta.

@RequestMapping("/consulta")
@ResponseBody
public Map detailConsulta(Model model, WebRequest request) {
    String consultaInstrutorIdParam = request.getParameter("consultaId");
    Long consultaId = Long.parseLong(consultaInstrutorIdParam);
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy");
    ConsultaInstrutorDTO consulta = instructorsService.findConsultaInstrutor(consultaId);
    Map item = new HashMap();
    item.put("id", consulta.getId());
    item.put("emailTo", consulta.getEmailTo());
    PessoaDTO pessoa = organizationalService.findPessoa(consulta.getPessoa().getId());
    item.put("instrutor", pessoa.getTargetaSimples() + " (" + (pessoa.getOrganizacao().getSigla()) + ")");
    item.put("pessoaId", pessoa.getId());
    TurmaEfetivaDTO turma = (TurmaEfetivaDTO) atividadesEnsinoService.findTurmaEfetiva(consulta.getTurma().getId());
    item.put("turma", "Consulta " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getPeriodoFormatted() + ")");
    item.put("data", df.format(new Date(consulta.getDataConsulta().getTimeInMillis())));
    item.put("texto", consulta.getText());
    return item;
}
Also used : TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) HashMap(java.util.HashMap) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) Map(java.util.Map) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with ConsultaInstrutorDTO

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

the class InstrutoresController method initializeConsultasAtivasDataList.

public List initializeConsultasAtivasDataList(Long organizacaoId) {
    List result = new ArrayList();
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy");
    ConsultaInstrutorDTO[] consultas = instructorsService.findAllConsultaInstrutorByRemetenteId(organizacaoId, false);
    for (ConsultaInstrutorDTO consulta : consultas) {
        if (consulta.isFinalizado() == false) {
            Map item = new HashMap();
            item.put("id", consulta.getId());
            item.put("emailTo", consulta.getEmailTo());
            PessoaDTO pessoa = organizationalService.findPessoa(consulta.getPessoa().getId());
            item.put("instrutor", pessoa.getTargetaSimples() + " (" + (pessoa.getOrganizacao().getSigla()) + ")");
            item.put("pessoaId", pessoa.getId());
            TurmaEfetivaDTO turma = (TurmaEfetivaDTO) atividadesEnsinoService.findTurmaEfetiva(consulta.getTurma().getId());
            item.put("turma", "Consulta " + turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma() + " (" + turma.getPeriodoFormatted() + ")");
            item.put("data", df.format(new Date(consulta.getDataConsulta().getTimeInMillis())));
            result.add(item);
        }
    }
    return result;
}
Also used : TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) Map(java.util.Map) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO) Date(java.util.Date)

Example 3 with ConsultaInstrutorDTO

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

the class InstructorsServiceSimpleImpl method findAllConsultaInstrutorByRemetenteId.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO[] findAllConsultaInstrutorByRemetenteId(Long remetenteId, boolean finalizado) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutorDTO[] consultasArray = null;
    try {
        List<ConsultaInstrutor> consultas = dao.findAllByRemetenteId(remetenteId, finalizado);
        if (consultas != null) {
            consultasArray = new ConsultaInstrutorDTO[consultas.size()];
            for (int i = 0; i < consultas.size(); i++) {
                consultasArray[i] = consultas.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return consultasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO) ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with ConsultaInstrutorDTO

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

the class InstrutoresController method initializeConsultasArquivadasDataList.

public List initializeConsultasArquivadasDataList(Long organizacaoId) {
    List result = new ArrayList();
    ConsultaInstrutorDTO[] consultas = instructorsService.findAllConsultaInstrutorByRemetenteId(organizacaoId, false);
    for (ConsultaInstrutorDTO consulta : consultas) {
        if (consulta.isFinalizado()) {
            Map item = new HashMap();
            item.put("id", consulta.getId());
            item.put("emailTo", consulta.getEmailTo());
            result.add(item);
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)

Example 5 with ConsultaInstrutorDTO

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

the class InstrutoresController method saveConsultaInstrutor.

public String saveConsultaInstrutor(ConsultaInstrutorForm form) {
    ConsultaInstrutorDTO dto = new ConsultaInstrutorDTO();
    dto.setEmailCC(form.getEmailCC());
    dto.setEmailTo(form.getEmailTo());
    dto.setDataConsulta(Calendar.getInstance());
    dto.setFinalizado(false);
    dto.setPessoa(organizationalService.findPessoa(form.getPessoaId()));
    Calendar prazo = Calendar.getInstance();
    prazo.setTime(form.getPrazoResposta());
    dto.setPrazoResposta(prazo);
    dto.setRemetente(organizationalService.findOrganizacao(form.getRemetenteId()));
    dto.setText(form.getText());
    dto.setTurma(atividadesEnsinoService.findTurmaEfetiva(form.getTurmaId()));
    Long id = instructorsService.createConsultaInstrutor(dto);
    if (id != null) {
        return "success";
    }
    return "fail";
}
Also used : Calendar(java.util.Calendar) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)

Aggregations

ConsultaInstrutorDTO (com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)8 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 CoreException (com.tomasio.projects.trainning.exeption.CoreException)3 ConsultaInstrutor (com.tomasio.projects.trainning.model.ConsultaInstrutor)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Transactional (org.springframework.transaction.annotation.Transactional)3 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)2 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 Calendar (java.util.Calendar)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1