Rev 353 | Rev 409 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 325 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 353 | espaco | 4 | import java.util.ArrayList; |
| 355 | espaco | 5 | import java.util.Date; |
| 325 | espaco | 6 | import java.util.List; |
| 7 | |||
| 8 | import javax.inject.Inject; |
||
| 9 | import javax.inject.Named; |
||
| 10 | |||
| 11 | import org.springframework.context.annotation.Scope; |
||
| 12 | |||
| 13 | import br.com.ec.core.generic.GenericService; |
||
| 353 | espaco | 14 | import br.com.ec.core.util.DataUtils; |
| 325 | espaco | 15 | import br.com.ec.core.util.VerificadorUtil; |
| 353 | espaco | 16 | import br.com.ec.domain.dto.AtestadoFuncionarioDTO; |
| 325 | espaco | 17 | import br.com.ec.domain.dto.EnderecoDTO; |
| 353 | espaco | 18 | import br.com.ec.domain.dto.ExameFuncionarioDTO; |
| 325 | espaco | 19 | import br.com.ec.domain.dto.FuncionarioDTO; |
| 353 | espaco | 20 | import br.com.ec.domain.dto.FuncionarioEscalaDTO; |
| 21 | import br.com.ec.domain.dto.FuncionarioFeriasDTO; |
||
| 22 | import br.com.ec.domain.dto.LojaDTO; |
||
| 23 | import br.com.ec.domain.dto.PessoaDTO; |
||
| 325 | espaco | 24 | import br.com.ec.domain.dto.PessoaPapelDTO; |
| 353 | espaco | 25 | import br.com.ec.domain.dto.PontoDTO; |
| 325 | espaco | 26 | import br.com.ec.domain.dto.UsuarioDTO; |
| 27 | import br.com.ec.domain.dto.UsuarioLojaDTO; |
||
| 28 | import br.com.ec.domain.dto.UsuarioPerfilDTO; |
||
| 355 | espaco | 29 | import br.com.ec.domain.dto.VigenciaDTO; |
| 325 | espaco | 30 | import br.com.ec.domain.model.Endereco; |
| 31 | import br.com.ec.domain.model.Funcionario; |
||
| 353 | espaco | 32 | import br.com.ec.domain.model.FuncionarioFerias; |
| 325 | espaco | 33 | import br.com.ec.domain.model.Papel; |
| 353 | espaco | 34 | import br.com.ec.domain.model.Ponto; |
| 325 | espaco | 35 | import br.com.ec.domain.model.Usuario; |
| 355 | espaco | 36 | import br.com.ec.domain.model.tipos.TipoOcorrenciaEscala; |
| 326 | espaco | 37 | import br.com.ec.domain.service.AvaliacaoFuncionarioService; |
| 325 | espaco | 38 | import br.com.ec.domain.service.EnderecoService; |
| 353 | espaco | 39 | import br.com.ec.domain.service.FuncionarioFeriasService; |
| 325 | espaco | 40 | import br.com.ec.domain.service.FuncionarioService; |
| 41 | import br.com.ec.domain.service.PapelService; |
||
| 42 | import br.com.ec.domain.service.PessoaPapelService; |
||
| 43 | import br.com.ec.domain.service.PessoaService; |
||
| 353 | espaco | 44 | import br.com.ec.domain.service.PontoService; |
| 325 | espaco | 45 | import br.com.ec.domain.service.UsuarioLojaService; |
| 46 | import br.com.ec.domain.service.UsuarioPerfilService; |
||
| 47 | import br.com.ec.domain.service.UsuarioService; |
||
| 48 | import br.com.ec.domain.service.VendedorService; |
||
| 49 | import br.com.ec.web.exception.VerificadorLancamentoException; |
||
| 50 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
||
| 51 | import br.com.ec.web.generic.AbstractBean; |
||
| 52 | import br.com.ec.web.message.LancadorMensagem; |
||
| 53 | import br.com.ec.web.util.TipoOperacao; |
||
| 54 | |||
| 55 | @Named |
||
| 56 | @Scope("view") |
||
| 57 | public class FuncionarioBean extends AbstractBean<Funcionario> implements Serializable { |
||
| 58 | |||
| 59 | private static final long serialVersionUID = 1L; |
||
| 60 | |||
| 61 | private FuncionarioService funcionarioService; |
||
| 62 | private UsuarioService usuarioService; |
||
| 63 | private PessoaService pessoaService; |
||
| 64 | private PapelService papelService; |
||
| 65 | private PessoaPapelService pessoaPapelService; |
||
| 66 | private EnderecoService enderecoService; |
||
| 67 | private UsuarioPerfilService usuarioPerfilService; |
||
| 68 | private UsuarioLojaService usuarioLojaService; |
||
| 69 | private VendedorService vendedorService; |
||
| 326 | espaco | 70 | private AvaliacaoFuncionarioService avaliacaoFuncionarioService; |
| 353 | espaco | 71 | private FuncionarioFeriasService funcionarioFeriasService; |
| 72 | private PontoService pontoService; |
||
| 325 | espaco | 73 | |
| 74 | private FuncionarioDTO entidadeParaConsulta; |
||
| 75 | private List<FuncionarioDTO> funcionarios; |
||
| 76 | |||
| 77 | private FuncionarioDTO entidadeDTO; |
||
| 78 | private PessoaPapelDTO pessoaPapelDTO; |
||
| 79 | private Endereco endereco; |
||
| 80 | private Usuario usuario; |
||
| 81 | private UsuarioPerfilDTO usuarioPerfilDTO; |
||
| 82 | private UsuarioLojaDTO usuarioLojaDTO; |
||
| 353 | espaco | 83 | private FuncionarioFeriasDTO funcionarioFeriasDTO; |
| 325 | espaco | 84 | |
| 85 | @Inject |
||
| 86 | public FuncionarioBean(FuncionarioService funcionarioService, UsuarioService usuarioService, PessoaService pessoaService, |
||
| 87 | PapelService papelService, PessoaPapelService pessoaPapelService, EnderecoService enderecoService, |
||
| 326 | espaco | 88 | UsuarioPerfilService usuarioPerfilService, UsuarioLojaService usuarioLojaService, VendedorService vendedorService, |
| 353 | espaco | 89 | AvaliacaoFuncionarioService avaliacaoFuncionarioService, FuncionarioFeriasService funcionarioFeriasService, |
| 90 | PontoService pontoService) { |
||
| 325 | espaco | 91 | this.funcionarioService = funcionarioService; |
| 92 | this.usuarioService = usuarioService; |
||
| 93 | this.pessoaService = pessoaService; |
||
| 94 | this.papelService = papelService; |
||
| 95 | this.pessoaPapelService = pessoaPapelService; |
||
| 96 | this.enderecoService = enderecoService; |
||
| 97 | this.usuarioPerfilService = usuarioPerfilService; |
||
| 98 | this.usuarioLojaService = usuarioLojaService; |
||
| 99 | this.vendedorService = vendedorService; |
||
| 326 | espaco | 100 | this.avaliacaoFuncionarioService = avaliacaoFuncionarioService; |
| 353 | espaco | 101 | this.funcionarioFeriasService = funcionarioFeriasService; |
| 102 | this.pontoService = pontoService; |
||
| 325 | espaco | 103 | } |
| 104 | |||
| 105 | @Override |
||
| 106 | public void preCarregamento() { |
||
| 107 | limparEntidade(); |
||
| 108 | consultarFuncionarios(); |
||
| 109 | } |
||
| 110 | |||
| 111 | @Override |
||
| 112 | public void limparEntidade() { |
||
| 113 | setEntidade(new Funcionario()); |
||
| 114 | setEntidadeParaConsulta(new FuncionarioDTO()); |
||
| 115 | setEntidadeDTO(null); |
||
| 116 | consultarFuncionarios(); |
||
| 117 | } |
||
| 118 | |||
| 119 | @Override |
||
| 120 | public GenericService<Funcionario> getService() { |
||
| 121 | return funcionarioService; |
||
| 122 | } |
||
| 123 | |||
| 124 | @Override |
||
| 125 | public Funcionario getEntidade() { |
||
| 126 | return entidade; |
||
| 127 | } |
||
| 128 | |||
| 129 | @Override |
||
| 130 | public void preConsultar() { |
||
| 131 | setTipoOperacao(TipoOperacao.CONSULTAR); |
||
| 132 | } |
||
| 133 | |||
| 134 | @Override |
||
| 135 | public Funcionario getId() { |
||
| 136 | return getEntidade(); |
||
| 137 | } |
||
| 138 | |||
| 139 | /*************************************************/ |
||
| 140 | |||
| 141 | public FuncionarioDTO getEntidadeParaConsulta() { |
||
| 142 | return entidadeParaConsulta; |
||
| 143 | } |
||
| 144 | public void setEntidadeParaConsulta(FuncionarioDTO entidadeParaConsulta) { |
||
| 145 | this.entidadeParaConsulta = entidadeParaConsulta; |
||
| 146 | } |
||
| 147 | |||
| 148 | public List<FuncionarioDTO> getFuncionarios() { |
||
| 149 | return funcionarios; |
||
| 150 | } |
||
| 151 | public void setFuncionarios(List<FuncionarioDTO> funcionarios) { |
||
| 152 | this.funcionarios = funcionarios; |
||
| 153 | } |
||
| 154 | |||
| 155 | public FuncionarioDTO getEntidadeDTO() { |
||
| 156 | return entidadeDTO; |
||
| 157 | } |
||
| 158 | public void setEntidadeDTO(FuncionarioDTO entidadeDTO) { |
||
| 159 | this.entidadeDTO = entidadeDTO; |
||
| 160 | } |
||
| 161 | |||
| 162 | public PessoaPapelDTO getPessoaPapelDTO() { |
||
| 163 | return pessoaPapelDTO; |
||
| 164 | } |
||
| 165 | public void setPessoaPapelDTO(PessoaPapelDTO pessoaPapelDTO) { |
||
| 166 | this.pessoaPapelDTO = pessoaPapelDTO; |
||
| 167 | } |
||
| 168 | |||
| 169 | public Endereco getEndereco() { |
||
| 170 | return endereco; |
||
| 171 | } |
||
| 172 | public void setEndereco(Endereco endereco) { |
||
| 173 | this.endereco = endereco; |
||
| 174 | } |
||
| 175 | |||
| 176 | public Usuario getUsuario() { |
||
| 177 | return usuario; |
||
| 178 | } |
||
| 179 | public void setUsuario(Usuario usuario) { |
||
| 180 | this.usuario = usuario; |
||
| 181 | } |
||
| 182 | |||
| 183 | public UsuarioPerfilDTO getUsuarioPerfilDTO() { |
||
| 184 | return usuarioPerfilDTO; |
||
| 185 | } |
||
| 186 | public void setUsuarioPerfilDTO(UsuarioPerfilDTO usuarioPerfilDTO) { |
||
| 187 | this.usuarioPerfilDTO = usuarioPerfilDTO; |
||
| 188 | } |
||
| 189 | |||
| 190 | public UsuarioLojaDTO getUsuarioLojaDTO() { |
||
| 191 | return usuarioLojaDTO; |
||
| 192 | } |
||
| 193 | public void setUsuarioLojaDTO(UsuarioLojaDTO usuarioLojaDTO) { |
||
| 194 | this.usuarioLojaDTO = usuarioLojaDTO; |
||
| 195 | } |
||
| 196 | |||
| 353 | espaco | 197 | public FuncionarioFeriasDTO getFuncionarioFeriasDTO() { |
| 198 | return funcionarioFeriasDTO; |
||
| 199 | } |
||
| 200 | public void setFuncionarioFeriasDTO(FuncionarioFeriasDTO funcionarioFeriasDTO) { |
||
| 201 | this.funcionarioFeriasDTO = funcionarioFeriasDTO; |
||
| 202 | } |
||
| 203 | |||
| 325 | espaco | 204 | /*************************************************/ |
| 205 | |||
| 206 | public void prepararDetalhar(FuncionarioDTO funcionarioDTO) { |
||
| 207 | super.preDetalhar(funcionarioService.consultarPorId(new Funcionario(funcionarioDTO.getSequencialFuncionario()))); |
||
| 208 | } |
||
| 209 | |||
| 210 | public void prepararAlterar(FuncionarioDTO funcionarioDTO) { |
||
| 211 | super.preAlterar(funcionarioService.consultarPorId(new Funcionario(funcionarioDTO.getSequencialFuncionario()))); |
||
| 212 | } |
||
| 213 | |||
| 214 | public void consultarFuncionarios() { |
||
| 215 | setFuncionarios(funcionarioService.consultarFuncionarios(getEntidadeParaConsulta())); |
||
| 216 | } |
||
| 217 | |||
| 218 | public void prepararAlterarCompleto(FuncionarioDTO funcionarioDTO) { |
||
| 219 | super.preAlterar(funcionarioService.consultarPorId(new Funcionario(funcionarioDTO.getSequencialFuncionario()))); |
||
| 220 | UsuarioDTO usuarioDTO = usuarioService.consultarPorPessoa(funcionarioDTO.getSequencialPessoa()); |
||
| 221 | setEntidadeDTO(new FuncionarioDTO(getEntidade().getSequencial())); |
||
| 222 | if (VerificadorUtil.naoEstaNulo(usuarioDTO)) { |
||
| 223 | getEntidadeDTO().setUsuarioDTO(usuarioDTO); |
||
| 224 | getEntidadeDTO().getUsuarioDTO().setPerfis(usuarioPerfilService.consultarPerfisDoUsuario(usuarioDTO.getSequencial())); |
||
| 225 | getEntidadeDTO().getUsuarioDTO().setLojas(usuarioLojaService.consultarLojasDoUsuario(usuarioDTO.getSequencial())); |
||
| 226 | } |
||
| 227 | getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 228 | getEntidadeDTO().setEnderecosDTO(enderecoService.consultarEnderecosDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 229 | getEntidadeDTO().setVendedorDTO(vendedorService.consultarVendedorPorPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 230 | limparPapel(); |
||
| 231 | } |
||
| 232 | |||
| 233 | public void alterarCompleto() { |
||
| 234 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 235 | public void execute() { |
||
| 236 | pessoaService.alterar(getEntidade().getPessoa()); |
||
| 353 | espaco | 237 | if (VerificadorUtil.naoEstaNulo(getEntidadeDTO().getUsuarioDTO())) { |
| 238 | usuarioService.alterar(getEntidadeDTO().getUsuarioDTO()); |
||
| 239 | } |
||
| 326 | espaco | 240 | vendedorService.alterar(getEntidadeDTO().getVendedorDTO()); |
| 325 | espaco | 241 | alterar(getEntidade()); |
| 242 | } |
||
| 243 | }); |
||
| 244 | } |
||
| 245 | |||
| 246 | public void limparPapel() { |
||
| 247 | PessoaPapelDTO pessoaPapelDTO = new PessoaPapelDTO(); |
||
| 248 | pessoaPapelDTO.setSequencialPessoa(getEntidade().getPessoa().getSequencial()); |
||
| 249 | setPessoaPapelDTO(pessoaPapelDTO); |
||
| 250 | } |
||
| 251 | |||
| 252 | public void adicionarPapel() { |
||
| 253 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 254 | public void execute() { |
||
| 255 | pessoaPapelService.adicionarPapel(getEntidade().getPessoa(), new Papel(getPessoaPapelDTO().getCodigoPapel())); |
||
| 256 | getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(getPessoaPapelDTO().getSequencialPessoa())); |
||
| 257 | LancadorMensagem.lancarSucesso("PAPEL ADICIONADO COM SUCESSO"); |
||
| 258 | } |
||
| 259 | }); |
||
| 260 | } |
||
| 261 | |||
| 262 | public void removerPapel(PessoaPapelDTO pessoaPapelDTO) { |
||
| 263 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 264 | public void execute() { |
||
| 265 | pessoaPapelService.removerPapel(pessoaPapelDTO.getSequencialPessoa(), pessoaPapelDTO.getCodigoPapel()); |
||
| 266 | getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(pessoaPapelDTO.getSequencialPessoa())); |
||
| 267 | LancadorMensagem.lancarSucesso("PAPEL REMOVIDO COM SUCESSO"); |
||
| 268 | } |
||
| 269 | }); |
||
| 270 | } |
||
| 271 | |||
| 272 | public void limparEndereco() { |
||
| 273 | Endereco endereco = new Endereco(); |
||
| 274 | endereco.setPessoa(getEntidade().getPessoa()); |
||
| 275 | endereco.setAtivo(true); |
||
| 276 | setEndereco(endereco); |
||
| 277 | } |
||
| 278 | |||
| 279 | public void prepararAlterarEndereco(EnderecoDTO enderecoDTO) { |
||
| 280 | setEndereco(enderecoService.consultarPorId(new Endereco(enderecoDTO.getSequencial()))); |
||
| 281 | } |
||
| 282 | |||
| 283 | public void adicionarEndereco() { |
||
| 284 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 285 | public void execute() { |
||
| 286 | enderecoService.alterar(getEndereco()); |
||
| 287 | getEntidadeDTO().setEnderecosDTO(enderecoService.consultarEnderecosDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 288 | LancadorMensagem.lancarSucesso("ENDEREÇO SALVO COM SUCESSO"); |
||
| 289 | } |
||
| 290 | }); |
||
| 291 | } |
||
| 292 | |||
| 293 | public void removerEndereco(EnderecoDTO enderecoDTO) { |
||
| 294 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 295 | public void execute() { |
||
| 296 | enderecoService.removerEndereco(enderecoDTO.getSequencial()); |
||
| 297 | getEntidadeDTO().setEnderecosDTO(enderecoService.consultarEnderecosDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 298 | LancadorMensagem.lancarSucesso("ENDEREÇO REMOVIDO COM SUCESSO"); |
||
| 299 | } |
||
| 300 | }); |
||
| 301 | } |
||
| 302 | |||
| 303 | public void limparUsuarioPerfil() { |
||
| 304 | UsuarioPerfilDTO usuarioPerfilDTO = new UsuarioPerfilDTO(); |
||
| 305 | usuarioPerfilDTO.setSequencialUsuario(getEntidadeDTO().getUsuarioDTO().getSequencial()); |
||
| 306 | setUsuarioPerfilDTO(usuarioPerfilDTO); |
||
| 307 | } |
||
| 308 | |||
| 309 | public void adicionarUsuarioPerfil() { |
||
| 310 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 311 | public void execute() { |
||
| 312 | usuarioPerfilService.adicionarPerfil(getUsuarioPerfilDTO().getSequencialUsuario(), getUsuarioPerfilDTO().getCodigoPerfil()); |
||
| 313 | getEntidadeDTO().getUsuarioDTO().setPerfis(usuarioPerfilService.consultarPerfisDoUsuario(getUsuarioPerfilDTO().getSequencialUsuario())); |
||
| 314 | LancadorMensagem.lancarSucesso("PERFIL ADICIONADO COM SUCESSO"); |
||
| 315 | } |
||
| 316 | }); |
||
| 317 | } |
||
| 318 | |||
| 319 | public void removerUsuarioPerfil(UsuarioPerfilDTO usuarioPerfilDTO) { |
||
| 320 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 321 | public void execute() { |
||
| 322 | usuarioPerfilService.removerPerfil(usuarioPerfilDTO.getSequencial()); |
||
| 323 | getEntidadeDTO().getUsuarioDTO().setPerfis(usuarioPerfilService.consultarPerfisDoUsuario(usuarioPerfilDTO.getSequencialUsuario())); |
||
| 324 | LancadorMensagem.lancarSucesso("PERFIL REMOVIDO COM SUCESSO"); |
||
| 325 | } |
||
| 326 | }); |
||
| 327 | } |
||
| 328 | |||
| 329 | public void limparUsuarioLoja() { |
||
| 330 | UsuarioLojaDTO usuarioLojaDTO = new UsuarioLojaDTO(); |
||
| 331 | usuarioLojaDTO.setSequencialUsuario(getEntidadeDTO().getUsuarioDTO().getSequencial()); |
||
| 332 | setUsuarioLojaDTO(usuarioLojaDTO); |
||
| 333 | } |
||
| 334 | |||
| 335 | public void adicionarUsuarioLoja() { |
||
| 336 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 337 | public void execute() { |
||
| 338 | usuarioLojaService.adicionarLoja(getUsuarioLojaDTO().getSequencialUsuario(), getUsuarioLojaDTO().getSequencialLoja()); |
||
| 339 | getEntidadeDTO().getUsuarioDTO().setLojas(usuarioLojaService.consultarLojasDoUsuario(getUsuarioLojaDTO().getSequencialUsuario())); |
||
| 340 | LancadorMensagem.lancarSucesso("LOJA ADICIONADA COM SUCESSO"); |
||
| 341 | } |
||
| 342 | }); |
||
| 343 | } |
||
| 344 | |||
| 345 | public void removerUsuarioLoja(UsuarioLojaDTO usuarioLojaDTO) { |
||
| 346 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 347 | public void execute() { |
||
| 348 | usuarioLojaService.removerLoja(usuarioLojaDTO.getSequencialUsuario(), usuarioLojaDTO.getSequencialLoja()); |
||
| 349 | getEntidadeDTO().getUsuarioDTO().setLojas(usuarioLojaService.consultarLojasDoUsuario(usuarioLojaDTO.getSequencialUsuario())); |
||
| 350 | LancadorMensagem.lancarSucesso("LOJA REMOVIDA COM SUCESSO"); |
||
| 351 | } |
||
| 352 | }); |
||
| 353 | } |
||
| 354 | |||
| 353 | espaco | 355 | public void consultarFerias() { |
| 356 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 357 | public void execute() { |
||
| 358 | getEntidadeDTO().setFeriasDTO(funcionarioFeriasService.consultarFerias(getEntidadeDTO().getSequencialFuncionario())); |
||
| 359 | } |
||
| 360 | }); |
||
| 361 | } |
||
| 362 | |||
| 363 | public void selecionarFerias(FuncionarioFeriasDTO funcionarioFeriasDTO) { |
||
| 364 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 365 | public void execute() { |
||
| 366 | setFuncionarioFeriasDTO(funcionarioFeriasDTO); |
||
| 367 | } |
||
| 368 | }); |
||
| 369 | } |
||
| 370 | |||
| 371 | public void prepararFerias() { |
||
| 372 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 373 | public void execute() { |
||
| 374 | FuncionarioFeriasDTO funcionarioFeriasDTO = new FuncionarioFeriasDTO(); |
||
| 375 | funcionarioFeriasDTO.setFuncionarioDTO(getEntidadeDTO()); |
||
| 376 | setFuncionarioFeriasDTO(funcionarioFeriasDTO); |
||
| 377 | } |
||
| 378 | }); |
||
| 379 | } |
||
| 380 | |||
| 381 | public void atualizarFerias() { |
||
| 382 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 383 | public void execute() { |
||
| 384 | funcionarioFeriasService.alterarProvisao(getFuncionarioFeriasDTO()); |
||
| 385 | consultarFerias(); |
||
| 386 | LancadorMensagem.lancarSucesso("FÉRIAS ATUALIZADA COM SUCESSO!"); |
||
| 387 | } |
||
| 388 | }); |
||
| 389 | } |
||
| 390 | |||
| 391 | public void removerFerias(FuncionarioFeriasDTO funcionarioFeriasDTO) { |
||
| 392 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 393 | public void execute() { |
||
| 394 | FuncionarioFerias funcionarioFerias = new FuncionarioFerias(); |
||
| 395 | funcionarioFerias.setSequencial(funcionarioFeriasDTO.getSequencialFuncionarioFerias()); |
||
| 396 | funcionarioFeriasService.excluir(funcionarioFerias); |
||
| 397 | consultarFerias(); |
||
| 398 | LancadorMensagem.lancarSucesso("FÉRIAS REMOVIDA COM SUCESSO"); |
||
| 399 | } |
||
| 400 | }); |
||
| 401 | } |
||
| 402 | |||
| 326 | espaco | 403 | public void consultarAvaliacoes() { |
| 404 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 405 | public void execute() { |
||
| 406 | getEntidadeDTO().setAvaliacoesDTO(avaliacaoFuncionarioService.consultarAvaliacoesFuncionario(getEntidadeDTO().getSequencialFuncionario())); |
||
| 407 | } |
||
| 408 | }); |
||
| 325 | espaco | 409 | } |
| 410 | |||
| 353 | espaco | 411 | // TODO: IMPLEMENTAÇÃO PENDENTE |
| 412 | public void consultarExames() { |
||
| 413 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 414 | public void execute() { |
||
| 415 | List<ExameFuncionarioDTO> examesDTO = new ArrayList<ExameFuncionarioDTO>(); |
||
| 416 | ExameFuncionarioDTO exameDTO = new ExameFuncionarioDTO(); |
||
| 417 | exameDTO.setDataPrevista(DataUtils.converterStringParaData("01/05/2021")); |
||
| 418 | exameDTO.setTipoExame("P"); |
||
| 419 | examesDTO.add(exameDTO); |
||
| 420 | |||
| 421 | exameDTO = new ExameFuncionarioDTO(); |
||
| 422 | exameDTO.setDataPrevista(DataUtils.converterStringParaData("01/05/2020")); |
||
| 423 | exameDTO.setDataRealizada(DataUtils.converterStringParaData("01/05/2020")); |
||
| 424 | exameDTO.setTipoExame("P"); |
||
| 425 | examesDTO.add(exameDTO); |
||
| 426 | |||
| 427 | exameDTO = new ExameFuncionarioDTO(); |
||
| 428 | exameDTO.setDataRealizada(DataUtils.converterStringParaData("01/05/2019")); |
||
| 429 | exameDTO.setTipoExame("A"); |
||
| 430 | examesDTO.add(exameDTO); |
||
| 431 | |||
| 432 | getEntidadeDTO().setExamesDTO(examesDTO); |
||
| 433 | } |
||
| 434 | }); |
||
| 435 | } |
||
| 436 | |||
| 437 | // TODO: IMPLEMENTAÇÃO PENDENTE |
||
| 438 | public void consultarAtestados() { |
||
| 439 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 440 | public void execute() { |
||
| 441 | List<AtestadoFuncionarioDTO> atestadosDTO = new ArrayList<AtestadoFuncionarioDTO>(); |
||
| 442 | AtestadoFuncionarioDTO atestadoDTO = new AtestadoFuncionarioDTO(); |
||
| 443 | atestadoDTO.setDataAtestado(DataUtils.converterStringParaData("01/11/2020")); |
||
| 444 | atestadoDTO.setQuantidadeDias(new Long(15)); |
||
| 445 | atestadoDTO.setCodigoCid("Y71"); |
||
| 446 | atestadoDTO.setObservacao("COVID"); |
||
| 447 | atestadosDTO.add(atestadoDTO); |
||
| 448 | |||
| 449 | atestadoDTO = new AtestadoFuncionarioDTO(); |
||
| 450 | atestadoDTO.setDataAtestado(DataUtils.converterStringParaData("01/09/2020")); |
||
| 451 | atestadoDTO.setQuantidadeDias(new Long(3)); |
||
| 452 | atestadoDTO.setCodigoCid("Y59"); |
||
| 453 | atestadoDTO.setObservacao(""); |
||
| 454 | atestadosDTO.add(atestadoDTO); |
||
| 455 | |||
| 456 | getEntidadeDTO().setAtestadosDTO(atestadosDTO); |
||
| 457 | } |
||
| 458 | }); |
||
| 459 | } |
||
| 460 | |||
| 461 | // TODO: IMPLEMENTAÇÃO PENDENTE |
||
| 462 | public void consultarPontoEletronico() { |
||
| 463 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 464 | public void execute() { |
||
| 465 | List<PontoDTO> pontosDTO = new ArrayList<PontoDTO>(); |
||
| 466 | PontoDTO pontoDTO = new PontoDTO(); |
||
| 467 | LojaDTO lojaDTO = new LojaDTO(); |
||
| 468 | lojaDTO.setDescricao("QUIOSQUE BIG GRUTA"); |
||
| 469 | pontoDTO.setLojaDTO(lojaDTO); |
||
| 470 | |||
| 471 | PessoaDTO pessoaDTO = new PessoaDTO(); |
||
| 472 | pessoaDTO.setNome(getEntidadeDTO().getNome()); |
||
| 473 | pontoDTO.setPessoaDTO(pessoaDTO); |
||
| 474 | |||
| 475 | pontoDTO.setDataPonto(DataUtils.converterStringParaData("13/08/2021")); |
||
| 476 | pontoDTO.setDataHoraPontoInicio(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 477 | pontoDTO.setDataHoraPontoFim(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 478 | pontoDTO.setDataHoraIntervaloInicio(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 479 | pontoDTO.setDataHoraIntervaloFim(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 480 | pontoDTO.setObservacao(""); |
||
| 481 | pontosDTO.add(pontoDTO); |
||
| 482 | |||
| 483 | getEntidadeDTO().setPontosDTO(pontosDTO); |
||
| 484 | } |
||
| 485 | }); |
||
| 486 | } |
||
| 487 | |||
| 355 | espaco | 488 | /* |
| 489 | public String retornarTipoOcorrenciaEscala(Date dataPonto, List<Ponto> pontos) { |
||
| 490 | String tipoOcorrenciaEscala = TipoOcorrenciaEscala.SEM_PONTO.getValor(); |
||
| 491 | for (Ponto ponto : pontos) { |
||
| 492 | if (DataUtils.datasIguais(ponto.getDataPonto(), dataPonto)) { |
||
| 493 | if (ponto.getPontoCompleto()) { |
||
| 494 | return TipoOcorrenciaEscala.PONTO_COMPLETO.getValor(); |
||
| 495 | } else { |
||
| 496 | return TipoOcorrenciaEscala.PONTO_INCOMPLETO.getValor(); |
||
| 497 | } |
||
| 498 | } |
||
| 499 | } |
||
| 500 | return tipoOcorrenciaEscala; |
||
| 501 | } |
||
| 502 | */ |
||
| 503 | |||
| 353 | espaco | 504 | // TODO: IMPLEMENTAÇÃO PENDENTE |
| 505 | public void consultarEscala() { |
||
| 506 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 507 | public void execute() { |
||
| 355 | espaco | 508 | List<Ponto> pontos = pontoService.consultarPontosEletronicos(getEntidadeDTO().getVigenciaEscalaDTO(), getEntidade().getSequencialDaPessoa()); |
| 509 | |||
| 510 | VigenciaDTO vigenciaSelecionada = getEntidadeDTO().getVigenciaEscalaDTO(); |
||
| 511 | Date dataPonto = vigenciaSelecionada.getDataInicio(); |
||
| 512 | Date dataInicio = vigenciaSelecionada.getDataInicio(); |
||
| 513 | Date dataFim = vigenciaSelecionada.getDataFim(); |
||
| 514 | List<FuncionarioEscalaDTO> escalasDTO = new ArrayList<FuncionarioEscalaDTO>(); |
||
| 515 | FuncionarioEscalaDTO escalaDTO = null; |
||
| 516 | while (DataUtils.dataEstaEntrePeriodos(dataPonto, dataInicio, dataFim) || |
||
| 517 | DataUtils.datasIguais(dataPonto, dataInicio) || |
||
| 518 | DataUtils.datasIguais(dataPonto, dataFim)) { |
||
| 519 | escalaDTO = new FuncionarioEscalaDTO(); |
||
| 520 | escalaDTO.atualizarDadosEscala(dataPonto, pontos); |
||
| 521 | escalasDTO.add(escalaDTO); |
||
| 522 | dataPonto = DataUtils.acrescentarDias(dataPonto, 1); |
||
| 353 | espaco | 523 | } |
| 355 | espaco | 524 | getEntidadeDTO().setListaFuncionarioEscalaDTO(escalasDTO); |
| 353 | espaco | 525 | |
| 355 | espaco | 526 | /* |
| 353 | espaco | 527 | List<FuncionarioEscalaDTO> escalasDTO = new ArrayList<FuncionarioEscalaDTO>(); |
| 528 | |||
| 529 | FuncionarioEscalaDTO escalaDTO = null; |
||
| 530 | Integer contador = 1; |
||
| 531 | while (contador < 32) { |
||
| 532 | escalaDTO = new FuncionarioEscalaDTO(); |
||
| 533 | |||
| 534 | String dataEscala = "" + contador; |
||
| 535 | if (contador < 10) { |
||
| 536 | dataEscala = "0" + dataEscala; |
||
| 537 | } |
||
| 538 | escalaDTO.setDataEscala(DataUtils.converterStringParaData(dataEscala + "/12/2022")); |
||
| 539 | escalaDTO.setTipoOcorrenciaEscala("C"); |
||
| 540 | if (contador == 5 || contador == 10 || contador == 15 || contador == 25) { |
||
| 541 | escalaDTO.setTipoOcorrenciaEscala("S"); |
||
| 542 | } |
||
| 543 | if (contador == 12) { |
||
| 544 | escalaDTO.setTipoOcorrenciaEscala("I"); |
||
| 545 | } |
||
| 546 | escalasDTO.add(escalaDTO); |
||
| 547 | contador++; |
||
| 548 | } |
||
| 549 | |||
| 550 | getEntidadeDTO().setListaFuncionarioEscalaDTO(escalasDTO); |
||
| 355 | espaco | 551 | */ |
| 353 | espaco | 552 | } |
| 553 | }); |
||
| 554 | } |
||
| 555 | |||
| 325 | espaco | 556 | } |