diff --git a/pom.xml b/pom.xml
index 77765bfec..d5236beae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
br.com.rjconsultores
ModelWeb
- 1.61.0
+ 1.62.0
diff --git a/src/com/rjconsultores/ventaboletos/dao/RecuperarSenhaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RecuperarSenhaDAO.java
new file mode 100644
index 000000000..cbae88d0e
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/dao/RecuperarSenhaDAO.java
@@ -0,0 +1,13 @@
+package com.rjconsultores.ventaboletos.dao;
+
+import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
+
+/**
+ * @author valdir.cordeiro
+ *
+ */
+public interface RecuperarSenhaDAO extends GenericDAO{
+
+ public RecuperarSenha buscarPeloParam(String param);
+
+}
diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RecuperarSenhaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RecuperarSenhaHibernateDAO.java
new file mode 100644
index 000000000..2e47a2591
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RecuperarSenhaHibernateDAO.java
@@ -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 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();
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/entidad/RecuperarSenha.java b/src/com/rjconsultores/ventaboletos/entidad/RecuperarSenha.java
new file mode 100644
index 000000000..4ab5e1f20
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/entidad/RecuperarSenha.java
@@ -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;
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/entidad/Usuario.java b/src/com/rjconsultores/ventaboletos/entidad/Usuario.java
index 8203bf1b0..dc20f17fe 100644
--- a/src/com/rjconsultores/ventaboletos/entidad/Usuario.java
+++ b/src/com/rjconsultores/ventaboletos/entidad/Usuario.java
@@ -45,6 +45,7 @@ import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.security.SecurityEmpresaToken;
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.AuditarID;
import br.com.rjconsultores.auditador.annotations.AuditarLista;
@@ -59,7 +60,6 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel;
@Entity
@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1)
@Table(name = "USUARIO")
-
public class Usuario implements Serializable, UserDetails, Auditavel {
public final static int CANT_DIAS_CONTRASENA = 999;
@@ -140,7 +140,19 @@ public class Usuario implements Serializable, UserDetails, Auditavel {
@Column(name = "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
@NaoAuditar
@@ -599,9 +611,38 @@ public class Usuario implements Serializable, UserDetails, Auditavel {
@Override
public String getTextoInclusaoExclusao() {
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;
+ }
}
diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioService.java
index 664bb12fd..ee0acab5a 100644
--- a/src/com/rjconsultores/ventaboletos/service/UsuarioService.java
+++ b/src/com/rjconsultores/ventaboletos/service/UsuarioService.java
@@ -8,6 +8,7 @@ import java.util.List;
import com.rjconsultores.ventaboletos.entidad.Empleado;
import com.rjconsultores.ventaboletos.entidad.Perfil;
+import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
@@ -45,4 +46,10 @@ public interface UsuarioService {
public List buscarUsuarioEmbarcadaPorUsuariosIds(List usuariosIdList);
public List buscaUsuariosDoPuntoVenta(Long dispositivoEmbarcadaId);
+
+ public RecuperarSenha buscarLinkRecuperacaoSenhaPeloParam(String param);
+
+ public void desativarLinkRecuperacaoSenha(RecuperarSenha entidad);
+
+ public void salvarLinkRecuperacaoSenha(RecuperarSenha entidad);
}
\ No newline at end of file
diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java
index 1a380e744..394e34c78 100644
--- a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java
+++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java
@@ -19,10 +19,12 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import com.rjconsultores.ventaboletos.dao.RecuperarSenhaDAO;
import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO;
import com.rjconsultores.ventaboletos.entidad.Empleado;
import com.rjconsultores.ventaboletos.entidad.Perfil;
+import com.rjconsultores.ventaboletos.entidad.RecuperarSenha;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
import com.rjconsultores.ventaboletos.exception.BusinessException;
@@ -50,7 +52,9 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
@Autowired
private LogAuditoriaService logAuditoriaService;
private static final Logger log = LogManager.getLogger(UsuarioServiceImpl.class);
-
+
+ @Autowired
+ private RecuperarSenhaDAO recuperarSenhaDAO;
public List buscarPeloNome(String nome) {
return usuarioDAO.buscarPeloNome(nome);
@@ -296,4 +300,22 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
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);
+ }
}
diff --git a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java
index 593fc3541..c567f3aa5 100644
--- a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java
+++ b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java
@@ -291,6 +291,23 @@ public final class DateUtil {
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
* @param d
@@ -303,6 +320,24 @@ public final class DateUtil {
}
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) {
try {
return getStringDate(d, "dd/MM/yyyy");