parent
840c1f36af
commit
3d049a3eac
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.61.0</version>
|
<version>1.62.0</version>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author valdir.cordeiro
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface RecuperarSenhaDAO extends GenericDAO<RecuperarSenha, Long>{
|
||||||
|
|
||||||
|
public RecuperarSenha buscarPeloParam(String param);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.RecuperarSenhaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author valdir.cordeiro
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Repository("recuperarSenhaDAO")
|
||||||
|
public class RecuperarSenhaHibernateDAO extends GenericHibernateDAO<RecuperarSenha, Long> implements RecuperarSenhaDAO{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RecuperarSenhaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecuperarSenha buscarPeloParam(String param) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("param", param));
|
||||||
|
|
||||||
|
return (RecuperarSenha) c.uniqueResult();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author valdir.cordeiro
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "RECUPERARSENHA_SEQ", sequenceName = "RECUPERARSENHA_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "RECUPERAR_SENHA")
|
||||||
|
public class RecuperarSenha implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "RECUPERARSENHA_SEQ")
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "RECUPERARSENHA_ID")
|
||||||
|
private Long recuperarSenhaId;
|
||||||
|
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@Column(name = "PARAM")
|
||||||
|
private String param;
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public Long getRecuperarSenhaId() {
|
||||||
|
return recuperarSenhaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecuperarSenhaId(Long recuperarSenhaId) {
|
||||||
|
this.recuperarSenhaId = recuperarSenhaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParam() {
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParam(String param) {
|
||||||
|
this.param = param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,6 +45,7 @@ import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.security.SecurityEmpresaToken;
|
import com.rjconsultores.ventaboletos.web.utilerias.security.SecurityEmpresaToken;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarAtributo;
|
||||||
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
||||||
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||||
import br.com.rjconsultores.auditador.annotations.AuditarLista;
|
import br.com.rjconsultores.auditador.annotations.AuditarLista;
|
||||||
|
@ -59,7 +60,6 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1)
|
||||||
@Table(name = "USUARIO")
|
@Table(name = "USUARIO")
|
||||||
|
|
||||||
public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
|
|
||||||
public final static int CANT_DIAS_CONTRASENA = 999;
|
public final static int CANT_DIAS_CONTRASENA = 999;
|
||||||
|
@ -140,7 +140,19 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
@Column(name = "INDTROCASENHA")
|
@Column(name = "INDTROCASENHA")
|
||||||
private Boolean indTrocaSenha;
|
private Boolean indTrocaSenha;
|
||||||
|
|
||||||
|
@Column(name = "INDRECUPERARSENHA")
|
||||||
|
private Boolean indRecuperarSenha;
|
||||||
|
|
||||||
|
@Column(name = "NOMBPATERNORECUPERAR")
|
||||||
|
private String nombpaternoRecuperacao;
|
||||||
|
|
||||||
|
@Column(name = "MATRICULA")
|
||||||
|
private String matricula;
|
||||||
|
|
||||||
|
@Column(name = "DATANASCIMENTO")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Data Nascimento")
|
||||||
|
private Date dataNascimento;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@NaoAuditar
|
@NaoAuditar
|
||||||
|
@ -601,7 +613,36 @@ public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
return String.format("ID [%s]", getUsuarioId());
|
return String.format("ID [%s]", getUsuarioId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIndRecuperarSenha() {
|
||||||
|
return indRecuperarSenha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndRecuperarSenha(Boolean indRecuperarSenha) {
|
||||||
|
this.indRecuperarSenha = indRecuperarSenha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombpaternoRecuperacao() {
|
||||||
|
return nombpaternoRecuperacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombpaternoRecuperacao(String nombpaternoRecuperacao) {
|
||||||
|
this.nombpaternoRecuperacao = nombpaternoRecuperacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMatricula() {
|
||||||
|
return matricula;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatricula(String matricula) {
|
||||||
|
this.matricula = matricula;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataNascimento() {
|
||||||
|
return dataNascimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataNascimento(Date dataNascimento) {
|
||||||
|
this.dataNascimento = dataNascimento;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Perfil;
|
import com.rjconsultores.ventaboletos.entidad.Perfil;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
|
@ -45,4 +46,10 @@ public interface UsuarioService {
|
||||||
public List<UsuarioEmbarcadaVO> buscarUsuarioEmbarcadaPorUsuariosIds(List<Long> usuariosIdList);
|
public List<UsuarioEmbarcadaVO> buscarUsuarioEmbarcadaPorUsuariosIds(List<Long> usuariosIdList);
|
||||||
|
|
||||||
public List<UsuarioEmbarcadaVO> buscaUsuariosDoPuntoVenta(Long dispositivoEmbarcadaId);
|
public List<UsuarioEmbarcadaVO> buscaUsuariosDoPuntoVenta(Long dispositivoEmbarcadaId);
|
||||||
|
|
||||||
|
public RecuperarSenha buscarLinkRecuperacaoSenhaPeloParam(String param);
|
||||||
|
|
||||||
|
public void desativarLinkRecuperacaoSenha(RecuperarSenha entidad);
|
||||||
|
|
||||||
|
public void salvarLinkRecuperacaoSenha(RecuperarSenha entidad);
|
||||||
}
|
}
|
|
@ -19,10 +19,12 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.RecuperarSenhaDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
|
import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO;
|
import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Perfil;
|
import com.rjconsultores.ventaboletos.entidad.Perfil;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
@ -51,6 +53,8 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
private LogAuditoriaService logAuditoriaService;
|
private LogAuditoriaService logAuditoriaService;
|
||||||
private static final Logger log = LogManager.getLogger(UsuarioServiceImpl.class);
|
private static final Logger log = LogManager.getLogger(UsuarioServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RecuperarSenhaDAO recuperarSenhaDAO;
|
||||||
|
|
||||||
public List<Usuario> buscarPeloNome(String nome) {
|
public List<Usuario> buscarPeloNome(String nome) {
|
||||||
return usuarioDAO.buscarPeloNome(nome);
|
return usuarioDAO.buscarPeloNome(nome);
|
||||||
|
@ -296,4 +300,22 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
return usuarioDAO.buscaUsuariosDoPuntoVenta(puntoVentaId);
|
return usuarioDAO.buscaUsuariosDoPuntoVenta(puntoVentaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecuperarSenha buscarLinkRecuperacaoSenhaPeloParam(String param) {
|
||||||
|
return recuperarSenhaDAO.buscarPeloParam(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void desativarLinkRecuperacaoSenha(RecuperarSenha entidad) {
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
recuperarSenhaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void salvarLinkRecuperacaoSenha(RecuperarSenha entidad) {
|
||||||
|
recuperarSenhaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,6 +291,23 @@ public final class DateUtil {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formato 12 horas
|
||||||
|
* @param d
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date getDateStringHour(String d) {
|
||||||
|
try {
|
||||||
|
if (d != null) {
|
||||||
|
DateFormat df = new SimpleDateFormat(ddMMaaHHmm);
|
||||||
|
return df.parse(d);
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formato 24 horas
|
* Formato 24 horas
|
||||||
* @param d
|
* @param d
|
||||||
|
@ -303,6 +320,24 @@ public final class DateUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formato 24 horas
|
||||||
|
* @param d
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date getDateString24Hour(String d) {
|
||||||
|
try {
|
||||||
|
if (d != null) {
|
||||||
|
DateFormat df = new SimpleDateFormat(ddMMaaHH24mm);
|
||||||
|
return df.parse(d);
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getStringDate(java.util.Date d) {
|
public static String getStringDate(java.util.Date d) {
|
||||||
try {
|
try {
|
||||||
return getStringDate(d, "dd/MM/yyyy");
|
return getStringDate(d, "dd/MM/yyyy");
|
||||||
|
|
Loading…
Reference in New Issue