diff --git a/pom.xml b/pom.xml index 3b9777f83..bae0406f5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,12 @@ 4.0.0 br.com.rjconsultores ventaboletosadm - 1.25.4 + 1.25.6 war 1.17.2 - 1.14.1 + 1.15.0 UTF-8 UTF-8 diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCorridaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCorridaController.java index 6d88e6c7d..57d51be37 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCorridaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCorridaController.java @@ -17,6 +17,7 @@ import java.util.Map; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -47,6 +48,7 @@ import org.zkoss.zul.Window; import com.rjconsultores.ventaboletos.entidad.Autobus; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Constante; import com.rjconsultores.ventaboletos.entidad.Corrida; import com.rjconsultores.ventaboletos.entidad.Division; import com.rjconsultores.ventaboletos.entidad.Empresa; @@ -68,6 +70,7 @@ import com.rjconsultores.ventaboletos.entidad.TramoServicio; import com.rjconsultores.ventaboletos.service.AutobusService; import com.rjconsultores.ventaboletos.service.BoletoService; import com.rjconsultores.ventaboletos.service.ClaseServicioService; +import com.rjconsultores.ventaboletos.service.ConstanteService; import com.rjconsultores.ventaboletos.service.CorridaService; import com.rjconsultores.ventaboletos.service.DivisionService; import com.rjconsultores.ventaboletos.service.EmpresaService; @@ -146,6 +149,9 @@ public class EditarCorridaController extends MyGenericForwardComposer { @Autowired private EsquemaCorridaInfoService esquemaCorridaInfoService; + @Autowired + private ConstanteService constanteService; + //Radio private Radio porBloq; private Radio latente; @@ -2448,8 +2454,21 @@ public class EditarCorridaController extends MyGenericForwardComposer { return myls; } - private boolean tramoIsEqual(Tramo este, Tramo outro) { - + public boolean naoValidaEsquemaCorridaVia() { + Constante contante = constanteService.buscarPorNomeConstante("NAO_VALIDA_ESQUEMA_CORRIDA_VIA"); + String valorConstante = contante == null ? null : contante.getValorconstante(); + + if (StringUtils.isBlank(valorConstante)) { + return false; + } else { + if (BooleanUtils.toBoolean(valorConstante)) { + return true; + } + return false; + } + } + + private boolean tramoIsEqual(Tramo este, Tramo outro) { if(este == null && outro == null){ return true; } @@ -2459,12 +2478,14 @@ public class EditarCorridaController extends MyGenericForwardComposer { if(este != null && outro == null){ return false; } - if(este.getDesctramo().equals(outro.getDesctramo()) && - este.getDestino().equals(outro.getDestino()) && - este.getOrigem().equals(outro.getOrigem()) && - este.getKmReal().equals(outro.getKmReal()) && - este.getVia().equals(outro.getVia()) ){ - return true; + if (este.getDestino().equals(outro.getDestino()) + && este.getOrigem().equals(outro.getOrigem())) { + if (naoValidaEsquemaCorridaVia()) { + return true; + } else if (este.getDesctramo().equals(outro.getDesctramo()) && este.getKmReal().equals(outro.getKmReal()) + && este.getVia().equals(outro.getVia())) { + return true; + } } return false; }