git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@31586 d1611594-4594-4d17-8e1d-87c2c4800839
parent
29655a0976
commit
8970739612
|
@ -83,4 +83,6 @@ public interface CorridaDAO extends GenericDAO<Corrida, Corrida.Id> {
|
|||
|
||||
public List<Corrida> buscarPorEstado(Estado estado, Date dataInicial);
|
||||
|
||||
List<Corrida> buscarPorEstado(Estado estado, Date dataInicial, Integer corridaId);
|
||||
|
||||
}
|
|
@ -536,12 +536,12 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
|||
|
||||
// Si los tiempos son distintos, hube cambio de huso horario/horario de verano
|
||||
if (tiempoOrigen != tiempoDestino) {
|
||||
long elapsedHoras = DateUtil.getElapsedHoras(fechorsalida,fechorllegada);
|
||||
long elapsedMinutes = DateUtil.getElapsedMinutos(fechorsalida, fechorllegada);
|
||||
|
||||
horLlegada = Calendar.getInstance();
|
||||
horLlegada.setTime(fechorsalidaH);
|
||||
|
||||
horLlegada.add(Calendar.HOUR, (int)elapsedHoras);
|
||||
horLlegada.add(Calendar.MINUTE, (int) elapsedMinutes);
|
||||
horLlegada.add(Calendar.HOUR, difHuso(tiempoOrigen, tiempoDestino));
|
||||
|
||||
}
|
||||
|
@ -566,11 +566,11 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Corrida> buscarPorEstado(final Estado estado, final Date dataInicial) {
|
||||
public List<Corrida> buscarPorEstado(final Estado estado, final Date dataInicial, Integer corridaId) {
|
||||
StringBuilder hql = new StringBuilder();
|
||||
|
||||
hql.append(" select ");
|
||||
hql.append(" new com.rjconsultores.ventaboletos.entidad.Corrida").append("(");
|
||||
hql.append(" distinct new com.rjconsultores.ventaboletos.entidad.Corrida").append("(");
|
||||
hql.append(" ct.corrida.id.corridaId, ");
|
||||
hql.append(" ct.corrida.id.feccorrida").append(")");
|
||||
hql.append(" from CorridaTramo ct ");
|
||||
|
@ -580,6 +580,9 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
|||
hql.append(" and ct.corrida.id.feccorrida >= :feccorrida ");
|
||||
hql.append(" and ( eo.estadoId = :estadoId ");
|
||||
hql.append(" or ed.estadoId = :estadoId )");
|
||||
if (corridaId != null) {
|
||||
hql.append(" and ct.corrida.id.corridaId = :corridaId )");
|
||||
}
|
||||
hql.append(" group by ");
|
||||
hql.append(" ct.corrida.id.corridaId, ");
|
||||
hql.append(" ct.corrida.id.feccorrida ");
|
||||
|
@ -589,9 +592,18 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
|||
query.setDate("feccorrida", dataInicial);
|
||||
query.setInteger("estadoId", estado.getEstadoId());
|
||||
|
||||
if (corridaId != null) {
|
||||
query.setInteger("corridaId", corridaId);
|
||||
}
|
||||
|
||||
return query.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Corrida> buscarPorEstado(final Estado estado, final Date dataInicial) {
|
||||
return buscarPorEstado(estado, dataInicial, null);
|
||||
}
|
||||
|
||||
private List<Object[]> buscarTramosCorrida(final Corrida corrida) {
|
||||
StringBuilder hql = new StringBuilder();
|
||||
|
||||
|
|
|
@ -63,4 +63,6 @@ public interface CorridaService extends GenericService<Corrida, Corrida.Id> {
|
|||
public List<Corrida> buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, Integer ruta, Integer numRuta, Date dateInicio, Date dateFin);
|
||||
|
||||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial);
|
||||
|
||||
Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId);
|
||||
}
|
||||
|
|
|
@ -524,7 +524,6 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
Date horaChegadaAnterior = null;
|
||||
Date tiempoInstanciaAnterior = null; // indica o tempo de instancia que fica no tramo anterior ao atual
|
||||
|
||||
|
||||
Date husoHorVeranoLlegadaAnterior = null;
|
||||
|
||||
for (EsquemaTramo esquemaTramo : lsEsquemaTramo) {
|
||||
|
@ -601,7 +600,6 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
corridaTramo.setFechorSalidaOriginalH(corridaTramo.getFechorSalidaOriginal());
|
||||
}
|
||||
|
||||
|
||||
if (numSec == 1) {
|
||||
corrida.setFechorSalidaOriginalH(corridaTramo.getFechorsalidaH());
|
||||
}
|
||||
|
@ -690,18 +688,19 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
Calendar horLlegada = null;
|
||||
// Si los tiempos son distintos, hube cambio de huso horario/horario de verano
|
||||
if (tiempoOrigen != tiempoDestino) {
|
||||
long elapsedHoras = DateUtil.getElapsedHoras(corridaTramo.getFechorsalida(),corridaTramo.getFechorllegada());
|
||||
long elapsedMinutes = DateUtil.getElapsedMinutos(corridaTramo.getFechorsalida(), corridaTramo.getFechorllegada());
|
||||
|
||||
horLlegada = Calendar.getInstance();
|
||||
horLlegada.setTime(corridaTramo.getFechorsalidaH());
|
||||
|
||||
horLlegada.add(Calendar.HOUR, (int)elapsedHoras);
|
||||
horLlegada.add(Calendar.MINUTE, (int) elapsedMinutes);
|
||||
horLlegada.add(Calendar.HOUR, difHuso(tiempoOrigen, tiempoDestino));
|
||||
|
||||
}
|
||||
|
||||
return (horLlegada == null) ? null : horLlegada.getTime();
|
||||
}
|
||||
|
||||
private int difHuso(int a, int b) {
|
||||
int mult = 0;
|
||||
|
||||
|
@ -715,8 +714,6 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
mult = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ((Math.abs(a) - Math.abs(b)) * mult);
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1120,7 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) {
|
||||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId) {
|
||||
try {
|
||||
List<Corrida> corridas = corridaDAO.buscarPorEstado(estado, dataInicial);
|
||||
corridaDAO.actualizaFecHusoFecVerano(corridas);
|
||||
|
@ -1135,4 +1132,9 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
return Boolean.FALSE;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) {
|
||||
return atualizarCorridaFecHusoFecVerano(estado, dataInicial, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue