Rev 411 | Rev 430 | 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 | |||
| 412 | espaco | 3 | import java.io.IOException; |
| 325 | espaco | 4 | import java.io.Serializable; |
| 353 | espaco | 5 | import java.util.ArrayList; |
| 355 | espaco | 6 | import java.util.Date; |
| 325 | espaco | 7 | import java.util.List; |
| 8 | |||
| 9 | import javax.inject.Inject; |
||
| 10 | import javax.inject.Named; |
||
| 11 | |||
| 12 | import org.springframework.context.annotation.Scope; |
||
| 13 | |||
| 14 | import br.com.ec.core.generic.GenericService; |
||
| 353 | espaco | 15 | import br.com.ec.core.util.DataUtils; |
| 325 | espaco | 16 | import br.com.ec.core.util.VerificadorUtil; |
| 353 | espaco | 17 | import br.com.ec.domain.dto.AtestadoFuncionarioDTO; |
| 412 | espaco | 18 | import br.com.ec.domain.dto.BancoHorasDTO; |
| 325 | espaco | 19 | import br.com.ec.domain.dto.EnderecoDTO; |
| 353 | espaco | 20 | import br.com.ec.domain.dto.ExameFuncionarioDTO; |
| 325 | espaco | 21 | import br.com.ec.domain.dto.FuncionarioDTO; |
| 353 | espaco | 22 | import br.com.ec.domain.dto.FuncionarioEscalaDTO; |
| 409 | espaco | 23 | import br.com.ec.domain.dto.FuncionarioEventoDTO; |
| 353 | espaco | 24 | import br.com.ec.domain.dto.FuncionarioFeriasDTO; |
| 25 | import br.com.ec.domain.dto.LojaDTO; |
||
| 26 | import br.com.ec.domain.dto.PessoaDTO; |
||
| 325 | espaco | 27 | import br.com.ec.domain.dto.PessoaPapelDTO; |
| 353 | espaco | 28 | import br.com.ec.domain.dto.PontoDTO; |
| 325 | espaco | 29 | import br.com.ec.domain.dto.UsuarioDTO; |
| 30 | import br.com.ec.domain.dto.UsuarioLojaDTO; |
||
| 31 | import br.com.ec.domain.dto.UsuarioPerfilDTO; |
||
| 355 | espaco | 32 | import br.com.ec.domain.dto.VigenciaDTO; |
| 412 | espaco | 33 | import br.com.ec.domain.model.BancoHoras; |
| 325 | espaco | 34 | import br.com.ec.domain.model.Endereco; |
| 35 | import br.com.ec.domain.model.Funcionario; |
||
| 411 | espaco | 36 | import br.com.ec.domain.model.FuncionarioEvento; |
| 353 | espaco | 37 | import br.com.ec.domain.model.FuncionarioFerias; |
| 325 | espaco | 38 | import br.com.ec.domain.model.Papel; |
| 353 | espaco | 39 | import br.com.ec.domain.model.Ponto; |
| 325 | espaco | 40 | import br.com.ec.domain.model.Usuario; |
| 409 | espaco | 41 | import br.com.ec.domain.model.tipos.TipoFuncionarioEvento; |
| 326 | espaco | 42 | import br.com.ec.domain.service.AvaliacaoFuncionarioService; |
| 412 | espaco | 43 | import br.com.ec.domain.service.BancoHorasService; |
| 325 | espaco | 44 | import br.com.ec.domain.service.EnderecoService; |
| 409 | espaco | 45 | import br.com.ec.domain.service.FuncionarioEventoService; |
| 353 | espaco | 46 | import br.com.ec.domain.service.FuncionarioFeriasService; |
| 325 | espaco | 47 | import br.com.ec.domain.service.FuncionarioService; |
| 48 | import br.com.ec.domain.service.PapelService; |
||
| 49 | import br.com.ec.domain.service.PessoaPapelService; |
||
| 50 | import br.com.ec.domain.service.PessoaService; |
||
| 353 | espaco | 51 | import br.com.ec.domain.service.PontoService; |
| 325 | espaco | 52 | import br.com.ec.domain.service.UsuarioLojaService; |
| 53 | import br.com.ec.domain.service.UsuarioPerfilService; |
||
| 54 | import br.com.ec.domain.service.UsuarioService; |
||
| 55 | import br.com.ec.domain.service.VendedorService; |
||
| 56 | import br.com.ec.web.exception.VerificadorLancamentoException; |
||
| 57 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
||
| 58 | import br.com.ec.web.generic.AbstractBean; |
||
| 59 | import br.com.ec.web.message.LancadorMensagem; |
||
| 60 | import br.com.ec.web.util.TipoOperacao; |
||
| 61 | |||
| 62 | @Named |
||
| 63 | @Scope("view") |
||
| 64 | public class FuncionarioBean extends AbstractBean<Funcionario> implements Serializable { |
||
| 65 | |||
| 66 | private static final long serialVersionUID = 1L; |
||
| 67 | |||
| 68 | private FuncionarioService funcionarioService; |
||
| 69 | private UsuarioService usuarioService; |
||
| 70 | private PessoaService pessoaService; |
||
| 71 | private PapelService papelService; |
||
| 72 | private PessoaPapelService pessoaPapelService; |
||
| 73 | private EnderecoService enderecoService; |
||
| 74 | private UsuarioPerfilService usuarioPerfilService; |
||
| 75 | private UsuarioLojaService usuarioLojaService; |
||
| 76 | private VendedorService vendedorService; |
||
| 326 | espaco | 77 | private AvaliacaoFuncionarioService avaliacaoFuncionarioService; |
| 353 | espaco | 78 | private FuncionarioFeriasService funcionarioFeriasService; |
| 409 | espaco | 79 | private FuncionarioEventoService funcionarioEventoService; |
| 412 | espaco | 80 | private BancoHorasService bancoHorasService; |
| 353 | espaco | 81 | private PontoService pontoService; |
| 325 | espaco | 82 | |
| 83 | private FuncionarioDTO entidadeParaConsulta; |
||
| 84 | private List<FuncionarioDTO> funcionarios; |
||
| 85 | |||
| 86 | private FuncionarioDTO entidadeDTO; |
||
| 87 | private PessoaPapelDTO pessoaPapelDTO; |
||
| 88 | private Endereco endereco; |
||
| 89 | private Usuario usuario; |
||
| 90 | private UsuarioPerfilDTO usuarioPerfilDTO; |
||
| 91 | private UsuarioLojaDTO usuarioLojaDTO; |
||
| 353 | espaco | 92 | private FuncionarioFeriasDTO funcionarioFeriasDTO; |
| 409 | espaco | 93 | private FuncionarioEventoDTO funcionarioEventoDTO; |
| 94 | private FuncionarioEscalaDTO funcionarioEscalaDTO; |
||
| 412 | espaco | 95 | private BancoHorasDTO bancoHorasDTO; |
| 325 | espaco | 96 | |
| 97 | @Inject |
||
| 98 | public FuncionarioBean(FuncionarioService funcionarioService, UsuarioService usuarioService, PessoaService pessoaService, |
||
| 99 | PapelService papelService, PessoaPapelService pessoaPapelService, EnderecoService enderecoService, |
||
| 326 | espaco | 100 | UsuarioPerfilService usuarioPerfilService, UsuarioLojaService usuarioLojaService, VendedorService vendedorService, |
| 353 | espaco | 101 | AvaliacaoFuncionarioService avaliacaoFuncionarioService, FuncionarioFeriasService funcionarioFeriasService, |
| 412 | espaco | 102 | FuncionarioEventoService funcionarioEventoService, BancoHorasService bancoHorasService, PontoService pontoService) { |
| 325 | espaco | 103 | this.funcionarioService = funcionarioService; |
| 104 | this.usuarioService = usuarioService; |
||
| 105 | this.pessoaService = pessoaService; |
||
| 106 | this.papelService = papelService; |
||
| 107 | this.pessoaPapelService = pessoaPapelService; |
||
| 108 | this.enderecoService = enderecoService; |
||
| 109 | this.usuarioPerfilService = usuarioPerfilService; |
||
| 110 | this.usuarioLojaService = usuarioLojaService; |
||
| 111 | this.vendedorService = vendedorService; |
||
| 326 | espaco | 112 | this.avaliacaoFuncionarioService = avaliacaoFuncionarioService; |
| 353 | espaco | 113 | this.funcionarioFeriasService = funcionarioFeriasService; |
| 409 | espaco | 114 | this.funcionarioEventoService = funcionarioEventoService; |
| 412 | espaco | 115 | this.bancoHorasService = bancoHorasService; |
| 353 | espaco | 116 | this.pontoService = pontoService; |
| 325 | espaco | 117 | } |
| 118 | |||
| 119 | @Override |
||
| 120 | public void preCarregamento() { |
||
| 121 | limparEntidade(); |
||
| 122 | consultarFuncionarios(); |
||
| 123 | } |
||
| 124 | |||
| 125 | @Override |
||
| 126 | public void limparEntidade() { |
||
| 127 | setEntidade(new Funcionario()); |
||
| 128 | setEntidadeParaConsulta(new FuncionarioDTO()); |
||
| 129 | setEntidadeDTO(null); |
||
| 130 | consultarFuncionarios(); |
||
| 131 | } |
||
| 132 | |||
| 133 | @Override |
||
| 134 | public GenericService<Funcionario> getService() { |
||
| 135 | return funcionarioService; |
||
| 136 | } |
||
| 137 | |||
| 138 | @Override |
||
| 139 | public Funcionario getEntidade() { |
||
| 140 | return entidade; |
||
| 141 | } |
||
| 142 | |||
| 143 | @Override |
||
| 144 | public void preConsultar() { |
||
| 145 | setTipoOperacao(TipoOperacao.CONSULTAR); |
||
| 146 | } |
||
| 147 | |||
| 148 | @Override |
||
| 149 | public Funcionario getId() { |
||
| 150 | return getEntidade(); |
||
| 151 | } |
||
| 152 | |||
| 153 | /*************************************************/ |
||
| 154 | |||
| 155 | public FuncionarioDTO getEntidadeParaConsulta() { |
||
| 156 | return entidadeParaConsulta; |
||
| 157 | } |
||
| 158 | public void setEntidadeParaConsulta(FuncionarioDTO entidadeParaConsulta) { |
||
| 159 | this.entidadeParaConsulta = entidadeParaConsulta; |
||
| 160 | } |
||
| 161 | |||
| 162 | public List<FuncionarioDTO> getFuncionarios() { |
||
| 163 | return funcionarios; |
||
| 164 | } |
||
| 165 | public void setFuncionarios(List<FuncionarioDTO> funcionarios) { |
||
| 166 | this.funcionarios = funcionarios; |
||
| 167 | } |
||
| 168 | |||
| 169 | public FuncionarioDTO getEntidadeDTO() { |
||
| 170 | return entidadeDTO; |
||
| 171 | } |
||
| 172 | public void setEntidadeDTO(FuncionarioDTO entidadeDTO) { |
||
| 173 | this.entidadeDTO = entidadeDTO; |
||
| 174 | } |
||
| 175 | |||
| 176 | public PessoaPapelDTO getPessoaPapelDTO() { |
||
| 177 | return pessoaPapelDTO; |
||
| 178 | } |
||
| 179 | public void setPessoaPapelDTO(PessoaPapelDTO pessoaPapelDTO) { |
||
| 180 | this.pessoaPapelDTO = pessoaPapelDTO; |
||
| 181 | } |
||
| 182 | |||
| 183 | public Endereco getEndereco() { |
||
| 184 | return endereco; |
||
| 185 | } |
||
| 186 | public void setEndereco(Endereco endereco) { |
||
| 187 | this.endereco = endereco; |
||
| 188 | } |
||
| 189 | |||
| 190 | public Usuario getUsuario() { |
||
| 191 | return usuario; |
||
| 192 | } |
||
| 193 | public void setUsuario(Usuario usuario) { |
||
| 194 | this.usuario = usuario; |
||
| 195 | } |
||
| 196 | |||
| 197 | public UsuarioPerfilDTO getUsuarioPerfilDTO() { |
||
| 198 | return usuarioPerfilDTO; |
||
| 199 | } |
||
| 200 | public void setUsuarioPerfilDTO(UsuarioPerfilDTO usuarioPerfilDTO) { |
||
| 201 | this.usuarioPerfilDTO = usuarioPerfilDTO; |
||
| 202 | } |
||
| 203 | |||
| 204 | public UsuarioLojaDTO getUsuarioLojaDTO() { |
||
| 205 | return usuarioLojaDTO; |
||
| 206 | } |
||
| 207 | public void setUsuarioLojaDTO(UsuarioLojaDTO usuarioLojaDTO) { |
||
| 208 | this.usuarioLojaDTO = usuarioLojaDTO; |
||
| 209 | } |
||
| 210 | |||
| 353 | espaco | 211 | public FuncionarioFeriasDTO getFuncionarioFeriasDTO() { |
| 212 | return funcionarioFeriasDTO; |
||
| 213 | } |
||
| 214 | public void setFuncionarioFeriasDTO(FuncionarioFeriasDTO funcionarioFeriasDTO) { |
||
| 215 | this.funcionarioFeriasDTO = funcionarioFeriasDTO; |
||
| 216 | } |
||
| 217 | |||
| 409 | espaco | 218 | public FuncionarioEventoDTO getFuncionarioEventoDTO() { |
| 219 | return funcionarioEventoDTO; |
||
| 220 | } |
||
| 221 | public void setFuncionarioEventoDTO(FuncionarioEventoDTO funcionarioEventoDTO) { |
||
| 222 | this.funcionarioEventoDTO = funcionarioEventoDTO; |
||
| 223 | } |
||
| 224 | |||
| 225 | public FuncionarioEscalaDTO getFuncionarioEscalaDTO() { |
||
| 226 | return funcionarioEscalaDTO; |
||
| 227 | } |
||
| 228 | public void setFuncionarioEscalaDTO(FuncionarioEscalaDTO funcionarioEscalaDTO) { |
||
| 229 | this.funcionarioEscalaDTO = funcionarioEscalaDTO; |
||
| 230 | } |
||
| 231 | |||
| 412 | espaco | 232 | public BancoHorasDTO getBancoHorasDTO() { |
| 233 | return bancoHorasDTO; |
||
| 234 | } |
||
| 235 | public void setBancoHorasDTO(BancoHorasDTO bancoHorasDTO) { |
||
| 236 | this.bancoHorasDTO = bancoHorasDTO; |
||
| 237 | } |
||
| 409 | espaco | 238 | |
| 325 | espaco | 239 | /*************************************************/ |
| 240 | |||
| 241 | public void prepararDetalhar(FuncionarioDTO funcionarioDTO) { |
||
| 242 | super.preDetalhar(funcionarioService.consultarPorId(new Funcionario(funcionarioDTO.getSequencialFuncionario()))); |
||
| 243 | } |
||
| 244 | |||
| 245 | public void prepararAlterar(FuncionarioDTO funcionarioDTO) { |
||
| 246 | super.preAlterar(funcionarioService.consultarPorId(new Funcionario(funcionarioDTO.getSequencialFuncionario()))); |
||
| 247 | } |
||
| 248 | |||
| 249 | public void consultarFuncionarios() { |
||
| 250 | setFuncionarios(funcionarioService.consultarFuncionarios(getEntidadeParaConsulta())); |
||
| 251 | } |
||
| 252 | |||
| 253 | public void prepararAlterarCompleto(FuncionarioDTO funcionarioDTO) { |
||
| 254 | super.preAlterar(funcionarioService.consultarPorId(new Funcionario(funcionarioDTO.getSequencialFuncionario()))); |
||
| 255 | UsuarioDTO usuarioDTO = usuarioService.consultarPorPessoa(funcionarioDTO.getSequencialPessoa()); |
||
| 256 | setEntidadeDTO(new FuncionarioDTO(getEntidade().getSequencial())); |
||
| 257 | if (VerificadorUtil.naoEstaNulo(usuarioDTO)) { |
||
| 258 | getEntidadeDTO().setUsuarioDTO(usuarioDTO); |
||
| 259 | getEntidadeDTO().getUsuarioDTO().setPerfis(usuarioPerfilService.consultarPerfisDoUsuario(usuarioDTO.getSequencial())); |
||
| 260 | getEntidadeDTO().getUsuarioDTO().setLojas(usuarioLojaService.consultarLojasDoUsuario(usuarioDTO.getSequencial())); |
||
| 261 | } |
||
| 262 | getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 263 | getEntidadeDTO().setEnderecosDTO(enderecoService.consultarEnderecosDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 264 | getEntidadeDTO().setVendedorDTO(vendedorService.consultarVendedorPorPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 265 | limparPapel(); |
||
| 266 | } |
||
| 267 | |||
| 268 | public void alterarCompleto() { |
||
| 269 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 270 | public void execute() { |
||
| 271 | pessoaService.alterar(getEntidade().getPessoa()); |
||
| 353 | espaco | 272 | if (VerificadorUtil.naoEstaNulo(getEntidadeDTO().getUsuarioDTO())) { |
| 273 | usuarioService.alterar(getEntidadeDTO().getUsuarioDTO()); |
||
| 274 | } |
||
| 326 | espaco | 275 | vendedorService.alterar(getEntidadeDTO().getVendedorDTO()); |
| 325 | espaco | 276 | alterar(getEntidade()); |
| 277 | } |
||
| 278 | }); |
||
| 279 | } |
||
| 280 | |||
| 281 | public void limparPapel() { |
||
| 282 | PessoaPapelDTO pessoaPapelDTO = new PessoaPapelDTO(); |
||
| 283 | pessoaPapelDTO.setSequencialPessoa(getEntidade().getPessoa().getSequencial()); |
||
| 284 | setPessoaPapelDTO(pessoaPapelDTO); |
||
| 285 | } |
||
| 286 | |||
| 287 | public void adicionarPapel() { |
||
| 288 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 289 | public void execute() { |
||
| 290 | pessoaPapelService.adicionarPapel(getEntidade().getPessoa(), new Papel(getPessoaPapelDTO().getCodigoPapel())); |
||
| 291 | getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(getPessoaPapelDTO().getSequencialPessoa())); |
||
| 292 | LancadorMensagem.lancarSucesso("PAPEL ADICIONADO COM SUCESSO"); |
||
| 293 | } |
||
| 294 | }); |
||
| 295 | } |
||
| 296 | |||
| 297 | public void removerPapel(PessoaPapelDTO pessoaPapelDTO) { |
||
| 298 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 299 | public void execute() { |
||
| 300 | pessoaPapelService.removerPapel(pessoaPapelDTO.getSequencialPessoa(), pessoaPapelDTO.getCodigoPapel()); |
||
| 301 | getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(pessoaPapelDTO.getSequencialPessoa())); |
||
| 302 | LancadorMensagem.lancarSucesso("PAPEL REMOVIDO COM SUCESSO"); |
||
| 303 | } |
||
| 304 | }); |
||
| 305 | } |
||
| 306 | |||
| 307 | public void limparEndereco() { |
||
| 308 | Endereco endereco = new Endereco(); |
||
| 309 | endereco.setPessoa(getEntidade().getPessoa()); |
||
| 310 | endereco.setAtivo(true); |
||
| 311 | setEndereco(endereco); |
||
| 312 | } |
||
| 313 | |||
| 314 | public void prepararAlterarEndereco(EnderecoDTO enderecoDTO) { |
||
| 315 | setEndereco(enderecoService.consultarPorId(new Endereco(enderecoDTO.getSequencial()))); |
||
| 316 | } |
||
| 317 | |||
| 318 | public void adicionarEndereco() { |
||
| 319 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 320 | public void execute() { |
||
| 321 | enderecoService.alterar(getEndereco()); |
||
| 322 | getEntidadeDTO().setEnderecosDTO(enderecoService.consultarEnderecosDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 323 | LancadorMensagem.lancarSucesso("ENDEREÇO SALVO COM SUCESSO"); |
||
| 324 | } |
||
| 325 | }); |
||
| 326 | } |
||
| 327 | |||
| 328 | public void removerEndereco(EnderecoDTO enderecoDTO) { |
||
| 329 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 330 | public void execute() { |
||
| 331 | enderecoService.removerEndereco(enderecoDTO.getSequencial()); |
||
| 332 | getEntidadeDTO().setEnderecosDTO(enderecoService.consultarEnderecosDaPessoa(getEntidade().getSequencialDaPessoa())); |
||
| 333 | LancadorMensagem.lancarSucesso("ENDEREÇO REMOVIDO COM SUCESSO"); |
||
| 334 | } |
||
| 335 | }); |
||
| 336 | } |
||
| 337 | |||
| 338 | public void limparUsuarioPerfil() { |
||
| 339 | UsuarioPerfilDTO usuarioPerfilDTO = new UsuarioPerfilDTO(); |
||
| 340 | usuarioPerfilDTO.setSequencialUsuario(getEntidadeDTO().getUsuarioDTO().getSequencial()); |
||
| 341 | setUsuarioPerfilDTO(usuarioPerfilDTO); |
||
| 342 | } |
||
| 343 | |||
| 344 | public void adicionarUsuarioPerfil() { |
||
| 345 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 346 | public void execute() { |
||
| 347 | usuarioPerfilService.adicionarPerfil(getUsuarioPerfilDTO().getSequencialUsuario(), getUsuarioPerfilDTO().getCodigoPerfil()); |
||
| 348 | getEntidadeDTO().getUsuarioDTO().setPerfis(usuarioPerfilService.consultarPerfisDoUsuario(getUsuarioPerfilDTO().getSequencialUsuario())); |
||
| 349 | LancadorMensagem.lancarSucesso("PERFIL ADICIONADO COM SUCESSO"); |
||
| 350 | } |
||
| 351 | }); |
||
| 352 | } |
||
| 353 | |||
| 354 | public void removerUsuarioPerfil(UsuarioPerfilDTO usuarioPerfilDTO) { |
||
| 355 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 356 | public void execute() { |
||
| 357 | usuarioPerfilService.removerPerfil(usuarioPerfilDTO.getSequencial()); |
||
| 358 | getEntidadeDTO().getUsuarioDTO().setPerfis(usuarioPerfilService.consultarPerfisDoUsuario(usuarioPerfilDTO.getSequencialUsuario())); |
||
| 359 | LancadorMensagem.lancarSucesso("PERFIL REMOVIDO COM SUCESSO"); |
||
| 360 | } |
||
| 361 | }); |
||
| 362 | } |
||
| 363 | |||
| 364 | public void limparUsuarioLoja() { |
||
| 365 | UsuarioLojaDTO usuarioLojaDTO = new UsuarioLojaDTO(); |
||
| 366 | usuarioLojaDTO.setSequencialUsuario(getEntidadeDTO().getUsuarioDTO().getSequencial()); |
||
| 367 | setUsuarioLojaDTO(usuarioLojaDTO); |
||
| 368 | } |
||
| 369 | |||
| 370 | public void adicionarUsuarioLoja() { |
||
| 371 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 372 | public void execute() { |
||
| 373 | usuarioLojaService.adicionarLoja(getUsuarioLojaDTO().getSequencialUsuario(), getUsuarioLojaDTO().getSequencialLoja()); |
||
| 374 | getEntidadeDTO().getUsuarioDTO().setLojas(usuarioLojaService.consultarLojasDoUsuario(getUsuarioLojaDTO().getSequencialUsuario())); |
||
| 375 | LancadorMensagem.lancarSucesso("LOJA ADICIONADA COM SUCESSO"); |
||
| 376 | } |
||
| 377 | }); |
||
| 378 | } |
||
| 379 | |||
| 380 | public void removerUsuarioLoja(UsuarioLojaDTO usuarioLojaDTO) { |
||
| 381 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 382 | public void execute() { |
||
| 383 | usuarioLojaService.removerLoja(usuarioLojaDTO.getSequencialUsuario(), usuarioLojaDTO.getSequencialLoja()); |
||
| 384 | getEntidadeDTO().getUsuarioDTO().setLojas(usuarioLojaService.consultarLojasDoUsuario(usuarioLojaDTO.getSequencialUsuario())); |
||
| 385 | LancadorMensagem.lancarSucesso("LOJA REMOVIDA COM SUCESSO"); |
||
| 386 | } |
||
| 387 | }); |
||
| 388 | } |
||
| 389 | |||
| 353 | espaco | 390 | public void consultarFerias() { |
| 391 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 392 | public void execute() { |
||
| 393 | getEntidadeDTO().setFeriasDTO(funcionarioFeriasService.consultarFerias(getEntidadeDTO().getSequencialFuncionario())); |
||
| 394 | } |
||
| 395 | }); |
||
| 396 | } |
||
| 397 | |||
| 398 | public void selecionarFerias(FuncionarioFeriasDTO funcionarioFeriasDTO) { |
||
| 399 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 400 | public void execute() { |
||
| 401 | setFuncionarioFeriasDTO(funcionarioFeriasDTO); |
||
| 402 | } |
||
| 403 | }); |
||
| 404 | } |
||
| 405 | |||
| 406 | public void prepararFerias() { |
||
| 407 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 408 | public void execute() { |
||
| 409 | FuncionarioFeriasDTO funcionarioFeriasDTO = new FuncionarioFeriasDTO(); |
||
| 410 | funcionarioFeriasDTO.setFuncionarioDTO(getEntidadeDTO()); |
||
| 411 | setFuncionarioFeriasDTO(funcionarioFeriasDTO); |
||
| 412 | } |
||
| 413 | }); |
||
| 414 | } |
||
| 415 | |||
| 416 | public void atualizarFerias() { |
||
| 417 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 418 | public void execute() { |
||
| 419 | funcionarioFeriasService.alterarProvisao(getFuncionarioFeriasDTO()); |
||
| 420 | consultarFerias(); |
||
| 421 | LancadorMensagem.lancarSucesso("FÉRIAS ATUALIZADA COM SUCESSO!"); |
||
| 422 | } |
||
| 423 | }); |
||
| 424 | } |
||
| 425 | |||
| 426 | public void removerFerias(FuncionarioFeriasDTO funcionarioFeriasDTO) { |
||
| 427 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 428 | public void execute() { |
||
| 429 | FuncionarioFerias funcionarioFerias = new FuncionarioFerias(); |
||
| 430 | funcionarioFerias.setSequencial(funcionarioFeriasDTO.getSequencialFuncionarioFerias()); |
||
| 431 | funcionarioFeriasService.excluir(funcionarioFerias); |
||
| 432 | consultarFerias(); |
||
| 433 | LancadorMensagem.lancarSucesso("FÉRIAS REMOVIDA COM SUCESSO"); |
||
| 434 | } |
||
| 435 | }); |
||
| 436 | } |
||
| 437 | |||
| 326 | espaco | 438 | public void consultarAvaliacoes() { |
| 439 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 440 | public void execute() { |
||
| 441 | getEntidadeDTO().setAvaliacoesDTO(avaliacaoFuncionarioService.consultarAvaliacoesFuncionario(getEntidadeDTO().getSequencialFuncionario())); |
||
| 442 | } |
||
| 443 | }); |
||
| 325 | espaco | 444 | } |
| 445 | |||
| 412 | espaco | 446 | public void prepararEvento() { |
| 409 | espaco | 447 | FuncionarioEventoDTO funcionarioEventoDTO = new FuncionarioEventoDTO(); |
| 448 | funcionarioEventoDTO.setFuncionarioDTO(getEntidadeDTO()); |
||
| 449 | setFuncionarioEventoDTO(funcionarioEventoDTO); |
||
| 450 | } |
||
| 451 | |||
| 452 | public void adicionarEvento(UsuarioDTO usuarioLogado) { |
||
| 453 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 454 | public void execute() { |
||
| 455 | getFuncionarioEventoDTO().setUsuarioDTOCadastro(usuarioLogado); |
||
| 456 | funcionarioEventoService.cadastrar(getFuncionarioEventoDTO()); |
||
| 457 | consultarEscala(); |
||
| 458 | LancadorMensagem.lancarSucesso("EVENTO ADICIONADO COM SUCESSO"); |
||
| 459 | } |
||
| 460 | }); |
||
| 461 | } |
||
| 462 | |||
| 463 | public void removerEvento(FuncionarioEventoDTO funcionarioEventoDTO) { |
||
| 464 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 465 | public void execute() { |
||
| 411 | espaco | 466 | funcionarioEventoService.excluir(new FuncionarioEvento(funcionarioEventoDTO)); |
| 409 | espaco | 467 | getFuncionarioEscalaDTO().getEventosDTO().remove(funcionarioEventoDTO); |
| 468 | consultarEscala(); |
||
| 469 | LancadorMensagem.lancarSucesso("EVENTO REMOVIDO COM SUCESSO"); |
||
| 470 | } |
||
| 471 | }); |
||
| 472 | } |
||
| 473 | |||
| 412 | espaco | 474 | public void prepararParaAlterarEvento(FuncionarioEventoDTO funcionarioEventoDTO) { |
| 475 | setFuncionarioEventoDTO(funcionarioEventoDTO); |
||
| 476 | } |
||
| 477 | |||
| 409 | espaco | 478 | public void confirmarEvento(UsuarioDTO usuarioLogado, FuncionarioEventoDTO funcionarioEventoDTO) { |
| 479 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 480 | public void execute() { |
||
| 481 | funcionarioEventoDTO.setUsuarioDTOAuditor(usuarioLogado); |
||
| 412 | espaco | 482 | funcionarioEventoService.alterar(new FuncionarioEvento(funcionarioEventoDTO)); |
| 483 | consultarEscala(); |
||
| 409 | espaco | 484 | LancadorMensagem.lancarSucesso("EVENTO CONFIRMADO COM SUCESSO"); |
| 485 | } |
||
| 486 | }); |
||
| 487 | } |
||
| 488 | |||
| 412 | espaco | 489 | public void alterarEvento() { |
| 490 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 491 | public void execute() { |
||
| 492 | FuncionarioEvento funcionarioEvento = funcionarioEventoService.consultarPorId(new FuncionarioEvento(getFuncionarioEventoDTO())); |
||
| 493 | funcionarioEvento.atualizarDados(getFuncionarioEventoDTO()); |
||
| 494 | funcionarioEventoService.alterar(funcionarioEvento); |
||
| 495 | consultarEscala(); |
||
| 496 | LancadorMensagem.lancarSucesso("EVENTO ALTERADO COM SUCESSO"); |
||
| 497 | } |
||
| 498 | }); |
||
| 499 | } |
||
| 500 | |||
| 409 | espaco | 501 | public void consultarEventos(FuncionarioEscalaDTO escalaDTOSelecionada) { |
| 502 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 503 | public void execute() { |
||
| 504 | setFuncionarioEscalaDTO(escalaDTOSelecionada); |
||
| 505 | } |
||
| 506 | }); |
||
| 507 | } |
||
| 508 | |||
| 412 | espaco | 509 | public void adicionarBancoHoras() { |
| 510 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 511 | public void execute() { |
||
| 512 | bancoHorasService.cadastrar(getBancoHorasDTO()); |
||
| 513 | consultarBancoHoras(); |
||
| 514 | LancadorMensagem.lancarSucesso("BANCO DE HORAS ADICIONADO COM SUCESSO"); |
||
| 515 | } |
||
| 516 | }); |
||
| 517 | } |
||
| 518 | |||
| 519 | public void removerBancoHoras(BancoHorasDTO bancoHorasDTO) { |
||
| 520 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 521 | public void execute() { |
||
| 522 | bancoHorasService.excluir(new BancoHoras(bancoHorasDTO)); |
||
| 523 | getEntidadeDTO().getListaBancoHorasDTO().remove(bancoHorasDTO); |
||
| 524 | consultarBancoHoras(); |
||
| 525 | LancadorMensagem.lancarSucesso("BANCO DE HORAS REMOVIDO COM SUCESSO"); |
||
| 526 | } |
||
| 527 | }); |
||
| 528 | } |
||
| 529 | |||
| 530 | public void prepararBancoHoras() { |
||
| 531 | BancoHorasDTO bancoHorasDTO = new BancoHorasDTO(); |
||
| 532 | bancoHorasDTO.setFuncionarioDTO(getEntidadeDTO()); |
||
| 533 | setBancoHorasDTO(bancoHorasDTO); |
||
| 534 | } |
||
| 535 | |||
| 536 | public void prepararParaAlterarBancoHoras(BancoHorasDTO bancoHorasDTO) { |
||
| 537 | setBancoHorasDTO(bancoHorasDTO); |
||
| 538 | } |
||
| 539 | |||
| 540 | public void alterarBancoHoras() { |
||
| 541 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 542 | public void execute() { |
||
| 543 | BancoHoras bancoHoras = bancoHorasService.consultarPorId(new BancoHoras(getBancoHorasDTO())); |
||
| 544 | bancoHoras.atualizarDados(getBancoHorasDTO()); |
||
| 545 | bancoHorasService.alterar(bancoHoras); |
||
| 546 | consultarBancoHoras(); |
||
| 547 | LancadorMensagem.lancarSucesso("BANCO DE HORAS ALTERADO COM SUCESSO"); |
||
| 548 | } |
||
| 549 | }); |
||
| 550 | } |
||
| 551 | |||
| 552 | public void consultarBancoHoras() { |
||
| 553 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 554 | public void execute() { |
||
| 555 | getEntidadeDTO().setListaBancoHorasDTO(bancoHorasService.consultarBancoHorasFuncionario(getEntidadeDTO().getSequencialFuncionario())); |
||
| 556 | } |
||
| 557 | }); |
||
| 558 | } |
||
| 559 | |||
| 560 | public void consultarBancoHorasDoUsuario(UsuarioDTO usuarioDTO) { |
||
| 561 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 562 | public void execute() { |
||
| 563 | Usuario usuario = usuarioService.consultarPorId(new Usuario(usuarioDTO.getSequencial())); |
||
| 564 | Funcionario funcionario = funcionarioService.consultarFuncionarioPelaPessoa(usuario.getSequencialDaPessoa()); |
||
| 565 | FuncionarioDTO funcionarioDTO = new FuncionarioDTO(); |
||
| 566 | funcionarioDTO.setListaBancoHorasDTO(bancoHorasService.consultarBancoHorasFuncionario(funcionario.getSequencial())); |
||
| 567 | funcionarioDTO.setListaBancoHorasDTOAnoVigente(bancoHorasService.consultarBancoHorasFuncionarioAnoVigente(funcionario.getSequencial())); |
||
| 568 | setEntidadeDTO(funcionarioDTO); |
||
| 569 | } |
||
| 570 | }); |
||
| 571 | } |
||
| 572 | |||
| 353 | espaco | 573 | // TODO: IMPLEMENTAÇÃO PENDENTE |
| 574 | public void consultarExames() { |
||
| 575 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 576 | public void execute() { |
||
| 577 | List<ExameFuncionarioDTO> examesDTO = new ArrayList<ExameFuncionarioDTO>(); |
||
| 578 | ExameFuncionarioDTO exameDTO = new ExameFuncionarioDTO(); |
||
| 579 | exameDTO.setDataPrevista(DataUtils.converterStringParaData("01/05/2021")); |
||
| 580 | exameDTO.setTipoExame("P"); |
||
| 581 | examesDTO.add(exameDTO); |
||
| 582 | |||
| 583 | exameDTO = new ExameFuncionarioDTO(); |
||
| 584 | exameDTO.setDataPrevista(DataUtils.converterStringParaData("01/05/2020")); |
||
| 585 | exameDTO.setDataRealizada(DataUtils.converterStringParaData("01/05/2020")); |
||
| 586 | exameDTO.setTipoExame("P"); |
||
| 587 | examesDTO.add(exameDTO); |
||
| 588 | |||
| 589 | exameDTO = new ExameFuncionarioDTO(); |
||
| 590 | exameDTO.setDataRealizada(DataUtils.converterStringParaData("01/05/2019")); |
||
| 591 | exameDTO.setTipoExame("A"); |
||
| 592 | examesDTO.add(exameDTO); |
||
| 593 | |||
| 594 | getEntidadeDTO().setExamesDTO(examesDTO); |
||
| 595 | } |
||
| 596 | }); |
||
| 597 | } |
||
| 598 | |||
| 599 | // TODO: IMPLEMENTAÇÃO PENDENTE |
||
| 600 | public void consultarAtestados() { |
||
| 601 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 602 | public void execute() { |
||
| 603 | List<AtestadoFuncionarioDTO> atestadosDTO = new ArrayList<AtestadoFuncionarioDTO>(); |
||
| 604 | AtestadoFuncionarioDTO atestadoDTO = new AtestadoFuncionarioDTO(); |
||
| 605 | atestadoDTO.setDataAtestado(DataUtils.converterStringParaData("01/11/2020")); |
||
| 606 | atestadoDTO.setQuantidadeDias(new Long(15)); |
||
| 607 | atestadoDTO.setCodigoCid("Y71"); |
||
| 608 | atestadoDTO.setObservacao("COVID"); |
||
| 609 | atestadosDTO.add(atestadoDTO); |
||
| 610 | |||
| 611 | atestadoDTO = new AtestadoFuncionarioDTO(); |
||
| 612 | atestadoDTO.setDataAtestado(DataUtils.converterStringParaData("01/09/2020")); |
||
| 613 | atestadoDTO.setQuantidadeDias(new Long(3)); |
||
| 614 | atestadoDTO.setCodigoCid("Y59"); |
||
| 615 | atestadoDTO.setObservacao(""); |
||
| 616 | atestadosDTO.add(atestadoDTO); |
||
| 617 | |||
| 618 | getEntidadeDTO().setAtestadosDTO(atestadosDTO); |
||
| 619 | } |
||
| 620 | }); |
||
| 621 | } |
||
| 622 | |||
| 623 | // TODO: IMPLEMENTAÇÃO PENDENTE |
||
| 624 | public void consultarPontoEletronico() { |
||
| 625 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 626 | public void execute() { |
||
| 627 | List<PontoDTO> pontosDTO = new ArrayList<PontoDTO>(); |
||
| 628 | PontoDTO pontoDTO = new PontoDTO(); |
||
| 629 | LojaDTO lojaDTO = new LojaDTO(); |
||
| 630 | lojaDTO.setDescricao("QUIOSQUE BIG GRUTA"); |
||
| 631 | pontoDTO.setLojaDTO(lojaDTO); |
||
| 632 | |||
| 633 | PessoaDTO pessoaDTO = new PessoaDTO(); |
||
| 634 | pessoaDTO.setNome(getEntidadeDTO().getNome()); |
||
| 635 | pontoDTO.setPessoaDTO(pessoaDTO); |
||
| 636 | |||
| 637 | pontoDTO.setDataPonto(DataUtils.converterStringParaData("13/08/2021")); |
||
| 638 | pontoDTO.setDataHoraPontoInicio(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 639 | pontoDTO.setDataHoraPontoFim(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 640 | pontoDTO.setDataHoraIntervaloInicio(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 641 | pontoDTO.setDataHoraIntervaloFim(DataUtils.converterStringParaDataComHorario("13/08/2021 16:00:00")); |
||
| 642 | pontoDTO.setObservacao(""); |
||
| 643 | pontosDTO.add(pontoDTO); |
||
| 644 | |||
| 645 | getEntidadeDTO().setPontosDTO(pontosDTO); |
||
| 646 | } |
||
| 647 | }); |
||
| 648 | } |
||
| 649 | |||
| 355 | espaco | 650 | /* |
| 651 | public String retornarTipoOcorrenciaEscala(Date dataPonto, List<Ponto> pontos) { |
||
| 652 | String tipoOcorrenciaEscala = TipoOcorrenciaEscala.SEM_PONTO.getValor(); |
||
| 653 | for (Ponto ponto : pontos) { |
||
| 654 | if (DataUtils.datasIguais(ponto.getDataPonto(), dataPonto)) { |
||
| 655 | if (ponto.getPontoCompleto()) { |
||
| 656 | return TipoOcorrenciaEscala.PONTO_COMPLETO.getValor(); |
||
| 657 | } else { |
||
| 658 | return TipoOcorrenciaEscala.PONTO_INCOMPLETO.getValor(); |
||
| 659 | } |
||
| 660 | } |
||
| 661 | } |
||
| 662 | return tipoOcorrenciaEscala; |
||
| 663 | } |
||
| 664 | */ |
||
| 665 | |||
| 353 | espaco | 666 | // TODO: IMPLEMENTAÇÃO PENDENTE |
| 667 | public void consultarEscala() { |
||
| 668 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 669 | public void execute() { |
||
| 355 | espaco | 670 | VigenciaDTO vigenciaSelecionada = getEntidadeDTO().getVigenciaEscalaDTO(); |
| 671 | Date dataPonto = vigenciaSelecionada.getDataInicio(); |
||
| 672 | Date dataInicio = vigenciaSelecionada.getDataInicio(); |
||
| 673 | Date dataFim = vigenciaSelecionada.getDataFim(); |
||
| 674 | List<FuncionarioEscalaDTO> escalasDTO = new ArrayList<FuncionarioEscalaDTO>(); |
||
| 675 | FuncionarioEscalaDTO escalaDTO = null; |
||
| 412 | espaco | 676 | List<Ponto> pontos = pontoService.consultarPontosEletronicos(getEntidadeDTO().getVigenciaEscalaDTO(), getEntidade().getSequencialDaPessoa()); |
| 677 | List<FuncionarioEventoDTO> eventos = funcionarioEventoService.consultarEventos(getEntidadeDTO().getVigenciaEscalaDTO(), getEntidade().getSequencial()); |
||
| 355 | espaco | 678 | while (DataUtils.dataEstaEntrePeriodos(dataPonto, dataInicio, dataFim) || |
| 679 | DataUtils.datasIguais(dataPonto, dataInicio) || |
||
| 680 | DataUtils.datasIguais(dataPonto, dataFim)) { |
||
| 681 | escalaDTO = new FuncionarioEscalaDTO(); |
||
| 682 | escalaDTO.atualizarDadosEscala(dataPonto, pontos); |
||
| 409 | espaco | 683 | escalaDTO.atualizarDadosEventos(dataPonto, eventos); |
| 355 | espaco | 684 | escalasDTO.add(escalaDTO); |
| 685 | dataPonto = DataUtils.acrescentarDias(dataPonto, 1); |
||
| 353 | espaco | 686 | } |
| 355 | espaco | 687 | getEntidadeDTO().setListaFuncionarioEscalaDTO(escalasDTO); |
| 353 | espaco | 688 | } |
| 689 | }); |
||
| 690 | } |
||
| 691 | |||
| 325 | espaco | 692 | } |