P3 - Bloqueio por tipo de Passagem (fixed bug #5381)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@36227 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
2b56a20195
commit
db5f99a2ea
|
@ -0,0 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
||||
|
||||
public interface PtovtaCatIndDAO extends GenericDAO<PtovtaCatInd, Integer> {
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.PtovtaCatIndDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
||||
|
||||
@Repository("ptovtaCatIndDAO")
|
||||
public class PtovtaCatIndHibernateDAO extends GenericHibernateDAO<PtovtaCatInd, Integer>
|
||||
implements PtovtaCatIndDAO {
|
||||
|
||||
@Autowired
|
||||
public PtovtaCatIndHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
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.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1)
|
||||
@Table(name = "PTOVTA_CAT_IND")
|
||||
public class PtovtaCatInd implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_CAT_IND_SEQ")
|
||||
@Column(name = "PTOVTACATEGORIA_ID")
|
||||
private Integer ptovtaCategoriaId;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
|
||||
@ManyToOne
|
||||
private Categoria categoria;
|
||||
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||
@ManyToOne
|
||||
private PuntoVenta puntoVenta;
|
||||
|
||||
public Integer getPtovtaCategoriaId() {
|
||||
return ptovtaCategoriaId;
|
||||
}
|
||||
|
||||
public void setPtovtaCategoriaId(Integer ptovtaCategoriaId) {
|
||||
this.ptovtaCategoriaId = ptovtaCategoriaId;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Categoria getCategoria() {
|
||||
return categoria;
|
||||
}
|
||||
|
||||
public void setCategoria(Categoria categoria) {
|
||||
this.categoria = categoria;
|
||||
}
|
||||
|
||||
public PuntoVenta getPuntoVenta() {
|
||||
return puntoVenta;
|
||||
}
|
||||
|
||||
public void setPuntoVenta(PuntoVenta puntoVenta) {
|
||||
this.puntoVenta = puntoVenta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((activo == null) ? 0 : activo.hashCode());
|
||||
result = prime * result + ((categoria == null) ? 0 : categoria.hashCode());
|
||||
result = prime * result + ((fecmodif == null) ? 0 : fecmodif.hashCode());
|
||||
result = prime * result + ((ptovtaCategoriaId == null) ? 0 : ptovtaCategoriaId.hashCode());
|
||||
result = prime * result + ((puntoVenta == null) ? 0 : puntoVenta.hashCode());
|
||||
result = prime * result + ((usuarioId == null) ? 0 : usuarioId.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;
|
||||
PtovtaCatInd other = (PtovtaCatInd) obj;
|
||||
if (activo == null) {
|
||||
if (other.activo != null)
|
||||
return false;
|
||||
} else if (!activo.equals(other.activo))
|
||||
return false;
|
||||
if (categoria == null) {
|
||||
if (other.categoria != null)
|
||||
return false;
|
||||
} else if (!categoria.equals(other.categoria))
|
||||
return false;
|
||||
if (fecmodif == null) {
|
||||
if (other.fecmodif != null)
|
||||
return false;
|
||||
} else if (!fecmodif.equals(other.fecmodif))
|
||||
return false;
|
||||
if (ptovtaCategoriaId == null) {
|
||||
if (other.ptovtaCategoriaId != null)
|
||||
return false;
|
||||
} else if (!ptovtaCategoriaId.equals(other.ptovtaCategoriaId))
|
||||
return false;
|
||||
if (puntoVenta == null) {
|
||||
if (other.puntoVenta != null)
|
||||
return false;
|
||||
} else if (!puntoVenta.equals(other.puntoVenta))
|
||||
return false;
|
||||
if (usuarioId == null) {
|
||||
if (other.usuarioId != null)
|
||||
return false;
|
||||
} else if (!usuarioId.equals(other.usuarioId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -138,7 +138,7 @@ public class PuntoVenta implements Serializable {
|
|||
@Column(name = "INDVALIDASTOCK")
|
||||
private Boolean indValidaStock;
|
||||
@Column(name = "INDPERMISOTASAEMBARQUE")
|
||||
private Boolean indPermisoTasaEmbarque;
|
||||
private Boolean indPermisoTasaEmbarque;
|
||||
@Column(name = "TIEMPOCANCELACION")
|
||||
private Integer tiempoCancelacion;
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
|
@ -151,26 +151,30 @@ public class PuntoVenta implements Serializable {
|
|||
|
||||
@Column(name = "INDCTRLESTCENTRAL")
|
||||
private Boolean usaCrtlEstCentral;
|
||||
|
||||
|
||||
@Column(name = "NUMDOCPUNTOVENTA")
|
||||
private String numDoCPuntoVenta;
|
||||
|
||||
|
||||
@Column(name = "RAZONSOCIAL")
|
||||
private String razonSocial;
|
||||
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
private List<PtovtaEmpresaBloqueada> ptovtaEmpresaBloqueadaList;
|
||||
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
private List<PtoVtaCheckin> ptovtaCheckinList;
|
||||
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
private List<PtoVtaSeguro> ptovtaSeguroList;
|
||||
|
||||
public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e){
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
private List<PtovtaCatInd> ptovtaCatIndList;
|
||||
|
||||
public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e) {
|
||||
PtovtaEmpresaBloqueada eb = new PtovtaEmpresaBloqueada();
|
||||
eb.setEmpresa(e);
|
||||
eb.setPuntoventaId(this);
|
||||
|
@ -180,20 +184,20 @@ public class PuntoVenta implements Serializable {
|
|||
this.ptovtaEmpresaBloqueadaList.add(eb);
|
||||
return eb;
|
||||
}
|
||||
|
||||
public void removeEmpresaBloqueada(PtovtaEmpresaBloqueada e){
|
||||
|
||||
public void removeEmpresaBloqueada(PtovtaEmpresaBloqueada e) {
|
||||
this.ptovtaEmpresaBloqueadaList.remove(e);
|
||||
}
|
||||
|
||||
public void removeEmpresaBloqueada(Empresa e){
|
||||
for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList){
|
||||
if (eb.getEmpresa().equals(e)){
|
||||
|
||||
public void removeEmpresaBloqueada(Empresa e) {
|
||||
for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList) {
|
||||
if (eb.getEmpresa().equals(e)) {
|
||||
this.ptovtaEmpresaBloqueadaList.remove(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public PtovtaTipoEstoque getPtovtaTipoEstoque() {
|
||||
return ptovtaTipoEstoque;
|
||||
}
|
||||
|
@ -613,7 +617,7 @@ public class PuntoVenta implements Serializable {
|
|||
|
||||
public void setIndValidaStock(Boolean indValidaStock) {
|
||||
this.indValidaStock = indValidaStock;
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getIndPermisoTasaEmbarque() {
|
||||
return indPermisoTasaEmbarque;
|
||||
|
@ -665,8 +669,8 @@ public class PuntoVenta implements Serializable {
|
|||
|
||||
public List<PtovtaEmpresaBloqueada> getPtovtaEmpresaBloqueadaList() {
|
||||
List<PtovtaEmpresaBloqueada> lista = new ArrayList<PtovtaEmpresaBloqueada>();
|
||||
for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList ){
|
||||
if (eb.getActivo()){
|
||||
for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList) {
|
||||
if (eb.getActivo()) {
|
||||
lista.add(eb);
|
||||
}
|
||||
}
|
||||
|
@ -679,8 +683,8 @@ public class PuntoVenta implements Serializable {
|
|||
|
||||
public List<PtoVtaCheckin> getPtovtaCheckinList() {
|
||||
List<PtoVtaCheckin> lista = new ArrayList<PtoVtaCheckin>();
|
||||
for (PtoVtaCheckin ck : ptovtaCheckinList ){
|
||||
if (ck.getActivo()){
|
||||
for (PtoVtaCheckin ck : ptovtaCheckinList) {
|
||||
if (ck.getActivo()) {
|
||||
lista.add(ck);
|
||||
}
|
||||
}
|
||||
|
@ -690,8 +694,8 @@ public class PuntoVenta implements Serializable {
|
|||
public void setPtovtaCheckinList(List<PtoVtaCheckin> ptovtaCheckinList) {
|
||||
this.ptovtaCheckinList = ptovtaCheckinList;
|
||||
}
|
||||
|
||||
public PtoVtaCheckin addPtovtaCheckin(PtoVtaCheckin pto){
|
||||
|
||||
public PtoVtaCheckin addPtovtaCheckin(PtoVtaCheckin pto) {
|
||||
PtoVtaCheckin pt = new PtoVtaCheckin();
|
||||
pt.setPuntoventaId(pto.getPuntoventaId());
|
||||
pt.setParadaId(pto.getParadaId());
|
||||
|
@ -701,15 +705,15 @@ public class PuntoVenta implements Serializable {
|
|||
this.ptovtaCheckinList.add(pt);
|
||||
return pt;
|
||||
}
|
||||
|
||||
public void removePtovtaCheckin(PtoVtaCheckin pto){
|
||||
|
||||
public void removePtovtaCheckin(PtoVtaCheckin pto) {
|
||||
this.ptovtaCheckinList.remove(pto);
|
||||
}
|
||||
|
||||
|
||||
public List<PtoVtaSeguro> getPtovtaSeguroList() {
|
||||
List<PtoVtaSeguro> lista = new ArrayList<PtoVtaSeguro>();
|
||||
for (PtoVtaSeguro ck : ptovtaSeguroList ){
|
||||
if (ck.getActivo()){
|
||||
for (PtoVtaSeguro ck : ptovtaSeguroList) {
|
||||
if (ck.getActivo()) {
|
||||
lista.add(ck);
|
||||
}
|
||||
}
|
||||
|
@ -719,8 +723,8 @@ public class PuntoVenta implements Serializable {
|
|||
public void setPtovtaSeguroList(List<PtoVtaSeguro> ptovtaSeguroList) {
|
||||
this.ptovtaSeguroList = ptovtaSeguroList;
|
||||
}
|
||||
|
||||
public PtoVtaSeguro addPtovtaSeguro(PtoVtaSeguro pto){
|
||||
|
||||
public PtoVtaSeguro addPtovtaSeguro(PtoVtaSeguro pto) {
|
||||
PtoVtaSeguro pt = new PtoVtaSeguro();
|
||||
pt.setPuntoventaId(pto.getPuntoventaId());
|
||||
pt.setEmpresa(pto.getEmpresa());
|
||||
|
@ -732,9 +736,36 @@ public class PuntoVenta implements Serializable {
|
|||
this.ptovtaSeguroList.add(pt);
|
||||
return pt;
|
||||
}
|
||||
|
||||
public void removePtovtaSeguro(PtoVtaSeguro pto){
|
||||
|
||||
public void removePtovtaSeguro(PtoVtaSeguro pto) {
|
||||
this.ptovtaSeguroList.remove(pto);
|
||||
}
|
||||
|
||||
public List<PtovtaCatInd> getPtovtaCatIndList() {
|
||||
List<PtovtaCatInd> lista = new ArrayList<PtovtaCatInd>();
|
||||
for (PtovtaCatInd ck : ptovtaCatIndList) {
|
||||
if (ck.getActivo()) {
|
||||
lista.add(ck);
|
||||
}
|
||||
}
|
||||
return lista;
|
||||
}
|
||||
|
||||
public void setPtovtaCatIndList(List<PtovtaCatInd> ptovtaCatIndList) {
|
||||
this.ptovtaCatIndList = ptovtaCatIndList;
|
||||
}
|
||||
|
||||
public PtovtaCatInd addPtovtaCatInd(PtovtaCatInd pto) {
|
||||
pto.setActivo(Boolean.TRUE);
|
||||
pto.setFecmodif(Calendar.getInstance().getTime());
|
||||
pto.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
this.ptovtaCatIndList.add(pto);
|
||||
return pto;
|
||||
}
|
||||
|
||||
public void removePtovtaCatInd(PtovtaCatInd pto) {
|
||||
this.ptovtaCatIndList.remove(pto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
||||
|
||||
public interface PtovtaCatIndService extends GenericService<PtovtaCatInd, Integer> {
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
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.PtovtaCatIndDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
||||
import com.rjconsultores.ventaboletos.service.PtovtaCatIndService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("ptovtaCatIndService")
|
||||
public class PtovtaCatIndServiceImpl implements PtovtaCatIndService {
|
||||
|
||||
@Autowired
|
||||
private PtovtaCatIndDAO ptovtaCatIndDAO;
|
||||
|
||||
@Override
|
||||
public List<PtovtaCatInd> obtenerTodos() {
|
||||
return ptovtaCatIndDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PtovtaCatInd obtenerID(Integer id) {
|
||||
return ptovtaCatIndDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PtovtaCatInd suscribir(PtovtaCatInd entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return ptovtaCatIndDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PtovtaCatInd actualizacion(PtovtaCatInd entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return ptovtaCatIndDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void borrar(PtovtaCatInd entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
ptovtaCatIndDAO.actualizacion(entidad);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.EstacionDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
|
@ -20,7 +19,6 @@ import com.rjconsultores.ventaboletos.entidad.Parada;
|
|||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||
import com.rjconsultores.ventaboletos.service.UsuarioUbicacionService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue