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
|
* @param claseServicioId
|
||||||
* @return
|
* @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
|
* Graba el registro en la base de datos
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class OrgaoTramoHibernateDAO extends GenericHibernateDAO<OrgaoTramo, Inte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 c = makeCriteria();
|
||||||
Criteria cTramo = c.createCriteria("tramo");
|
Criteria cTramo = c.createCriteria("tramo");
|
||||||
cTramo.add(Restrictions.eq("origem.paradaId", origenId));
|
cTramo.add(Restrictions.eq("origem.paradaId", origenId));
|
||||||
|
|
|
@ -21,7 +21,7 @@ import javax.persistence.TemporalType;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -30,184 +30,184 @@ import javax.persistence.SequenceGenerator;
|
||||||
public class ClaseServicio implements Serializable {
|
public class ClaseServicio implements Serializable {
|
||||||
|
|
||||||
public final static short TODOS = -1;
|
public final static short TODOS = -1;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@Id
|
|
||||||
@Basic(optional = false)
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASE_SERVICIO_SEQ")
|
|
||||||
@Column(name = "CLASESERVICIO_ID")
|
|
||||||
private Short claseservicioId;
|
|
||||||
@Column(name = "DESCCLASE")
|
|
||||||
private String descclase;
|
|
||||||
@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;
|
|
||||||
@OneToMany(mappedBy = "claseServicio")
|
|
||||||
private List<CategoriaClase> categoriaClaseList;
|
|
||||||
@OneToMany(mappedBy = "claseServicio")
|
|
||||||
private List<ReservacionClase> reservacionClaseList;
|
|
||||||
@OneToMany(mappedBy = "claseServicio")
|
|
||||||
private List<TramoTiempo> tramoTiempoList;
|
|
||||||
@Column(name = "EQUIVALENCIA_ID")
|
|
||||||
private String equivalenciaId;
|
|
||||||
@Column(name = "EQUIVALENCIAELEKTRA_ID")
|
|
||||||
private String equivalenciaElektraId;
|
|
||||||
@OneToMany(mappedBy = "claseServicio")
|
|
||||||
private List<TarifaHist> tarifaHistList;
|
|
||||||
@OneToMany(mappedBy = "claseServicio")
|
|
||||||
private List<Corrida> corridaList;
|
|
||||||
|
|
||||||
public ClaseServicio() {
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASE_SERVICIO_SEQ")
|
||||||
|
@Column(name = "CLASESERVICIO_ID")
|
||||||
|
private Integer claseservicioId;
|
||||||
|
@Column(name = "DESCCLASE")
|
||||||
|
private String descclase;
|
||||||
|
@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;
|
||||||
|
@OneToMany(mappedBy = "claseServicio")
|
||||||
|
private List<CategoriaClase> categoriaClaseList;
|
||||||
|
@OneToMany(mappedBy = "claseServicio")
|
||||||
|
private List<ReservacionClase> reservacionClaseList;
|
||||||
|
@OneToMany(mappedBy = "claseServicio")
|
||||||
|
private List<TramoTiempo> tramoTiempoList;
|
||||||
|
@Column(name = "EQUIVALENCIA_ID")
|
||||||
|
private String equivalenciaId;
|
||||||
|
@Column(name = "EQUIVALENCIAELEKTRA_ID")
|
||||||
|
private String equivalenciaElektraId;
|
||||||
|
@OneToMany(mappedBy = "claseServicio")
|
||||||
|
private List<TarifaHist> tarifaHistList;
|
||||||
|
@OneToMany(mappedBy = "claseServicio")
|
||||||
|
private List<Corrida> corridaList;
|
||||||
|
|
||||||
public ClaseServicio(Short claseservicioId) {
|
public ClaseServicio() {
|
||||||
this.claseservicioId = claseservicioId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public ClaseServicio(Short claseservicioId, Date fecmodif) {
|
public ClaseServicio(Integer claseservicioId) {
|
||||||
this.claseservicioId = claseservicioId;
|
this.claseservicioId = claseservicioId;
|
||||||
this.fecmodif = fecmodif;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Short getClaseservicioId() {
|
public ClaseServicio(Integer claseservicioId, Date fecmodif) {
|
||||||
return claseservicioId;
|
this.claseservicioId = claseservicioId;
|
||||||
}
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
public void setClaseservicioId(Short claseservicioId) {
|
public Integer getClaseservicioId() {
|
||||||
this.claseservicioId = claseservicioId;
|
return claseservicioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescclase() {
|
public void setClaseservicioId(Integer claseservicioId) {
|
||||||
return descclase;
|
this.claseservicioId = claseservicioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescclase(String descclase) {
|
public String getDescclase() {
|
||||||
this.descclase = descclase;
|
return descclase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getActivo() {
|
public void setDescclase(String descclase) {
|
||||||
return activo;
|
this.descclase = descclase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivo(Boolean activo) {
|
public Boolean getActivo() {
|
||||||
this.activo = activo;
|
return activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getFecmodif() {
|
public void setActivo(Boolean activo) {
|
||||||
return fecmodif;
|
this.activo = activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFecmodif(Date fecmodif) {
|
public Date getFecmodif() {
|
||||||
this.fecmodif = fecmodif;
|
return fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUsuarioId() {
|
public void setFecmodif(Date fecmodif) {
|
||||||
return usuarioId;
|
this.fecmodif = fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsuarioId(Integer usuarioId) {
|
public Integer getUsuarioId() {
|
||||||
this.usuarioId = usuarioId;
|
return usuarioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CategoriaClase> getCategoriaClaseList() {
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
List<CategoriaClase> tmp = new ArrayList<CategoriaClase>();
|
this.usuarioId = usuarioId;
|
||||||
if (categoriaClaseList != null) {
|
}
|
||||||
for (CategoriaClase cc : this.categoriaClaseList) {
|
|
||||||
if (cc.getActivo()) {
|
|
||||||
tmp.add(cc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
public List<CategoriaClase> getCategoriaClaseList() {
|
||||||
}
|
List<CategoriaClase> tmp = new ArrayList<CategoriaClase>();
|
||||||
|
if (categoriaClaseList != null) {
|
||||||
|
for (CategoriaClase cc : this.categoriaClaseList) {
|
||||||
|
if (cc.getActivo()) {
|
||||||
|
tmp.add(cc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setCategoriaClaseList(List<CategoriaClase> categoriaClaseList) {
|
return tmp;
|
||||||
this.categoriaClaseList = categoriaClaseList;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReservacionClase> getReservacionClaseList() {
|
public void setCategoriaClaseList(List<CategoriaClase> categoriaClaseList) {
|
||||||
List<ReservacionClase> tmp = new ArrayList<ReservacionClase>();
|
this.categoriaClaseList = categoriaClaseList;
|
||||||
for (ReservacionClase rc : this.reservacionClaseList) {
|
}
|
||||||
if (rc.getActivo()) {
|
|
||||||
tmp.add(rc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
public List<ReservacionClase> getReservacionClaseList() {
|
||||||
}
|
List<ReservacionClase> tmp = new ArrayList<ReservacionClase>();
|
||||||
|
for (ReservacionClase rc : this.reservacionClaseList) {
|
||||||
|
if (rc.getActivo()) {
|
||||||
|
tmp.add(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Corrida> getCorridaList() {
|
return tmp;
|
||||||
return corridaList;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void setCorridaList(List<Corrida> corridaList) {
|
public List<Corrida> getCorridaList() {
|
||||||
this.corridaList = corridaList;
|
return corridaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReservacionClaseList(List<ReservacionClase> reservacionClaseList) {
|
public void setCorridaList(List<Corrida> corridaList) {
|
||||||
this.reservacionClaseList = reservacionClaseList;
|
this.corridaList = corridaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setReservacionClaseList(List<ReservacionClase> reservacionClaseList) {
|
||||||
public int hashCode() {
|
this.reservacionClaseList = reservacionClaseList;
|
||||||
int hash = 0;
|
}
|
||||||
hash += (claseservicioId != null ? claseservicioId.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object) {
|
public int hashCode() {
|
||||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
int hash = 0;
|
||||||
if (!(object instanceof ClaseServicio)) {
|
hash += (claseservicioId != null ? claseservicioId.hashCode() : 0);
|
||||||
return false;
|
return hash;
|
||||||
}
|
}
|
||||||
ClaseServicio other = (ClaseServicio) object;
|
|
||||||
if ((this.claseservicioId == null && other.claseservicioId != null) || (this.claseservicioId != null && !this.claseservicioId.equals(other.claseservicioId))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public boolean equals(Object object) {
|
||||||
return getDescclase();
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
}
|
if (!(object instanceof ClaseServicio)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ClaseServicio other = (ClaseServicio) object;
|
||||||
|
if ((this.claseservicioId == null && other.claseservicioId != null) || (this.claseservicioId != null && !this.claseservicioId.equals(other.claseservicioId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public List<TramoTiempo> getTramoTiempoList() {
|
@Override
|
||||||
return tramoTiempoList;
|
public String toString() {
|
||||||
}
|
return getDescclase();
|
||||||
|
}
|
||||||
|
|
||||||
public void setTramoTiempoList(List<TramoTiempo> tramoTiempoList) {
|
public List<TramoTiempo> getTramoTiempoList() {
|
||||||
this.tramoTiempoList = tramoTiempoList;
|
return tramoTiempoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEquivalenciaId() {
|
public void setTramoTiempoList(List<TramoTiempo> tramoTiempoList) {
|
||||||
return equivalenciaId;
|
this.tramoTiempoList = tramoTiempoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEquivalenciaId(String equivalenciaId) {
|
public String getEquivalenciaId() {
|
||||||
this.equivalenciaId = equivalenciaId;
|
return equivalenciaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TarifaHist> getTarifaHistList() {
|
public void setEquivalenciaId(String equivalenciaId) {
|
||||||
return tarifaHistList;
|
this.equivalenciaId = equivalenciaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarifaHistList(List<TarifaHist> tarifaHistList) {
|
public List<TarifaHist> getTarifaHistList() {
|
||||||
this.tarifaHistList = tarifaHistList;
|
return tarifaHistList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEquivalenciaElektraId() {
|
public void setTarifaHistList(List<TarifaHist> tarifaHistList) {
|
||||||
return equivalenciaElektraId;
|
this.tarifaHistList = tarifaHistList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEquivalenciaElektraId(String equivalenciaElektraId) {
|
public String getEquivalenciaElektraId() {
|
||||||
this.equivalenciaElektraId = equivalenciaElektraId;
|
return equivalenciaElektraId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEquivalenciaElektraId(String equivalenciaElektraId) {
|
||||||
|
this.equivalenciaElektraId = equivalenciaElektraId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ public interface CorridaService extends GenericService<Corrida, Corrida.Id> {
|
||||||
* @param dataDe
|
* @param dataDe
|
||||||
* @param dataAte
|
* @param dataAte
|
||||||
* @return A quantidade de corridas geradas
|
* @return A quantidade de corridas geradas
|
||||||
* @throws BusinessException
|
* @throws BusinessException
|
||||||
*/
|
*/
|
||||||
public Long generarCorridasSelecionadas(List<EsquemaCorrida> lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException;
|
public Long generarCorridasSelecionadas(List<EsquemaCorrida> lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException;
|
||||||
|
|
||||||
|
@ -69,4 +71,6 @@ public interface CorridaService extends GenericService<Corrida, Corrida.Id> {
|
||||||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial);
|
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial);
|
||||||
|
|
||||||
Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId);
|
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;
|
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.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
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.ClaseServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Corrida.Id;
|
||||||
import com.rjconsultores.ventaboletos.entidad.CorridaCtrl;
|
import com.rjconsultores.ventaboletos.entidad.CorridaCtrl;
|
||||||
import com.rjconsultores.ventaboletos.entidad.CorridaTramo;
|
import com.rjconsultores.ventaboletos.entidad.CorridaTramo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus;
|
import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus;
|
||||||
|
@ -75,7 +80,9 @@ import com.rjconsultores.ventaboletos.utilerias.UtileriasFiscal;
|
||||||
@Service("corridaService")
|
@Service("corridaService")
|
||||||
public class CorridaServiceImpl implements CorridaService {
|
public class CorridaServiceImpl implements CorridaService {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(CorridaServiceImpl.class);
|
||||||
private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40;
|
private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CorridaDAO corridaDAO;
|
private CorridaDAO corridaDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -97,12 +104,11 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private EsquemaCorridaDAO esquemaCorridaDAO;
|
private EsquemaCorridaDAO esquemaCorridaDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DetDiagramaAutobusService detDiagramaAutobusService;
|
private DetDiagramaAutobusService detDiagramaAutobusService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConstanteService constanteService;
|
private ConstanteService constanteService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RutaSecuenciaService rutaSecuenciaService;
|
private RutaSecuenciaService rutaSecuenciaService;
|
||||||
private static Logger log = Logger.getLogger(CorridaServiceImpl.class);
|
|
||||||
private PlatformTransactionManager transactionManager;
|
private PlatformTransactionManager transactionManager;
|
||||||
@Transient
|
@Transient
|
||||||
private int cantCorridaGenerada;
|
private int cantCorridaGenerada;
|
||||||
|
@ -519,15 +525,15 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
|
|
||||||
corrida.setFechorsalida(truncarDataHora(dataGeracao, esquemaCorrida.getHorasalida()));
|
corrida.setFechorsalida(truncarDataHora(dataGeracao, esquemaCorrida.getHorasalida()));
|
||||||
corrida.setFechorSalidaOriginal(corrida.getFechorsalida());
|
corrida.setFechorSalidaOriginal(corrida.getFechorsalida());
|
||||||
|
|
||||||
if(esquemaCorrida.getStatusCorrida().equals("A")){
|
if (esquemaCorrida.getStatusCorrida().equals("A")) {
|
||||||
corrida.setIndstatuscorrida("H");
|
corrida.setIndstatuscorrida("H");
|
||||||
corrida.setActivo(ActivoUtil.ATIVO);
|
corrida.setActivo(ActivoUtil.ATIVO);
|
||||||
}else if (esquemaCorrida.getStatusCorrida().equals("L")){
|
} else if (esquemaCorrida.getStatusCorrida().equals("L")) {
|
||||||
corrida.setIndstatuscorrida("P");
|
corrida.setIndstatuscorrida("P");
|
||||||
corrida.setActivo(ActivoUtil.INATIVO);
|
corrida.setActivo(ActivoUtil.INATIVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
corrida.setMarca(esquemaCorrida.getMarca());
|
corrida.setMarca(esquemaCorrida.getMarca());
|
||||||
corrida.setNodo(corridaCtrl.getNodo());
|
corrida.setNodo(corridaCtrl.getNodo());
|
||||||
corrida.setDivision(esquemaCorrida.getDivision());
|
corrida.setDivision(esquemaCorrida.getDivision());
|
||||||
|
@ -607,12 +613,12 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
horaChegadaAnterior = excepcionTiempo;
|
horaChegadaAnterior = excepcionTiempo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(esquemaCorrida.getStatusCorrida().equals("A")){
|
if (esquemaCorrida.getStatusCorrida().equals("A")) {
|
||||||
corridaTramo.setActivo(ActivoUtil.ATIVO);
|
corridaTramo.setActivo(ActivoUtil.ATIVO);
|
||||||
}else if (esquemaCorrida.getStatusCorrida().equals("L")){
|
} else if (esquemaCorrida.getStatusCorrida().equals("L")) {
|
||||||
corridaTramo.setActivo(ActivoUtil.INATIVO);
|
corridaTramo.setActivo(ActivoUtil.INATIVO);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
corridaTramo.setFecmodif(Calendar.getInstance().getTime());
|
corridaTramo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
if (UsuarioLogado.getUsuarioLogado() != null) {
|
if (UsuarioLogado.getUsuarioLogado() != null) {
|
||||||
corridaTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
corridaTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
@ -643,7 +649,7 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
lsCorridaTramo.add(corridaTramo);
|
lsCorridaTramo.add(corridaTramo);
|
||||||
}
|
}
|
||||||
corrida.setCorridaTramoList(lsCorridaTramo);
|
corrida.setCorridaTramoList(lsCorridaTramo);
|
||||||
//
|
//
|
||||||
corrida.setFecmodif(Calendar.getInstance().getTime());
|
corrida.setFecmodif(Calendar.getInstance().getTime());
|
||||||
if (UsuarioLogado.getUsuarioLogado() != null) {
|
if (UsuarioLogado.getUsuarioLogado() != null) {
|
||||||
corrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
corrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
@ -658,8 +664,8 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
|
|
||||||
List<EsquemaAsiento> lsEsquemaAsiento = esquemaAsientoService.obtenerPorCorrida(esquemaCorrida);
|
List<EsquemaAsiento> lsEsquemaAsiento = esquemaAsientoService.obtenerPorCorrida(esquemaCorrida);
|
||||||
for (EsquemaAsiento ea : lsEsquemaAsiento) {
|
for (EsquemaAsiento ea : lsEsquemaAsiento) {
|
||||||
DetDiagramaAutobus detDiagramaAutobus = detDiagramaAutobusService.obtenerPorDiagramaAutobusAsiento(esquemaCorrida.getDiagramaAutobusId(),ea.getNumasiento());
|
DetDiagramaAutobus detDiagramaAutobus = detDiagramaAutobusService.obtenerPorDiagramaAutobusAsiento(esquemaCorrida.getDiagramaAutobusId(), ea.getNumasiento());
|
||||||
if(detDiagramaAutobus.getVendible()){
|
if (detDiagramaAutobus.getVendible()) {
|
||||||
AsientoExclusivo asientoExclusivo = new AsientoExclusivo();
|
AsientoExclusivo asientoExclusivo = new AsientoExclusivo();
|
||||||
asientoExclusivo.setCorrida(corrida);
|
asientoExclusivo.setCorrida(corrida);
|
||||||
asientoExclusivo.setMotivobloqueo(null);
|
asientoExclusivo.setMotivobloqueo(null);
|
||||||
|
@ -674,19 +680,19 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
asientoExclusivo.setMotivobloqueo(ea.getMotivobloqueo());
|
asientoExclusivo.setMotivobloqueo(ea.getMotivobloqueo());
|
||||||
asientoExclusivo.setDestino(ea.getDestino());
|
asientoExclusivo.setDestino(ea.getDestino());
|
||||||
}
|
}
|
||||||
|
|
||||||
asientoExclusivo.setActivo(Boolean.TRUE);
|
asientoExclusivo.setActivo(Boolean.TRUE);
|
||||||
asientoExclusivo.setFecmodif(Calendar.getInstance().getTime());
|
asientoExclusivo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
if (UsuarioLogado.getUsuarioLogado() != null) {
|
if (UsuarioLogado.getUsuarioLogado() != null) {
|
||||||
asientoExclusivo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
asientoExclusivo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
}
|
}
|
||||||
|
|
||||||
asientoExclusivo = asientoExclusivoService.suscribir(asientoExclusivo);
|
asientoExclusivo = asientoExclusivoService.suscribir(asientoExclusivo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (org.springframework.dao.DataIntegrityViolationException ex) {
|
} catch (org.springframework.dao.DataIntegrityViolationException ex) {
|
||||||
log.error("",ex);
|
log.error("", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return corrida;
|
return corrida;
|
||||||
|
@ -760,7 +766,7 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
private void generarCorrida(Date dataGeracao, List<EsquemaCorrida> lsEsquemaCorrida) {
|
private void generarCorrida(Date dataGeracao, List<EsquemaCorrida> lsEsquemaCorrida) {
|
||||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||||
|
|
||||||
//TODO: Melhorar o tratamento às transações manuais em caso de erro,etc
|
// TODO: Melhorar o tratamento às transações manuais em caso de erro,etc
|
||||||
TransactionStatus status = transactionManager.getTransaction(def);
|
TransactionStatus status = transactionManager.getTransaction(def);
|
||||||
cantCorridaGenerada = 0;
|
cantCorridaGenerada = 0;
|
||||||
cantCorridaCommit = 1;
|
cantCorridaCommit = 1;
|
||||||
|
@ -1014,7 +1020,7 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
|
|
||||||
log.debug(" Generacion cant dias " + sdf.format(dataDeOriginal));
|
log.debug(" Generacion cant dias " + sdf.format(dataDeOriginal));
|
||||||
|
|
||||||
//TODO: Melhorar o tratamento às transações manuais em caso de erro,etc
|
// TODO: Melhorar o tratamento às transações manuais em caso de erro,etc
|
||||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||||
TransactionStatus status = transactionManager.getTransaction(def);
|
TransactionStatus status = transactionManager.getTransaction(def);
|
||||||
|
|
||||||
|
@ -1057,17 +1063,17 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
calendarData.add(Calendar.DATE, 1);
|
calendarData.add(Calendar.DATE, 1);
|
||||||
dataDe = calendarData.getTime();
|
dataDe = calendarData.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("commit bloco corridas");
|
log.info("commit bloco corridas");
|
||||||
|
|
||||||
transactionManager.commit(status);
|
transactionManager.commit(status);
|
||||||
status = transactionManager.getTransaction(def);
|
status = transactionManager.getTransaction(def);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!status.isCompleted()) {
|
if (!status.isCompleted()) {
|
||||||
log.info("commit bloco final");
|
log.info("commit bloco final");
|
||||||
|
|
||||||
transactionManager.commit(status);
|
transactionManager.commit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1093,9 +1099,9 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
Boolean dentroVigenciaEsquemaOperacional = !lsEsquemaCorrida.isEmpty();
|
Boolean dentroVigenciaEsquemaOperacional = !lsEsquemaCorrida.isEmpty();
|
||||||
if (dentroVigenciaEsquemaOperacional) {
|
if (dentroVigenciaEsquemaOperacional) {
|
||||||
log.debug("Geracao de servicos sem cant dias especifico. Adotando o padrao");
|
log.debug("Geracao de servicos sem cant dias especifico. Adotando o padrao");
|
||||||
|
|
||||||
this.generarCorrida(dataDe, lsEsquemaCorrida);
|
this.generarCorrida(dataDe, lsEsquemaCorrida);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.info("No hay esquema vigente para la fecha " + sdfData.format(dataDe));
|
log.info("No hay esquema vigente para la fecha " + sdfData.format(dataDe));
|
||||||
}
|
}
|
||||||
|
@ -1112,32 +1118,32 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
return generacionExitosa;
|
return generacionExitosa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int cantDiasMaxGerarCorridasManual() {
|
||||||
private int cantDiasMaxGerarCorridasManual(){
|
|
||||||
|
|
||||||
Constante constante = constanteService.buscarPorNomeConstante("CANT_MAX_CORRIDA_GERA_MANUAL");
|
Constante constante = constanteService.buscarPorNomeConstante("CANT_MAX_CORRIDA_GERA_MANUAL");
|
||||||
|
|
||||||
if ((constante == null) ||(StringUtils.isBlank(constante.getValorconstante()))){
|
if ((constante == null) || (StringUtils.isBlank(constante.getValorconstante()))) {
|
||||||
return CANT_MAX_CORRIDA_GERA_MANUAL;
|
return CANT_MAX_CORRIDA_GERA_MANUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Integer.valueOf(constante.getValorconstante());
|
return Integer.valueOf(constante.getValorconstante());
|
||||||
|
|
||||||
}
|
}
|
||||||
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS,rollbackFor=BusinessException.class)
|
|
||||||
|
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS, rollbackFor = BusinessException.class)
|
||||||
public Long generarCorridasSelecionadas(List<EsquemaCorrida> lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException {
|
public Long generarCorridasSelecionadas(List<EsquemaCorrida> lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException {
|
||||||
|
|
||||||
int cantDiasGeneracion = DateUtil.getElapsedDias(dataDe, dataAte);
|
int cantDiasGeneracion = DateUtil.getElapsedDias(dataDe, dataAte);
|
||||||
|
|
||||||
int cantDiasMaxGerarCorridasManual = cantDiasMaxGerarCorridasManual();
|
int cantDiasMaxGerarCorridasManual = cantDiasMaxGerarCorridasManual();
|
||||||
|
|
||||||
log.info("cantDiasGeneracion="+cantDiasGeneracion);
|
log.info("cantDiasGeneracion=" + cantDiasGeneracion);
|
||||||
log.info("cantDiasMaxGerarCorridasManual="+cantDiasMaxGerarCorridasManual);
|
log.info("cantDiasMaxGerarCorridasManual=" + cantDiasMaxGerarCorridasManual);
|
||||||
|
|
||||||
if (cantDiasGeneracion > cantDiasMaxGerarCorridasManual()){
|
if (cantDiasGeneracion > cantDiasMaxGerarCorridasManual()) {
|
||||||
throw new BusinessException("corridaServiceImpl.geracaoCorrida.cantDiasManual", new Object[]{cantDiasMaxGerarCorridasManual});
|
throw new BusinessException("corridaServiceImpl.geracaoCorrida.cantDiasManual", new Object[] { cantDiasMaxGerarCorridasManual });
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy");
|
SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
|
||||||
log.info("** SELECIONADOS - Data De: " + sdfData.format(dataDe) + " **Data Ateh: " + sdfData.format(dataAte));
|
log.info("** SELECIONADOS - Data De: " + sdfData.format(dataDe) + " **Data Ateh: " + sdfData.format(dataAte));
|
||||||
|
@ -1216,4 +1222,101 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) {
|
public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) {
|
||||||
return atualizarCorridaFecHusoFecVerano(estado, dataInicial, null);
|
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