Rev 106 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 106 | Rev 128 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | 2 | ||
| 3 | import java.io.Serializable; |
3 | import java.io.Serializable; |
| 4 | import java.util.Calendar; |
- | |
| 5 | import java.util.Date; |
- | |
| 6 | import java.util.GregorianCalendar; |
- | |
| 7 | import java.util.List; |
- | |
| 8 | 4 | ||
| 9 | import javax.inject.Inject; |
5 | import javax.inject.Inject; |
| 10 | import javax.inject.Named; |
6 | import javax.inject.Named; |
| 11 | 7 | ||
| 12 | import org.primefaces.model.chart.Axis; |
- | |
| 13 | import org.primefaces.model.chart.AxisType; |
- | |
| 14 | import org.primefaces.model.chart.BarChartModel; |
- | |
| 15 | import org.primefaces.model.chart.ChartSeries; |
- | |
| 16 | import org.springframework.context.annotation.Scope; |
8 | import org.springframework.context.annotation.Scope; |
| 17 | 9 | ||
| - | 10 | import br.com.ec.controller.managedbean.consultademanda.PessoaConsultaPorDemanda; |
|
| 18 | import br.com.ec.domain.dto.ColaboradorDTO; |
11 | import br.com.ec.domain.dto.ColaboradorDTO; |
| 19 | import br.com.ec.domain.dto.ParametrosConsultaVendasDTO; |
- | |
| 20 | import br.com.ec.domain.dto.ParametrosRelatorioVendasDTO; |
- | |
| 21 | import br.com.ec.domain.model.AvaliacaoFuncionario; |
- | |
| 22 | import br.com.ec.domain.model.Usuario; |
- | |
| 23 | import br.com.ec.domain.model.Vigencia; |
- | |
| 24 | import br.com.ec.domain.service.avaliacaofuncionario.AvaliacaoFuncionarioService; |
- | |
| - | 12 | import br.com.ec.domain.dto.ParametrosConsultaPessoaDTO; |
|
| - | 13 | import br.com.ec.domain.model.Funcionario; |
|
| - | 14 | import br.com.ec.domain.model.Pessoa; |
|
| - | 15 | import br.com.ec.domain.model.tipos.TipoCategoria; |
|
| - | 16 | import br.com.ec.domain.model.tipos.TipoColaborador; |
|
| - | 17 | import br.com.ec.domain.service.funcionario.FuncionarioService; |
|
| 25 | import br.com.ec.domain.service.seguranca.ContextoSeguranca; |
18 | import br.com.ec.domain.service.seguranca.ContextoSeguranca; |
| 26 | import br.com.ec.domain.service.usuario.UsuarioService; |
- | |
| 27 | import br.com.ec.domain.service.venda.VendaService; |
- | |
| 28 | import br.com.ec.domain.service.vendedor.VendedorService; |
- | |
| 29 | import br.com.ec.domain.service.vigencia.VigenciaService; |
- | |
| 30 | import br.com.ec.domain.shared.ConstantesSEC; |
19 | import br.com.ec.domain.shared.ConstantesSEC; |
| 31 | import br.edu.cesmac.core.generic.GenericService; |
20 | import br.edu.cesmac.core.generic.GenericService; |
| 32 | import br.edu.cesmac.core.util.DataUtils; |
- | |
| 33 | import br.edu.cesmac.core.util.VerificadorUtil; |
- | |
| 34 | import br.edu.cesmac.web.generic.AbstractBean; |
21 | import br.edu.cesmac.web.generic.AbstractBean; |
| 35 | import br.edu.cesmac.web.util.DataUtil; |
- | |
| 36 | 22 | ||
| 37 | @Named |
23 | @Named |
| 38 | @Scope("view") |
24 | @Scope("view") |
| 39 | public class ColaboradorBean extends AbstractBean<ColaboradorDTO> implements Serializable { |
25 | public class ColaboradorBean extends AbstractBean<ColaboradorDTO> implements Serializable { |
| 40 | 26 | ||
| 41 | private static final long serialVersionUID = 1L; |
27 | private static final long serialVersionUID = 1L; |
| 42 | 28 | ||
| - | 29 | private ParametrosConsultaPessoaDTO parametrosConsultaPessoaDTO; |
|
| - | 30 | private PessoaConsultaPorDemanda lazy; |
|
| - | 31 | ||
| - | 32 | private FuncionarioService funcionarioService; |
|
| - | 33 | ||
| - | 34 | /*
|
|
| 43 | private UsuarioService usuarioService; |
35 | private UsuarioService usuarioService;
|
| 44 | private VendaService vendaService; |
36 | private VendaService vendaService;
|
| 45 | private VendedorService vendedorService; |
37 | private VendedorService vendedorService;
|
| 46 | private VigenciaService vigenciaService; |
38 | private VigenciaService vigenciaService;
|
| 47 | private AvaliacaoFuncionarioService avaliacaoFuncionarioService; |
39 | private AvaliacaoFuncionarioService avaliacaoFuncionarioService;
|
| Line 56... | Line 48... | ||
| 56 | 48 |
|
|
| 57 | List<Vigencia> ultimasVigencias; |
49 | List<Vigencia> ultimasVigencias;
|
| 58 | 50 |
|
|
| 59 | private BarChartModel historico; |
51 | private BarChartModel historico;
|
| 60 | private BarChartModel historicoPercentual; |
52 | private BarChartModel historicoPercentual;
|
| - | 53 | */
|
|
| 61 | 54 | ||
| 62 | @Inject |
55 | @Inject |
| 63 | public ColaboradorBean(UsuarioService usuarioService, VendaService vendaService, VendedorService vendedorService, |
- | |
| 64 | VigenciaService vigenciaService, AvaliacaoFuncionarioService avaliacaoFuncionarioService, ContextoSeguranca contextoSeguranca) { |
- | |
| - | 56 | public ColaboradorBean(PessoaConsultaPorDemanda lazy, |
|
| - | 57 | FuncionarioService funcionarioService, |
|
| - | 58 | //UsuarioService usuarioService, VendaService vendaService, VendedorService vendedorService,
|
|
| - | 59 | //VigenciaService vigenciaService, AvaliacaoFuncionarioService avaliacaoFuncionarioService,
|
|
| - | 60 | ContextoSeguranca contextoSeguranca) { |
|
| - | 61 | this.lazy = lazy; |
|
| - | 62 | ||
| - | 63 | this.funcionarioService = funcionarioService; |
|
| - | 64 | /*
|
|
| 65 | this.usuarioService = usuarioService; |
65 | this.usuarioService = usuarioService;
|
| 66 | this.vendaService = vendaService; |
66 | this.vendaService = vendaService;
|
| 67 | this.vendedorService = vendedorService; |
67 | this.vendedorService = vendedorService;
|
| 68 | this.vigenciaService = vigenciaService; |
68 | this.vigenciaService = vigenciaService;
|
| 69 | this.avaliacaoFuncionarioService = avaliacaoFuncionarioService; |
69 | this.avaliacaoFuncionarioService = avaliacaoFuncionarioService;
|
| 70 | this.contextoSeguranca = contextoSeguranca; |
70 | this.contextoSeguranca = contextoSeguranca;
|
| - | 71 | */
|
|
| - | 72 | }
|
|
| - | 73 | ||
| - | 74 | @Override |
|
| - | 75 | public ColaboradorDTO getId() { |
|
| - | 76 | return getEntidade(); |
|
| - | 77 | }
|
|
| - | 78 | ||
| - | 79 | @Override |
|
| - | 80 | public GenericService<ColaboradorDTO> getService() { |
|
| - | 81 | return null; |
|
| - | 82 | }
|
|
| - | 83 | ||
| - | 84 | @Override |
|
| - | 85 | public void limparEntidade() { |
|
| - | 86 | setEntidade(new ColaboradorDTO()); |
|
| - | 87 | }
|
|
| - | 88 | ||
| - | 89 | public ParametrosConsultaPessoaDTO getParametrosConsultaPessoaDTO() { |
|
| - | 90 | return parametrosConsultaPessoaDTO; |
|
| - | 91 | }
|
|
| - | 92 | public void setParametrosConsultaPessoaDTO(ParametrosConsultaPessoaDTO parametrosConsultaPessoaDTO) { |
|
| - | 93 | this.parametrosConsultaPessoaDTO = parametrosConsultaPessoaDTO; |
|
| - | 94 | }
|
|
| - | 95 | ||
| - | 96 | public PessoaConsultaPorDemanda getLazy() { |
|
| - | 97 | return lazy; |
|
| - | 98 | }
|
|
| - | 99 | public void setLazy(PessoaConsultaPorDemanda lazy) { |
|
| - | 100 | this.lazy = lazy; |
|
| - | 101 | }
|
|
| - | 102 | public void prepararConsultaDemanda() { |
|
| - | 103 | lazy.setarParametrosConsulta(getParametrosConsultaPessoaDTO()); |
|
| - | 104 | }
|
|
| - | 105 | ||
| - | 106 | public TipoColaborador[] getTiposColaborador() { |
|
| - | 107 | return TipoColaborador.values(); |
|
| - | 108 | }
|
|
| - | 109 | ||
| - | 110 | @Override |
|
| - | 111 | public void preCarregamento() { |
|
| - | 112 | parametrosConsultaPessoaDTO = new ParametrosConsultaPessoaDTO(); |
|
| - | 113 | parametrosConsultaPessoaDTO.setEntidade(new Pessoa()); |
|
| - | 114 | parametrosConsultaPessoaDTO.setConsultarColaboradores(ConstantesSEC.Pessoa.CONSULTAR_COLABORADORES_C); |
|
| - | 115 | prepararConsultaDemanda(); |
|
| - | 116 | limparEntidade(); |
|
| - | 117 | }
|
|
| - | 118 | ||
| - | 119 | public Funcionario consultarFuncionarioPorPessoa(Pessoa pessoa) { |
|
| - | 120 | return funcionarioService.consultarFuncionarioPorPessoa(pessoa); |
|
| 71 | }
|
121 | }
|
| 72 | 122 | ||
| - | 123 | /*
|
|
| 73 | @Override |
124 | @Override
|
| 74 | public void preCarregamento() { |
125 | public void preCarregamento() {
|
| 75 | setUltimasVigencias(vigenciaService.consultarUltimasVigencias()); |
126 | setUltimasVigencias(vigenciaService.consultarUltimasVigencias());
|
| 76 | Usuario usuarioSelecionado = usuarioService.consultarPorId(contextoSeguranca.obterUsuario()); |
127 | Usuario usuarioSelecionado = usuarioService.consultarPorId(contextoSeguranca.obterUsuario());
|
| 77 | 128 |
|
|
| Line 116... | Line 167... | ||
| 116 | if (vigencia.getDataInicio().before(dataAtual) && vigencia.getDataFim().after(dataAtual)) { |
167 | if (vigencia.getDataInicio().before(dataAtual) && vigencia.getDataFim().after(dataAtual)) {
|
| 117 | return vigencia; |
168 | return vigencia;
|
| 118 | }
|
169 | }
|
| 119 | }
|
170 | }
|
| 120 | return null; |
171 | return null;
|
| 121 | }
|
- | |
| 122 | - | ||
| 123 | @Override |
- | |
| 124 | public void limparEntidade() { |
- | |
| 125 | setEntidade(new ColaboradorDTO()); |
- | |
| 126 | }
|
172 | }
|
| 127 | 173 | ||
| 128 | @Override |
174 | @Override
|
| 129 | public GenericService<ColaboradorDTO> getService() { |
175 | public GenericService<ColaboradorDTO> getService() {
|
| 130 | return null; |
176 | return null;
|
| Line 133... | Line 179... | ||
| 133 | @Override |
179 | @Override
|
| 134 | public ColaboradorDTO getEntidade() { |
180 | public ColaboradorDTO getEntidade() {
|
| 135 | return entidade; |
181 | return entidade;
|
| 136 | }
|
182 | }
|
| 137 | 183 | ||
| 138 | @Override |
- | |
| 139 | public ColaboradorDTO getId() { |
- | |
| 140 | return getEntidade(); |
- | |
| 141 | }
|
- | |
| 142 | - | ||
| 143 | public Vigencia getVigenciaAtual() { |
184 | public Vigencia getVigenciaAtual() {
|
| 144 | return vigenciaAtual; |
185 | return vigenciaAtual;
|
| 145 | }
|
186 | }
|
| 146 | public void setVigenciaAtual(Vigencia vigenciaAtual) { |
187 | public void setVigenciaAtual(Vigencia vigenciaAtual) {
|
| 147 | this.vigenciaAtual = vigenciaAtual; |
188 | this.vigenciaAtual = vigenciaAtual;
|
| Line 200... | Line 241... | ||
| 200 | }
|
241 | }
|
| 201 | public void setHistoricoPercentual(BarChartModel historicoPercentual) { |
242 | public void setHistoricoPercentual(BarChartModel historicoPercentual) {
|
| 202 | this.historicoPercentual = historicoPercentual; |
243 | this.historicoPercentual = historicoPercentual;
|
| 203 | }
|
244 | }
|
| 204 | 245 |
|
|
| 205 | /***************************************************************/
|
- | |
| 206 | - | ||
| 207 | public Double calcularPorcentagemDaMetaMensal() { |
246 | public Double calcularPorcentagemDaMetaMensal() {
|
| 208 | return verificarMetas(getEntidade().getRankingVendedor().getAvaliacaoFuncionario()) ? |
247 | return verificarMetas(getEntidade().getRankingVendedor().getAvaliacaoFuncionario()) ?
|
| 209 | consultarPorcentagem(getEntidade().getRankingVendedor().getAvaliacaoFuncionario().getValorMetaMensal(), |
248 | consultarPorcentagem(getEntidade().getRankingVendedor().getAvaliacaoFuncionario().getValorMetaMensal(),
|
| 210 | getEntidade().getRankingVendedor().getValorTotalVendido()) : 0.0; |
249 | getEntidade().getRankingVendedor().getValorTotalVendido()) : 0.0;
|
| 211 | }
|
250 | }
|
| Line 391... | Line 430... | ||
| 391 | }
|
430 | }
|
| 392 | 431 |
|
|
| 393 | public String produtosPromocaoInterna() { |
432 | public String produtosPromocaoInterna() {
|
| 394 | return ConstantesSEC.ProdutosPromocaoInterna.PRODUTOS.replace("'", ""); |
433 | return ConstantesSEC.ProdutosPromocaoInterna.PRODUTOS.replace("'", "");
|
| 395 | }
|
434 | }
|
| 396 | - | ||
| - | 435 | */
|
|
| 397 | }
|
436 | }
|