fixes bug #6313
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@44399 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
f13aebecd4
commit
6db44d3097
|
@ -0,0 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe;
|
||||
|
||||
public interface EnderecoApanheDAO extends GenericDAO<EnderecoApanhe, Long>{
|
||||
|
||||
public List<EnderecoApanhe> buscar(Date datapacote, String numoperacion);
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.EnderecoApanheDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe;
|
||||
|
||||
@Repository("enderecoApanheDAO")
|
||||
public class EnderecoApanheHibernateDAO extends GenericHibernateDAO<EnderecoApanhe, Long> implements EnderecoApanheDAO {
|
||||
|
||||
@Autowired
|
||||
public EnderecoApanheHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnderecoApanhe> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public List<EnderecoApanhe> buscar(Date datapacote, String numoperacion) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
if(datapacote != null) {
|
||||
c.add(Restrictions.eq("hotel.datapacote", datapacote));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(numoperacion)) {
|
||||
c.add(Restrictions.eq("hotel.numoperacion", numoperacion));
|
||||
}
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
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.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe;
|
||||
|
||||
@Entity
|
||||
@Table(name = "ENDERECO_APANHE")
|
||||
@SequenceGenerator(name = "ENDERECO_APANHE_SEQ", sequenceName = "ENDERECO_APANHE_SEQ", allocationSize = 1)
|
||||
public class EnderecoApanhe implements Serializable, Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ENDERECO_APANHE_SEQ")
|
||||
@Column(name = "ENDERECOAPANHE_ID")
|
||||
private Long enderecoapanheId;
|
||||
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
@Column(name = "LOCAL")
|
||||
private LocalEnderecoApanhe localEnderecoApanhe;
|
||||
|
||||
@Column(name = "CEP")
|
||||
private String cep;
|
||||
|
||||
@Column(name = "ENDERECO")
|
||||
private String endereco;
|
||||
|
||||
@Column(name = "CIDADE")
|
||||
private String cidade;
|
||||
|
||||
@Column(name = "NUMERO")
|
||||
private String numero;
|
||||
|
||||
@Column(name = "BAIRRO")
|
||||
private String bairro;
|
||||
|
||||
@Column(name = "COMPLEMENTO")
|
||||
private String complemento;
|
||||
|
||||
@Column(name = "REFERENCIA")
|
||||
private String referencia;
|
||||
|
||||
@Column(name = "DESCHOTEL")
|
||||
private String deschotel;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "FECMODIF")
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "VENDAPACOTE_ID")
|
||||
private VendaPacote vendaPacote;
|
||||
|
||||
public Long getEnderecoapanheId() {
|
||||
return enderecoapanheId;
|
||||
}
|
||||
|
||||
public void setEnderecoapanheId(Long enderecoapanheId) {
|
||||
this.enderecoapanheId = enderecoapanheId;
|
||||
}
|
||||
|
||||
public LocalEnderecoApanhe getLocalEnderecoApanhe() {
|
||||
return localEnderecoApanhe;
|
||||
}
|
||||
|
||||
public void setLocalEnderecoApanhe(LocalEnderecoApanhe localEnderecoApanhe) {
|
||||
this.localEnderecoApanhe = localEnderecoApanhe;
|
||||
}
|
||||
|
||||
public String getCep() {
|
||||
return cep;
|
||||
}
|
||||
|
||||
public void setCep(String cep) {
|
||||
this.cep = cep;
|
||||
}
|
||||
|
||||
public String getEndereco() {
|
||||
return endereco;
|
||||
}
|
||||
|
||||
public void setEndereco(String endereco) {
|
||||
this.endereco = endereco;
|
||||
}
|
||||
|
||||
public String getCidade() {
|
||||
return cidade;
|
||||
}
|
||||
|
||||
public void setCidade(String cidade) {
|
||||
this.cidade = cidade;
|
||||
}
|
||||
|
||||
public String getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public void setNumero(String numero) {
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public String getBairro() {
|
||||
return bairro;
|
||||
}
|
||||
|
||||
public void setBairro(String bairro) {
|
||||
this.bairro = bairro;
|
||||
}
|
||||
|
||||
public String getComplemento() {
|
||||
return complemento;
|
||||
}
|
||||
|
||||
public void setComplemento(String complemento) {
|
||||
this.complemento = complemento;
|
||||
}
|
||||
|
||||
public String getReferencia() {
|
||||
return referencia;
|
||||
}
|
||||
|
||||
public void setReferencia(String referencia) {
|
||||
this.referencia = referencia;
|
||||
}
|
||||
|
||||
public String getDeschotel() {
|
||||
return deschotel;
|
||||
}
|
||||
|
||||
public void setDeschotel(String deschotel) {
|
||||
this.deschotel = deschotel;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((enderecoapanheId == null) ? 0 : enderecoapanheId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
EnderecoApanhe other = (EnderecoApanhe) obj;
|
||||
if (enderecoapanheId == null) {
|
||||
if (other.enderecoapanheId != null)
|
||||
return false;
|
||||
} else if (!enderecoapanheId.equals(other.enderecoapanheId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public VendaPacote getVendaPacote() {
|
||||
return vendaPacote;
|
||||
}
|
||||
|
||||
public void setVendaPacote(VendaPacote vendaPacote) {
|
||||
this.vendaPacote = vendaPacote;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
@Entity
|
||||
@Table(name = "VENDA_PACOTE")
|
||||
@SequenceGenerator(name = "VENDA_PACOTE_SEQ", sequenceName = "VENDA_PACOTE_SEQ", allocationSize = 1)
|
||||
public class VendaPacote implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "VENDA_PACOTE_SEQ")
|
||||
@Column(name = "VENDAPACOTE_ID")
|
||||
private Long vendapacoteId;
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "DATAVENDA")
|
||||
private Date datavenda;
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "DATAPACOTE")
|
||||
private Date datapacote;
|
||||
|
||||
@Column(name = "NUMOPERACION")
|
||||
private String numoperacion;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "PACOTE_ID")
|
||||
private Pacote pacote;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "vendaPacote")
|
||||
@Where(clause = "activo=1")
|
||||
private List<EnderecoApanhe> enderecoApanhes;
|
||||
|
||||
@Column(name = "INDCANCELADO")
|
||||
private Boolean indcancelado;
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "DATACANCELAMENTO")
|
||||
private Date datacancelamento;
|
||||
|
||||
@Column(name = "USUARIO_CANCELAMENTO_ID")
|
||||
private Integer usuarioCancelamentoId;
|
||||
|
||||
@Column(name = "SUBTOTAL")
|
||||
private BigDecimal subtotal;
|
||||
|
||||
@Column(name = "DESCONTO")
|
||||
private BigDecimal desconto;
|
||||
|
||||
@Column(name = "TOTAL")
|
||||
private BigDecimal total;
|
||||
|
||||
public Long getVendapacoteId() {
|
||||
return vendapacoteId;
|
||||
}
|
||||
|
||||
public void setVendapacoteId(Long vendapacoteId) {
|
||||
this.vendapacoteId = vendapacoteId;
|
||||
}
|
||||
|
||||
public Date getDatavenda() {
|
||||
return datavenda;
|
||||
}
|
||||
|
||||
public void setDatavenda(Date datavenda) {
|
||||
this.datavenda = datavenda;
|
||||
}
|
||||
|
||||
public Date getDatapacote() {
|
||||
return datapacote;
|
||||
}
|
||||
|
||||
public void setDatapacote(Date datapacote) {
|
||||
this.datapacote = datapacote;
|
||||
}
|
||||
|
||||
public Pacote getPacote() {
|
||||
return pacote;
|
||||
}
|
||||
|
||||
public void setPacote(Pacote pacote) {
|
||||
this.pacote = pacote;
|
||||
}
|
||||
|
||||
public Boolean getIndcancelado() {
|
||||
return indcancelado;
|
||||
}
|
||||
|
||||
public void setIndcancelado(Boolean indcancelado) {
|
||||
this.indcancelado = indcancelado;
|
||||
}
|
||||
|
||||
public Date getDatacancelamento() {
|
||||
return datacancelamento;
|
||||
}
|
||||
|
||||
public void setDatacancelamento(Date datacancelamento) {
|
||||
this.datacancelamento = datacancelamento;
|
||||
}
|
||||
|
||||
public Integer getUsuarioCancelamentoId() {
|
||||
return usuarioCancelamentoId;
|
||||
}
|
||||
|
||||
public void setUsuarioCancelamentoId(Integer usuarioCancelamentoId) {
|
||||
this.usuarioCancelamentoId = usuarioCancelamentoId;
|
||||
}
|
||||
|
||||
public BigDecimal getSubtotal() {
|
||||
return subtotal;
|
||||
}
|
||||
|
||||
public void setSubtotal(BigDecimal subtotal) {
|
||||
this.subtotal = subtotal;
|
||||
}
|
||||
|
||||
public BigDecimal getDesconto() {
|
||||
return desconto;
|
||||
}
|
||||
|
||||
public void setDesconto(BigDecimal desconto) {
|
||||
this.desconto = desconto;
|
||||
}
|
||||
|
||||
public BigDecimal getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(BigDecimal total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getNumoperacion() {
|
||||
return numoperacion;
|
||||
}
|
||||
|
||||
public void setNumoperacion(String numoperacion) {
|
||||
this.numoperacion = numoperacion;
|
||||
}
|
||||
|
||||
public List<EnderecoApanhe> getEnderecoApanhes() {
|
||||
return enderecoApanhes;
|
||||
}
|
||||
|
||||
public void setEnderecoApanhes(List<EnderecoApanhe> enderecoApanhes) {
|
||||
this.enderecoApanhes = enderecoApanhes;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.rjconsultores.ventaboletos.enums;
|
||||
|
||||
public enum LocalEnderecoApanhe {
|
||||
|
||||
APANHE_EM_CASA(0,"Apanhe em Casa"),
|
||||
HOTEL(1,"Hotel"),
|
||||
NENHUM(2,"Nenhum"),
|
||||
REGIAO_METROPOLITANA(3,"Região Metropolitana");
|
||||
|
||||
private Integer valor;
|
||||
private String descricao;
|
||||
|
||||
private LocalEnderecoApanhe(Integer valor, String descricao) {
|
||||
this.valor = valor;
|
||||
this.descricao = descricao;
|
||||
}
|
||||
|
||||
public Integer getValor() {
|
||||
return this.valor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.descricao;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe;
|
||||
|
||||
public interface EnderecoApanheService extends GenericService<EnderecoApanhe, Long> {
|
||||
|
||||
public List<EnderecoApanhe> buscar(Date datapacote, String numoperacion);
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
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.EnderecoApanheDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe;
|
||||
import com.rjconsultores.ventaboletos.service.EnderecoApanheService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("enderecoApanheService")
|
||||
public class EnderecoApanheServiceImpl implements EnderecoApanheService {
|
||||
|
||||
@Autowired
|
||||
private EnderecoApanheDAO enderecoApanheDAO;
|
||||
|
||||
public List<EnderecoApanhe> obtenerTodos() {
|
||||
return enderecoApanheDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public EnderecoApanhe obtenerID(Long id) {
|
||||
return enderecoApanheDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public EnderecoApanhe suscribir(EnderecoApanhe entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return enderecoApanheDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public EnderecoApanhe actualizacion(EnderecoApanhe entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return enderecoApanheDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(EnderecoApanhe entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
enderecoApanheDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
public List<EnderecoApanhe> buscar(Date datapacote, String numoperacion) {
|
||||
return enderecoApanheDAO.buscar(datapacote, numoperacion);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue