Rev 429 | Rev 433 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 429 | Rev 430 | ||
|---|---|---|---|
| Line 3... | Line 3... | ||
| 3 | import java.io.Serializable; |
3 | import java.io.Serializable; |
| 4 | 4 | ||
| 5 | import javax.inject.Inject; |
5 | import javax.inject.Inject; |
| 6 | import javax.inject.Named; |
6 | import javax.inject.Named; |
| 7 | 7 | ||
| - | 8 | import org.primefaces.event.FileUploadEvent; |
|
| - | 9 | import org.primefaces.model.StreamedContent; |
|
| - | 10 | import org.primefaces.model.file.UploadedFile; |
|
| 8 | import org.springframework.context.annotation.Scope; |
11 | import org.springframework.context.annotation.Scope; |
| 9 | 12 | ||
| 10 | import br.com.ec.controller.consultademanda.AvaliacaoConsultaPorDemanda; |
13 | import br.com.ec.controller.consultademanda.AvaliacaoConsultaPorDemanda; |
| 11 | import br.com.ec.core.consulta.ParametrosConsulta; |
14 | import br.com.ec.core.consulta.ParametrosConsulta; |
| 12 | import br.com.ec.core.generic.GenericService; |
15 | import br.com.ec.core.generic.GenericService; |
| - | 16 | import br.com.ec.core.util.VerificadorUtil; |
|
| - | 17 | import br.com.ec.domain.dto.AvaliacaoDTO; |
|
| 13 | import br.com.ec.domain.dto.FolhaPagamentoDTO; |
18 | import br.com.ec.domain.dto.FolhaPagamentoDTO; |
| - | 19 | import br.com.ec.domain.dto.FolhaPagamentoFuncionarioDTO; |
|
| 14 | import br.com.ec.domain.model.Avaliacao; |
20 | import br.com.ec.domain.model.Avaliacao; |
| 15 | import br.com.ec.domain.service.AvaliacaoService; |
- | |
| 16 | import br.com.ec.domain.service.FolhaPagamentoService; |
21 | import br.com.ec.domain.service.FolhaPagamentoService; |
| 17 | import br.com.ec.web.exception.VerificadorLancamentoException; |
22 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 18 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
23 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| - | 24 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandRelatorioStreamedContent; |
|
| 19 | import br.com.ec.web.generic.AbstractBean; |
25 | import br.com.ec.web.generic.AbstractBean; |
| - | 26 | import br.com.ec.web.message.LancadorMensagem; |
|
| 20 | import br.com.ec.web.util.TipoOperacao; |
27 | import br.com.ec.web.util.TipoOperacao; |
| 21 | 28 | ||
| 22 | @Named |
29 | @Named |
| 23 | @Scope("view") |
30 | @Scope("view") |
| 24 | public class FolhaPagamentoBean extends AbstractBean<Avaliacao> implements Serializable { |
31 | public class FolhaPagamentoBean extends AbstractBean<Avaliacao> implements Serializable { |
| 25 | 32 | ||
| 26 | private static final long serialVersionUID = 1L; |
33 | private static final long serialVersionUID = 1L; |
| 27 | 34 | ||
| 28 | private FolhaPagamentoDTO folhaPagamentoDTO; |
35 | private FolhaPagamentoDTO folhaPagamentoDTO; |
| - | 36 | ||
| - | 37 | private UploadedFile arquivoParaImportacao; |
|
| - | 38 | private String tituloEmail = "CONTRACHEQUE"; |
|
| 29 | 39 | ||
| 30 | private FolhaPagamentoService folhaPagamentoService; |
40 | private FolhaPagamentoService folhaPagamentoService; |
| 31 | 41 | ||
| 32 | private AvaliacaoConsultaPorDemanda lazy; |
42 | private AvaliacaoConsultaPorDemanda lazy; |
| 33 | private ParametrosConsulta<Avaliacao> parametrosConsultaAvaliacao; |
43 | private ParametrosConsulta<Avaliacao> parametrosConsultaAvaliacao; |
| Line 67... | Line 77... | ||
| 67 | }
|
77 | }
|
| 68 | 78 | ||
| 69 | @Override |
79 | @Override |
| 70 | public void preAlterar(Avaliacao avaliacao) { |
80 | public void preAlterar(Avaliacao avaliacao) { |
| 71 | super.preAlterar(avaliacao); |
81 | super.preAlterar(avaliacao); |
| 72 | // setFolhaPagamentoDTO(new FolhaPagamentoDTO(avaliacao));
|
- | |
| 73 | setFolhaPagamentoDTO(folhaPagamentoService.detalharFolhaPagamento(avaliacao.getSequencial())); |
- | |
| - | 82 | setFolhaPagamentoDTO(folhaPagamentoService.detalharFolhaPagamento(new AvaliacaoDTO(avaliacao.getSequencial(), avaliacao.getSequencialDaVigencia(), avaliacao.getDescricaoDaVigencia()))); |
|
| 74 | }
|
83 | }
|
| 75 | 84 | ||
| 76 | @Override |
85 | @Override |
| 77 | public Avaliacao getId() { |
86 | public Avaliacao getId() { |
| 78 | return getEntidade(); |
87 | return getEntidade(); |
| Line 98... | Line 107... | ||
| 98 | public FolhaPagamentoDTO getFolhaPagamentoDTO() { |
107 | public FolhaPagamentoDTO getFolhaPagamentoDTO() { |
| 99 | return folhaPagamentoDTO; |
108 | return folhaPagamentoDTO; |
| 100 | }
|
109 | }
|
| 101 | public void setFolhaPagamentoDTO(FolhaPagamentoDTO folhaPagamentoDTO) { |
110 | public void setFolhaPagamentoDTO(FolhaPagamentoDTO folhaPagamentoDTO) { |
| 102 | this.folhaPagamentoDTO = folhaPagamentoDTO; |
111 | this.folhaPagamentoDTO = folhaPagamentoDTO; |
| - | 112 | }
|
|
| - | 113 | ||
| - | 114 | public UploadedFile getArquivoParaImportacao() { |
|
| - | 115 | return arquivoParaImportacao; |
|
| - | 116 | }
|
|
| - | 117 | public void setArquivoParaImportacao(UploadedFile arquivoParaImportacao) { |
|
| - | 118 | this.arquivoParaImportacao = arquivoParaImportacao; |
|
| - | 119 | }
|
|
| - | 120 | ||
| - | 121 | public String getTituloEmail() { |
|
| - | 122 | return tituloEmail; |
|
| - | 123 | }
|
|
| - | 124 | public void setTituloEmail(String tituloEmail) { |
|
| - | 125 | this.tituloEmail = tituloEmail; |
|
| 103 | }
|
126 | }
|
| 104 | 127 | ||
| 105 | /**************************************************/
|
128 | /**************************************************/
|
| - | 129 | ||
| - | 130 | public void uploadArquivoEspacoCase() { |
|
| - | 131 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 132 | public void execute() { |
|
| - | 133 | setFolhaPagamentoDTO(folhaPagamentoService.importarFolhaPagamento(getArquivoParaImportacao().getContent(), getFolhaPagamentoDTO())); |
|
| - | 134 | LancadorMensagem.lancarSucesso("ARQUIVO IMPORTADO COM SUCESSO!"); |
|
| - | 135 | }
|
|
| - | 136 | }); |
|
| - | 137 | }
|
|
| - | 138 | ||
| - | 139 | public void selecionarTodosParaEnviarEmail() { |
|
| - | 140 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 141 | public void execute() { |
|
| - | 142 | for (FolhaPagamentoFuncionarioDTO folhaPagamentoFuncionario : getFolhaPagamentoDTO().getFuncionarios()) { |
|
| - | 143 | if (folhaPagamentoFuncionario.getEnviarEmail()) { |
|
| - | 144 | folhaPagamentoFuncionario.setEnviarEmail(false); |
|
| - | 145 | } else { |
|
| - | 146 | folhaPagamentoFuncionario.setEnviarEmail(true); |
|
| - | 147 | }
|
|
| - | 148 | }
|
|
| - | 149 | }
|
|
| - | 150 | }); |
|
| - | 151 | }
|
|
| - | 152 | ||
| - | 153 | public void uploadArquivoEspacoCase(final FileUploadEvent e) { |
|
| - | 154 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 155 | public void execute() { |
|
| - | 156 | setFolhaPagamentoDTO(folhaPagamentoService.importarFolhaPagamento(e.getFile().getContent(), getFolhaPagamentoDTO())); |
|
| - | 157 | }
|
|
| - | 158 | }); |
|
| - | 159 | }
|
|
| - | 160 | ||
| - | 161 | public void atualizarValoresImportados() { |
|
| - | 162 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 163 | public void execute() { |
|
| - | 164 | for (FolhaPagamentoFuncionarioDTO folhaPagamentoFuncionario : getFolhaPagamentoDTO().getFuncionarios()) { |
|
| - | 165 | if (VerificadorUtil.naoEstaNulo(folhaPagamentoFuncionario.getValorSalarioImportado()) && |
|
| - | 166 | VerificadorUtil.naoEstaNulo(folhaPagamentoFuncionario.getParcelaSalario())) { |
|
| - | 167 | folhaPagamentoFuncionario.getParcelaSalario().setValor(folhaPagamentoFuncionario.getValorSalarioImportado()); |
|
| - | 168 | }
|
|
| - | 169 | }
|
|
| - | 170 | LancadorMensagem.lancarSucesso("VALORES ATUALIZADOS COM SUCESSO"); |
|
| - | 171 | }
|
|
| - | 172 | }); |
|
| - | 173 | }
|
|
| - | 174 | ||
| - | 175 | public StreamedContent downloadRecibos() throws Exception { |
|
| - | 176 | return new VerificadorLancamentoException().verificarLancamentoException(new CommandRelatorioStreamedContent() { |
|
| - | 177 | @Override |
|
| - | 178 | public StreamedContent execute() { |
|
| - | 179 | return null; |
|
| - | 180 | // return arquivoService.gerarRecibos(arquivoDTO, ((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()));
|
|
| - | 181 | }
|
|
| - | 182 | }); |
|
| - | 183 | }
|
|
| - | 184 | ||
| - | 185 | public StreamedContent enviarRecibos() throws Exception { |
|
| - | 186 | return new VerificadorLancamentoException().verificarLancamentoException(new CommandRelatorioStreamedContent() { |
|
| - | 187 | @Override |
|
| - | 188 | public StreamedContent execute() { |
|
| - | 189 | return null; |
|
| - | 190 | // return arquivoService.gerarRecibos(arquivoDTO, ((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()));
|
|
| - | 191 | }
|
|
| - | 192 | }); |
|
| - | 193 | }
|
|
| 106 | 194 | ||
| 107 | }
|
195 | }
|