Merge pull request 'bug#al-2935' (!81) from AL2935 into master
Reviewed-on: adm/ModelWeb#81 Reviewed-by: Gleison da Cruz <gleison.cruz@totvs.com.br>master
commit
1725155a08
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>ModelWeb</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<version>1.7.1</version>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>rj-releases</id>
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConexionCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.PricingConexao;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta;
|
||||
|
||||
public interface ConexionCtrlDAO extends GenericDAO<ConexionCtrl, Long> {
|
||||
|
@ -13,4 +14,7 @@ public interface ConexionCtrlDAO extends GenericDAO<ConexionCtrl, Long> {
|
|||
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Long conexionctrlId);
|
||||
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Integer origenId, Integer destinoId, Long conexionctrlId);
|
||||
|
||||
public void limparPesquisaPricingConexao(Integer pricingId);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
@ -13,9 +14,9 @@ import org.springframework.stereotype.Repository;
|
|||
import com.rjconsultores.ventaboletos.dao.ConexionCtrlDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConexionCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.PricingConexao;
|
||||
import com.rjconsultores.ventaboletos.vo.conexion.OrdenarLocalidadesGeradas;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ConexionCtrlVO;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaCtrlVO;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta;
|
||||
|
||||
@Repository("conexionCtrlDAO")
|
||||
|
@ -63,6 +64,7 @@ public class ConexionCtrlHibernateDAO extends GenericHibernateDAO<ConexionCtrl,
|
|||
return list;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Long conexionctrlId) {
|
||||
|
||||
|
@ -86,10 +88,77 @@ public class ConexionCtrlHibernateDAO extends GenericHibernateDAO<ConexionCtrl,
|
|||
|
||||
confRutaDAO.transformarObjetosConexao(localidadesCombinadas, listConexionCtrl, listConexionCtrlVO, result);
|
||||
|
||||
|
||||
Collections.sort(localidadesCombinadas, new OrdenarLocalidadesGeradas());
|
||||
|
||||
return localidadesCombinadas;
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Integer origenId, Integer destinoId, Long conexionctrlId) {
|
||||
|
||||
if(origenId == null || destinoId == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sQuery = new StringBuilder();
|
||||
sQuery.append(" select distinct ")
|
||||
.append(" origem.descparada as origem, destino.descparada as destino, c.conexionctrl_id ")
|
||||
.append(" from")
|
||||
.append(" conexion_ctrl c inner join ")
|
||||
.append(" parada origem on origem.parada_id = c.origen_id inner join ")
|
||||
.append(" parada destino on destino.parada_id = c.destino_id ")
|
||||
.append(" where ")
|
||||
.append(" c.activo = 1 and c.indpricing = 1 and c.origen_id = :origenId and c.destino_id = :destinoId ");
|
||||
|
||||
if(conexionctrlId != null) {
|
||||
sQuery.append(" and c.conexionctrl_id = :conexionctrlId ");
|
||||
}
|
||||
|
||||
Query qr = getSession().createSQLQuery(sQuery.toString());
|
||||
qr.setParameter("origenId", origenId);
|
||||
qr.setParameter("destinoId", destinoId);
|
||||
|
||||
if(conexionctrlId != null) {
|
||||
qr.setParameter("conexionctrlId", conexionctrlId);
|
||||
}
|
||||
|
||||
List<ParadaVOConexionRuta> localidadesCombinadas = new ArrayList<ParadaVOConexionRuta>(0);
|
||||
|
||||
List<Object[]> result = qr.list();
|
||||
|
||||
for (Object[] tupla : result) {
|
||||
|
||||
Parada paradaOrigem = new Parada(origenId, null, tupla[0].toString());
|
||||
Parada paradaDestino = new Parada(destinoId, null, tupla[1].toString());
|
||||
|
||||
conexionctrlId = Long.valueOf(tupla[2].toString());
|
||||
|
||||
ConexionCtrlVO conex = new ConexionCtrlVO(origenId, destinoId);
|
||||
conex.setConexionctrlId(conexionctrlId);
|
||||
conex.setIndPricing(true);
|
||||
conex.setOrigenId(origenId);
|
||||
conex.setDestinoId(destinoId);
|
||||
|
||||
ParadaVOConexionRuta parada = new ParadaVOConexionRuta();
|
||||
|
||||
parada.setParadaOrigem(paradaOrigem);
|
||||
parada.setParadaDestino(paradaDestino);
|
||||
parada.setConexionCtrl(conex);
|
||||
|
||||
localidadesCombinadas.add(parada);
|
||||
}
|
||||
|
||||
return localidadesCombinadas;
|
||||
|
||||
}
|
||||
|
||||
public void limparPesquisaPricingConexao(Integer pricingId) {
|
||||
StringBuilder sQuery = new StringBuilder("DELETE FROM PRICING_CONEXAO_VALOR WHERE PRICING_ID = :pricingId AND TRUNC(FECMODIF) = TRUNC(SYSDATE) ");
|
||||
SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString());
|
||||
|
||||
qrUpdate.setParameter("pricingId", pricingId);
|
||||
qrUpdate.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class ConexionCtrl implements Serializable {
|
|||
}
|
||||
|
||||
public boolean isOrigemDestinoIgual(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) {
|
||||
return getOrigenId().equals(origemConexaoCtrl) && getDestinoId().equals(destinoConexaoCtrl);
|
||||
return getOrigenId() != null && getDestinoId() != null && getOrigenId().equals(origemConexaoCtrl) && getDestinoId().equals(destinoConexaoCtrl);
|
||||
}
|
||||
|
||||
public Boolean getIndPricing() {
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -103,4 +105,22 @@ public class PricingConexao implements Serializable {
|
|||
public void setConexionCtrl(ConexionCtrl conexionCtrl) {
|
||||
this.conexionCtrl = conexionCtrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(conexionCtrl, pricing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PricingConexao other = (PricingConexao) obj;
|
||||
return Objects.equals(conexionCtrl, other.conexionCtrl) && Objects.equals(pricing, other.pricing);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConexionCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.PricingConexao;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta;
|
||||
|
||||
public interface ConexionCtrlService extends GenericService<ConexionCtrl, Long> {
|
||||
|
@ -15,4 +16,8 @@ public interface ConexionCtrlService extends GenericService<ConexionCtrl, Long>
|
|||
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Long conexionctrlId);
|
||||
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Integer origenId, Integer destinoId, Long conexionctrlId);
|
||||
|
||||
public void limparPesquisaPricingConexao(Integer pricingId);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.rjconsultores.ventaboletos.entidad.ConexionCtrl;
|
|||
import com.rjconsultores.ventaboletos.entidad.ConexionDescuento;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl;
|
||||
import com.rjconsultores.ventaboletos.entidad.PricingConexao;
|
||||
import com.rjconsultores.ventaboletos.service.ConexionConfService;
|
||||
import com.rjconsultores.ventaboletos.service.ConexionCtrlService;
|
||||
import com.rjconsultores.ventaboletos.service.ConexionService;
|
||||
|
@ -131,4 +132,13 @@ public class ConexionCtrlServiceImpl implements ConexionCtrlService {
|
|||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Long conexionctrlId) {
|
||||
return conexionCtrlDAO.carregarConexoesCadastradas(conexionctrlId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParadaVOConexionRuta> carregarConexoesCadastradas(Integer origenId, Integer destinoId, Long conexionctrlId) {
|
||||
return conexionCtrlDAO.carregarConexoesCadastradas(origenId, destinoId, conexionctrlId);
|
||||
}
|
||||
|
||||
public void limparPesquisaPricingConexao(Integer pricingId) {
|
||||
conexionCtrlDAO.limparPesquisaPricingConexao(pricingId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ public class ParadaVOConexionRuta {
|
|||
|
||||
private PricingConexao pricingConexao;
|
||||
|
||||
public ParadaVOConexionRuta() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ParadaVOConexionRuta(int grupo, Parada paradaOrigem, Parada paradaDestino, Integer rutaId, String numRuta, Short secuencia,
|
||||
boolean valido, Parada paradaOrigemTrecho, Parada paradaDestinoTrecho, ConexionCtrlVO conexionCtrl,
|
||||
ConexionRutaCtrlVO conexionRutaCtrl, String sentido) {
|
||||
|
|
Loading…
Reference in New Issue