Usuario representante do contrato feat bug#AL-4278
parent
6508b19491
commit
28a4ed937f
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>ModelWeb</artifactId>
|
<artifactId>ModelWeb</artifactId>
|
||||||
<version>1.74.0</version>
|
<version>1.75.0</version>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
|
|
@ -7,52 +7,53 @@ import java.util.List;
|
||||||
|
|
||||||
public class Constantes {
|
public class Constantes {
|
||||||
|
|
||||||
public static final Long FORMA_PAGO_DINHEIRO = new Long(1);
|
public static final Long FORMA_PAGO_DINHEIRO = 1L;
|
||||||
public static final Long FORMA_PAGO_RESERVA = new Long(94);
|
public static final Long FORMA_PAGO_CREDITO = 2L;
|
||||||
public static final Long FORMA_PAGO_NOTA_CREDITO = new Long(93);
|
public static final Long FORMA_PAGO_DEBITO = 3L;
|
||||||
public static final Long FORMA_PAGO_CREDITO = new Long(2);
|
public static final Long FORMA_PAGO_TROCA_PASSAGEM = 10L;
|
||||||
public static final Long FORMA_PAGO_DEBITO = new Long(3);
|
public static final Long FORMA_PAGO_ORDEN_SERVICIO = 11L;
|
||||||
public static final Long FORMA_PAGO_GERACAO_OCD = new Long(35);
|
public static final Long FORMA_PAGO_GERACAO_OCD = 35L;
|
||||||
public static final Long FORMA_PAGO_TROCA_PASSAGEM = new Long(10);
|
public static final Long FORMA_PAGO_NOTA_CREDITO = 93L;
|
||||||
public static final Long FORMA_PAGO_ORDEN_SERVICIO = new Long(11);
|
public static final Long FORMA_PAGO_RESERVA = 94L;
|
||||||
|
|
||||||
public static final Long MVO_CANCEL_CANCELACION = new Long(31);
|
|
||||||
public static final Long MVO_CANCEL_DEVOLUCAO = new Long(32);
|
|
||||||
public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50 = new Long(36);
|
|
||||||
public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100 = new Long(37);
|
|
||||||
public static final Long MVO_CANCEL_TROCA = new Long(10);
|
|
||||||
public static final Long MVO_CANCEL_CHECKIN = new Long(27);
|
|
||||||
public static final Long MVO_CANCEL_TRANSFERENCIA = new Long(23);
|
|
||||||
public static final Long MVO_CANCEL_BOLETO_ENTREGADO = new Long(16);
|
|
||||||
public static final Long MVO_CANCEL_BOLETO_AGRUPAMENTO = new Long(17);
|
|
||||||
public static final Long MVO_CANCEL_GERACAO_OCD = new Long(99);
|
|
||||||
public static final Long MVO_CANCEL_QUITACAO_OCD = new Long(35);
|
|
||||||
public static final Long MVO_CANCEL_VENDA_PACOTE = new Long(33);
|
|
||||||
public static final Long ORGAO_CONCEDENTE_ID_AGERBA = new Long(27);
|
|
||||||
|
|
||||||
public static Long TPV_DIRECTO_NORMAL = new Long(1);
|
public static final Long MVO_CANCEL_CANCELACION = 31L;
|
||||||
public static Long TPV_MANUAL = new Long(3);
|
public static final Long MVO_CANCEL_DEVOLUCAO = 32L;
|
||||||
public static Long TPV_CALL_CENTER = new Long(5);
|
public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50 = 36L;
|
||||||
public static Long TPV_BOLETO_REMOTO = new Long(18);
|
public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100 = 37L;
|
||||||
public static Long TPV_TRANSFERENCIAS = new Long(8); // é a troca de passagens
|
public static final Long MVO_CANCEL_TROCA = 10L;
|
||||||
public static Long TPV_CAMBIO_VIAJE = new Long(81); // é a transferência de passagens
|
public static final Long MVO_CANCEL_CHECKIN = 27L;
|
||||||
public static Long TPV_CHECKIN_VIAGEM = new Long(41); // chekin boletos
|
public static final Long MVO_CANCEL_TRANSFERENCIA = 23L;
|
||||||
public static Long TPV_BOLETO_ABIERTO = new Long(9);
|
public static final Long MVO_CANCEL_BOLETO_ENTREGADO = 16L;
|
||||||
public static Long TPV_CONFIRMA_ABIERTO = new Long(82);
|
public static final Long MVO_CANCEL_BOLETO_AGRUPAMENTO = 17L;
|
||||||
public static Long TPV_VENDA_BOLETO_ABERTO_MANUAL = new Long(39);
|
public static final Long MVO_CANCEL_GERACAO_OCD = 99L;
|
||||||
|
public static final Long MVO_CANCEL_QUITACAO_OCD = 35L;
|
||||||
|
public static final Long MVO_CANCEL_VENDA_PACOTE = 33L;
|
||||||
|
public static final Long ORGAO_CONCEDENTE_ID_AGERBA = 27L;
|
||||||
|
|
||||||
|
public static final Long TPV_DIRECTO_NORMAL = 1L;
|
||||||
|
public static final Long TPV_MANUAL = 3L;
|
||||||
|
public static final Long TPV_CALL_CENTER = 5L;
|
||||||
|
public static final Long TPV_BOLETO_REMOTO = 18L;
|
||||||
|
public static final Long TPV_TRANSFERENCIAS = 8L; // é a troca de passagens
|
||||||
|
public static final Long TPV_CAMBIO_VIAJE = 81L; // é a transferência de passagens
|
||||||
|
public static final Long TPV_CHECKIN_VIAGEM = 41L; // chekin boletos
|
||||||
|
public static final Long TPV_BOLETO_ABIERTO = 9L;
|
||||||
|
public static final Long TPV_CONFIRMA_ABIERTO = 82L;
|
||||||
|
public static final Long TPV_VENDA_BOLETO_ABERTO_MANUAL = 39L;
|
||||||
|
|
||||||
public static Long TPV_RESERVACION_POR_INTERNET = new Long(16);
|
public static final Long TPV_RESERVACION_POR_INTERNET = 16L;
|
||||||
public static Long TPV_POR_INTERNET = new Long(12);
|
public static final Long TPV_POR_INTERNET = 12L;
|
||||||
public static Long TPV_AGENCIA_WEB = new Long(19);
|
public static final Long TPV_AGENCIA_WEB = 19L;
|
||||||
|
|
||||||
public static final Integer TIPO_OPERACION_CC_LQ = new Integer(1);
|
public static final Integer TIPO_OPERACION_CC_LQ = 1;
|
||||||
public static final Integer TIPO_OPERACION_CC_PAGO = new Integer(2);
|
public static final Integer TIPO_OPERACION_CC_PAGO = 2;
|
||||||
|
|
||||||
public static final Integer ARTICULO_VENTA = 1;
|
public static final Integer ARTICULO_VENTA = 1;
|
||||||
public static final Integer ARTICULO_OUTROS = 2;
|
public static final Integer ARTICULO_OUTROS = 2;
|
||||||
public static final Integer ARTICULO_MANUAL = 3;
|
public static final Integer ARTICULO_MANUAL = 3;
|
||||||
|
|
||||||
public static Short TURNO_AUTOMATICO = new Short("99");
|
public static final Short TURNO_AUTOMATICO = new Short("99");
|
||||||
|
|
||||||
public static final String IMAGEM_EMPRESA = "EMPRESA_BACKGROUND";
|
public static final String IMAGEM_EMPRESA = "EMPRESA_BACKGROUND";
|
||||||
public static final String IMAGEM_EMPRESA_GENERICA = "EMPRESA_BACKGROUND_GENERICA";
|
public static final String IMAGEM_EMPRESA_GENERICA = "EMPRESA_BACKGROUND_GENERICA";
|
||||||
|
@ -105,7 +106,7 @@ public class Constantes {
|
||||||
|
|
||||||
public static final String RETER_COMISSAO_ADM_FECHAMENTO_CAIXA = "RETER_COMISSAO_ADM_FECHAMENTO_CAIXA";
|
public static final String RETER_COMISSAO_ADM_FECHAMENTO_CAIXA = "RETER_COMISSAO_ADM_FECHAMENTO_CAIXA";
|
||||||
|
|
||||||
public static enum FiltroEnviadosSefaz { SIM, NAO, TODOS };
|
public enum FiltroEnviadosSefaz { SIM, NAO, TODOS };
|
||||||
|
|
||||||
public static final String CVESISTEMA_MOTIVO_CANCELAMENTO_ALTERACAO_POLTRONA = "ALTERACAO_POLTRONA";
|
public static final String CVESISTEMA_MOTIVO_CANCELAMENTO_ALTERACAO_POLTRONA = "ALTERACAO_POLTRONA";
|
||||||
|
|
||||||
|
@ -148,4 +149,10 @@ public class Constantes {
|
||||||
|
|
||||||
public static final String DESATIVAR_OBR_CAM_EMPRESA_IMPOSTO = "DESATIVAR_OBR_CAM_EMPRESA_IMPOSTO";
|
public static final String DESATIVAR_OBR_CAM_EMPRESA_IMPOSTO = "DESATIVAR_OBR_CAM_EMPRESA_IMPOSTO";
|
||||||
|
|
||||||
|
public static final Integer PERFIL_ADM_CONTRATO = 32;
|
||||||
|
|
||||||
|
private Constantes() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion;
|
||||||
import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO;
|
import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
|
|
||||||
|
@ -31,6 +34,12 @@ public interface UsuarioDAO extends GenericDAO<Usuario, Integer> {
|
||||||
|
|
||||||
public Usuario buscarPeloId(Integer usuarioId);
|
public Usuario buscarPeloId(Integer usuarioId);
|
||||||
|
|
||||||
|
public List<UsuarioEmpresa> buscarUsuarioEmpresaList(Integer usuarioId);
|
||||||
|
|
||||||
|
public List<UsuarioPerfil> buscarUsuarioPerfilList(Integer usuarioId);
|
||||||
|
|
||||||
|
public List<UsuarioUbicacion> buscarUsuarioUbicacionList(Integer usuarioId);
|
||||||
|
|
||||||
public List<UsuarioEmbarcadaVO> buscarPorFuncionSistema(Long funcionSistemaId);
|
public List<UsuarioEmbarcadaVO> buscarPorFuncionSistema(Long funcionSistemaId);
|
||||||
|
|
||||||
public List<UsuarioEmbarcadaVO> buscarUsuarioPorPontoVenda(Long puntoVentaId);
|
public List<UsuarioEmbarcadaVO> buscarUsuarioPorPontoVenda(Long puntoVentaId);
|
||||||
|
@ -40,5 +49,7 @@ public interface UsuarioDAO extends GenericDAO<Usuario, Integer> {
|
||||||
public List<UsuarioEmbarcadaVO> buscarUsuarioEmbarcadaPorUsuariosIds(List<Long> usuariosIdList);
|
public List<UsuarioEmbarcadaVO> buscarUsuarioEmbarcadaPorUsuariosIds(List<Long> usuariosIdList);
|
||||||
|
|
||||||
public List<UsuarioEmbarcadaVO> buscaUsuariosDoPuntoVenta(Long puntoventaId);
|
public List<UsuarioEmbarcadaVO> buscaUsuariosDoPuntoVenta(Long puntoventaId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,9 @@ import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
|
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion;
|
||||||
import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO;
|
import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
|
|
||||||
|
@ -247,6 +250,33 @@ public class UsuarioHibernateDAO extends GenericHibernateDAO<Usuario, Integer> i
|
||||||
return (List<UsuarioEmbarcadaVO>)qr.list();
|
return (List<UsuarioEmbarcadaVO>)qr.list();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UsuarioEmpresa> buscarUsuarioEmpresaList(Integer usuarioId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("usuarioId", usuarioId));
|
||||||
|
|
||||||
|
Usuario result = (Usuario)c.uniqueResult();
|
||||||
|
return result.getUsuarioEmpresaList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UsuarioUbicacion> buscarUsuarioUbicacionList(Integer usuarioId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("usuarioId", usuarioId));
|
||||||
|
|
||||||
|
Usuario result = (Usuario)c.uniqueResult();
|
||||||
|
return result.getUsuarioUbicacionList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UsuarioPerfil> buscarUsuarioPerfilList(Integer usuarioId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("usuarioId", usuarioId));
|
||||||
|
|
||||||
|
Usuario result = (Usuario)c.uniqueResult();
|
||||||
|
return result.getUsuarioPerfilList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Repository;
|
||||||
*
|
*
|
||||||
* @author Rafius
|
* @author Rafius
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Repository("usuarioPerfilDAO")
|
@Repository("usuarioPerfilDAO")
|
||||||
public class UsuarioPerfilHibernateDAO extends GenericHibernateDAO<UsuarioPerfil, Integer>
|
public class UsuarioPerfilHibernateDAO extends GenericHibernateDAO<UsuarioPerfil, Integer>
|
||||||
implements UsuarioPerfilDAO {
|
implements UsuarioPerfilDAO {
|
||||||
|
@ -28,7 +29,8 @@ public class UsuarioPerfilHibernateDAO extends GenericHibernateDAO<UsuarioPerfil
|
||||||
setSessionFactory(factory);
|
setSessionFactory(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
|
@Override
|
||||||
public List<UsuarioPerfil> obtenerTodos() {
|
public List<UsuarioPerfil> obtenerTodos() {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
|
@ -72,28 +72,36 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@Column(name = "USUARIO_ID")
|
@Column(name = "USUARIO_ID")
|
||||||
private Integer usuarioId;
|
private Integer usuarioId;
|
||||||
|
|
||||||
@Column(name = "NOMBUSUARIO")
|
@Column(name = "NOMBUSUARIO")
|
||||||
private String nombusuario;
|
private String nombusuario;
|
||||||
|
|
||||||
@Column(name = "NOMBPATERNO")
|
@Column(name = "NOMBPATERNO")
|
||||||
private String nombpaterno;
|
private String nombpaterno;
|
||||||
|
|
||||||
@Column(name = "NOMBMATERNO")
|
@Column(name = "NOMBMATERNO")
|
||||||
private String nombmaterno;
|
private String nombmaterno;
|
||||||
|
|
||||||
@Column(name = "ACTIVO")
|
@Column(name = "ACTIVO")
|
||||||
private Boolean activo;
|
private Boolean activo;
|
||||||
|
|
||||||
@Column(name = "FECMODIF")
|
@Column(name = "FECMODIF")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fecmodif;
|
private Date fecmodif;
|
||||||
|
|
||||||
@Column(name = "USUARIOMODIF_ID")
|
@Column(name = "USUARIOMODIF_ID")
|
||||||
private Integer usuariomodifId;
|
private Integer usuariomodifId;
|
||||||
|
|
||||||
@Column(name = "DESCCONTRASENA")
|
@Column(name = "DESCCONTRASENA")
|
||||||
private String senha;
|
private String senha;
|
||||||
|
|
||||||
@Column(name = "CVEUSUARIO")
|
@Column(name = "CVEUSUARIO")
|
||||||
private String claveUsuario;
|
private String claveUsuario;
|
||||||
|
|
||||||
@Column(name = "DESCCORREO")
|
@Column(name = "DESCCORREO")
|
||||||
private String descCorreo;
|
private String descCorreo;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
@Fetch(FetchMode.SELECT)
|
|
||||||
@AuditarLista(auditarEntidades = true, nome = "Perfil")
|
@AuditarLista(auditarEntidades = true, nome = "Perfil")
|
||||||
private List<UsuarioPerfil> usuarioPerfilList;
|
private List<UsuarioPerfil> usuarioPerfilList;
|
||||||
|
|
||||||
|
@ -104,12 +112,12 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
@JoinColumn(name = "EMPLEADO_ID")
|
@JoinColumn(name = "EMPLEADO_ID")
|
||||||
private Empleado empleado;
|
private Empleado empleado;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
@Fetch(FetchMode.SELECT)
|
@Fetch(FetchMode.SELECT)
|
||||||
@NaoAuditar
|
@NaoAuditar
|
||||||
private List<UsuarioEmpresa> usuarioEmpresaList;
|
private List<UsuarioEmpresa> usuarioEmpresaList;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
@Fetch(FetchMode.SELECT)
|
@Fetch(FetchMode.SELECT)
|
||||||
@OrderBy("padrao desc")
|
@OrderBy("padrao desc")
|
||||||
@NaoAuditar
|
@NaoAuditar
|
||||||
|
@ -605,6 +613,26 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
}
|
}
|
||||||
usuarioClone.setUsuarioPerfilList((lsClones));
|
usuarioClone.setUsuarioPerfilList((lsClones));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.getUsuarioEmpresaList() != null) {
|
||||||
|
List<UsuarioEmpresa> lsClones = new ArrayList<UsuarioEmpresa>();
|
||||||
|
for (UsuarioEmpresa usuarioEmpresa : this.getUsuarioEmpresaList()) {
|
||||||
|
if(BooleanUtils.isTrue(usuarioEmpresa.getActivo())) {
|
||||||
|
lsClones.add(usuarioEmpresa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usuarioClone.setUsuarioEmpresaList((lsClones));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.getUsuarioUbicacionList() != null) {
|
||||||
|
List<UsuarioUbicacion> lsClones = new ArrayList<UsuarioUbicacion>();
|
||||||
|
for (UsuarioUbicacion usuarioUbicacion : this.getUsuarioUbicacionList()) {
|
||||||
|
if(BooleanUtils.isTrue(usuarioUbicacion.getActivo())) {
|
||||||
|
lsClones.add(usuarioUbicacion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usuarioClone.setUsuarioUbicacionList((lsClones));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,4 +52,6 @@ public interface UsuarioService {
|
||||||
public void desativarLinkRecuperacaoSenha(RecuperarSenha entidad);
|
public void desativarLinkRecuperacaoSenha(RecuperarSenha entidad);
|
||||||
|
|
||||||
public void salvarLinkRecuperacaoSenha(RecuperarSenha entidad);
|
public void salvarLinkRecuperacaoSenha(RecuperarSenha entidad);
|
||||||
|
|
||||||
|
public Usuario obtenerCompletoID(Integer id);
|
||||||
}
|
}
|
|
@ -75,6 +75,19 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
return usuario;
|
return usuario;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Usuario obtenerCompletoID(Integer id) {
|
||||||
|
|
||||||
|
Usuario usuario = usuarioDAO.obtenerID(id);
|
||||||
|
try {
|
||||||
|
usuario.clonar();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return usuario;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
/*
|
|
||||||
* To change this template, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package com.rjconsultores.ventaboletos.utilerias;
|
package com.rjconsultores.ventaboletos.utilerias;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -13,22 +9,22 @@ import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContext;
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.web.context.ContextLoaderListener;
|
import org.springframework.web.context.ContextLoader;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO;
|
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PerfilFuncion;
|
import com.rjconsultores.ventaboletos.entidad.PerfilFuncion;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author rodrigo
|
|
||||||
*/
|
|
||||||
public class UsuarioLogado {
|
public class UsuarioLogado {
|
||||||
|
|
||||||
private static final Logger log = LogManager.getLogger(UsuarioLogado.class);
|
private static final Logger log = LogManager.getLogger(UsuarioLogado.class);
|
||||||
|
|
||||||
public static Usuario getUsuarioLogado() {
|
public static Usuario getUsuarioLogado() {
|
||||||
|
|
||||||
Usuario usuario = null;
|
Usuario usuario = null;
|
||||||
SecurityContext sc = SecurityContextHolder.getContext();
|
SecurityContext sc = SecurityContextHolder.getContext();
|
||||||
if (sc != null) {
|
if (sc != null) {
|
||||||
|
@ -40,37 +36,101 @@ public class UsuarioLogado {
|
||||||
if(usuario.getListClavesPermisos() == null) {
|
if(usuario.getListClavesPermisos() == null) {
|
||||||
cargaPermisoClave(usuario);
|
cargaPermisoClave(usuario);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
usuario.getUsuarioEmpresaList();
|
||||||
|
}catch (Exception e) {
|
||||||
|
carregaUsuarioEmpresaList(usuario);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
usuario.getUsuarioPerfilList();
|
||||||
|
}catch (Exception e) {
|
||||||
|
carregaUsuarioPerfilList(usuario);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
usuario.getUsuarioUbicacionList();
|
||||||
|
}catch (Exception e) {
|
||||||
|
carregaUsuarioUbicacionList(usuario);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
usuario = null;
|
usuario = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return usuario;
|
return usuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void cargaPermisoClave(Usuario usuario) {
|
private static void carregaUsuarioPerfilList(Usuario usuario) {
|
||||||
try {
|
try {
|
||||||
if(usuario != null && usuario.getListClavesPermisos() == null || usuario.getListClavesPermisos().isEmpty()) {
|
List<UsuarioPerfil> list = obtemUsuarioDao().buscarUsuarioPerfilList(usuario.getUsuarioId());
|
||||||
ApplicationContext context = ContextLoaderListener.getCurrentWebApplicationContext();
|
usuario.setUsuarioPerfilList(list);
|
||||||
|
}catch (Exception e) {
|
||||||
if(context != null) {
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void carregaUsuarioUbicacionList(Usuario usuario) {
|
||||||
|
try {
|
||||||
|
List<UsuarioUbicacion> list = obtemUsuarioDao().buscarUsuarioUbicacionList(usuario.getUsuarioId());
|
||||||
|
usuario.setUsuarioUbicacionList(list);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void carregaUsuarioEmpresaList(Usuario usuario) {
|
||||||
|
try {
|
||||||
|
List<UsuarioEmpresa> list = obtemUsuarioDao().buscarUsuarioEmpresaList(usuario.getUsuarioId());
|
||||||
|
usuario.setUsuarioEmpresaList(list);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UsuarioPerfilDAO usuarioPerfilDAO = context.getBean(UsuarioPerfilDAO.class);
|
private static void cargaPermisoClave(Usuario usuario) {
|
||||||
if(usuarioPerfilDAO != null) {
|
try {
|
||||||
usuario.setListClavesPermisos(new ArrayList<String>());
|
usuario.setListClavesPermisos(new ArrayList<String>());
|
||||||
List<UsuarioPerfil> listUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(usuario);
|
List<UsuarioPerfil> listUsuarioPerfil = obtemUsuarioDao().buscarUsuarioPerfilList(usuario.getUsuarioId());
|
||||||
for (UsuarioPerfil up : listUsuarioPerfil) {
|
for (UsuarioPerfil up : listUsuarioPerfil) {
|
||||||
List<PerfilFuncion> listPerfilFuncion = up.getPerfil().getPerfilFuncionList();
|
List<PerfilFuncion> listPerfilFuncion = up.getPerfil().getPerfilFuncionList();
|
||||||
for (PerfilFuncion pf : listPerfilFuncion) {
|
for (PerfilFuncion pf : listPerfilFuncion) {
|
||||||
usuario.getListClavesPermisos().add(pf.getFuncionSistema().getDescruta());
|
usuario.getListClavesPermisos().add(pf.getFuncionSistema().getDescruta());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static UsuarioDAO obtemUsuarioDao() {
|
||||||
|
ApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
|
||||||
|
|
||||||
|
if(context != null) {
|
||||||
|
UsuarioDAO usuarioDAO = context.getBean(UsuarioDAO.class);
|
||||||
|
if(usuarioDAO != null) {
|
||||||
|
return usuarioDAO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUsuarioAdmContrato() {
|
||||||
|
if( getUsuarioLogado() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UsuarioPerfil perf : getUsuarioLogado().getUsuarioPerfilList()){
|
||||||
|
if(perf.getPerfil().getPerfilId().equals(Constantes.PERFIL_ADM_CONTRATO)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UsuarioLogado() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue