Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 325 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.io.ByteArrayInputStream; |
||
| 4 | import java.io.Serializable; |
||
| 5 | |||
| 6 | import javax.faces.context.FacesContext; |
||
| 7 | import javax.inject.Inject; |
||
| 8 | import javax.inject.Named; |
||
| 9 | import javax.servlet.ServletContext; |
||
| 10 | |||
| 11 | import org.primefaces.model.DefaultStreamedContent; |
||
| 12 | import org.primefaces.model.StreamedContent; |
||
| 13 | import org.springframework.context.annotation.Scope; |
||
| 14 | |||
| 15 | import br.com.ec.core.util.ArquivoUtil; |
||
| 16 | import br.com.ec.domain.model.tipos.TipoComissionamento; |
||
| 17 | import br.com.ec.domain.model.tipos.TipoEscolaridade; |
||
| 18 | import br.com.ec.domain.model.tipos.TipoEstadoCivil; |
||
| 19 | import br.com.ec.domain.model.tipos.TipoRacaCor; |
||
| 20 | import br.com.ec.domain.service.PessoaService; |
||
| 21 | |||
| 22 | @Named |
||
| 23 | @Scope("view") |
||
| 24 | public class DocumentosBean implements Serializable { |
||
| 25 | |||
| 26 | private static final long serialVersionUID = 1L; |
||
| 27 | |||
| 28 | private PessoaService pessoaService; |
||
| 29 | |||
| 30 | @Inject |
||
| 31 | public DocumentosBean(PessoaService pessoaService) { |
||
| 32 | this.pessoaService = pessoaService; |
||
| 33 | } |
||
| 34 | |||
| 35 | public TipoEstadoCivil[] getTiposEstadoCivil() { |
||
| 36 | return TipoEstadoCivil.values(); |
||
| 37 | } |
||
| 38 | |||
| 39 | public TipoRacaCor[] getTiposRacaCor() { |
||
| 40 | return TipoRacaCor.values(); |
||
| 41 | } |
||
| 42 | |||
| 43 | public TipoEscolaridade[] getTiposEscolaridade() { |
||
| 44 | return TipoEscolaridade.values(); |
||
| 45 | } |
||
| 46 | |||
| 47 | // public TipoRegimeTributario[] getTiposRegimeTributario() { |
||
| 48 | // return TipoRegimeTributario.values(); |
||
| 49 | // } |
||
| 50 | |||
| 51 | public TipoComissionamento[] getTiposComissionamento() { |
||
| 52 | return TipoComissionamento.values(); |
||
| 53 | } |
||
| 54 | |||
| 55 | /***********************************************************/ |
||
| 56 | public StreamedContent emitirFichaColaboradorEsocial(Long sequencialPessoa) throws Exception { |
||
| 57 | ByteArrayInputStream input = new ByteArrayInputStream(pessoaService.emitirFichaColaboradorEsocial((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), sequencialPessoa)); |
||
| 58 | return DefaultStreamedContent.builder().contentType(ArquivoUtil.retornarContentTypeArquivo("doc")).name("formulario_esocial.doc").stream(() -> input).build(); |
||
| 59 | } |
||
| 60 | |||
| 61 | public StreamedContent emitirSolicitacaoExameAdmissional(Long sequencialPessoa) throws Exception { |
||
| 62 | ByteArrayInputStream input = new ByteArrayInputStream(pessoaService.emitirSolicitacaoExameAdmissional((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), sequencialPessoa)); |
||
| 63 | return DefaultStreamedContent.builder().contentType(ArquivoUtil.retornarContentTypeArquivo("docx")).name("exameAdmissional.docx").stream(() -> input).build(); |
||
| 64 | } |
||
| 65 | |||
| 66 | public StreamedContent emitirSolicitacaoExameDemissional(Long sequencialPessoa) throws Exception { |
||
| 67 | ByteArrayInputStream input = new ByteArrayInputStream(pessoaService.emitirSolicitacaoExameDemissional((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), sequencialPessoa)); |
||
| 68 | return DefaultStreamedContent.builder().contentType(ArquivoUtil.retornarContentTypeArquivo("docx")).name("exameDemissional.docx").stream(() -> input).build(); |
||
| 69 | } |
||
| 70 | |||
| 71 | public StreamedContent emitirSolicitacaoExamePeriodico(Long sequencialPessoa) throws Exception { |
||
| 72 | ByteArrayInputStream input = new ByteArrayInputStream(pessoaService.emitirSolicitacaoExamePeriodico((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), sequencialPessoa)); |
||
| 73 | return DefaultStreamedContent.builder().contentType(ArquivoUtil.retornarContentTypeArquivo("docx")).name("examePeriodico.docx").stream(() -> input).build(); |
||
| 74 | } |
||
| 75 | |||
| 76 | public StreamedContent emitirSolicitacaoAberturaContaBancaria(Long sequencialPessoa) throws Exception { |
||
| 77 | ByteArrayInputStream input = new ByteArrayInputStream(pessoaService.emitirSolicitacaoAberturaContaBancaria((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), sequencialPessoa)); |
||
| 78 | return DefaultStreamedContent.builder().contentType(ArquivoUtil.retornarContentTypeArquivo("docx")).name("aberturaContaBancaria.docx").stream(() -> input).build(); |
||
| 79 | } |
||
| 80 | |||
| 81 | public StreamedContent emitirAdesaoValeTransporte(Long sequencialPessoa) throws Exception { |
||
| 82 | ByteArrayInputStream input = new ByteArrayInputStream(pessoaService.emitirAdesaoValeTransporte((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), sequencialPessoa)); |
||
| 83 | return DefaultStreamedContent.builder().contentType(ArquivoUtil.retornarContentTypeArquivo("docx")).name("adesaoValeTransporte.docx").stream(() -> input).build(); |
||
| 84 | } |
||
| 85 | |||
| 86 | } |