Rev 553 | Rev 698 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 553 | Rev 648 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | package br.com.ec.controller; |
1 | package br.com.ec.controller; |
| 2 | 2 | ||
| - | 3 | import java.io.IOException; |
|
| 3 | import java.io.Serializable; |
4 | import java.io.Serializable; |
| 4 | import java.util.ArrayList; |
5 | import java.util.ArrayList; |
| 5 | import java.util.Date; |
6 | import java.util.Date; |
| 6 | import java.util.List; |
7 | import java.util.List; |
| 7 | 8 | ||
| - | 9 | import javax.annotation.PostConstruct; |
|
| 8 | import javax.inject.Inject; |
10 | import javax.inject.Inject; |
| 9 | import javax.inject.Named; |
11 | import javax.inject.Named; |
| 10 | 12 | ||
| 11 | import org.primefaces.event.FileUploadEvent; |
13 | import org.primefaces.event.FileUploadEvent; |
| 12 | import org.primefaces.model.StreamedContent; |
14 | import org.primefaces.model.StreamedContent; |
| Line 19... | Line 21... | ||
| 19 | import br.com.ec.core.util.VerificadorUtil; |
21 | import br.com.ec.core.util.VerificadorUtil; |
| 20 | import br.com.ec.domain.dto.AvaliacaoDTO; |
22 | import br.com.ec.domain.dto.AvaliacaoDTO; |
| 21 | import br.com.ec.domain.dto.FolhaPagamentoDTO; |
23 | import br.com.ec.domain.dto.FolhaPagamentoDTO; |
| 22 | import br.com.ec.domain.dto.FolhaPagamentoFuncionarioDTO; |
24 | import br.com.ec.domain.dto.FolhaPagamentoFuncionarioDTO; |
| 23 | import br.com.ec.domain.dto.FolhaPagamentoFuncionarioExtraidoDTO; |
25 | import br.com.ec.domain.dto.FolhaPagamentoFuncionarioExtraidoDTO; |
| - | 26 | import br.com.ec.domain.dto.VigenciaDTO; |
|
| 24 | import br.com.ec.domain.model.Avaliacao; |
27 | import br.com.ec.domain.model.Avaliacao; |
| - | 28 | import br.com.ec.domain.service.AvaliacaoService; |
|
| 25 | import br.com.ec.domain.service.FolhaPagamentoService; |
29 | import br.com.ec.domain.service.FolhaPagamentoService; |
| 26 | import br.com.ec.domain.service.ParcelaService; |
30 | import br.com.ec.domain.service.ParcelaService; |
| - | 31 | import br.com.ec.domain.service.VigenciaService; |
|
| 27 | import br.com.ec.web.exception.VerificadorLancamentoException; |
32 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 28 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
33 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 29 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandRelatorioStreamedContent; |
34 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandRelatorioStreamedContent; |
| 30 | import br.com.ec.web.generic.AbstractBean; |
35 | import br.com.ec.web.generic.AbstractBean; |
| 31 | import br.com.ec.web.message.LancadorMensagem; |
36 | import br.com.ec.web.message.LancadorMensagem; |
| Line 36... | Line 41... | ||
| 36 | public class FolhaPagamentoBean extends AbstractBean<Avaliacao> implements Serializable { |
41 | public class FolhaPagamentoBean extends AbstractBean<Avaliacao> implements Serializable { |
| 37 | 42 | ||
| 38 | private static final long serialVersionUID = 1L; |
43 | private static final long serialVersionUID = 1L; |
| 39 | 44 | ||
| 40 | private FolhaPagamentoDTO folhaPagamentoDTO; |
45 | private FolhaPagamentoDTO folhaPagamentoDTO; |
| - | 46 | private VigenciaDTO vigenciaSelecionada; |
|
| - | 47 | ||
| - | 48 | private FolhaPagamentoService folhaPagamentoService; |
|
| - | 49 | private VigenciaService vigenciaService; |
|
| - | 50 | private AvaliacaoService avaliacaoService; |
|
| 41 | 51 | ||
| 42 | private UploadedFile arquivoParaImportacao; |
52 | private UploadedFile arquivoParaImportacao; |
| 43 | private String tituloEmail = "CONTRACHEQUE"; |
53 | private String tituloEmail = "CONTRACHEQUE"; |
| 44 | private Date dataPagamento = new Date(); |
54 | private Date dataPagamento = new Date(); |
| 45 | 55 | ||
| 46 | private FolhaPagamentoService folhaPagamentoService; |
- | |
| 47 | private ParcelaService parcelaService; |
56 | private ParcelaService parcelaService; |
| 48 | 57 | ||
| 49 | private AvaliacaoConsultaPorDemanda lazy; |
58 | private AvaliacaoConsultaPorDemanda lazy; |
| 50 | private ParametrosConsulta<Avaliacao> parametrosConsultaAvaliacao; |
59 | private ParametrosConsulta<Avaliacao> parametrosConsultaAvaliacao; |
| 51 | 60 | ||
| 52 | @Inject |
61 | @Inject |
| 53 | public FolhaPagamentoBean(AvaliacaoConsultaPorDemanda lazy, FolhaPagamentoService folhaPagamentoService, ParcelaService parcelaService) { |
- | |
| - | 62 | public FolhaPagamentoBean(AvaliacaoConsultaPorDemanda lazy, FolhaPagamentoService folhaPagamentoService, VigenciaService vigenciaService, |
|
| - | 63 | AvaliacaoService avaliacaoService, ParcelaService parcelaService) { |
|
| 54 | this.lazy = lazy; |
64 | this.lazy = lazy; |
| 55 | this.folhaPagamentoService = folhaPagamentoService; |
65 | this.folhaPagamentoService = folhaPagamentoService; |
| - | 66 | this.vigenciaService= vigenciaService; |
|
| - | 67 | this.avaliacaoService = avaliacaoService; |
|
| 56 | this.parcelaService = parcelaService; |
68 | this.parcelaService = parcelaService; |
| 57 | }
|
69 | }
|
| 58 | 70 | ||
| 59 | @Override |
71 | @Override |
| 60 | public void preCarregamento() { |
72 | public void preCarregamento() { |
| 61 | parametrosConsultaAvaliacao = new ParametrosConsulta<Avaliacao>(); |
73 | parametrosConsultaAvaliacao = new ParametrosConsulta<Avaliacao>(); |
| 62 | parametrosConsultaAvaliacao.setEntidade(new Avaliacao()); |
74 | parametrosConsultaAvaliacao.setEntidade(new Avaliacao()); |
| 63 | prepararConsultaDemanda(); |
75 | prepararConsultaDemanda(); |
| 64 | limparEntidade(); |
76 | limparEntidade(); |
| - | 77 | }
|
|
| - | 78 | ||
| - | 79 | @PostConstruct |
|
| - | 80 | private void posCarregamento() { |
|
| - | 81 | if (VerificadorUtil.estaNulo(vigenciaSelecionada)) { |
|
| - | 82 | if (VerificadorUtil.naoEstaNulo(getParametro("vigencia"))) { |
|
| - | 83 | setVigenciaSelecionada(vigenciaService.consultarVigencia(new Long(getParametro("vigencia").toString()))); |
|
| - | 84 | }
|
|
| - | 85 | }
|
|
| - | 86 | AvaliacaoDTO avaliacaoDTO = avaliacaoService.consultarAvaliacao(getVigenciaSelecionada().getSequencial()); |
|
| - | 87 | if (VerificadorUtil.naoEstaNulo(avaliacaoDTO)) { |
|
| - | 88 | setFolhaPagamentoDTO(folhaPagamentoService.detalharFolhaPagamento(avaliacaoDTO)); |
|
| - | 89 | }
|
|
| 65 | }
|
90 | }
|
| 66 | 91 | ||
| 67 | @Override |
92 | @Override |
| 68 | public void limparEntidade() { |
93 | public void limparEntidade() { |
| 69 | setEntidade(new Avaliacao()); |
94 | setEntidade(new Avaliacao()); |
| Line 115... | Line 140... | ||
| 115 | public FolhaPagamentoDTO getFolhaPagamentoDTO() { |
140 | public FolhaPagamentoDTO getFolhaPagamentoDTO() { |
| 116 | return folhaPagamentoDTO; |
141 | return folhaPagamentoDTO; |
| 117 | }
|
142 | }
|
| 118 | public void setFolhaPagamentoDTO(FolhaPagamentoDTO folhaPagamentoDTO) { |
143 | public void setFolhaPagamentoDTO(FolhaPagamentoDTO folhaPagamentoDTO) { |
| 119 | this.folhaPagamentoDTO = folhaPagamentoDTO; |
144 | this.folhaPagamentoDTO = folhaPagamentoDTO; |
| - | 145 | }
|
|
| - | 146 | ||
| - | 147 | public VigenciaDTO getVigenciaSelecionada() { |
|
| - | 148 | return vigenciaSelecionada; |
|
| - | 149 | }
|
|
| - | 150 | public void setVigenciaSelecionada(VigenciaDTO vigenciaSelecionada) { |
|
| - | 151 | this.vigenciaSelecionada = vigenciaSelecionada; |
|
| 120 | }
|
152 | }
|
| 121 | 153 | ||
| 122 | public UploadedFile getArquivoParaImportacao() { |
154 | public UploadedFile getArquivoParaImportacao() { |
| 123 | return arquivoParaImportacao; |
155 | return arquivoParaImportacao; |
| 124 | }
|
156 | }
|
| Line 151... | Line 183... | ||
| 151 | }
|
183 | }
|
| 152 | return extraidosForaDaAvaliacao; |
184 | return extraidosForaDaAvaliacao; |
| 153 | }
|
185 | }
|
| 154 | 186 | ||
| 155 | /**************************************************/
|
187 | /**************************************************/
|
| - | 188 | ||
| - | 189 | public void redirecionarGestaoMensal() { |
|
| - | 190 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 191 | public void execute() { |
|
| - | 192 | try { |
|
| - | 193 | LancadorMensagem.redirecionarTela("/sistema/gestao_mensal/gestao_mensal.xhtml"); |
|
| - | 194 | } catch (IOException e) { |
|
| - | 195 | e.printStackTrace(); |
|
| - | 196 | }
|
|
| - | 197 | }
|
|
| - | 198 | }); |
|
| - | 199 | }
|
|
| 156 | 200 | ||
| 157 | public void uploadArquivoEspacoCase() { |
201 | public void uploadArquivoEspacoCase() { |
| 158 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
202 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 159 | public void execute() { |
203 | public void execute() { |
| 160 | setFolhaPagamentoDTO(folhaPagamentoService.importarFolhaPagamento(getArquivoParaImportacao().getContent(), getFolhaPagamentoDTO())); |
204 | setFolhaPagamentoDTO(folhaPagamentoService.importarFolhaPagamento(getArquivoParaImportacao().getContent(), getFolhaPagamentoDTO())); |