Criação do cadastro de clientes
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@22548 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
f04cc3ea3f
commit
a973adf28f
|
@ -0,0 +1,16 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public interface ClienteDireccionDAO extends GenericDAO<ClienteDireccion, Integer> {
|
||||
|
||||
public List<ClienteDireccion> buscar(Integer clienteId);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Order;
|
||||
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.ClienteDireccionDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||
|
||||
|
||||
@Repository("clienteDireccionDAO")
|
||||
public class ClienteDireccionHibernateDAO extends GenericHibernateDAO<ClienteDireccion, Integer>
|
||||
implements ClienteDireccionDAO {
|
||||
|
||||
@Autowired
|
||||
public ClienteDireccionHibernateDAO(
|
||||
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClienteDireccion> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.addOrder(Order.asc("id"));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public List<ClienteDireccion> buscar(Integer clienteId) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("clienteId", clienteId));
|
||||
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -73,13 +74,17 @@ public class Cliente implements Serializable {
|
|||
@Column(name = "NUMEXTENSIONDOS")
|
||||
private String numextensiondos;
|
||||
|
||||
@Column(name = "TIPOOCUPACION_ID")
|
||||
|
||||
@JoinColumn(name = "TIPOOCUPACION_ID")
|
||||
@OneToOne(cascade=CascadeType.ALL)
|
||||
private TipoOcupacion tipoocupacionId;
|
||||
|
||||
@Column(name = "MEDIOINFORMATIVO_ID")
|
||||
private Integer medioinformativoId;
|
||||
|
||||
@Column(name = "MOTIVOVIAJE_ID")
|
||||
|
||||
@JoinColumn(name = "MOTIVOVIAJE_ID")
|
||||
@OneToOne(cascade=CascadeType.ALL)
|
||||
private MotivoViaje motivoviajeId;
|
||||
|
||||
@Column(name = "INDSEXO")
|
||||
|
@ -125,10 +130,10 @@ public class Cliente implements Serializable {
|
|||
@Column(name = "INDCAMBIOCONTRASENA")
|
||||
private Integer indcambiocontrasena;
|
||||
|
||||
//
|
||||
// @OneToMany(cascade = CascadeType.ALL)
|
||||
// @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
||||
// private List<ClienteDireccion> lsClienteDireccion;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
private List<ClienteDireccion> lsClienteDireccion;
|
||||
|
||||
|
||||
public Cliente() {
|
||||
}
|
||||
|
@ -362,13 +367,13 @@ public class Cliente implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
// public List<ClienteDireccion> getLsClienteDireccion() {
|
||||
// return lsClienteDireccion;
|
||||
// }
|
||||
//
|
||||
// public void setLsClienteDireccion(List<ClienteDireccion> lsClienteDireccion) {
|
||||
// this.lsClienteDireccion = lsClienteDireccion;
|
||||
// }
|
||||
public List<ClienteDireccion> getLsClienteDireccion() {
|
||||
return lsClienteDireccion;
|
||||
}
|
||||
|
||||
public void setLsClienteDireccion(List<ClienteDireccion> lsClienteDireccion) {
|
||||
this.lsClienteDireccion = lsClienteDireccion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -16,6 +17,7 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -41,26 +43,36 @@ public class ClienteDireccion implements Serializable {
|
|||
|
||||
@Column(name = "DESCCALLE")
|
||||
private String desccalle;
|
||||
|
||||
@Column(name = "DESCCALLECOMP")
|
||||
private String desccallecomp;
|
||||
|
||||
@Column(name = "DESCDELEGACION")
|
||||
private String descdelegacion;
|
||||
@Column(name = "TIPODOMICILIO_ID")
|
||||
private Short tipodomicilioId;
|
||||
|
||||
@JoinColumn(name = "TIPODOMICILIO_ID")
|
||||
@OneToOne(cascade=CascadeType.ALL)
|
||||
private TipoDomicilio tipodomicilioId;
|
||||
|
||||
@Column(name = "DESCPLANO")
|
||||
private String descplano;
|
||||
|
||||
@Column(name = "DESCCOORDENADA")
|
||||
private String desccoordenada;
|
||||
|
||||
@Column(name = "FECHORINICIOENTREGA")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fechorinicioentrega;
|
||||
|
||||
@Column(name = "FECHORFINENTREGA")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fechorfinentrega;
|
||||
|
||||
@Column(name = "COLONIA_ID")
|
||||
private Integer coloniaId;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Short activo;
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
@ -78,12 +90,15 @@ public class ClienteDireccion implements Serializable {
|
|||
private String desciudad;
|
||||
@Column(name = "DESESTADO")
|
||||
private String desestado;
|
||||
|
||||
|
||||
// @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
||||
// @ManyToOne
|
||||
// private Cliente clienteId;
|
||||
@JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
||||
@ManyToOne
|
||||
private Cliente clienteId;
|
||||
|
||||
|
||||
public ClienteDireccion() {
|
||||
|
||||
}
|
||||
|
||||
public ClienteDireccion(Integer clientedireccionId) {
|
||||
|
@ -99,13 +114,13 @@ public class ClienteDireccion implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
// public Cliente getClienteId() {
|
||||
// return clienteId;
|
||||
// }
|
||||
//
|
||||
// public void setClienteId(Cliente clienteId) {
|
||||
// this.clienteId = clienteId;
|
||||
// }
|
||||
public Cliente getClienteId() {
|
||||
return clienteId;
|
||||
}
|
||||
|
||||
public void setClienteId(Cliente clienteId) {
|
||||
this.clienteId = clienteId;
|
||||
}
|
||||
|
||||
public String getDesccalle() {
|
||||
return desccalle;
|
||||
|
@ -131,11 +146,11 @@ public class ClienteDireccion implements Serializable {
|
|||
this.descdelegacion = descdelegacion;
|
||||
}
|
||||
|
||||
public Short getTipodomicilioId() {
|
||||
public TipoDomicilio getTipodomicilioId() {
|
||||
return tipodomicilioId;
|
||||
}
|
||||
|
||||
public void setTipodomicilioId(Short tipodomicilioId) {
|
||||
public void setTipodomicilioId(TipoDomicilio tipodomicilioId) {
|
||||
this.tipodomicilioId = tipodomicilioId;
|
||||
}
|
||||
|
||||
|
@ -179,11 +194,11 @@ public class ClienteDireccion implements Serializable {
|
|||
this.coloniaId = coloniaId;
|
||||
}
|
||||
|
||||
public Short getActivo() {
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Short activo) {
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,7 @@ public class TipoOcupacion implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.TipoOcupacion[tipoocupacionId=" + tipoocupacionId + "]";
|
||||
// return "com.rjconsultores.ventaboletos.entidad.TipoOcupacion[tipoocupacionId=" + tipoocupacionId + "]";
|
||||
return this.desctipo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||
|
||||
|
||||
|
||||
|
||||
public interface ClienteDireccionService extends GenericService<ClienteDireccion, Integer> {
|
||||
|
||||
public List<ClienteDireccion> buscar(Integer clienteId);
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.ClienteDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Cliente;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||
import com.rjconsultores.ventaboletos.service.ClienteDireccionService;
|
||||
import com.rjconsultores.ventaboletos.service.ClienteService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
@Service("clienteDireccionService")
|
||||
public class ClienteDireccionServiceImpl implements ClienteDireccionService{
|
||||
|
||||
@Autowired
|
||||
private ClienteDireccionDAO clienteDAO;
|
||||
|
||||
public List<ClienteDireccion> obtenerTodos() {
|
||||
return clienteDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public ClienteDireccion obtenerID(Integer id) {
|
||||
return clienteDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ClienteDireccion suscribir(ClienteDireccion entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return clienteDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ClienteDireccion actualizacion(ClienteDireccion entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return clienteDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void borrar(ClienteDireccion entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
clienteDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
||||
public List<ClienteDireccion> buscar(Integer clienteId) {
|
||||
return clienteDAO.buscar(clienteId);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue