fixes bug #6602
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@47896 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
dc79296b9f
commit
0e6820d83a
|
@ -14,7 +14,7 @@ public interface OrgaoTramoDAO {
|
|||
* @param claseServicioId
|
||||
* @return
|
||||
*/
|
||||
public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Short claseServicioId);
|
||||
public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Integer claseServicioId);
|
||||
|
||||
/**
|
||||
* Graba el registro en la base de datos
|
||||
|
|
|
@ -22,7 +22,7 @@ public class OrgaoTramoHibernateDAO extends GenericHibernateDAO<OrgaoTramo, Inte
|
|||
}
|
||||
|
||||
@Override
|
||||
public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Short claseServicioId) {
|
||||
public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Integer claseServicioId) {
|
||||
Criteria c = makeCriteria();
|
||||
Criteria cTramo = c.createCriteria("tramo");
|
||||
cTramo.add(Restrictions.eq("origem.paradaId", origenId));
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ClaseServicio implements Serializable {
|
|||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASE_SERVICIO_SEQ")
|
||||
@Column(name = "CLASESERVICIO_ID")
|
||||
private Short claseservicioId;
|
||||
private Integer claseservicioId;
|
||||
@Column(name = "DESCCLASE")
|
||||
private String descclase;
|
||||
@Column(name = "ACTIVO")
|
||||
|
@ -65,20 +65,20 @@ public class ClaseServicio implements Serializable {
|
|||
public ClaseServicio() {
|
||||
}
|
||||
|
||||
public ClaseServicio(Short claseservicioId) {
|
||||
public ClaseServicio(Integer claseservicioId) {
|
||||
this.claseservicioId = claseservicioId;
|
||||
}
|
||||
|
||||
public ClaseServicio(Short claseservicioId, Date fecmodif) {
|
||||
public ClaseServicio(Integer claseservicioId, Date fecmodif) {
|
||||
this.claseservicioId = claseservicioId;
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Short getClaseservicioId() {
|
||||
public Integer getClaseservicioId() {
|
||||
return claseservicioId;
|
||||
}
|
||||
|
||||
public void setClaseservicioId(Short claseservicioId) {
|
||||
public void setClaseservicioId(Integer claseservicioId) {
|
||||
this.claseservicioId = claseservicioId;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -69,4 +71,6 @@ public interface CorridaService extends GenericService<Corrida, Corrida.Id> {
|
|||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial);
|
||||
|
||||
Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId);
|
||||
|
||||
public List<Corrida> buscarCorridaRelatorio(Connection conexao, Parada origem, Parada destino, Date feccorrida, Integer corridaId);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -32,6 +36,7 @@ import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
|
|||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
||||
import com.rjconsultores.ventaboletos.entidad.Corrida.Id;
|
||||
import com.rjconsultores.ventaboletos.entidad.CorridaCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.CorridaTramo;
|
||||
import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus;
|
||||
|
@ -75,7 +80,9 @@ import com.rjconsultores.ventaboletos.utilerias.UtileriasFiscal;
|
|||
@Service("corridaService")
|
||||
public class CorridaServiceImpl implements CorridaService {
|
||||
|
||||
private static Logger log = Logger.getLogger(CorridaServiceImpl.class);
|
||||
private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40;
|
||||
|
||||
@Autowired
|
||||
private CorridaDAO corridaDAO;
|
||||
@Autowired
|
||||
|
@ -102,7 +109,6 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
private ConstanteService constanteService;
|
||||
@Autowired
|
||||
private RutaSecuenciaService rutaSecuenciaService;
|
||||
private static Logger log = Logger.getLogger(CorridaServiceImpl.class);
|
||||
private PlatformTransactionManager transactionManager;
|
||||
@Transient
|
||||
private int cantCorridaGenerada;
|
||||
|
@ -1112,7 +1118,6 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
return generacionExitosa;
|
||||
}
|
||||
|
||||
|
||||
private int cantDiasMaxGerarCorridasManual() {
|
||||
|
||||
Constante constante = constanteService.buscarPorNomeConstante("CANT_MAX_CORRIDA_GERA_MANUAL");
|
||||
|
@ -1124,6 +1129,7 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
return Integer.valueOf(constante.getValorconstante());
|
||||
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS, rollbackFor = BusinessException.class)
|
||||
public Long generarCorridasSelecionadas(List<EsquemaCorrida> lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException {
|
||||
|
||||
|
@ -1216,4 +1222,101 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) {
|
||||
return atualizarCorridaFecHusoFecVerano(estado, dataInicial, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Corrida> buscarCorridaRelatorio(Connection conexao, Parada origem, Parada destino,
|
||||
Date feccorrida, Integer corridaId) {
|
||||
|
||||
List<Corrida> ls = new ArrayList<Corrida>();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append(" select ");
|
||||
sql.append(" c.corrida_id as corrida_id, ");
|
||||
sql.append(" c.feccorrida as feccorrida, ");
|
||||
sql.append(" c.fechorsalida as fechorsalida, ");
|
||||
sql.append(" origen.parada_id as origen_id, ");
|
||||
sql.append(" origen.descparada as origen, ");
|
||||
sql.append(" destino.parada_id as destino_id, ");
|
||||
sql.append(" destino.descparada as destino, ");
|
||||
sql.append(" r.ruta_id as ruta_id, ");
|
||||
sql.append(" r.descruta as descruta, ");
|
||||
sql.append(" cs.claseservicio_id as claseservicio_id, ");
|
||||
sql.append(" cs.descclase as descclase ");
|
||||
sql.append(" from corrida c ");
|
||||
sql.append(" inner join parada origen on c.origen_id = origen.parada_id ");
|
||||
sql.append(" inner join parada destino on c.destino_id = destino.parada_id ");
|
||||
sql.append(" inner join ruta r on c.ruta_id = r.ruta_id ");
|
||||
sql.append(" inner join clase_servicio cs on c.claseservicio_id = cs.claseservicio_id ");
|
||||
sql.append(" where c.activo <> 0 ");
|
||||
sql.append(corridaId == null ? "" : " and c.corrida_id = ? ");
|
||||
sql.append(feccorrida == null ? "" : " and c.feccorrida = ? ");
|
||||
sql.append(origem == null ? "" : " and c.origen_id = ? ");
|
||||
sql.append(destino == null ? "" : " and c.destino_id = ? ");
|
||||
|
||||
int atbNum = 1;
|
||||
PreparedStatement stmt = conexao.prepareStatement(sql.toString());
|
||||
if (corridaId != null) {
|
||||
stmt.setInt(atbNum, corridaId);
|
||||
atbNum++;
|
||||
}
|
||||
|
||||
if (feccorrida != null) {
|
||||
stmt.setDate(atbNum, new java.sql.Date(feccorrida.getTime()));
|
||||
atbNum++;
|
||||
}
|
||||
|
||||
if (origem != null) {
|
||||
stmt.setInt(atbNum, origem.getParadaId());
|
||||
atbNum++;
|
||||
}
|
||||
|
||||
if (destino != null) {
|
||||
stmt.setInt(atbNum, destino.getParadaId());
|
||||
atbNum++;
|
||||
}
|
||||
|
||||
ResultSet rset = stmt.executeQuery();
|
||||
|
||||
while (rset.next()) {
|
||||
|
||||
Id id = new Id();
|
||||
id.setCorridaId(rset.getInt("corrida_id"));
|
||||
id.setFeccorrida(rset.getDate("feccorrida"));
|
||||
|
||||
Parada o = new Parada();
|
||||
o.setParadaId(rset.getInt("origen_id"));
|
||||
o.setDescparada(rset.getString("origen"));
|
||||
|
||||
Parada d = new Parada();
|
||||
d.setParadaId(rset.getInt("destino_id"));
|
||||
d.setDescparada(rset.getString("destino"));
|
||||
|
||||
Ruta ruta = new Ruta();
|
||||
ruta.setRutaId(rset.getInt("ruta_id"));
|
||||
ruta.setDescruta(rset.getString("descruta"));
|
||||
|
||||
ClaseServicio claseServicio = new ClaseServicio();
|
||||
claseServicio.setClaseservicioId(rset.getInt("claseservicio_id"));
|
||||
claseServicio.setDescclase(rset.getString("descclase"));
|
||||
|
||||
Corrida corrida = new Corrida();
|
||||
corrida.setId(id);
|
||||
corrida.setFechorsalida(new Date(rset.getTimestamp("fechorsalida").getTime()));
|
||||
corrida.setOrigem(o);
|
||||
corrida.setDestino(d);
|
||||
corrida.setRuta(ruta);
|
||||
corrida.setClaseServicio(claseServicio);
|
||||
|
||||
ls.add(corrida);
|
||||
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
||||
return ls;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue