fixes bug #7588
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@58654 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
8e6ac31e82
commit
6499d229c3
|
@ -3,9 +3,11 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
|
||||
public interface CasetaPeajeDAO extends GenericDAO<CasetaPeaje, Integer> {
|
||||
|
||||
List<CasetaPeaje> buscar(String casetaPeajeDesc);
|
||||
List<CasetaPeaje> buscarTodosOrdenadoPorDescricao();
|
||||
void deletarVigencias(List<CasetaPeajeExcepcion> cpes);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
|
||||
public interface CasetaPeajeExcepcionDAO extends GenericDAO<CasetaPeajeExcepcion, Integer> {
|
||||
public List<CasetaPeajeExcepcion> obtenerPorCasetaPeaje(CasetaPeaje caseta);
|
||||
}
|
|
@ -7,27 +7,28 @@ import java.sql.SQLException;
|
|||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Peaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
||||
import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.RutaSecuencia;
|
||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Repository("calcularPeajeDAO")
|
||||
|
@ -128,6 +129,8 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
// pra cada ruta obter as combinacoes de tramos, cada tramo com sua lista de casetaPeaje
|
||||
public int[] gerarSQLInserirPeajes(List<Ruta> lsRuta, OrgaoConcedente orgao) {
|
||||
List<String> batchSql = new ArrayList<String>();
|
||||
List<String> batchExcepcionPeajeVigenciaSql = new ArrayList<String>();
|
||||
List<PeajeVO> peajes = new ArrayList<PeajeVO>();
|
||||
for (Ruta ruta : lsRuta) {
|
||||
|
||||
List<Object> lsObj = buscarCasetasPeajeWithinTramo(ruta);
|
||||
|
@ -136,7 +139,15 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
int i = 0;
|
||||
for (Object arrObj : lsObj) {
|
||||
PeajeVO pvo = PeajeVO.create(ruta, orgao, (Object[]) arrObj);
|
||||
if (pvo != null){
|
||||
batchSql.add(pvo.toInsertQuery());
|
||||
batchExcepcionPeajeVigenciaSql.add("update EXCEPCION_PEAJE_VIGENCIA set activo = 0 " +
|
||||
"where excepcionpeaje_id in (select excepcionpeaje_id from EXCEPCION_PEAJE "+
|
||||
"where ruta_id = " + pvo.rutaId +
|
||||
" and origen_id = " + pvo.origenId + " and " +
|
||||
"destino_id = " + pvo.destinoId + ")");
|
||||
peajes.add(pvo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,8 +166,12 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
for (String sql : batchSql) {
|
||||
stmt.addBatch(sql);
|
||||
}
|
||||
for (String sql : batchExcepcionPeajeVigenciaSql) {
|
||||
stmt.addBatch(sql);
|
||||
}
|
||||
result = stmt.executeBatch();
|
||||
con.commit();
|
||||
recalcularExcecoesPedagio(peajes);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -165,6 +180,82 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
return result;
|
||||
}
|
||||
|
||||
private Map<Integer, CasetaPeaje> buscaCasetas(List<PeajeVO> pvo){
|
||||
List<Integer> ids = new ArrayList<Integer>();
|
||||
Map<Integer, CasetaPeaje> casetas = new HashMap<Integer, CasetaPeaje>();
|
||||
for(PeajeVO p : pvo){
|
||||
ids.add(p.casetaPeajeId);
|
||||
}
|
||||
Query query = getSession().createQuery("select c from CasetaPeaje c where c.casetaPeajeId in (:ids) ");
|
||||
query.setParameterList("ids", ids);
|
||||
for (CasetaPeaje c : (List<CasetaPeaje>)query.list()){
|
||||
casetas.put(c.getCasetaPeajeId(), c);
|
||||
}
|
||||
return casetas;
|
||||
}
|
||||
|
||||
private ExcepcionPeaje getExcepcion(Integer rutaId, Integer origenId, Integer destinoId){
|
||||
Query query = getSession().createQuery("select e from ExcepcionPeaje e where e.ruta.rutaId = :rutaId "+
|
||||
"and e.origem.paradaId = :origenId and e.destino.paradaId = :destinoId ");
|
||||
|
||||
query.setInteger("rutaId", rutaId);
|
||||
query.setInteger("origenId", origenId);
|
||||
query.setInteger("destinoId", destinoId);
|
||||
return (ExcepcionPeaje)query.uniqueResult();
|
||||
}
|
||||
|
||||
private Parada getParada(Integer paradaId){
|
||||
return (Parada)getSession().get(Parada.class, paradaId);
|
||||
}
|
||||
|
||||
private Ruta getRuta(Integer rutaId){
|
||||
return (Ruta)getSession().get(Ruta.class, rutaId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
private void recalcularExcecoesPedagio(List<PeajeVO> pvos){
|
||||
Map<Integer, CasetaPeaje> casetas = buscaCasetas(pvos);
|
||||
Map<Integer, ExcepcionPeaje> excepciones = new HashMap<Integer, ExcepcionPeaje>();
|
||||
for (PeajeVO peaje : pvos){
|
||||
ExcepcionPeaje excepcion = getExcepcion(peaje.rutaId, peaje.origenId, peaje.destinoId);
|
||||
if (excepcion == null){
|
||||
excepcion = new ExcepcionPeaje();
|
||||
excepcion.setActivo(true);
|
||||
excepcion.setDestino(getParada(peaje.destinoId));
|
||||
excepcion.setFecmodif(Calendar.getInstance().getTime());
|
||||
excepcion.setOrigem(getParada(peaje.origenId));
|
||||
excepcion.setRuta(getRuta(peaje.rutaId));
|
||||
excepcion.setUsuarioId(1);
|
||||
}
|
||||
|
||||
CasetaPeaje caseta = casetas.get(peaje.casetaPeajeId);
|
||||
|
||||
for (CasetaPeajeExcepcion cpe : caseta.getLsCasetaPeajeExcepcion()){
|
||||
ExcepcionPeajeVigencia epv = new ExcepcionPeajeVigencia();
|
||||
epv.setActivo(cpe.getActivo());
|
||||
epv.setExcepcionPeaje(excepcion);
|
||||
epv.setFecmodif(Calendar.getInstance().getTime());
|
||||
epv.setFecVentaFin(cpe.getFecVentaFin());
|
||||
epv.setFecVentaIni(cpe.getFecVentaIni());
|
||||
epv.setHoraFin(cpe.getHoraFin());
|
||||
epv.setHoraIni(cpe.getHoraIni());
|
||||
epv.setINDDOMINGO(cpe.getINDDOMINGO());
|
||||
epv.setINDJUEVES(cpe.getINDJUEVES());
|
||||
epv.setINDLUNES(cpe.getINDLUNES());
|
||||
epv.setINDMARTES(cpe.getINDMARTES());
|
||||
epv.setINDMIERCOLES(cpe.getINDMIERCOLES());
|
||||
epv.setINDSABADO(cpe.getINDSABADO());
|
||||
epv.setINDVIERNES(cpe.getINDVIERNES());
|
||||
epv.setPrecio(cpe.getPrecio());
|
||||
epv.setUsuarioId(1);
|
||||
epv.setCasetaPeaje(caseta);
|
||||
excepcion.getLsExcepcionPeajeVigencia().add(epv);
|
||||
}
|
||||
|
||||
getSession().saveOrUpdate(excepcion);
|
||||
}
|
||||
}
|
||||
|
||||
private static class PeajeVO {
|
||||
|
||||
private static final int LOW_PRECISION = 2;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.CasetaPeajeExcepcionDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
|
||||
@Repository("casetaPeajeExcepcionDAO")
|
||||
public class CasetaPeajeExcepcionHibernateDAO extends GenericHibernateDAO<CasetaPeajeExcepcion, Integer> implements CasetaPeajeExcepcionDAO {
|
||||
|
||||
@Autowired
|
||||
public CasetaPeajeExcepcionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CasetaPeajeExcepcion> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CasetaPeajeExcepcion> obtenerPorCasetaPeaje(CasetaPeaje caseta) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("casetaPeaje", caseta));
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
@ -12,6 +13,7 @@ import org.springframework.stereotype.Repository;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
|
||||
@Repository("casetaPeajeDAO")
|
||||
public class CasetaPeajeHibernateDAO extends GenericHibernateDAO<CasetaPeaje, Integer> implements CasetaPeajeDAO {
|
||||
|
@ -45,4 +47,15 @@ public class CasetaPeajeHibernateDAO extends GenericHibernateDAO<CasetaPeaje, In
|
|||
c.add(Restrictions.eq("desccaseta", casetaPeajeDesc));
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletarVigencias(List<CasetaPeajeExcepcion> cpes) {
|
||||
for (CasetaPeajeExcepcion cpe : cpes) {
|
||||
String hql = " update CasetaPeajeExcepcion set activo = false, fecModif = :fecModif, usuarioId = :usuarioId where casetaPeajeExcepcionId = " + cpe.getCasetaPeajeExcepcionId();
|
||||
Query sq = getSession().createQuery(hql);
|
||||
sq.setTimestamp("fecModif", cpe.getFecmodif());
|
||||
sq.setInteger("usuarioId", cpe.getUsuarioId());
|
||||
sq.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
|
@ -16,11 +17,16 @@ import javax.persistence.Id;
|
|||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "CASETA_PEAJE_SEQ", sequenceName = "CASETA_PEAJE_SEQ", allocationSize = 1)
|
||||
@Table(name = "CASETA_PEAJE")
|
||||
|
@ -45,7 +51,9 @@ public class CasetaPeaje implements Serializable, Comparable<CasetaPeaje>, Clone
|
|||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@OneToMany(mappedBy = "casetaPeaje", fetch=FetchType.LAZY, cascade = CascadeType.ALL)
|
||||
//@Fetch(FetchMode.SELECT)
|
||||
private List<CasetaPeajeExcepcion> lsCasetaPeajeExcepcion = new ArrayList<CasetaPeajeExcepcion>();
|
||||
@ManyToMany(fetch=FetchType.EAGER)
|
||||
@JoinTable(name = "RUTA_CASETA", joinColumns = { @JoinColumn(name = "CASETAPEAJE_ID") },
|
||||
inverseJoinColumns = { @JoinColumn(name = "RUTASECUENCIA_ID") })
|
||||
|
@ -135,4 +143,13 @@ public class CasetaPeaje implements Serializable, Comparable<CasetaPeaje>, Clone
|
|||
public void setLsRutaSecuencia(List<RutaSecuencia> lsRutaSecuencia) {
|
||||
this.lsRutaSecuencia = lsRutaSecuencia;
|
||||
}
|
||||
|
||||
public List<CasetaPeajeExcepcion> getLsCasetaPeajeExcepcion() {
|
||||
return lsCasetaPeajeExcepcion;
|
||||
}
|
||||
|
||||
public void setLsCasetaPeajeExcepcion(List<CasetaPeajeExcepcion> lsCasetaPeajeExcepcion) {
|
||||
this.lsCasetaPeajeExcepcion = lsCasetaPeajeExcepcion;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
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.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "CASETA_PEAJE_EXCEPCION_SEQ", sequenceName = "CASETA_PEAJE_EXCEPCION_SEQ", allocationSize = 1)
|
||||
@Table(name = "CASETA_PEAJE_EXCEPCION")
|
||||
public class CasetaPeajeExcepcion implements Serializable, Comparable<CasetaPeajeExcepcion> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@Column(name = "CASETAPEAJEEXCEPCION_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CASETA_PEAJE_EXCEPCION_SEQ")
|
||||
private Integer casetaPeajeExcepcionId;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "CASETAPEAJE_ID" , referencedColumnName = "CASETAPEAJE_ID")
|
||||
private CasetaPeaje casetaPeaje;
|
||||
@Column(name = "FECHAVENTAINI")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private java.util.Date fecVentaIni;
|
||||
@Column(name = "FECHAVENTAFIN")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private java.util.Date fecVentaFin;
|
||||
@Column(name = "FECHORINICIO")
|
||||
@Temporal(TemporalType.TIME)
|
||||
private Date horaIni;
|
||||
@Column(name = "FECHORFINAL")
|
||||
@Temporal(TemporalType.TIME)
|
||||
private Date horaFin;
|
||||
@Column(name = "INDLUNES")
|
||||
private Boolean INDLUNES;
|
||||
@Column(name = "INDMARTES")
|
||||
private Boolean INDMARTES;
|
||||
@Column(name = "INDMIERCOLES")
|
||||
private Boolean INDMIERCOLES;
|
||||
@Column(name = "INDJUEVES")
|
||||
private Boolean INDJUEVES;
|
||||
@Column(name = "INDVIERNES")
|
||||
private Boolean INDVIERNES;
|
||||
@Column(name = "INDSABADO")
|
||||
private Boolean INDSABADO;
|
||||
@Column(name = "INDDOMINGO")
|
||||
private Boolean INDDOMINGO;
|
||||
@Column(name = "PRECIO")
|
||||
private BigDecimal precio;
|
||||
|
||||
|
||||
public Integer getCasetaPeajeExcepcionId() {
|
||||
return casetaPeajeExcepcionId;
|
||||
}
|
||||
public void setCasetaPeajeExcepcionId(Integer casetaPeajeExcepcionId) {
|
||||
this.casetaPeajeExcepcionId = casetaPeajeExcepcionId;
|
||||
}
|
||||
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 CasetaPeaje getCasetaPeaje() {
|
||||
return casetaPeaje;
|
||||
}
|
||||
public void setCasetaPeaje(CasetaPeaje casetaPeaje) {
|
||||
this.casetaPeaje = casetaPeaje;
|
||||
}
|
||||
public java.util.Date getFecVentaIni() {
|
||||
return fecVentaIni;
|
||||
}
|
||||
public void setFecVentaIni(java.util.Date fecVentaIni) {
|
||||
this.fecVentaIni = fecVentaIni;
|
||||
}
|
||||
public java.util.Date getFecVentaFin() {
|
||||
return fecVentaFin;
|
||||
}
|
||||
public void setFecVentaFin(java.util.Date fecVentaFin) {
|
||||
this.fecVentaFin = fecVentaFin;
|
||||
}
|
||||
public Date getHoraIni() {
|
||||
return horaIni;
|
||||
}
|
||||
public void setHoraIni(Date horaIni) {
|
||||
this.horaIni = horaIni;
|
||||
}
|
||||
public Date getHoraFin() {
|
||||
return horaFin;
|
||||
}
|
||||
public void setHoraFin(Date horaFin) {
|
||||
this.horaFin = horaFin;
|
||||
}
|
||||
public Boolean getINDLUNES() {
|
||||
return INDLUNES;
|
||||
}
|
||||
public void setINDLUNES(Boolean iNDLUNES) {
|
||||
INDLUNES = iNDLUNES;
|
||||
}
|
||||
public Boolean getINDMARTES() {
|
||||
return INDMARTES;
|
||||
}
|
||||
public void setINDMARTES(Boolean iNDMARTES) {
|
||||
INDMARTES = iNDMARTES;
|
||||
}
|
||||
public Boolean getINDMIERCOLES() {
|
||||
return INDMIERCOLES;
|
||||
}
|
||||
public void setINDMIERCOLES(Boolean iNDMIERCOLES) {
|
||||
INDMIERCOLES = iNDMIERCOLES;
|
||||
}
|
||||
public Boolean getINDJUEVES() {
|
||||
return INDJUEVES;
|
||||
}
|
||||
public void setINDJUEVES(Boolean iNDJUEVES) {
|
||||
INDJUEVES = iNDJUEVES;
|
||||
}
|
||||
public Boolean getINDVIERNES() {
|
||||
return INDVIERNES;
|
||||
}
|
||||
public void setINDVIERNES(Boolean iNDVIERNES) {
|
||||
INDVIERNES = iNDVIERNES;
|
||||
}
|
||||
public Boolean getINDSABADO() {
|
||||
return INDSABADO;
|
||||
}
|
||||
public void setINDSABADO(Boolean iNDSABADO) {
|
||||
INDSABADO = iNDSABADO;
|
||||
}
|
||||
public Boolean getINDDOMINGO() {
|
||||
return INDDOMINGO;
|
||||
}
|
||||
public void setINDDOMINGO(Boolean iNDDOMINGO) {
|
||||
INDDOMINGO = iNDDOMINGO;
|
||||
}
|
||||
public BigDecimal getPrecio() {
|
||||
return precio;
|
||||
}
|
||||
public void setPrecio(BigDecimal precio) {
|
||||
this.precio = precio;
|
||||
}
|
||||
@Override
|
||||
public int compareTo(CasetaPeajeExcepcion o) {
|
||||
if(o.getCasetaPeajeExcepcionId() != null){
|
||||
return this.getCasetaPeajeExcepcionId().intValue() - o.getCasetaPeajeExcepcionId().intValue();
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class ExcepcionPeaje implements Serializable,Comparable<ExcepcionPeaje> {
|
|||
private Parada destino;
|
||||
@OneToMany(mappedBy = "excepcionPeaje", cascade = CascadeType.ALL)//, fetch = FetchType.EAGER
|
||||
@Filter(name="ativo", condition="ACTIVO = 1")
|
||||
private List<ExcepcionPeajeVigencia> lsExcepcionPeajeVigencia;
|
||||
private List<ExcepcionPeajeVigencia> lsExcepcionPeajeVigencia = new ArrayList<ExcepcionPeajeVigencia>();
|
||||
|
||||
public Integer getExcepcionPeajeId() {
|
||||
return excepcionPeajeId;
|
||||
|
|
|
@ -40,6 +40,9 @@ private static final long serialVersionUID = 1L;
|
|||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "EXCEPCIONPEAJE_ID" , referencedColumnName = "EXCEPCIONPEAJE_ID")
|
||||
private ExcepcionPeaje excepcionPeaje;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "CASETAPEAJE_ID" , referencedColumnName = "CASETAPEAJE_ID")
|
||||
private CasetaPeaje casetaPeaje;
|
||||
@Column(name = "FECHAVENTAINI")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private java.util.Date fecVentaIni;
|
||||
|
@ -238,6 +241,17 @@ private static final long serialVersionUID = 1L;
|
|||
this.precio = precio;
|
||||
}
|
||||
|
||||
|
||||
public CasetaPeaje getCasetaPeaje() {
|
||||
return casetaPeaje;
|
||||
}
|
||||
|
||||
|
||||
public void setCasetaPeaje(CasetaPeaje casetaPeaje) {
|
||||
this.casetaPeaje = casetaPeaje;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia[excepcionPeajeVigenciaId=" + excepcionPeajeVigenciaId + "]";
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
|
||||
public interface CasetaPeajeExcepcionService extends GenericService<CasetaPeajeExcepcion, Integer> {
|
||||
public List<CasetaPeajeExcepcion> buscarPorCasetaPeaje(CasetaPeaje caseta);
|
||||
}
|
|
@ -3,9 +3,11 @@ package com.rjconsultores.ventaboletos.service;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
|
||||
public interface CasetaPeajeService extends GenericService<CasetaPeaje, Integer> {
|
||||
public List<CasetaPeaje> buscar(String descricaoPracaPedagio);
|
||||
public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje);
|
||||
public List<CasetaPeaje> buscarTodosOrdenadoPorDescricao();
|
||||
public void deletarVigencias(List<CasetaPeajeExcepcion> cpes);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
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.CasetaPeajeExcepcionDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
import com.rjconsultores.ventaboletos.service.CasetaPeajeExcepcionService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("casetaPeajeExcepcionService")
|
||||
public class CasetaPeajeExcepcionServiceImpl implements CasetaPeajeExcepcionService {
|
||||
|
||||
@Autowired
|
||||
private CasetaPeajeExcepcionDAO casetaPeajeExcepcionDAO;
|
||||
|
||||
@Override
|
||||
public List<CasetaPeajeExcepcion> buscarPorCasetaPeaje(CasetaPeaje caseta){
|
||||
return casetaPeajeExcepcionDAO.obtenerPorCasetaPeaje(caseta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CasetaPeajeExcepcion> obtenerTodos() {
|
||||
return casetaPeajeExcepcionDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CasetaPeajeExcepcion obtenerID(Integer id) {
|
||||
return casetaPeajeExcepcionDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CasetaPeajeExcepcion suscribir(CasetaPeajeExcepcion entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return casetaPeajeExcepcionDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CasetaPeajeExcepcion actualizacion(CasetaPeajeExcepcion entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return casetaPeajeExcepcionDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(CasetaPeajeExcepcion entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
casetaPeajeExcepcionDAO.borrar(entidad);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||
import com.rjconsultores.ventaboletos.service.CasetaPeajeService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
|
@ -80,4 +81,9 @@ public class CasetaPeajeServiceImpl implements CasetaPeajeService {
|
|||
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletarVigencias(List<CasetaPeajeExcepcion> cpes) {
|
||||
casetaPeajeDAO.deletarVigencias(cpes);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue