fixes bug#22458

dev:wilian
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@106955 d1611594-4594-4d17-8e1d-87c2c4800839
master
wilian 2021-05-28 22:04:13 +00:00
parent f527f49c6d
commit 2ca7f0ec8e
1 changed files with 77 additions and 47 deletions

View File

@ -70,26 +70,31 @@ public class ConexionRutaCombinacionFactory {
for (Ruta rutaEixoB : rutasEixoB) { for (Ruta rutaEixoB : rutasEixoB) {
for (String comb : combinacoes) { for (String comb : combinacoes) {
valoresCalculados = comb.split(";"); valoresCalculados = comb.split(";");
if(valoresCalculados != null && valoresCalculados.length == 4) {
Integer origemConexaoCtrl = Integer.parseInt(valoresCalculados[0]);
Integer destinoConexaoCtrl = Integer.parseInt(valoresCalculados[3]);
if(origemConexaoCtrl == null || cacheLocalidades.get(origemConexaoCtrl) == null ||
destinoConexaoCtrl == null || cacheLocalidades.get(destinoConexaoCtrl) == null) {
continue;
}
Integer origemConexaoCtrl = cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])).getParadaId(); ConexionCtrlVO conexionCtrl = adicionarConexao(conexoesCtrl, origemConexaoCtrl, destinoConexaoCtrl);
Integer destinoConexaoCtrl = cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])).getParadaId(); ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaEixoA.getRutaId(), rutaEixoB.getRutaId(), null);
ConexionCtrlVO conexionCtrl = adicionarConexao(conexoesCtrl, origemConexaoCtrl, destinoConexaoCtrl); ParadaVOConexionRuta trechoA = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[1])), rutaEixoA.getRutaId(), rutaEixoA.getNumRuta(), i, true,
ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaEixoA.getRutaId(), rutaEixoB.getRutaId(), null); cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])),
conexionCtrl, conexionRutaCtrl, rutaEixoA.getDescSentido());
i++;
ParadaVOConexionRuta trechoA = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[1])), rutaEixoA.getRutaId(), rutaEixoA.getNumRuta(), i, true, ParadaVOConexionRuta trechoB = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[2])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), rutaEixoB.getRutaId(), rutaEixoB.getNumRuta(), i, true,
cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])),
conexionCtrl, conexionRutaCtrl, rutaEixoA.getDescSentido()); conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido());
i++; i++;
ParadaVOConexionRuta trechoB = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[2])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), rutaEixoB.getRutaId(), rutaEixoB.getNumRuta(), i, true, adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, null);
cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])),
conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido());
i++;
adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, null); i = 1;
}
i = 1;
} }
} }
@ -133,12 +138,24 @@ public class ConexionRutaCombinacionFactory {
} }
private static void adicionarLocalidadeGerada(ConexionCtrlVO conexionCtrl, List<ParadaVOConexionRuta> localidadesGeradas, ParadaVOConexionRuta trechoA, ParadaVOConexionRuta trechoB, ParadaVOConexionRuta trechoC) { private static void adicionarLocalidadeGerada(ConexionCtrlVO conexionCtrl, List<ParadaVOConexionRuta> localidadesGeradas, ParadaVOConexionRuta trechoA, ParadaVOConexionRuta trechoB, ParadaVOConexionRuta trechoC) {
boolean isTrechoAVende = rutaCombinacionService.isRutaCombinacionVenda(trechoA.getRutaId(), trechoA.getParadaOrigem().getParadaId(), trechoA.getParadaDestino().getParadaId()); boolean isTrechoAVende = false;
boolean isTrechoBVende = rutaCombinacionService.isRutaCombinacionVenda(trechoB.getRutaId(), trechoB.getParadaOrigem().getParadaId(), trechoB.getParadaDestino().getParadaId()); boolean isTrechoBVende = false;
if(isDadosNotNull(trechoA)) {
isTrechoAVende = rutaCombinacionService.isRutaCombinacionVenda(trechoA.getRutaId(), trechoA.getParadaOrigem().getParadaId(), trechoA.getParadaDestino().getParadaId());
}
if(isDadosNotNull(trechoB)) {
isTrechoBVende = rutaCombinacionService.isRutaCombinacionVenda(trechoB.getRutaId(), trechoB.getParadaOrigem().getParadaId(), trechoB.getParadaDestino().getParadaId());
}
boolean isTrechoCVende = true; boolean isTrechoCVende = true;
if(trechoC != null) { if(trechoC != null) {
isTrechoCVende = rutaCombinacionService.isRutaCombinacionVenda(trechoC.getRutaId(), trechoC.getParadaOrigem().getParadaId(), trechoC.getParadaDestino().getParadaId()); if(isDadosNotNull(trechoC)) {
isTrechoCVende = rutaCombinacionService.isRutaCombinacionVenda(trechoC.getRutaId(), trechoC.getParadaOrigem().getParadaId(), trechoC.getParadaDestino().getParadaId());
} else {
isTrechoCVende = false;
}
} }
if(isTrechoAVende && isTrechoBVende && isTrechoCVende) { if(isTrechoAVende && isTrechoBVende && isTrechoCVende) {
@ -163,30 +180,36 @@ public class ConexionRutaCombinacionFactory {
for (Ruta rutaEixoC : rutasEixoC) { for (Ruta rutaEixoC : rutasEixoC) {
for (String comb : combinations) { for (String comb : combinations) {
valoresCalculados = comb.split(";"); valoresCalculados = comb.split(";");
if(valoresCalculados != null && valoresCalculados.length == 5) {
Integer origemConexaoCtrl = Integer.parseInt(valoresCalculados[0]);
Integer destinoConexaoCtrl = Integer.parseInt(valoresCalculados[4]);
if(origemConexaoCtrl == null || cacheLocalidades.get(origemConexaoCtrl) == null ||
destinoConexaoCtrl == null || cacheLocalidades.get(destinoConexaoCtrl) == null) {
continue;
}
Integer origemConexaoCtrl = cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])).getParadaId(); ConexionCtrlVO conexionCtrl = adicionarConexao(conexoesCtrl, origemConexaoCtrl, destinoConexaoCtrl);
Integer destinoConexaoCtrl = cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])).getParadaId(); ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaEixoA.getRutaId(), rutaEixoB.getRutaId(), rutaEixoC.getRutaId());
ConexionCtrlVO conexionCtrl = adicionarConexao(conexoesCtrl, origemConexaoCtrl, destinoConexaoCtrl);
ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaEixoA.getRutaId(), rutaEixoB.getRutaId(), rutaEixoC.getRutaId());
ParadaVOConexionRuta trechoA = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[1])), rutaEixoA.getRutaId(), rutaEixoA.getNumRuta(), i, true, ParadaVOConexionRuta trechoA = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[1])), rutaEixoA.getRutaId(), rutaEixoA.getNumRuta(), i, true,
cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])),
conexionCtrl, conexionRutaCtrl, rutaEixoA.getDescSentido()); conexionCtrl, conexionRutaCtrl, rutaEixoA.getDescSentido());
i++; i++;
ParadaVOConexionRuta trechoB = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[2])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), rutaEixoB.getRutaId(), rutaEixoB.getNumRuta(), i, true, ParadaVOConexionRuta trechoB = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[2])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), rutaEixoB.getRutaId(), rutaEixoB.getNumRuta(), i, true,
cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])),
conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido()); conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido());
i++; i++;
ParadaVOConexionRuta trechoC = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), rutaEixoC.getRutaId(), rutaEixoC.getNumRuta(), i, true, ParadaVOConexionRuta trechoC = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), rutaEixoC.getRutaId(), rutaEixoC.getNumRuta(), i, true,
cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])),
conexionCtrl, conexionRutaCtrl, rutaEixoC.getDescSentido()); conexionCtrl, conexionRutaCtrl, rutaEixoC.getDescSentido());
i++; i++;
adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, trechoC); adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, trechoC);
i = 1; i = 1;
}
} }
} }
@ -276,4 +299,11 @@ public class ConexionRutaCombinacionFactory {
return list; return list;
} }
private static boolean isDadosNotNull(ParadaVOConexionRuta trecho) {
return trecho != null &&
trecho.getRutaId() != null &&
trecho.getParadaOrigem() != null &&
trecho.getParadaDestino() != null;
}
} }