diff --git a/pom.xml b/pom.xml
index 6a47f9b99..fe105962f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
br.com.rjconsultores
ModelWeb
- 1.23.1
+ 1.23.2
diff --git a/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java
index 062d691cf..de6788cca 100644
--- a/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java
+++ b/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java
@@ -5,10 +5,14 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
/**
*
* @author rodrigo
*/
public interface AsientoExclusivoDAO extends GenericDAO {
+
+ void borrarByCorrida(Corrida corrida);
+
}
diff --git a/src/com/rjconsultores/ventaboletos/dao/DisponibilidadDAO.java b/src/com/rjconsultores/ventaboletos/dao/DisponibilidadDAO.java
new file mode 100644
index 000000000..c3a86c24b
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/dao/DisponibilidadDAO.java
@@ -0,0 +1,18 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.rjconsultores.ventaboletos.dao;
+
+import com.rjconsultores.ventaboletos.entidad.Corrida;
+import com.rjconsultores.ventaboletos.entidad.Disponibilidad;
+
+/**
+ *
+ * @author wallace
+ */
+public interface DisponibilidadDAO extends GenericDAO {
+
+ void borrarByCorrida(Corrida corrida);
+
+}
diff --git a/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java b/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java
index efa57eabc..5cf98ef8b 100644
--- a/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java
+++ b/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java
@@ -1,7 +1,10 @@
package com.rjconsultores.ventaboletos.dao;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs;
public interface IntegracaoTotvsDAO extends GenericDAO {
+
+ public void borrarByCorrida(Corrida corrida);
}
diff --git a/src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java
deleted file mode 100644
index 6566cce8c..000000000
--- a/src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.rjconsultores.ventaboletos.dao;
-
-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.hibernate.GenericHibernateDAO;
-import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs;
-
-@Repository("IntgeracaoTotvsDAO")
-public class IntgeracaoTotvsHibernateDAO extends GenericHibernateDAO
- implements IntegracaoTotvsDAO {
-
- @Autowired
- public IntgeracaoTotvsHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
- setSessionFactory(factory);
- }
-
-}
diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java
index e62e7b0d7..990e6fe53 100644
--- a/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java
+++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java
@@ -4,19 +4,23 @@
*/
package com.rjconsultores.ventaboletos.dao.hibernate;
-import com.rjconsultores.ventaboletos.dao.AsientoExclusivoDAO;
-import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
import java.util.List;
+
import org.hibernate.Criteria;
+import org.hibernate.SQLQuery;
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.AsientoExclusivoDAO;
+import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
+
/**
*
- * @author rodrigo
+ * @author walace
*/
@Repository("asientoExclusivoDAO")
public class AsientoExclusivoHibernateDAO extends GenericHibernateDAO
@@ -34,4 +38,17 @@ public class AsientoExclusivoHibernateDAO extends GenericHibernateDAO implements DisponibilidadDAO {
+
+ @Autowired
+ public DisponibilidadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
+ setSessionFactory(factory);
+ }
+
+ @Override
+ public void borrarByCorrida(Corrida corrida) {
+
+ StringBuilder sQuery = new StringBuilder("DELETE FROM Disponibilidad WHERE corrida_Id = :corridaId AND TRUNC(feccorrida) = :feccorrida ");
+ SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString());
+
+ qrUpdate.setParameter("feccorrida", corrida.getId().getFeccorrida());
+ qrUpdate.setParameter("corridaId", corrida.getId().getCorridaId());
+ qrUpdate.executeUpdate();
+
+
+ }
+}
+
diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoTotvsHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoTotvsHibernateDAO.java
new file mode 100644
index 000000000..26c3cf210
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoTotvsHibernateDAO.java
@@ -0,0 +1,34 @@
+package com.rjconsultores.ventaboletos.dao.hibernate;
+
+import org.hibernate.SQLQuery;
+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.IntegracaoTotvsDAO;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
+import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs;
+
+@Repository("integracaoTotvsDAO")
+public class IntegracaoTotvsHibernateDAO extends GenericHibernateDAO implements IntegracaoTotvsDAO {
+
+ @Autowired
+ public IntegracaoTotvsHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
+ setSessionFactory(factory);
+ }
+
+ @Override
+ public void borrarByCorrida(Corrida corrida) {
+
+ StringBuilder sQuery = new StringBuilder("DELETE FROM INTEGRACAO_TOTVS_CORRIDA WHERE corrida_Id = :corridaId AND TRUNC(feccorrida) = :feccorrida ");
+ SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString());
+
+ qrUpdate.setParameter("feccorrida", corrida.getId().getFeccorrida());
+ qrUpdate.setParameter("corridaId", corrida.getId().getCorridaId());
+ qrUpdate.executeUpdate();
+
+
+ }
+}
+
diff --git a/src/com/rjconsultores/ventaboletos/entidad/Disponibilidad.java b/src/com/rjconsultores/ventaboletos/entidad/Disponibilidad.java
new file mode 100644
index 000000000..aa3096635
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/entidad/Disponibilidad.java
@@ -0,0 +1,85 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+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.JoinColumns;
+import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ *
+ * @author wallace
+ */
+@Entity
+@SequenceGenerator(name = "DISPONIBILIDAD_SEQ", sequenceName = "DISPONIBILIDAD_SEQ", allocationSize = 1)
+@Table(name = "DISPONIBILIDAD")
+public class Disponibilidad implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "DISPONIBILIDAD_ID")
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "DISPONIBILIDAD_SEQ")
+ private long disponibilidadId;
+ @OneToOne
+ @JoinColumns({
+ @JoinColumn(name = "CORRIDA_ID"),
+ @JoinColumn(name = "FECCORRIDA")})
+ private Corrida corrida;
+ @Column(name = "ACTIVO")
+ private Boolean activo;
+ @Basic(optional = false)
+ @Column(name = "FECMODIF")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date fecmodif;
+ @Column(name = "USUARIO_ID")
+ private Integer usuarioId;
+
+ public long getDisponibilidadId() {
+ return disponibilidadId;
+ }
+ public void setDisponibilidadId(long disponibilidadId) {
+ this.disponibilidadId = disponibilidadId;
+ }
+ public Corrida getCorrida() {
+ return corrida;
+ }
+ public void setCorrida(Corrida corrida) {
+ this.corrida = corrida;
+ }
+ 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;
+ }
+
+
+}
diff --git a/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java b/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java
index e932896fa..4153dcc5c 100644
--- a/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java
+++ b/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java
@@ -5,10 +5,14 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
/**
*
* @author rodrigo
*/
public interface AsientoExclusivoService extends GenericService {
+
+ void borrarByCorrida(Corrida corrida);
+
}
diff --git a/src/com/rjconsultores/ventaboletos/service/DisponibilidadService.java b/src/com/rjconsultores/ventaboletos/service/DisponibilidadService.java
new file mode 100644
index 000000000..c469e7071
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/service/DisponibilidadService.java
@@ -0,0 +1,17 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.rjconsultores.ventaboletos.service;
+
+import com.rjconsultores.ventaboletos.entidad.Corrida;
+import com.rjconsultores.ventaboletos.entidad.Disponibilidad;
+
+/**
+ *
+ * @author wallace
+ */
+public interface DisponibilidadService extends GenericService {
+
+ public void borrarByCorrida(Corrida corrida);
+}
diff --git a/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java b/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java
index 79498ffb9..91a70e8be 100644
--- a/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java
+++ b/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java
@@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service;
import java.util.Date;
import java.util.List;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.entidad.Usuario;
@@ -18,5 +19,7 @@ public interface IntegracaoTotvsService {
public List buscaPuntoVentaEmpresa(Empresa empresa) throws Exception;
public Integer solicitaReIntegracaoBilhete(Empresa empresa, Date dataInicial, Date dataFinal, PuntoVenta puntoVenta, Usuario usuario) throws BusinessException;
+
+ public void borrarByCorrida(Corrida corrida);
}
\ No newline at end of file
diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java
index 08fb0e71b..377a860bc 100644
--- a/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java
+++ b/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java
@@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl;
import com.rjconsultores.ventaboletos.dao.AsientoExclusivoDAO;
import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.service.AsientoExclusivoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import java.util.Calendar;
@@ -62,4 +63,10 @@ public class AsientoExclusivoServiceImpl implements AsientoExclusivoService {
asientoExclusivoDAO.actualizacion(entidad);
}
+
+ @Override
+ public void borrarByCorrida(Corrida corrida) {
+ asientoExclusivoDAO.borrarByCorrida(corrida);
+
+ }
}
diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DisponibilidadServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DisponibilidadServiceImpl.java
new file mode 100644
index 000000000..2e10d9cdf
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/service/impl/DisponibilidadServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+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.DisponibilidadDAO;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
+import com.rjconsultores.ventaboletos.entidad.Disponibilidad;
+import com.rjconsultores.ventaboletos.service.DisponibilidadService;
+import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
+
+/**
+ *
+ * @author wallace
+ */
+@Service("disponibilidadService")
+public class DisponibilidadServiceImpl implements DisponibilidadService {
+
+ @Autowired
+ private DisponibilidadDAO disponibilidadDAO;
+
+ public List obtenerTodos() {
+ return disponibilidadDAO.obtenerTodos();
+ }
+
+ public Disponibilidad obtenerID(Integer id) {
+ return disponibilidadDAO.obtenerID(id);
+ }
+
+ @Transactional
+ public Disponibilidad suscribir(Disponibilidad entidad) {
+ Integer usuarioId = 1;
+ if (UsuarioLogado.getUsuarioLogado() != null){
+ usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId();
+ }
+ entidad.setUsuarioId(usuarioId);
+ entidad.setFecmodif(Calendar.getInstance().getTime());
+ entidad.setActivo(Boolean.TRUE);
+
+ return disponibilidadDAO.suscribir(entidad);
+ }
+
+ @Transactional
+ public Disponibilidad actualizacion(Disponibilidad entidad) {
+ entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ entidad.setFecmodif(Calendar.getInstance().getTime());
+ entidad.setActivo(Boolean.TRUE);
+
+ return disponibilidadDAO.actualizacion(entidad);
+ }
+
+ @Transactional
+ public void borrar(Disponibilidad entidad) {
+ entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
+ entidad.setFecmodif(Calendar.getInstance().getTime());
+ entidad.setActivo(Boolean.FALSE);
+
+ disponibilidadDAO.actualizacion(entidad);
+ }
+
+ @Override
+ public void borrarByCorrida(Corrida corrida) {
+ disponibilidadDAO.borrarByCorrida(corrida);
+
+ }
+}
diff --git a/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java
index 6d9c9fdc5..bb6e34701 100644
--- a/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java
+++ b/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java
@@ -13,6 +13,7 @@ import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO;
import com.rjconsultores.ventaboletos.dao.IntegracaoTotvsDAO;
import com.rjconsultores.ventaboletos.dao.MarcaDAO;
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
+import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs;
import com.rjconsultores.ventaboletos.entidad.Marca;
@@ -96,4 +97,10 @@ public class IntegracaoTotvsServiceImpl implements IntegracaoTotvsService {
}
return corridaDao.atualizaCorridasIntegracaoTotvs(marca, dataInicial, dataFinal, numCorrida);
}
+
+ @Override
+ public void borrarByCorrida(Corrida corrida) {
+ integracaoTotvsDAO.borrarByCorrida(corrida);
+
+ }
}