AL-3101 validacao naoValidaEsquemaCorridaVia

master
Julio Heredia 2023-10-24 18:13:53 -03:00
parent b8514cf1de
commit 0bdafbc7b8
2 changed files with 31 additions and 10 deletions

View File

@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId>
<version>1.25.4</version>
<version>1.25.6</version>
<packaging>war</packaging>
<properties>
<modelWeb.version>1.17.2</modelWeb.version>
<flyway.version>1.14.1</flyway.version>
<flyway.version>1.15.0</flyway.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

View File

@ -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()) ){
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;
}