FIXES BUG #6491
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@47194 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
edf56a5402
commit
18a2aa64ab
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
|
||||||
|
public interface CalcularPeajeDAO {
|
||||||
|
public List<Object> buscarCasetasPeajeWithinTramo(Ruta ruta);
|
||||||
|
|
||||||
|
public int[] gerarSQLInserirPeajes(List<Ruta> lsRuta, OrgaoConcedente orgao);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||||
|
|
||||||
|
public interface CasetaPeajeDAO extends GenericDAO<CasetaPeaje, Integer> {
|
||||||
|
|
||||||
|
List<CasetaPeaje> buscar(String casetaPeajeDesc);
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PracaPedagio;
|
|
||||||
|
|
||||||
public interface PracaPedagioDAO extends GenericDAO<PracaPedagio, Integer> {
|
|
||||||
|
|
||||||
List<PracaPedagio> buscar(String descricaoPracaPedagio);
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
||||||
|
|
||||||
|
public interface RutaCasetaDAO extends GenericDAO<RutaCaseta, Integer> {
|
||||||
|
|
||||||
|
// public RutaCaseta suscribir(RutaCaseta entidad);
|
||||||
|
public void deletarRutaCasetasFromRutaSecuenciaId(Integer id);
|
||||||
|
}
|
|
@ -6,9 +6,11 @@ package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +31,8 @@ public interface RutaDAO extends GenericDAO<Ruta, Integer> {
|
||||||
public List<Ruta> obtenerPorEmpresa(Empresa empresa);
|
public List<Ruta> obtenerPorEmpresa(Empresa empresa);
|
||||||
|
|
||||||
public List<Ruta> buscarTodosExceto(Integer... idRuta);
|
public List<Ruta> buscarTodosExceto(Integer... idRuta);
|
||||||
|
|
||||||
|
public List<Ruta> buscarTodosEstos(Integer[] idRutas);
|
||||||
|
|
||||||
public List<Ruta> buscarNumRuta(String numRuta);
|
public List<Ruta> buscarNumRuta(String numRuta);
|
||||||
|
|
||||||
|
@ -49,5 +53,7 @@ public interface RutaDAO extends GenericDAO<Ruta, Integer> {
|
||||||
public Parada buscarDestino(Ruta ruta);
|
public Parada buscarDestino(Ruta ruta);
|
||||||
|
|
||||||
public List<Ruta> buscaRuta(String palavraPesquisaRuta);
|
public List<Ruta> buscaRuta(String palavraPesquisaRuta);
|
||||||
|
|
||||||
|
public List<Ruta> buscaRutasFromOrgao(OrgaoConcedente orgao);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,4 +77,6 @@ public interface TarifaOficialDAO extends GenericDAO<TarifaOficial, Integer>{
|
||||||
public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Integer usuarioId, Boolean taxaEmbarque);
|
public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Integer usuarioId, Boolean taxaEmbarque);
|
||||||
|
|
||||||
public void limparTarifasOficiais();
|
public void limparTarifasOficiais();
|
||||||
|
|
||||||
|
public void atualizarPedagio();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,327 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Repository("calcularPeajeDAO")
|
||||||
|
public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, String> implements CalcularPeajeDAO{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CalcularPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Object> buscarCasetasPeajeWithinTramo(Ruta ruta){
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|
||||||
|
sql.append(" with temp_table as ( ");
|
||||||
|
sql.append(" select tra.origen_id as orig , tra.DESTINO_ID as dest, tra.tramo_id as tra, tra.desctramo as traDesc, tra.origen_id as traorig, ");
|
||||||
|
sql.append(" tra.destino_id as tradest, tra.via_id as travia, tra.cantkmreal as tracantkm, ");
|
||||||
|
sql.append(" tra.cantkmpagoconductor as tracantkmpago, tra.activo as traactivo, tra.fecmodif as trafecmodif, tra.usuario_id as trausuario ");
|
||||||
|
sql.append(" from RUTA_COMBINACION rcom inner join ruta r on r.RUTA_ID = rcom.RUTA_ID ");
|
||||||
|
sql.append(" inner join ORGAO_CONCEDENTE oc on oc.ORGAOCONCEDENTE_ID = r.ORGAOCONCEDENTE_ID ");
|
||||||
|
sql.append(" inner join tramo tra on tra.tramo_id = rcom.tramo_id ");
|
||||||
|
sql.append(" where r.RUTA_ID = :rutaId ");
|
||||||
|
sql.append(" ) , "); //select * from temp_table
|
||||||
|
sql.append(" ");
|
||||||
|
sql.append(" myTable as ( ");
|
||||||
|
sql.append(" select rseq3.numsecuencia as origen_tramo_inicial_seq , rseq4.numsecuencia as destino_tramo_final_seq , T.tramo_id as ttramo, t2.tramo_id as tt2tramo , tt.tra as traComb, tt.orig as ttorig, tt.dest as ttdest, ");
|
||||||
|
sql.append(" tt.tradesc as traCombdesc, tt.traorig as traComborig, tt.tradest as traCombdest, tt.travia as tracombvia, tt.tracantkm as tracombcantkm, ");
|
||||||
|
sql.append(" tt.tracantkmpago as tracombcantkmpago, tt.traactivo as tracombactivo, tt.trafecmodif as tracombfecmodif, tt.trausuario as tracombusuario ");
|
||||||
|
sql.append(" from ruta_secuencia rseq3 ");
|
||||||
|
sql.append(" inner join tramo t on t.tramo_id = rseq3.tramo_id and rseq3.ruta_id = :rutaId ");
|
||||||
|
sql.append(" INNER JOIN ruta_secuencia rseq4 ON rseq3.ruta_id = rseq4.ruta_id ");
|
||||||
|
sql.append(" INNER JOIN TRAMO T2 ON T2.TRAMO_ID = rseq4.tramo_id and rseq4.ruta_id = :rutaId ");
|
||||||
|
sql.append(" inner join temp_table tt on t.ORIGEN_ID = tt.orig and T2.DESTINO_ID = tt.dest ");
|
||||||
|
// sql.append(" -- and t.ORIGEN_ID = 19231 ");
|
||||||
|
// sql.append(" -- AND T2.DESTINO_ID = 21708 ");
|
||||||
|
sql.append(" ) , ");
|
||||||
|
sql.append(" "); //select * from myTable
|
||||||
|
sql.append(" caseta_tramo_da_ruta as ( ");
|
||||||
|
sql.append(" select rcas.rutacaseta_id as rutacasetaid, rcas.rutasecuencia_id as rutasecuenciaId, rcas.casetaPeaje_Id, rseq.numSecuencia as numSecuencia, rseq.tramo_id as tramoid, rseq2.numSecuencia as numSecuencia2, ");
|
||||||
|
sql.append(" casp.casetaPeaje_id as casetaPeajeid, casp.desccaseta as desccaseta, casp.importeida as importeida, casp.importevuelta as importevuelta, casp.activo as caspActivo, ");
|
||||||
|
sql.append(" casp.fecmodif as caspfecmodif, casp.usuario_id as caspusuario ");
|
||||||
|
sql.append(" from RUTA_CASETA rcas inner join RUTA_SECUENCIA rseq on rcas.RUTASECUENCIA_ID = rseq.RUTASECUENCIA_ID ");
|
||||||
|
sql.append(" inner join RUTA_SECUENCIA rseq2 on rseq2.TRAMO_ID = rseq.TRAMO_ID ");
|
||||||
|
sql.append(" inner join tramo tra on tra.tramo_id = rseq.TRAMO_ID and rseq.ruta_id = :rutaId ");
|
||||||
|
sql.append(" inner join caseta_peaje casp on casp.casetapeaje_id = rcas.casetapeaje_id ");
|
||||||
|
sql.append(" ) ");
|
||||||
|
sql.append(" select * from myTable my inner join caseta_tramo_da_ruta ctr on ctr.numSecuencia2 between my.origen_tramo_inicial_seq and my.destino_tramo_final_seq order by tracomb ");
|
||||||
|
|
||||||
|
|
||||||
|
Query query = getSession().createSQLQuery(sql.toString());
|
||||||
|
query.setInteger("rutaId", ruta.getRutaId());
|
||||||
|
query.setInteger("rutaId", ruta.getRutaId());
|
||||||
|
query.setInteger("rutaId", ruta.getRutaId());
|
||||||
|
query.setInteger("rutaId", ruta.getRutaId());
|
||||||
|
|
||||||
|
return query.list();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// return new ArrayList<Object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] gerarSQLInserirPeajes(List<Ruta> lsRuta, OrgaoConcedente orgao){
|
||||||
|
|
||||||
|
int[] retorno = {};
|
||||||
|
//pra cada ruta obter as combinacoes de tramos, cada tramo com sua lista de casetaPeaje
|
||||||
|
|
||||||
|
|
||||||
|
StringBuilder updateSQL = new StringBuilder();
|
||||||
|
updateSQL.append(" update PEAJE set activo = 0 where ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()).append(" ");
|
||||||
|
|
||||||
|
List<String> lsSql = new ArrayList<String>();
|
||||||
|
|
||||||
|
for(Ruta r : lsRuta){
|
||||||
|
if(r.getRutaId() == 107){
|
||||||
|
System.out.println("oi");
|
||||||
|
}
|
||||||
|
List<Object> lsObj = buscarCasetasPeajeWithinTramo(r);
|
||||||
|
if(null != lsObj && 0 != lsObj.size()){
|
||||||
|
|
||||||
|
for(Object oArr : lsObj){
|
||||||
|
StringBuilder insertSQL = new StringBuilder();
|
||||||
|
|
||||||
|
Object o[] = (Object[])oArr;
|
||||||
|
|
||||||
|
PeajeVO pvo = new PeajeVO();
|
||||||
|
// pvo.setPeajeId(o[]);
|
||||||
|
pvo.setRutaId(r.getRutaId());
|
||||||
|
pvo.setOrigenId(Integer.parseInt(""+o[8]));
|
||||||
|
pvo.setDestinoId(Integer.parseInt(""+o[9]));
|
||||||
|
pvo.setOrgaoId(orgao.getOrgaoConcedenteId());
|
||||||
|
pvo.setCasetaPeajeId(Integer.parseInt(""+o[22]));
|
||||||
|
pvo.setCantAsientos(r.getCantAsientos());
|
||||||
|
pvo.setCantEixos(r.getCantEixos());
|
||||||
|
if(r.getIndSentidoIda()){
|
||||||
|
pvo.setImportePeaje(BigDecimal.valueOf(Double.parseDouble(""+o[24])));
|
||||||
|
}else{
|
||||||
|
pvo.setImportePeaje(BigDecimal.valueOf(Double.parseDouble(""+o[25])));
|
||||||
|
}
|
||||||
|
pvo.setIndicePeaje(orgao.getIndicePeaje());
|
||||||
|
pvo.setActivo(1);
|
||||||
|
pvo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
pvo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
Integer qtdEixos = r.getCantEixos();
|
||||||
|
Integer cantAsientos = r.getCantAsientos();
|
||||||
|
BigDecimal indice = orgao.getIndicePeaje();
|
||||||
|
BigDecimal pedagioPuro = pvo.getImportePeaje();
|
||||||
|
BigDecimal pedagioCalculado = BigDecimal.valueOf(0);
|
||||||
|
if(orgao.getOrgaoConcedenteId() == 21){ // 21 = artesp
|
||||||
|
pedagioCalculado = BigDecimal.valueOf(((pedagioPuro.doubleValue() * qtdEixos) / indice.doubleValue()));
|
||||||
|
}else if(orgao.getOrgaoConcedenteId() == 3){// 3 = antt
|
||||||
|
pedagioCalculado = BigDecimal.valueOf(((pedagioPuro.doubleValue() * qtdEixos) / ( indice.doubleValue() * cantAsientos)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pvo.setImportePeaje(pedagioCalculado);
|
||||||
|
|
||||||
|
System.out.println(pvo);
|
||||||
|
|
||||||
|
insertSQL.append(" insert into PEAJE ( PEAJE_ID , RUTA_ID , ORIGEN_ID , DESTINO_ID , ORGAOCONCEDENTE_ID , CASETAPEAJE_ID ,");
|
||||||
|
insertSQL.append(" CANTASIENTOS , CANTEIXOS , IMPORTEPEAJE , INDICEPEAJE , ACTIVO , FECMODIF , USUARIO_ID ) ");
|
||||||
|
insertSQL.append(" values ");
|
||||||
|
insertSQL.append(" ( PEAJE_SEQ.NEXTVAL , ");
|
||||||
|
insertSQL.append(pvo.getRutaId()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getOrigenId()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getDestinoId()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getOrgaoId()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getCasetaPeajeId()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getCantAsientos()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getCantEixos()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getImportePeaje()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getIndicePeaje()).append(" , ");
|
||||||
|
insertSQL.append(pvo.getActivo()).append(" , ");
|
||||||
|
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(pvo.getFecmodif());
|
||||||
|
StringBuilder minhaData = new StringBuilder().append("TO_DATE('").append(calendar.get(Calendar.YEAR)).append("/");
|
||||||
|
minhaData.append(String.format("%02d",calendar.get(Calendar.MONTH))).append("/");
|
||||||
|
minhaData.append(String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH))).append(" ");
|
||||||
|
minhaData.append(String.format("%02d",calendar.get(Calendar.HOUR_OF_DAY))).append(":");
|
||||||
|
minhaData.append(String.format("%02d",calendar.get(Calendar.MINUTE))).append(":");
|
||||||
|
minhaData.append(String.format("%02d",calendar.get(Calendar.SECOND))).append("', 'yyyy/mm/dd hh24:mi:ss')");
|
||||||
|
insertSQL.append(minhaData).append(" , "); //TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss')
|
||||||
|
|
||||||
|
insertSQL.append(pvo.getUsuarioId()).append(" ) ");
|
||||||
|
|
||||||
|
lsSql.add(insertSQL.toString());
|
||||||
|
//------------------------------------------- existia um if(arredondamento)
|
||||||
|
// if (trechoPracaPedagio.getSentido().equals("0")) {//IDA // esse trecho veio do calculo da artesp e NAO da antt
|
||||||
|
// va = (tp_ida * linhaEixo.getQuantidadeEixos()) / divisor;
|
||||||
|
// } else {
|
||||||
|
// va = (tp_volta * linhaEixo.getQuantidadeEixos()) / divisor;
|
||||||
|
// }
|
||||||
|
//---------------------
|
||||||
|
// // calculo IDA // esse veio da antt , e estava dentro
|
||||||
|
// va = ((tp_ida * qtdEixos) / (lot * iap)); // de um if desnecessário pois o corpo do true ou false
|
||||||
|
// //arredondamento para cima ou para baixo com 3 casas decimais // faziam a mesma coisa
|
||||||
|
// BigDecimal bd = new BigDecimal(va);
|
||||||
|
// bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||||
|
// va = bd.doubleValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection con = getSession().connection();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Statement stmt = con.createStatement();
|
||||||
|
con.setAutoCommit(false);
|
||||||
|
stmt.addBatch(updateSQL.toString());
|
||||||
|
for(String x : lsSql){
|
||||||
|
stmt.addBatch(x);
|
||||||
|
}
|
||||||
|
retorno = stmt.executeBatch();
|
||||||
|
con.commit();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PeajeVO {
|
||||||
|
private Integer peajeId;
|
||||||
|
private Integer rutaId;
|
||||||
|
private Integer origenId;
|
||||||
|
private Integer destinoId;
|
||||||
|
private Integer orgaoId;
|
||||||
|
private Integer casetaPeajeId;
|
||||||
|
private Integer cantAsientos;
|
||||||
|
private Integer cantEixos;
|
||||||
|
private BigDecimal importePeaje;
|
||||||
|
private BigDecimal indicePeaje;
|
||||||
|
private Integer activo;
|
||||||
|
private Date fecmodif;
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public Integer getPeajeId() {
|
||||||
|
return peajeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeajeId(Integer peajeId) {
|
||||||
|
this.peajeId = peajeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRutaId() {
|
||||||
|
return rutaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRutaId(Integer rutaId) {
|
||||||
|
this.rutaId = rutaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrigenId() {
|
||||||
|
return origenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrigenId(Integer origenId) {
|
||||||
|
this.origenId = origenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDestinoId() {
|
||||||
|
return destinoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDestinoId(Integer destinoId) {
|
||||||
|
this.destinoId = destinoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrgaoId() {
|
||||||
|
return orgaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrgaoId(Integer orgaoId) {
|
||||||
|
this.orgaoId = orgaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCasetaPeajeId() {
|
||||||
|
return casetaPeajeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCasetaPeajeId(Integer casetaPeajeId) {
|
||||||
|
this.casetaPeajeId = casetaPeajeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCantAsientos() {
|
||||||
|
return cantAsientos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCantAsientos(Integer cantAsientos) {
|
||||||
|
this.cantAsientos = cantAsientos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCantEixos() {
|
||||||
|
return cantEixos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCantEixos(Integer cantEixos) {
|
||||||
|
this.cantEixos = cantEixos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getImportePeaje() {
|
||||||
|
return importePeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImportePeaje(BigDecimal importePeaje) {
|
||||||
|
this.importePeaje = importePeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getIndicePeaje() {
|
||||||
|
return indicePeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndicePeaje(BigDecimal indicePeaje) {
|
||||||
|
this.indicePeaje = indicePeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Integer activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,31 +9,31 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.PracaPedagioDAO;
|
import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PracaPedagio;
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||||
|
|
||||||
@Repository("pracaPedagioDAO")
|
@Repository("casetaPeajeDAO")
|
||||||
public class PracaPedagioHibernateDAO extends GenericHibernateDAO<PracaPedagio, Integer> implements PracaPedagioDAO {
|
public class CasetaPeajeHibernateDAO extends GenericHibernateDAO<CasetaPeaje, Integer> implements CasetaPeajeDAO {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PracaPedagioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
public CasetaPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
setSessionFactory(factory);
|
setSessionFactory(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public List<PracaPedagio> obtenerTodos() {
|
public List<CasetaPeaje> obtenerTodos() {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
return (List<PracaPedagio>) c.list();
|
return (List<CasetaPeaje>) c.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public List<PracaPedagio> buscar(String descricaoPracaPedagio) {
|
public List<CasetaPeaje> buscar(String casetaPeajeDesc) {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
c.add(Restrictions.eq("descricao", descricaoPracaPedagio));
|
c.add(Restrictions.eq("desccaseta", casetaPeajeDesc));
|
||||||
return c.list();
|
return c.list();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.RutaCasetaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.RutaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
||||||
|
|
||||||
|
@Repository("rutaCasetaDAO")
|
||||||
|
public class RutaCasetaHibernateDAO extends GenericHibernateDAO<RutaCaseta, Integer>
|
||||||
|
implements RutaCasetaDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RutaCasetaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deletarRutaCasetasFromRutaSecuenciaId(Integer id){
|
||||||
|
this.getSession().createQuery("DELETE from RutaCaseta rc WHERE rc.rutaSecuencia.rutasecuenciaId = "+id+" ").executeUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Repository;
|
||||||
import com.rjconsultores.ventaboletos.dao.RutaDAO;
|
import com.rjconsultores.ventaboletos.dao.RutaDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.RutaSecuencia;
|
import com.rjconsultores.ventaboletos.entidad.RutaSecuencia;
|
||||||
|
@ -145,6 +146,15 @@ public class RutaHibernateDAO extends GenericHibernateDAO<Ruta, Integer>
|
||||||
|
|
||||||
return c.list();
|
return c.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Ruta> buscarTodosEstos(Integer[] idRutas) {
|
||||||
|
Criteria c = this.makeCriteria();
|
||||||
|
c.add(Restrictions.in("rutaId", idRutas));
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.addOrder(Order.asc("descruta"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
public List<Ruta> buscarNumRuta(String numRuta) {
|
public List<Ruta> buscarNumRuta(String numRuta) {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
@ -167,7 +177,18 @@ public class RutaHibernateDAO extends GenericHibernateDAO<Ruta, Integer>
|
||||||
|
|
||||||
List<Ruta> lsRuta = sq.list();
|
List<Ruta> lsRuta = sq.list();
|
||||||
return lsRuta;
|
return lsRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Ruta> buscaRutasFromOrgao(OrgaoConcedente orgao){
|
||||||
|
StringBuffer hql = new StringBuffer();
|
||||||
|
hql.append(" FROM Ruta r ");
|
||||||
|
hql.append(" WHERE r.orgaoConcedente.orgaoConcedenteId = :orgaoId ");
|
||||||
|
|
||||||
|
Query sq = getSession().createQuery(hql.toString());
|
||||||
|
sq.setParameter("orgaoId", orgao.getOrgaoConcedenteId());
|
||||||
|
|
||||||
|
List<Ruta> lsRuta = sq.list();
|
||||||
|
return lsRuta;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
@ -181,4 +184,36 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
||||||
query.setParameter("usuarioId", usuarioId);
|
query.setParameter("usuarioId", usuarioId);
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void atualizarPedagio() {
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append(" merge into tarifa_oficial ");
|
||||||
|
sql.append(" using ");
|
||||||
|
sql.append(" ( ");
|
||||||
|
sql.append(" WITH tarifas_ofic as ( ");
|
||||||
|
sql.append(" select tarifaoficial_id, ORGAOCONCEDENTE_ID, ruta_id , origen_id , DESTINO_ID from tarifa_oficial ");
|
||||||
|
sql.append(" ), ");
|
||||||
|
sql.append(" peaje_tarifas as ( ");
|
||||||
|
sql.append(" select * from peaje p inner join tarifas_ofic tof on ");
|
||||||
|
sql.append(" p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID and p.ruta_id = tof.ruta_id ");
|
||||||
|
sql.append(" and p.ORIGEN_ID = tof.ORIGEN_ID and p.DESTINO_ID = tof.DESTINO_ID and p.activo = 1 ");
|
||||||
|
sql.append(" ) ");
|
||||||
|
sql.append(" select pf.tarifaoficial_id , sum(importepeaje) as soma from peaje_tarifas pf Group by pf.tarifaoficial_id ");
|
||||||
|
sql.append(" ");
|
||||||
|
sql.append(" ) tarifa_importe ");
|
||||||
|
sql.append(" on (tarifa_oficial.tarifaoficial_id = tarifa_importe.tarifaoficial_id) ");
|
||||||
|
sql.append(" when matched then ");
|
||||||
|
sql.append(" update set ");
|
||||||
|
sql.append(" importepedagio = tarifa_importe.soma ");
|
||||||
|
|
||||||
|
Connection conn = getSession().connection();
|
||||||
|
Statement stmt;
|
||||||
|
try {
|
||||||
|
stmt = conn.createStatement();
|
||||||
|
stmt.executeUpdate(sql.toString());
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.ManyToMany;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "CASETA_PEAJE_SEQ", sequenceName = "CASETA_PEAJE_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "CASETA_PEAJE")
|
||||||
|
public class CasetaPeaje implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CASETA_PEAJE_SEQ")
|
||||||
|
@Column(name = "CASETAPEAJE_ID")
|
||||||
|
private Integer casetaPeajeId;
|
||||||
|
@Column(name = "DESCCASETA")
|
||||||
|
private String desccaseta;
|
||||||
|
@Column(name = "IMPORTEIDA")
|
||||||
|
private BigDecimal importeIda;
|
||||||
|
@Column(name = "IMPORTEVUELTA")
|
||||||
|
private BigDecimal importeVuelta;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(name = "RUTA_CASETA", joinColumns = { @JoinColumn(name = "CASETAPEAJE_ID") },
|
||||||
|
inverseJoinColumns = { @JoinColumn(name = "RUTASECUENCIA_ID") })
|
||||||
|
private List<RutaSecuencia> lsRutaSecuencia;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 0;
|
||||||
|
hash += casetaPeajeId != null ? casetaPeajeId.hashCode() : 0;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (!(object instanceof CasetaPeaje)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CasetaPeaje other = (CasetaPeaje) object;
|
||||||
|
if ((this.casetaPeajeId == null && other.casetaPeajeId != null) || (this.casetaPeajeId != null && !this.casetaPeajeId.equals(other.casetaPeajeId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCasetaPeajeId() {
|
||||||
|
return casetaPeajeId;
|
||||||
|
}
|
||||||
|
public void setCasetaPeajeId(Integer casetaPeajeId) {
|
||||||
|
this.casetaPeajeId = casetaPeajeId;
|
||||||
|
}
|
||||||
|
public String getDesccaseta() {
|
||||||
|
return desccaseta;
|
||||||
|
}
|
||||||
|
public void setDesccaseta(String desccaseta) {
|
||||||
|
this.desccaseta = desccaseta;
|
||||||
|
}
|
||||||
|
public BigDecimal getImporteIda() {
|
||||||
|
return importeIda;
|
||||||
|
}
|
||||||
|
public void setImporteIda(BigDecimal importeIda) {
|
||||||
|
this.importeIda = importeIda;
|
||||||
|
}
|
||||||
|
public BigDecimal getImporteVuelta() {
|
||||||
|
return importeVuelta;
|
||||||
|
}
|
||||||
|
public void setImporteVuelta(BigDecimal importeVuelta) {
|
||||||
|
this.importeVuelta = importeVuelta;
|
||||||
|
}
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getCasetaPeajeId() + " - " +getDesccaseta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -47,6 +48,8 @@ public class OrgaoConcedente implements Serializable {
|
||||||
private Boolean indNomDocObligatorio;
|
private Boolean indNomDocObligatorio;
|
||||||
@OneToMany(mappedBy = "orgao")
|
@OneToMany(mappedBy = "orgao")
|
||||||
private List<OrgaoCancelacion> orgaoCancelacionList;
|
private List<OrgaoCancelacion> orgaoCancelacionList;
|
||||||
|
@Column(name = "INDICEPEAJE")
|
||||||
|
private BigDecimal indicePeaje;
|
||||||
|
|
||||||
public void addParametro(OrgaoCancelacion param){
|
public void addParametro(OrgaoCancelacion param){
|
||||||
this.orgaoCancelacionList.add(param);
|
this.orgaoCancelacionList.add(param);
|
||||||
|
@ -138,6 +141,14 @@ public class OrgaoConcedente implements Serializable {
|
||||||
this.orgaoCancelacionList = orgaoCancelacionList;
|
this.orgaoCancelacionList = orgaoCancelacionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getIndicePeaje() {
|
||||||
|
return indicePeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndicePeaje(BigDecimal indicePeaje) {
|
||||||
|
this.indicePeaje = indicePeaje;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return descOrgao;
|
return descOrgao;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
|
@ -13,6 +15,8 @@ public class ParadaSecuencia {
|
||||||
private Short secuencia;
|
private Short secuencia;
|
||||||
private Parada parada;
|
private Parada parada;
|
||||||
private Via via;
|
private Via via;
|
||||||
|
private List<CasetaPeaje> casetas;
|
||||||
|
private String casetasTxt ="";
|
||||||
|
|
||||||
public ParadaSecuencia() {
|
public ParadaSecuencia() {
|
||||||
}
|
}
|
||||||
|
@ -40,4 +44,30 @@ public class ParadaSecuencia {
|
||||||
public void setVia(Via via) {
|
public void setVia(Via via) {
|
||||||
this.via = via;
|
this.via = via;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CasetaPeaje> getCasetas() {
|
||||||
|
return casetas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCasetas(List<CasetaPeaje> casetas) {
|
||||||
|
this.casetas = casetas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCasetasTxt() {
|
||||||
|
if(casetas != null){
|
||||||
|
for( int i = 0 ; i < casetas.size() ; i ++){
|
||||||
|
CasetaPeaje cs = casetas.get(i);
|
||||||
|
if(i == casetas.size()-1){
|
||||||
|
casetasTxt = casetasTxt + cs.getDesccaseta();
|
||||||
|
}else{
|
||||||
|
casetasTxt = casetasTxt + cs.getDesccaseta()+", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return casetasTxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCasetasTxt(String casetasTxt) {
|
||||||
|
this.casetasTxt = casetasTxt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "PEAJE_SEQ", sequenceName = "PEAJE_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "PEAJE")
|
||||||
|
public class Peaje implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PEAJE_SEQ")
|
||||||
|
@Column(name = "PEAJE_ID")
|
||||||
|
private Integer pejaeId;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "RUTA_ID")
|
||||||
|
private Ruta ruta;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID")
|
||||||
|
private Parada origem;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
|
||||||
|
private Parada destino;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID")
|
||||||
|
private OrgaoConcedente orgaoConcedente;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "CASETAPEAJE_ID", referencedColumnName = "CASETAPEAJE_ID")
|
||||||
|
private CasetaPeaje casetaPeaje;
|
||||||
|
@Column(name = "CANTASIENTOS")
|
||||||
|
private BigDecimal cantAsientos;
|
||||||
|
@Column(name = "CANTEIXOS")
|
||||||
|
private BigDecimal cantEixos;
|
||||||
|
@Column(name = "IMPORTEPEAJE")
|
||||||
|
private BigDecimal importePeaje;
|
||||||
|
@Column(name = "INDICEPEAJE")
|
||||||
|
private BigDecimal indicePeaje;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
public Integer getPejaeId() {
|
||||||
|
return pejaeId;
|
||||||
|
}
|
||||||
|
public void setPejaeId(Integer pejaeId) {
|
||||||
|
this.pejaeId = pejaeId;
|
||||||
|
}
|
||||||
|
public Ruta getRuta() {
|
||||||
|
return ruta;
|
||||||
|
}
|
||||||
|
public void setRuta(Ruta ruta) {
|
||||||
|
this.ruta = ruta;
|
||||||
|
}
|
||||||
|
public Parada getOrigem() {
|
||||||
|
return origem;
|
||||||
|
}
|
||||||
|
public void setOrigem(Parada origem) {
|
||||||
|
this.origem = origem;
|
||||||
|
}
|
||||||
|
public Parada getDestino() {
|
||||||
|
return destino;
|
||||||
|
}
|
||||||
|
public void setDestino(Parada destino) {
|
||||||
|
this.destino = destino;
|
||||||
|
}
|
||||||
|
public OrgaoConcedente getOrgaoConcedente() {
|
||||||
|
return orgaoConcedente;
|
||||||
|
}
|
||||||
|
public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) {
|
||||||
|
this.orgaoConcedente = orgaoConcedente;
|
||||||
|
}
|
||||||
|
public CasetaPeaje getCasetaPeaje() {
|
||||||
|
return casetaPeaje;
|
||||||
|
}
|
||||||
|
public void setCasetaPeaje(CasetaPeaje casetaPeaje) {
|
||||||
|
this.casetaPeaje = casetaPeaje;
|
||||||
|
}
|
||||||
|
public BigDecimal getCantAsientos() {
|
||||||
|
return cantAsientos;
|
||||||
|
}
|
||||||
|
public void setCantAsientos(BigDecimal cantAsientos) {
|
||||||
|
this.cantAsientos = cantAsientos;
|
||||||
|
}
|
||||||
|
public BigDecimal getCantEixos() {
|
||||||
|
return cantEixos;
|
||||||
|
}
|
||||||
|
public void setCantEixos(BigDecimal cantEixos) {
|
||||||
|
this.cantEixos = cantEixos;
|
||||||
|
}
|
||||||
|
public BigDecimal getImportePeaje() {
|
||||||
|
return importePeaje;
|
||||||
|
}
|
||||||
|
public void setImportePeaje(BigDecimal importePeaje) {
|
||||||
|
this.importePeaje = importePeaje;
|
||||||
|
}
|
||||||
|
public BigDecimal getIndicePeaje() {
|
||||||
|
return indicePeaje;
|
||||||
|
}
|
||||||
|
public void setIndicePeaje(BigDecimal indicePeaje) {
|
||||||
|
this.indicePeaje = indicePeaje;
|
||||||
|
}
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,129 +0,0 @@
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.SequenceGenerator;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Temporal;
|
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@SequenceGenerator(name="CASETA_PEAJE_SEQ", sequenceName="CASETA_PEAJE_SEQ", allocationSize=1)
|
|
||||||
@Table(name="CASETA_PEAJE")
|
|
||||||
public class PracaPedagio implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CASETA_PEAJE_SEQ")
|
|
||||||
@Basic(optional = false)
|
|
||||||
@Column(name = "CASETAPEAJE_ID")
|
|
||||||
private Integer pracaPedagioId;
|
|
||||||
|
|
||||||
@Column(name="DESCCASETA", unique = true)
|
|
||||||
private String descricao;
|
|
||||||
|
|
||||||
@Column(name="IMPORTEIDA")
|
|
||||||
private BigDecimal quantiaIda;
|
|
||||||
|
|
||||||
@Column(name="IMPORTEVUELTA")
|
|
||||||
private BigDecimal quantiaVolta;
|
|
||||||
|
|
||||||
@Column(name = "ACTIVO")
|
|
||||||
private Boolean activo;
|
|
||||||
|
|
||||||
@Column(name = "FECMODIF")
|
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
|
||||||
private Date fecmodif;
|
|
||||||
|
|
||||||
@Column(name = "USUARIO_ID")
|
|
||||||
private Integer usuarioId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 0;
|
|
||||||
hash += pracaPedagioId != null ? pracaPedagioId.hashCode() : 0;
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object object) {
|
|
||||||
if (!(object instanceof PracaPedagio)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
PracaPedagio other = (PracaPedagio) object;
|
|
||||||
if ((this.pracaPedagioId == null && other.pracaPedagioId != null) || (this.pracaPedagioId != null && !this.pracaPedagioId.equals(other.pracaPedagioId))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.pracaPedagioId + " - " + this.descricao;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPracaPedagioId() {
|
|
||||||
return pracaPedagioId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPracaPedagioId(Integer pracaPedagioId) {
|
|
||||||
this.pracaPedagioId = pracaPedagioId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescricao() {
|
|
||||||
return descricao;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescricao(String descricao) {
|
|
||||||
this.descricao = descricao;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getQuantiaIda() {
|
|
||||||
return quantiaIda;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantiaIda(BigDecimal quantiaIda) {
|
|
||||||
this.quantiaIda = quantiaIda;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getQuantiaVolta() {
|
|
||||||
return quantiaVolta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantiaVolta(BigDecimal quantiaVolta) {
|
|
||||||
this.quantiaVolta = quantiaVolta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getActivo() {
|
|
||||||
return activo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivo(Boolean activo) {
|
|
||||||
this.activo = activo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getFecmodif() {
|
|
||||||
return fecmodif;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFecmodif(Date fecmodif) {
|
|
||||||
this.fecmodif = fecmodif;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUsuarioId() {
|
|
||||||
return usuarioId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsuarioId(Integer usuarioId) {
|
|
||||||
this.usuarioId = usuarioId;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -85,6 +85,10 @@ public class Ruta implements Serializable {
|
||||||
private Boolean indTribPedagio;
|
private Boolean indTribPedagio;
|
||||||
@Column(name = "INDTRIBTAXAEMBARQUE")
|
@Column(name = "INDTRIBTAXAEMBARQUE")
|
||||||
private Boolean indTribTaxaEmbarque;
|
private Boolean indTribTaxaEmbarque;
|
||||||
|
@Column(name = "CANTEIXOS")
|
||||||
|
private Integer cantEixos;
|
||||||
|
@Column(name = "CANTASIENTOS")
|
||||||
|
private Integer cantAsientos;
|
||||||
|
|
||||||
public Ruta() {
|
public Ruta() {
|
||||||
}
|
}
|
||||||
|
@ -277,6 +281,22 @@ public class Ruta implements Serializable {
|
||||||
public void setIndNombreObligatorio(Boolean indNombreObligatorio) {
|
public void setIndNombreObligatorio(Boolean indNombreObligatorio) {
|
||||||
this.indNombreObligatorio = indNombreObligatorio;
|
this.indNombreObligatorio = indNombreObligatorio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getCantEixos() {
|
||||||
|
return cantEixos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCantEixos(Integer cantEixos) {
|
||||||
|
this.cantEixos = cantEixos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCantAsientos() {
|
||||||
|
return cantAsientos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCantAsientos(Integer cantAsientos) {
|
||||||
|
this.cantAsientos = cantAsientos;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "RUTA_CASETA_SEQ", sequenceName = "RUTA_CASETA_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "RUTA_CASETA")
|
||||||
|
public class RutaCaseta implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_CASETA_SEQ")
|
||||||
|
@Column(name = "RUTACASETA_ID")
|
||||||
|
private Integer rutaCasetaId;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
|
||||||
|
@JoinColumn(name = "RUTASECUENCIA_ID", referencedColumnName = "RUTASECUENCIA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private RutaSecuencia rutaSecuencia;
|
||||||
|
@JoinColumn(name = "CASETAPEAJE_ID", referencedColumnName = "CASETAPEAJE_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private CasetaPeaje casetaPeaje;
|
||||||
|
public Integer getRutaCasetaId() {
|
||||||
|
return rutaCasetaId;
|
||||||
|
}
|
||||||
|
public void setRutaCasetaId(Integer rutaCasetaId) {
|
||||||
|
this.rutaCasetaId = rutaCasetaId;
|
||||||
|
}
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
public RutaSecuencia getRutaSecuencia() {
|
||||||
|
return rutaSecuencia;
|
||||||
|
}
|
||||||
|
public void setRutaSecuencia(RutaSecuencia rutaSecuencia) {
|
||||||
|
this.rutaSecuencia = rutaSecuencia;
|
||||||
|
}
|
||||||
|
public CasetaPeaje getCasetaPeaje() {
|
||||||
|
return casetaPeaje;
|
||||||
|
}
|
||||||
|
public void setCasetaPeaje(CasetaPeaje casetaPeaje) {
|
||||||
|
this.casetaPeaje = casetaPeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,8 @@ package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -13,7 +15,10 @@ import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
@ -49,6 +54,14 @@ public class RutaSecuencia implements Serializable {
|
||||||
@JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
|
@JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Ruta ruta;
|
private Ruta ruta;
|
||||||
|
// @JoinColumn( referencedColumnName = "RUTACASETA_ID")
|
||||||
|
// @OneToMany
|
||||||
|
// private List<RutaCaseta> rutaCaseta;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(name = "RUTA_CASETA", joinColumns = { @JoinColumn(name = "RUTASECUENCIA_ID") },
|
||||||
|
inverseJoinColumns = { @JoinColumn(name = "CASETAPEAJE_ID") })
|
||||||
|
private List<CasetaPeaje> lsCasetaPeaje;
|
||||||
|
|
||||||
public RutaSecuencia() {
|
public RutaSecuencia() {
|
||||||
}
|
}
|
||||||
|
@ -113,7 +126,15 @@ public class RutaSecuencia implements Serializable {
|
||||||
this.ruta = ruta;
|
this.ruta = ruta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public List<CasetaPeaje> getLsCasetaPeaje() {
|
||||||
|
return lsCasetaPeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsCasetaPeaje(List<CasetaPeaje> lsCasetaPeaje) {
|
||||||
|
this.lsCasetaPeaje = lsCasetaPeaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 0;
|
int hash = 0;
|
||||||
hash += (rutasecuenciaId != null ? rutasecuenciaId.hashCode() : 0);
|
hash += (rutasecuenciaId != null ? rutasecuenciaId.hashCode() : 0);
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
|
||||||
|
public interface CalcularPeajeService {
|
||||||
|
public List<Object> buscarCasetasPeajeWithinTramo(Ruta ruta);
|
||||||
|
public int[] gerarSQLInserirPeajes(List<Ruta> lsRuta, OrgaoConcedente orgao);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||||
|
|
||||||
|
public interface CasetaPeajeService extends GenericService<CasetaPeaje, Integer> {
|
||||||
|
public List<CasetaPeaje> buscar(String descricaoPracaPedagio);
|
||||||
|
public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje);
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PracaPedagio;
|
|
||||||
|
|
||||||
public interface PracaPedagioService extends GenericService<PracaPedagio, Integer> {
|
|
||||||
public List<PracaPedagio> buscar(String descricaoPracaPedagio);
|
|
||||||
public Boolean validarDescricaoPracaPedagio(PracaPedagio pracaPedagio);
|
|
||||||
}
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
|
||||||
|
public interface RutaCasetaService {
|
||||||
|
|
||||||
|
public RutaCaseta suscribir(RutaCaseta entidad) throws BusinessException;
|
||||||
|
public void deletarRutaCasetasFromRutaSecuenciaId(Integer id)throws BusinessException;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,13 @@ package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,4 +83,9 @@ public interface RutaService {
|
||||||
public void generarCombinacion(Ruta ruta) throws BusinessException;
|
public void generarCombinacion(Ruta ruta) throws BusinessException;
|
||||||
|
|
||||||
public List<Ruta> buscaRuta(String palavraPesquisaRuta);
|
public List<Ruta> buscaRuta(String palavraPesquisaRuta);
|
||||||
|
|
||||||
|
public List<Ruta> buscaRutasFromOrgao(OrgaoConcedente orgao);
|
||||||
|
|
||||||
|
public List<Ruta> buscarTodosEstos(Integer[] idRutas);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,4 +128,6 @@ public interface TarifaOficialService {
|
||||||
|
|
||||||
public void gerarAtualizarTabelaZerada(Integer rudaId, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException ;
|
public void gerarAtualizarTabelaZerada(Integer rudaId, Integer orgaoConcedenteId, Integer empresaId) throws BusinessException ;
|
||||||
|
|
||||||
|
public void atualizarPedagio();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CalcularPeajeService;
|
||||||
|
|
||||||
|
@Service("calcularPeajeService")
|
||||||
|
public class CalcularPeajeServiceImpl implements CalcularPeajeService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CalcularPeajeDAO calcularPeajeDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Object> buscarCasetasPeajeWithinTramo(Ruta ruta){
|
||||||
|
return calcularPeajeDAO.buscarCasetasPeajeWithinTramo(ruta);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
|
public int[] gerarSQLInserirPeajes(List<Ruta> lsRuta, OrgaoConcedente orgao){
|
||||||
|
return calcularPeajeDAO.gerarSQLInserirPeajes(lsRuta, orgao);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CasetaPeajeService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("casetaPeajeService")
|
||||||
|
public class CasetaPeajeServiceImpl implements CasetaPeajeService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CasetaPeajeDAO casetaPeajeDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CasetaPeaje> obtenerTodos() {
|
||||||
|
return casetaPeajeDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CasetaPeaje obtenerID(Integer id) {
|
||||||
|
return casetaPeajeDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CasetaPeaje suscribir(CasetaPeaje entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
return casetaPeajeDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CasetaPeaje actualizacion(CasetaPeaje entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
return casetaPeajeDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(CasetaPeaje entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
casetaPeajeDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CasetaPeaje> buscar(String descricaoCasetaPeaje) {
|
||||||
|
return casetaPeajeDAO.buscar(descricaoCasetaPeaje);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje) {
|
||||||
|
List<CasetaPeaje> pracas = buscar(casetaPeaje.getDesccaseta());
|
||||||
|
|
||||||
|
if(casetaPeaje.getCasetaPeajeId() == null) {
|
||||||
|
if(pracas.isEmpty()){
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(pracas.isEmpty() || pracas.get(0).getCasetaPeajeId().equals(casetaPeaje.getCasetaPeajeId())) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,78 +0,0 @@
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.PracaPedagioDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PracaPedagio;
|
|
||||||
import com.rjconsultores.ventaboletos.service.PracaPedagioService;
|
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
|
||||||
|
|
||||||
@Service("pracaPedagioService")
|
|
||||||
public class PracaPedagioServiceImpl implements PracaPedagioService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PracaPedagioDAO pracaPedagioDAO;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PracaPedagio> obtenerTodos() {
|
|
||||||
return pracaPedagioDAO.obtenerTodos();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public PracaPedagio obtenerID(Integer id) {
|
|
||||||
return pracaPedagioDAO.obtenerID(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public PracaPedagio suscribir(PracaPedagio entidad) {
|
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
||||||
entidad.setActivo(Boolean.TRUE);
|
|
||||||
return pracaPedagioDAO.suscribir(entidad);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public PracaPedagio actualizacion(PracaPedagio entidad) {
|
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
||||||
entidad.setActivo(Boolean.TRUE);
|
|
||||||
return pracaPedagioDAO.actualizacion(entidad);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void borrar(PracaPedagio entidad) {
|
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
|
||||||
entidad.setActivo(Boolean.FALSE);
|
|
||||||
pracaPedagioDAO.actualizacion(entidad);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PracaPedagio> buscar(String descricaoPracaPedagio) {
|
|
||||||
return pracaPedagioDAO.buscar(descricaoPracaPedagio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean validarDescricaoPracaPedagio(PracaPedagio pracaPedagio) {
|
|
||||||
List<PracaPedagio> pracas = buscar(pracaPedagio.getDescricao());
|
|
||||||
|
|
||||||
if(pracaPedagio.getPracaPedagioId() == null) {
|
|
||||||
if(pracas.isEmpty()){
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(pracas.isEmpty() || pracas.get(0).getPracaPedagioId().equals(pracaPedagio.getPracaPedagioId())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.RutaCasetaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.RutaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RutaCasetaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("rutaCasetaService")
|
||||||
|
public class RutaCasetaServiceImpl implements RutaCasetaService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RutaCasetaDAO rutaCasetaDAO;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
|
public RutaCaseta suscribir(RutaCaseta entidad) throws BusinessException {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
entidad = rutaCasetaDAO.suscribir(entidad);
|
||||||
|
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
|
public void deletarRutaCasetasFromRutaSecuenciaId(Integer id) {
|
||||||
|
rutaCasetaDAO.deletarRutaCasetasFromRutaSecuenciaId(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.RutaDAO;
|
import com.rjconsultores.ventaboletos.dao.RutaDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
@ -277,6 +278,10 @@ public class RutaServiceImpl implements RutaService {
|
||||||
public List<Ruta> buscarTodosExceto(Integer... idRuta) {
|
public List<Ruta> buscarTodosExceto(Integer... idRuta) {
|
||||||
return rutaDAO.buscarTodosExceto(idRuta);
|
return rutaDAO.buscarTodosExceto(idRuta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Ruta> buscarTodosEstos(Integer[] idRutas) {
|
||||||
|
return rutaDAO.buscarTodosEstos(idRutas);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Ruta> buscarNumRuta(String numRuta) {
|
public List<Ruta> buscarNumRuta(String numRuta) {
|
||||||
return rutaDAO.buscarNumRuta(numRuta);
|
return rutaDAO.buscarNumRuta(numRuta);
|
||||||
|
@ -301,5 +306,9 @@ public class RutaServiceImpl implements RutaService {
|
||||||
public List<Ruta> buscaRuta(String palavraPesquisaRuta) {
|
public List<Ruta> buscaRuta(String palavraPesquisaRuta) {
|
||||||
return rutaDAO.buscaRuta(palavraPesquisaRuta);
|
return rutaDAO.buscaRuta(palavraPesquisaRuta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Ruta> buscaRutasFromOrgao(OrgaoConcedente orgao){
|
||||||
|
return rutaDAO.buscaRutasFromOrgao(orgao);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,5 +150,11 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||||
public void borrar(TarifaOficial tarifaOficial) {
|
public void borrar(TarifaOficial tarifaOficial) {
|
||||||
tarifaOficialDAO.borrar(tarifaOficial);
|
tarifaOficialDAO.borrar(tarifaOficial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void atualizarPedagio() {
|
||||||
|
tarifaOficialDAO.atualizarPedagio();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue