gleimar 2013-10-21 00:34:14 +00:00
parent 412a029c24
commit d7b5f23135
1 changed files with 32 additions and 28 deletions

View File

@ -26,7 +26,6 @@ import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.Corrida.Id;
import com.rjconsultores.ventaboletos.entidad.CorridaTramo;
import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus;
import com.rjconsultores.ventaboletos.entidad.Estado;
import com.rjconsultores.ventaboletos.entidad.Marca;
@ -468,27 +467,24 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
@Override
public void actualizaFecHusoFecVerano(final List<Corrida> corridas) {
List<Object[]> tramos = null;
Integer corridatramoId = 0;
Date fechorSalidaOriginal = null;
Date fechorsalida = null;
Date fechorllegada = null;
Integer tiempoHorHusoOrigem = Integer.valueOf(0);
Integer tiempoHorVeranoOrigem = Integer.valueOf(0);
Integer tiempoHorHusoDestino = Integer.valueOf(0);
Integer tiempoHorVeranoDestino = Integer.valueOf(0);
Date husoHorVeranoLlegadaAnterior = null;
Date fechorSalidaOriginalUpdate = null;
Date fechorsalidaUpdate = null;
Date fechorllegadaUpdate = null;
for (Corrida corrida : corridas) {
tramos = buscarTramosCorrida(corrida);
husoHorVeranoLlegadaAnterior = null;
Date husoHorVeranoLlegadaAnterior = null;
Date fechorSalidaOriginalUpdate = null;
Date fechorsalidaUpdate = null;
Date fechorllegadaUpdate = null;
Integer corridatramoId = 0;
Date fechorSalidaOriginal = null;
Date fechorsalida = null;
Date fechorllegada = null;
Integer tiempoHorHusoOrigem = Integer.valueOf(0);
Integer tiempoHorVeranoOrigem = Integer.valueOf(0);
Integer tiempoHorHusoDestino = Integer.valueOf(0);
Integer tiempoHorVeranoDestino = Integer.valueOf(0);
List<Object[]> tramos = buscarTramosCorrida(corrida);
for (Object[] objeto : tramos) {
corridatramoId = Integer.valueOf(objeto[0].toString());
@ -614,22 +610,30 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
hql.append(" ct.fechorSalidaOriginal,");
hql.append(" ct.fechorsalida,");
hql.append(" ct.fechorllegada,");
hql.append(" nvl(ct.origem.ciudad.estado.tiempoHorHuso, 0) as tiempoHorHusoOrigem,");
hql.append(" nvl(estadoO.tiempoHorHuso, 0) as tiempoHorHusoOrigem,");
hql.append(" nvl( case when ");
hql.append(" ct.fechorSalidaOriginal between ");
hql.append(" ct.origem.ciudad.estado.fecInicioHorVerano ");
hql.append(" and ct.origem.ciudad.estado.fecFinoHorVerano ");
hql.append(" then (ct.origem.ciudad.estado.tiempoHorVerano)");
hql.append(" estadoO.fecInicioHorVerano ");
hql.append(" and estadoO.fecFinoHorVerano ");
hql.append(" then (estadoO.tiempoHorVerano)");
hql.append(" else 0 end, 0) as tiempoHorVeranoOrigem,");
hql.append(" nvl(ct.destino.ciudad.estado.tiempoHorHuso, 0) as tiempoHorHusoDestino,");
hql.append(" nvl(estadoD.tiempoHorHuso, 0) as tiempoHorHusoDestino,");
hql.append(" nvl( case when ");
hql.append(" ct.fechorSalidaOriginal between ");
hql.append(" ct.destino.ciudad.estado.fecInicioHorVerano ");
hql.append(" and ct.destino.ciudad.estado.fecFinoHorVerano ");
hql.append(" then (ct.destino.ciudad.estado.tiempoHorVerano)");
hql.append(" estadoD.fecInicioHorVerano ");
hql.append(" and estadoD.fecFinoHorVerano ");
hql.append(" then (estadoD.tiempoHorVerano)");
hql.append(" else 0 end, 0) as tiempoHorVeranoDestino");
hql.append(" from CorridaTramo ct ");
hql.append(" inner join ct.origem origem ");
hql.append(" inner join origem.ciudad ciudadO ");
hql.append(" inner join ciudadO.estado estadoO ");
hql.append(" inner join ct.destino destino ");
hql.append(" inner join destino.ciudad ciudadD ");
hql.append(" inner join ciudadD.estado estadoD ");
hql.append(" where ct.corrida.activo = :isActivo ");
hql.append(" and ct.activo = :isActivo ");
hql.append(" and ct.corrida.id.corridaId = :corridaId ");
hql.append(" and ct.corrida.id.feccorrida = :feccorrida ");
hql.append(" order by ");